예제 #1
0
        /// <summary>
        /// Loads the file not saving comments.
        /// </summary>
        private void LoadReader(IniReader reader)
        {
            reader.IgnoreComments = false;
            bool       sectionFound = false;
            IniSection section      = null;

            try {
                while (reader.Read())
                {
                    switch (reader.Type)
                    {
                    case IniType.Empty:
                        if (!sectionFound)
                        {
                            initialComment.Add(reader.Comment);
                        }
                        else
                        {
                            section.Set(reader.Comment);
                        }

                        break;

                    case IniType.Section:
                        sectionFound = true;
                        // If section already exists then overwrite it
                        if (sections[reader.Name] != null)
                        {
                            sections.Remove(reader.Name);
                        }
                        section = new IniSection(reader.Name, reader.Comment);
                        sections.Add(section);

                        break;

                    case IniType.Key:
                        if (section.GetValue(reader.Name) == null)
                        {
                            section.Set(reader.Name, reader.Value, reader.Comment);
                        }
                        break;
                    }
                }
            } catch (Exception ex) {
                throw ex;
            } finally {
                // Always close the file
                reader.Close();
            }
        }
예제 #2
0
        /// <summary>
        /// Loads the file not saving comments.
        /// </summary>
        private void Load(IniReader reader)
        {
            reader.IgnoreComments = false;
            bool       sectionFound = false;
            IniSection section      = null;

            while (reader.Read())
            {
                switch (reader.Type)
                {
                case IniType.Empty:
                    if (!sectionFound)
                    {
                        initialComment.Add(reader.Comment);
                    }
                    else
                    {
                        section.Set(reader.Comment);
                    }

                    break;

                case IniType.Section:
                    sectionFound = true;
                    section      = new IniSection(reader.Name, reader.Comment);
                    sections.Add(section);
                    break;

                case IniType.Key:
                    section.Set(reader.Name, reader.Value, reader.Comment);
                    break;
                }
            }

            reader.Close();
        }
예제 #3
0
        /// <summary>
        /// Loads the file not saving comments.
        /// </summary>
        private void LoadReader(IniReader reader)
        {
            reader.IgnoreComments = false;
            bool sectionFound = false;
            IniSection section = null;

            try {
                while (reader.Read ())
                {
                    switch (reader.Type)
                    {
                    case IniType.Empty:
                        if (!sectionFound) {
                            initialComment.Add (reader.Comment);
                        } else {
                            section.Set (reader.Comment);
                        }

                        break;
                    case IniType.Section:
                        sectionFound = true;
                        // If section already exists then overwrite it
                        if (sections[reader.Name] != null) {
                            sections.RemoveSection (reader.Name);
                        }
                        section = new IniSection (reader.Name, reader.Comment);
                        sections.Add (section);

                        break;
                    case IniType.Key:
                        if (section.GetValue (reader.Name) == null) {
                            section.Set (reader.Name, reader.Value, reader.Comment);
                        }
                        break;
                    }
                }
            } catch (Exception ex) {
                throw ex;
            } finally {
                // Always close the file
                reader.Close ();
            }
        }
        /// <summary>
        /// Loads the file not saving comments.
        /// </summary>
        private void Load(IniReader reader)
        {
            reader.IgnoreComments = false;
            bool sectionFound = false;
            IniSection section = null;

            while (reader.Read ())
            {
                switch (reader.Type)
                {
                case IniType.Empty:
                    if (!sectionFound) {
                        initialComment.Add (reader.Comment);
                    } else {
                        section.Set (reader.Comment);
                    }

                    break;
                case IniType.Section:
                    sectionFound = true;
                    section = new IniSection (reader.Name, reader.Comment);
                    sections.Add (section);
                    break;
                case IniType.Key:
                    section.Set (reader.Name, reader.Value, reader.Comment);
                    break;
                }
            }

            reader.Close ();
        }