From cfbf3c78594003cb5a474b29ce52af56dbc38cb8 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Sun, 21 Jun 2015 06:12:30 +0200 Subject: [PATCH] Add costructors to LineParser. --- Tests/LineParserTest.cs | 3 +-- zaaReloaded2/Dictionaries/LineParser.cs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Tests/LineParserTest.cs b/Tests/LineParserTest.cs index 07e5d03..b596de5 100755 --- a/Tests/LineParserTest.cs +++ b/Tests/LineParserTest.cs @@ -55,8 +55,7 @@ namespace Tests [Test] public void ParseLineWithQuotesAndPunctuation() { - LineParser lp = new LineParser(); - lp.Line = "this-is \"a , simple ;\" line"; + LineParser lp = new LineParser("this-is \"a , simple ;\" line"); Assert.AreEqual("this-is", lp.Fields[0]); Assert.AreEqual("a , simple ;", lp.Fields[1]); Assert.AreEqual("line", lp.Fields[2]); diff --git a/zaaReloaded2/Dictionaries/LineParser.cs b/zaaReloaded2/Dictionaries/LineParser.cs index 11b420c..1815e7d 100755 --- a/zaaReloaded2/Dictionaries/LineParser.cs +++ b/zaaReloaded2/Dictionaries/LineParser.cs @@ -56,6 +56,25 @@ namespace zaaReloaded2.Dictionaries #endregion + #region Constructors + + /// + /// Constructs a LineParser object without a line. + /// + public LineParser() { } + + /// + /// Constructs a LineParser object with an initial . + /// + /// Initial line to parse. + public LineParser(string line) + : this() + { + Line = line; + } + + #endregion + #region Private methods void ParseLine()