public void TStrings_Load_Test_1()
        {
            TStrings_Save_Test_1();

            TStrings file = new TStrings();

            file.LoadFromFile(FileName);

            Assert.AreEqual("123", file[1]);
        }
Beispiel #2
0
        /******************************************************************************/

        public void LoadValues()
        {
            TStrings List = new TStrings();
            string   st;
            TStrings Strings;

            if ((FFileName.Length > 0))
            {
                List.LoadFromFile(FFileName, System.Text.Encoding.UTF8);

                Clear();
                Strings = null;

                for (int i = 0; i < List.Count; i++)
                {
                    st = List[i];

                    if ((st.Length > 0) && (st[0] != ';')) // ? Comment
                    {
                        if ((st[0] == '[') &&
                            (st[st.Length - 1] == ']'))       // ? Section
                        {
                            Strings = AddSection(st.Substring(1, st.Length - 2));
                        }
                        else
                        {
                            if (Strings != null)
                            {
                                Strings.Add(st);
                            }
                        };
                    }
                    ;
                }
                ;
            }
            else
            {
                Clear();
            };
        }