Created
October 29, 2011 07:51
-
-
Save Eugeny/1324212 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Test ReadFromTxt(string fileName) | |
{ | |
Test t = null; | |
using (Stream s = File.OpenRead(fileName)) | |
{ | |
using (StreamReader sr = new StreamReader(s)) | |
{ | |
string name = sr.ReadLine(); | |
t = new Test(name.SubString(6)); | |
Question q = null; | |
while (true) { | |
string s = sr.ReadLine(); | |
if (s==null)return; | |
if (s.StartsWith("<")) { | |
q = new Question(s.SubString(2)); | |
t.AddQuestionLOL(q); | |
} | |
if (s.StartsWith("--")) { | |
string[] ss = s.Split(":"); | |
Variant v = new Variant(ss[0].SubString(2).Trim(), ss[1].Trim()); | |
q.AddVariantWTFLOL(v); | |
} | |
} | |
return t; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment