示例#1
0
 private static Collection <PSSnapInInfo> ReadAll(
     RegistryKey monadRootKey,
     string psVersion)
 {
     using (PSSnapInReader._tracer.TraceMethod(psVersion, new object[0]))
     {
         Collection <PSSnapInInfo> collection = new Collection <PSSnapInInfo>();
         RegistryKey mshSnapinRootKey         = PSSnapInReader.GetMshSnapinRootKey(PSSnapInReader.GetVersionRootKey(monadRootKey, psVersion), psVersion);
         foreach (string subKeyName in mshSnapinRootKey.GetSubKeyNames())
         {
             if (!string.IsNullOrEmpty(subKeyName))
             {
                 try
                 {
                     collection.Add(PSSnapInReader.ReadOne(mshSnapinRootKey, subKeyName));
                 }
                 catch (SecurityException ex)
                 {
                     PSSnapInReader._tracer.TraceException((Exception)ex);
                 }
                 catch (ArgumentException ex)
                 {
                     PSSnapInReader._tracer.TraceException((Exception)ex);
                 }
             }
         }
         return(collection);
     }
 }
示例#2
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));
     }
 }