PageRenderTime 12ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/Source/FIMPSSnapIn.cs

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