예제 #1
0
        public IEnumerable <string> GetSubKeyNames(string registryKey)
        {
            IEnumerable <string> subkeyNames;

            using (IDistributedStoreKey distributedStoreKey = this.OpenRegKey(registryKey, false, false))
            {
                subkeyNames = distributedStoreKey.GetSubkeyNames(null);
            }
            return(subkeyNames);
        }
예제 #2
0
 public static IEnumerable <string> GetSubkeyNames(this IDistributedStoreKey parentKey, string subkeyName, ReadWriteConstraints constraints)
 {
     using (IDistributedStoreKey distributedStoreKey = parentKey.OpenKey(subkeyName, DxStoreKeyAccessMode.Read, true, constraints))
     {
         if (distributedStoreKey != null)
         {
             return(distributedStoreKey.GetSubkeyNames(constraints));
         }
     }
     return(null);
 }
        // Token: 0x06000543 RID: 1347 RVA: 0x00013D3C File Offset: 0x00011F3C
        private XElement GetXElementSnapshotInternal(string keyName)
        {
            bool   flag  = false;
            bool   flag2 = true;
            string keyName2;
            string value;

            if (!string.IsNullOrEmpty(keyName))
            {
                keyName2 = Utils.CombinePathNullSafe(this.rootKeyName, keyName);
                value    = keyName.Substring(keyName.LastIndexOf('\\') + 1);
            }
            else
            {
                keyName2 = this.rootKeyName;
                value    = "\\";
                flag     = true;
                if (this.filterRootKeys.Length > 1)
                {
                    flag2 = false;
                }
            }
            XElement xelement  = new XElement("Key", new XAttribute("Name", value));
            XElement xelement2 = xelement;

            if (this.IsProduceDxStoreFormat && flag)
            {
                xelement.Add(new XElement("Key", new XAttribute("Name", "Private")));
                XElement xelement3 = new XElement("Key", new XAttribute("Name", "Public"));
                xelement.Add(xelement3);
                xelement2 = xelement3;
            }
            IDistributedStoreKey distributedStoreKey = flag ? this.baseKey : this.baseKey.OpenKey(keyName2, DxStoreKeyAccessMode.Read, false, null);

            try
            {
                if (flag2 || this.isForceIncludeRootProperties)
                {
                    foreach (string propertyName in distributedStoreKey.GetValueNames(null))
                    {
                        bool flag3;
                        RegistryValueKind kind;
                        object            value2 = distributedStoreKey.GetValue(propertyName, out flag3, out kind, null);
                        if (value2 != null && flag3)
                        {
                            PropertyValue propertyValue = new PropertyValue(value2, kind);
                            xelement2.Add(propertyValue.ToXElement(propertyName));
                        }
                    }
                }
                IEnumerable <string> subkeyNames = distributedStoreKey.GetSubkeyNames(null);
                if (subkeyNames != null)
                {
                    foreach (string path in subkeyNames)
                    {
                        string keyName3 = Utils.CombinePathNullSafe(keyName ?? string.Empty, path);
                        if (!flag || this.IsIncludeKey(keyName3))
                        {
                            XElement xelementSnapshotInternal = this.GetXElementSnapshotInternal(keyName3);
                            xelement2.Add(xelementSnapshotInternal);
                        }
                    }
                }
            }
            finally
            {
                if (distributedStoreKey != null && !flag)
                {
                    distributedStoreKey.Dispose();
                }
            }
            return(xelement);
        }