Read() public method

public Read ( ) : bool
return bool
Beispiel #1
1
        public void NormalSectionAndKey() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Logging]");
            writer.WriteLine(" great logger =   log4net  ");
            writer.WriteLine("  [Pets] ; pets comment  ");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.AreEqual(IniReadState.Initial, reader.ReadState);
            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniReadState.Interactive, reader.ReadState);
            Assert.AreEqual(IniType.Section, reader.Type);
            Assert.AreEqual("Logging", reader.Name);
            Assert.AreEqual("", reader.Value);
            Assert.IsNull(reader.Comment);

            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniType.Key, reader.Type);
            Assert.AreEqual("great logger", reader.Name);
            Assert.AreEqual("log4net", reader.Value);
            Assert.AreEqual(null, reader.Comment);

            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniType.Section, reader.Type);
            Assert.AreEqual("Pets", reader.Name);
            Assert.AreEqual("", reader.Value);
            Assert.IsNull(reader.Comment);
        }
Beispiel #2
0
        public void NormalSectionAndKey()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Logging]");
            writer.WriteLine(" great logger =   log4net  ");
            writer.WriteLine("  [Pets] ; pets comment  ");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.AreEqual(IniReadState.Initial, reader.ReadState);
            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniReadState.Interactive, reader.ReadState);
            Assert.AreEqual(IniType.Section, reader.Type);
            Assert.AreEqual("Logging", reader.Name);
            Assert.AreEqual("", reader.Value);
            Assert.IsNull(reader.Comment);

            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniType.Key, reader.Type);
            Assert.AreEqual("great logger", reader.Name);
            Assert.AreEqual("log4net", reader.Value);
            Assert.AreEqual(null, reader.Comment);

            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniType.Section, reader.Type);
            Assert.AreEqual("Pets", reader.Name);
            Assert.AreEqual("", reader.Value);
            Assert.IsNull(reader.Comment);
        }
Beispiel #3
0
        public void NormalComment() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("");
            writer.WriteLine(" ; Something");
            writer.WriteLine(" ;   Some comment  ");
            writer.WriteLine(" ;");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.AreEqual(IniReadState.Initial, reader.ReadState);
            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniReadState.Interactive, reader.ReadState);
            Assert.AreEqual(IniType.Empty, reader.Type);
            Assert.AreEqual("", reader.Name);
            Assert.AreEqual(null, reader.Comment);

            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniType.Empty, reader.Type);
            Assert.AreEqual("Something", reader.Comment);

            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniType.Empty, reader.Type);
            Assert.AreEqual("Some comment", reader.Comment);

            Assert.IsTrue(reader.Read());
            Assert.AreEqual("", reader.Comment);

            Assert.IsFalse(reader.Read());
        }
Beispiel #4
0
        public void NormalComment()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("");
            writer.WriteLine(" ; Something");
            writer.WriteLine(" ;   Some comment  ");
            writer.WriteLine(" ;");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.AreEqual(IniReadState.Initial, reader.ReadState);
            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniReadState.Interactive, reader.ReadState);
            Assert.AreEqual(IniType.Empty, reader.Type);
            Assert.AreEqual("", reader.Name);
            Assert.AreEqual(null, reader.Comment);

            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniType.Empty, reader.Type);
            Assert.AreEqual("Something", reader.Comment);

            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniType.Empty, reader.Type);
            Assert.AreEqual("Some comment", reader.Comment);

            Assert.IsTrue(reader.Read());
            Assert.AreEqual("", reader.Comment);

            Assert.IsFalse(reader.Read());
        }
Beispiel #5
0
        public void KeyWithNoEquals()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Nini]");
            writer.WriteLine(" some key ");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
        }
Beispiel #6
0
        public void NoEndingQuote()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Nini]");
            writer.WriteLine(" some key = \" something ");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
        }
Beispiel #7
0
        public void IgnoreComments()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Nini]");
            writer.WriteLine(" some key = something ; my comment 1");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            reader.IgnoreComments = true;
            Assert.IsTrue(reader.Read());
            Assert.AreEqual(null, reader.Comment);
        }
Beispiel #8
0
        public void NoLineContinuation()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Test]");
            writer.WriteLine(" option = this will be \\ ");
            writer.WriteLine("continued later");

            IniReader reader = new IniReader
                                   (new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
        }
Beispiel #9
0
        public void AcceptNoKeyEndings()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Mysql]");
            writer.WriteLine("quick");
            writer.WriteLine(" my key = new key");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            reader.AcceptNoAssignmentOperator = true;

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual("quick", reader.Name);
            Assert.AreEqual("", reader.Value);
        }
Beispiel #10
0
        public void KeyWithQuotes()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Nini]");
            writer.WriteLine("  whitespace = \"  remove thing\"  ");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniType.Key, reader.Type);
            Assert.AreEqual("whitespace", reader.Name);
            Assert.AreEqual("  remove thing", reader.Value);
            Assert.AreEqual(null, reader.Comment);

            Assert.IsFalse(reader.Read());
        }
Beispiel #11
0
        public void LineContinuationNoSpace()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Test]");
            writer.WriteLine(" option = this will be \\");
            writer.WriteLine("continued later");

            IniReader reader = new IniReader
                                   (new StringReader(writer.ToString()));

            reader.LineContinuation = true;

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual("this will be continued later", reader.Value);
            Assert.IsFalse(reader.Read());
        }
Beispiel #12
0
        public void NoCommentAfterKey()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Test]");
            writer.WriteLine(" option = someValue ; some comment");
            writer.WriteLine("");

            IniReader reader = new IniReader
                                   (new StringReader(writer.ToString()));

            reader.AcceptCommentAfterKey = false;

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual("someValue ; some comment", reader.Value);
            Assert.IsTrue(reader.Read());
        }
Beispiel #13
0
        public void KeysWithSameName()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Nini]");
            writer.WriteLine(" superkey = legal ");
            writer.WriteLine("[Pets]");
            writer.WriteLine(" superkey = legal ");
            writer.WriteLine(" superkey = overrides original ");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());

            reader.Read();
        }
Beispiel #14
0
        public void SectionsWithSameName()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Nini]");
            writer.WriteLine(" some key = something");
            writer.WriteLine("[Nini]");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            try {
                reader.Read();
            }
            catch (IniException e) {
                Assert.AreEqual(3, e.LineNumber);
                Assert.AreEqual(6, e.LinePosition);
            }
        }
Beispiel #15
0
        public void SectionWithNoEndBracket()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Nini");
            writer.WriteLine("");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
        }
Beispiel #16
0
        public void CommentCharInString()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("Value = \"WEB;www.google.com|WEB;www.yahoo.com\"");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.AreEqual("Value", reader.Name);
            Assert.AreEqual("WEB;www.google.com|WEB;www.yahoo.com", reader.Value);
        }
Beispiel #17
0
        public void NoEndOfLineSection()
        {
            StringWriter writer = new StringWriter();

            writer.Write("[Nini Thing]");

            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            reader.Read();
            Assert.IsTrue(true);
        }
Beispiel #18
0
        public void NoSectionsOrKeys()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("");

            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            reader.Read();
            Assert.IsTrue(true);
        }
Beispiel #19
0
        public void NoEndOfLineComment()
        {
            StringWriter writer = new StringWriter();

            writer.Write(" ;   Some comment  ");

            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            reader.Read();
            Assert.IsTrue(true);
        }
Beispiel #20
0
        //[ExpectedException (typeof (IniException))]
        public void LinePositionAndNumber()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("; Test");
            writer.WriteLine("; Test 1");
            writer.WriteLine("[Nini Thing");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());

            try {
                reader.Read();
            }
            catch (IniException e) {
                Assert.AreEqual(3, e.LineNumber);
                Assert.AreEqual(13, e.LinePosition);
            }
        }
Beispiel #21
0
        public void NoEndOfLineKeyNoValue()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Nini Thing]");
            writer.Write(" somekey = ");

            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            reader.Read();
            Assert.IsTrue(true);
        }
Beispiel #22
0
        public void EndCommentUnix()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Test]");
            writer.WriteLine("; Test");
            writer.WriteLine(" float1 = 1.0 ;"); // no space after comment
            writer.WriteLine(" float2 = 2.0");

            IniReader reader = new IniReader
                                   (new StringReader(ConvertToUnix(writer.ToString())));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual("float1", reader.Name, "float1 not found");
            Assert.AreEqual("1.0", reader.Value, "float1 value not found");
            Assert.IsTrue(reader.Read(), "Could not find last float");
            Assert.AreEqual("float2", reader.Name);
            Assert.AreEqual("2.0", reader.Value);
        }
Beispiel #23
0
        /// <summary>
        /// Loads the file not saving comments.
        /// </summary>
        private void LoadReader(IniReader reader)
        {
            reader.IgnoreComments = false;
            var        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;
            }
            finally {
                // Always close the file
                reader.Close();
            }
        }
Beispiel #24
0
        public void ConsumeAllKeyText()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("email = \"John Smith\"; <*****@*****.**>");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            reader.ConsumeAllKeyText = true;

            Assert.IsTrue(reader.Read());
            Assert.AreEqual("email", reader.Name);
            Assert.AreEqual("\"John Smith\"; <*****@*****.**>", reader.Value);
        }
Beispiel #25
0
        public void EndCommentUnix() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Test]");
            writer.WriteLine("; Test");
            writer.WriteLine(" float1 = 1.0 ;"); // no space after comment
            writer.WriteLine(" float2 = 2.0");

            IniReader reader = new IniReader
                (new StringReader(ConvertToUnix(writer.ToString())));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual("float1", reader.Name, "float1 not found");
            Assert.AreEqual("1.0", reader.Value, "float1 value not found");
            Assert.IsTrue(reader.Read(), "Could not find last float");
            Assert.AreEqual("float2", reader.Name);
            Assert.AreEqual("2.0", reader.Value);
        }
Beispiel #26
0
        public void NoEndOfLineSection() {
            StringWriter writer = new StringWriter();
            writer.Write("[Nini Thing]");

            IniReader reader = new IniReader(new StringReader(writer.ToString()));
            reader.Read();
            Assert.IsTrue(true);
        }
Beispiel #27
0
        public void NoEndOfLineKeyNoValue() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Nini Thing]");
            writer.Write(" somekey = ");

            IniReader reader = new IniReader(new StringReader(writer.ToString()));
            reader.Read();
            Assert.IsTrue(true);
        }
Beispiel #28
0
        public void NoEndOfLineComment() {
            StringWriter writer = new StringWriter();
            writer.Write(" ;   Some comment  ");

            IniReader reader = new IniReader(new StringReader(writer.ToString()));
            reader.Read();
            Assert.IsTrue(true);
        }
Beispiel #29
0
        public void AcceptNoKeyEndings() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Mysql]");
            writer.WriteLine("quick");
            writer.WriteLine(" my key = new key");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            reader.AcceptNoAssignmentOperator = true;

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual("quick", reader.Name);
            Assert.AreEqual("", reader.Value);
        }
Beispiel #30
0
        public void KeysWithSameName() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Nini]");
            writer.WriteLine(" superkey = legal ");
            writer.WriteLine("[Pets]");
            writer.WriteLine(" superkey = legal ");
            writer.WriteLine(" superkey = overrides original ");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());

            reader.Read();
        }
Beispiel #31
0
        public void NoCommentAfterKey() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Test]");
            writer.WriteLine(" option = someValue ; some comment");
            writer.WriteLine("");

            IniReader reader = new IniReader
                (new StringReader(writer.ToString()));
            reader.AcceptCommentAfterKey = false;

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual("someValue ; some comment", reader.Value);
            Assert.IsTrue(reader.Read());
        }
Beispiel #32
0
        public void NoSectionsOrKeys() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("");

            IniReader reader = new IniReader(new StringReader(writer.ToString()));
            reader.Read();
            Assert.IsTrue(true);
        }
Beispiel #33
0
        public void KeyWithQuotes() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Nini]");
            writer.WriteLine("  whitespace = \"  remove thing\"  ");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual(IniType.Key, reader.Type);
            Assert.AreEqual("whitespace", reader.Name);
            Assert.AreEqual("  remove thing", reader.Value);
            Assert.AreEqual(null, reader.Comment);

            Assert.IsFalse(reader.Read());
        }
Beispiel #34
0
        public void NoEndingQuote() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Nini]");
            writer.WriteLine(" some key = \" something ");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
        }
Beispiel #35
0
        public void IgnoreComments() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Nini]");
            writer.WriteLine(" some key = something ; my comment 1");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            reader.IgnoreComments = true;
            Assert.IsTrue(reader.Read());
            Assert.AreEqual(null, reader.Comment);
        }
Beispiel #36
0
        public void SectionsWithSameName() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Nini]");
            writer.WriteLine(" some key = something");
            writer.WriteLine("[Nini]");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            try {
                reader.Read();
            }
            catch(IniException e) {
                Assert.AreEqual(3, e.LineNumber);
                Assert.AreEqual(6, e.LinePosition);
            }
        }
Beispiel #37
0
        public void NoLineContinuation() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Test]");
            writer.WriteLine(" option = this will be \\ ");
            writer.WriteLine("continued later");

            IniReader reader = new IniReader
                (new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
        }
Beispiel #38
0
        public void CommentCharInString() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("Value = \"WEB;www.google.com|WEB;www.yahoo.com\"");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.AreEqual("Value", reader.Name);
            Assert.AreEqual("WEB;www.google.com|WEB;www.yahoo.com", reader.Value);
        }
Beispiel #39
0
        public void LineContinuationNoSpace() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Test]");
            writer.WriteLine(" option = this will be \\");
            writer.WriteLine("continued later");

            IniReader reader = new IniReader
                (new StringReader(writer.ToString()));
            reader.LineContinuation = true;

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
            Assert.AreEqual("this will be continued later", reader.Value);
            Assert.IsFalse(reader.Read());
        }
Beispiel #40
0
        public void ConsumeAllKeyText() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("email = \"John Smith\"; <*****@*****.**>");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));
            reader.ConsumeAllKeyText = true;

            Assert.IsTrue(reader.Read());
            Assert.AreEqual("email", reader.Name);
            Assert.AreEqual("\"John Smith\"; <*****@*****.**>", reader.Value);
        }
Beispiel #41
0
        public void KeyWithNoEquals() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Nini]");
            writer.WriteLine(" some key ");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());
        }
Beispiel #42
0
        //[ExpectedException (typeof (IniException))]
        public void LinePositionAndNumber() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("; Test");
            writer.WriteLine("; Test 1");
            writer.WriteLine("[Nini Thing");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
            Assert.IsTrue(reader.Read());

            try {
                reader.Read();
            }
            catch(IniException e) {
                Assert.AreEqual(3, e.LineNumber);
                Assert.AreEqual(13, e.LinePosition);
            }
        }
Beispiel #43
0
        public void SectionWithNoEndBracket() {
            StringWriter writer = new StringWriter();
            writer.WriteLine("[Nini");
            writer.WriteLine("");
            IniReader reader = new IniReader(new StringReader(writer.ToString()));

            Assert.IsTrue(reader.Read());
        }
Beispiel #44
0
        /// <summary>
        /// Loads the file not saving comments.
        /// </summary>
        private void LoadReader(IniReader reader) {
            reader.IgnoreComments = false;
            var 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;
            }
            finally {
                // Always close the file
                reader.Close();
            }
        }