PageRenderTime 26ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/Source/FIMPSSnapIn.cs

#
C# | 62 lines | 52 code | 8 blank | 2 comment | 1 complexity | e4220cb8944ed471b11e8c22621d621d MD5 | raw file
  1. using System;
  2. using System.ComponentModel;
  3. using System.Management.Automation;
  4. using System.Collections;
  5. using System.IO;
  6. namespace Quest.FIMPowerShellSnapin
  7. {
  8. [RunInstaller(true)]
  9. public class FIMPowerShellSnapin : PSSnapIn
  10. {
  11. public override string Name
  12. {
  13. get { return "Quest.FIMPowerShellSnapin"; }
  14. }
  15. public override string Vendor
  16. {
  17. get { return "Quest Software"; }
  18. }
  19. public override string Description
  20. {
  21. get { return "This snap-in contains cmdlets for Microsoft Forefront Identity Manager (FIM)."; }
  22. }
  23. public override string[] Formats
  24. {
  25. get
  26. {
  27. return GetFileNames("Format");
  28. }
  29. }
  30. public override string[] Types
  31. {
  32. get
  33. {
  34. return GetFileNames("Types");
  35. }
  36. }
  37. private string[] GetFileNames(string suffix)
  38. {
  39. // we assume the types file is in the same folder as the snap-in dll
  40. string snapinName = GetType().Module.FullyQualifiedName;
  41. string resultFilename =
  42. Path.ChangeExtension(snapinName, suffix + ".ps1xml");
  43. // w/o this check if the file is missing we'll get an error when opening the PS console
  44. if (File.Exists(resultFilename))
  45. {
  46. return new string[] { resultFilename };
  47. }
  48. else
  49. {
  50. return null;
  51. }
  52. }
  53. }
  54. }