Globals.RegistryAccess.getValue C# (CSharp) Method

getValue() public method

Returns a value from the Label in the current path use setKey() to set the current mainKey & path
public getValue ( string valueName ) : string
valueName string The label name to return (Halo 2 uses RegistryAccess.RegNames)
return string
        public string getValue(string valueName)
        {
            if (!_isOpen) return null;
            object the_Obj;

            the_Obj = the_Reg.GetValue(valueName);
            if (the_Obj != null)
                return the_Obj.ToString();
            return null;
        }

Usage Example

示例#1
0
        /// <summary>
        /// Adds a file to the Halo 2 recently used list
        /// </summary>
        /// <param name="pos">The position in which to add the fileName (0-9)</param>
        /// <param name="fileName">The location and name of the file</param>
        public static void AddRecentFile(int pos, string fileName)
        {
            int found = -1;
            int count = 0;
            string[] files = new string[10];
            // Load recently used files list
            RegistryAccess ra = new RegistryAccess(Registry.CurrentUser, RegPaths.Halo2RecentFiles);
            for (int i = 0; i < files.Length; i++)
            {
                files[i] = ra.getValue(i.ToString());
                if (files[i] != null) count++;
                if (files[i] == fileName) found = i;
            }
            ra.CloseReg();

            if (found == -1) found = count;
            if (found < pos)
            {
                int z = found;
                found = pos;
                pos = z;
            }

            for (int i = found; i > pos; i--)
                setValue(Registry.CurrentUser, RegistryAccess.RegPaths.Halo2RecentFiles, i.ToString(), files[i-1]);
            setValue(Registry.CurrentUser, RegistryAccess.RegPaths.Halo2RecentFiles, pos.ToString(), fileName);
        }
All Usage Examples Of Globals.RegistryAccess::getValue