示例#1
0
        internal System.Collections.Generic.SortedList <string, string> EnumKeys(string p_SubKeyName)
        {
            // Return a sorted list of subkeys
            Generic.SortedList <string, string> Values;
            Generic.SortedList <string, string> RetValues = new Generic.SortedList <string, string>();
            string[] Directories;
            string   DefaultValue;

            try
            {
                GetProfileMutex("EnumKeys", p_SubKeyName);
                sw.Reset(); sw.Start(); // Start timing this call
                TL.LogMessage("EnumKeys", "SubKey: \"" + p_SubKeyName + "\"");

                Directories = FileStore.GetDirectoryNames(p_SubKeyName);            // Get a list of the keys
                foreach (string Directory in Directories)                           // Process each key in trun
                {
                    try                                                             // If there is an error reading the data don't include in the returned list
                    {
                        Values       = ReadValues(p_SubKeyName + @"\" + Directory); // Read the values of this key to find the default value
                        DefaultValue = Values.Item(COLLECTION_DEFAULT_VALUE_NAME);  // Save the default value
                        if (DefaultValue == COLLECTION_DEFAULT_UNSET_VALUE)
                        {
                            DefaultValue = "";
                        }
                        RetValues.Add(Directory, DefaultValue); // Add the directory name and default value to the hashtable
                    }
                    catch
                    {
                    }
                    Values = null /* TODO Change to default(_) if this is not a reference type */;
                }
                sw.Stop(); TL.LogMessage("  ElapsedTime", "  " + sw.ElapsedMilliseconds + " milliseconds");
            }
            finally
            {
                ProfileMutex.ReleaseMutex();
            }
            return(RetValues);
        }