Exemplo n.º 1
0
 internal static Collection <PSSnapInInfo> ReadAll()
 {
     using (PSSnapInReader._tracer.TraceMethod())
     {
         Collection <PSSnapInInfo> collection1 = new Collection <PSSnapInInfo>();
         RegistryKey monadRootKey = PSSnapInReader.GetMonadRootKey();
         string[]    subKeyNames  = monadRootKey.GetSubKeyNames();
         if (subKeyNames == null)
         {
             return(collection1);
         }
         foreach (string str in subKeyNames)
         {
             if (!string.IsNullOrEmpty(str))
             {
                 if (!PSSnapInReader.MeetsVersionFormat(str))
                 {
                     PSSnapInReader._tracer.WriteLine("Found key {0} which doesn't meet version format", (object)str);
                 }
                 else
                 {
                     Collection <PSSnapInInfo> collection2 = (Collection <PSSnapInInfo>)null;
                     try
                     {
                         collection2 = PSSnapInReader.ReadAll(monadRootKey, str);
                     }
                     catch (SecurityException ex)
                     {
                         PSSnapInReader._tracer.TraceException((Exception)ex);
                     }
                     catch (ArgumentException ex)
                     {
                         PSSnapInReader._tracer.TraceException((Exception)ex);
                     }
                     if (collection2 != null)
                     {
                         foreach (PSSnapInInfo psSnapInInfo in collection2)
                         {
                             collection1.Add(psSnapInInfo);
                         }
                     }
                 }
             }
         }
         return(collection1);
     }
 }
Exemplo n.º 2
0
 internal static RegistryKey GetMshSnapinKey(string mshSnapInName, string psVersion)
 {
     using (PSSnapInReader._tracer.TraceMethod())
         return((PSSnapInReader.GetVersionRootKey(PSSnapInReader.GetMonadRootKey(), psVersion).OpenSubKey("PowerShellSnapIns") ?? throw PSSnapInReader._tracer.NewArgumentException(nameof(psVersion), "MshSnapinInfo", "NoMshSnapinPresentForVersion", (object)psVersion)).OpenSubKey(mshSnapInName));
 }
Exemplo n.º 3
0
 internal static RegistryKey GetPSEngineKey(string psVersion)
 {
     using (PSSnapInReader._tracer.TraceMethod())
         return(PSSnapInReader.GetVersionRootKey(PSSnapInReader.GetMonadRootKey(), psVersion).OpenSubKey("PowerShellEngine") ?? throw PSSnapInReader._tracer.NewArgumentException("monad", "MshSnapinInfo", "MonadEngineRegistryAccessFailed"));
 }
Exemplo n.º 4
0
 internal static PSSnapInInfo Read(string psVersion, string mshsnapinId)
 {
     using (PSSnapInReader._tracer.TraceMethod("psVersion: {0}, mshsnapinId: {1}", (object)psVersion, (object)mshsnapinId))
     {
         if (string.IsNullOrEmpty(psVersion))
         {
             throw PSSnapInReader._tracer.NewArgumentNullException(nameof(psVersion));
         }
         if (string.IsNullOrEmpty(mshsnapinId))
         {
             throw PSSnapInReader._tracer.NewArgumentNullException(nameof(mshsnapinId));
         }
         PSSnapInInfo.VerifyPSSnapInFormatThrowIfError(mshsnapinId);
         return(PSSnapInReader.ReadOne(PSSnapInReader.GetMshSnapinRootKey(PSSnapInReader.GetVersionRootKey(PSSnapInReader.GetMonadRootKey(), psVersion), psVersion), mshsnapinId));
     }
 }
Exemplo n.º 5
0
 internal static Collection <PSSnapInInfo> ReadAll(string psVersion)
 {
     using (PSSnapInReader._tracer.TraceMethod())
         return(!string.IsNullOrEmpty(psVersion) ? PSSnapInReader.ReadAll(PSSnapInReader.GetMonadRootKey(), psVersion) : throw PSSnapInReader._tracer.NewArgumentNullException(nameof(psVersion)));
 }