Beispiel #1
0
        /// <summary>
        /// Remember to close Stream after this method completes
        /// </summary>
        /// <param name="stream"></param>
        public void Load(StreamReader stream)
        {
            this._sections.Clear();
            string line = null;

            line = stream.ReadLine();

            while (line != null)
            {
                if (line.Trim().StartsWith(";") ||
                    (line.Trim().StartsWith("[") && line.Trim().EndsWith("]")))
                {
                    IniSection section = IniSection.FromStream(ref line, stream);
                    if (section != null)
                    {
                        this._sections.Add(section);
                        section.OnChange += new EventHandler(this._sections_OnChange);
                    }
                }
                else
                {
                    // next linereads in section / key methods - used for comments
                    line = stream.ReadLine();
                    if (line != null)
                    {
                        line = line.Trim();
                    }
                }
            }

            this.changed = false;
        }