Read() public méthode

Reads specified value from the registry.
public Read ( string path, string valueName ) : object
path string Full registry key (minus root) that contains value.
valueName string Name of the value within key that will be read.
Résultat object
Exemple #1
0
        /// <summary>
        /// Gets or value that determines the <see cref="PerceivedType"/>PerceivedType of the file.
        /// </summary>
        /// <param name="file"><see cref="FileAssociationInfo"/> that provides specifics of the extension to be changed.</param>
        /// <returns><see cref="PerceivedTypes"/> that specifies Perceived Type of extension.</returns>
        protected PerceivedTypes GetPerceivedType(FileAssociationInfo file)
        {
            if (!file.Exists)
            {
                throw new Exception("Extension does not exist");
            }

            object         val        = registryWrapper.Read(file.extension, "PerceivedType");
            PerceivedTypes actualType = PerceivedTypes.None;

            if (val == null)
            {
                return(actualType);
            }

            try
            {
                actualType = (PerceivedTypes)Enum.Parse(typeof(PerceivedTypes), val.ToString(), true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }


            return(actualType);
        }
        /// <summary>
        /// Gets a value that determines what the friendly name of the file is.
        /// </summary>
        /// <returns>Friendly description of file type.</returns>
        protected string GetDescription()
        {
            if (!this.Exists)
            {
                throw new Exception("Extension does not exist");
            }

            object val = registryWrapper.Read(this.progId, string.Empty);

            if (val == null)
            {
                return(string.Empty);
            }

            return(val.ToString());
        }