Example #1
0
        /// <summary>
        /// reads an information from the ini file
        /// </summary>
        /// <example>
        /// <code>
        /// <![CDATA[
        /// // load "config.ini" from the application directory
        /// IniParser Config = new IniParser("config");
        /// string Get = Config.Read("Variable");
        /// ]]>
        /// </code>
        /// </example>
        /// <param name="Key">name of variable</param>
        /// <returns>value of variable</returns>
        public string Read(string Key)
        {
            StringBuilder temp = new StringBuilder(255);
            int           i    = NativeMethods.GetPrivateProfileString(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, Key, "", temp, 255, this.Path);

            return(temp.ToString());
        }
Example #2
0
        /// <summary>
        /// writes an information into the ini file
        /// </summary>
        /// <example>
        /// <code>
        /// <![CDATA[
        /// // load "config.ini" from the application directory
        /// IniParser Config = new IniParser("config");
        /// string Get = Config.Read("Section", "Variable");
        /// ]]>
        /// </code>
        /// </example>
        /// <param name="Section">section in ini file</param>
        /// <param name="Key">name of variable</param>
        /// <returns>value of variable</returns>
        public string Read(string Section, string Key)
        {
            StringBuilder temp = new StringBuilder(255);
            int           i    = NativeMethods.GetPrivateProfileString(Section, Key, "", temp, 255, this.Path);

            return(temp.ToString());
        }