Example #1
0
        private void WriteSections(IniSectionCollection sections)
        {
            if (sections.Count == 0)
            {
                return;
            }

            this.WriteFirstSection(sections[0]);

            for (int i = 1; i < sections.Count; i++)
            {
                this.WriteSection(sections[i]);
            }
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of <see cref="IniFile"/> class.
        /// </summary>
        /// <param name="options"><see cref="IniOptions"/> object that defines INI file's format, settings for both <see cref="O:MadMilkman.Ini.IniFile.Load">Load</see> and <see cref="O:MadMilkman.Ini.IniFile.Save">Save</see> methods.</param>
        /// <param name="filePath">Path from which to load a file</param>
        public IniFile(string filePath, IniOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            this.options  = new IniOptions(options);
            this.sections = new IniSectionCollection(this, options.SectionDuplicate, options.SectionNameCaseSensitive);

            if (filePath != null)
            {
                Load(filePath);
            }
        }