Example #1
0
        /// <summary>
        /// Return the section with the given name, creating it if necessary.
        /// </summary>
        /// <param name="name">The name of the section.</param>
        /// <returns></returns>
        public IniFileSection FindOrCreateSection(string name)
        {
            IniFileSection section;

            if (!SectionsByName.TryGetValue(name, out section))
            {
                section = new IniFileSection(this, name);
            }
            return(section);
        }
Example #2
0
        /// <summary>Get a value from the .ini file, supplying a default value if it's not found.</summary>
        /// <param name="sectionName"></param>
        /// <param name="settingName"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public string this[string sectionName, string settingName, string defaultValue] {
            get {
                IniFileSection section;

                if (!SectionsByName.TryGetValue(sectionName, out section))
                {
                    return(defaultValue);
                }
                return(section[settingName, defaultValue]);
            }
        }