示例#1
0
        /// <summary>
        /// Reads the values from all keys within a section of an INI file into a string list.
        /// </summary>
        /// <param name="Section">Section identifies the section in the file from which to read key values. </param>
        /// <param name="Strings">Strings is the string list object into which to read the values.</param>

        public void ReadSectionValues(string Section, TStrings Strings)
        {
            TStrings CurrentSection;

            Strings.Clear();

            if (Strings != null)
            {
                for (int i = 0; i < FSections.Count; i++)
                {
                    //if( FSections[ i ] == Section )
                    if (FSections[i].ToUpper() == Section.ToUpper())
                    {
                        CurrentSection = (FSections.GetObject(i) as TStrings);

                        for (int j = 0; j < CurrentSection.Count; j++)
                        {
                            string st = CurrentSection[j].TrimEnd();

                            if ((st.Length > 0) &&
                                (st[0] != '#') &&
                                (st[0] != '\n'))
                            {
                                Strings.Add(st);
                            }
                            ;
                        }
                        ;

                        i = FSections.Count;
                    }
                    ;
                }
                ;
            }
            ;
        }