Example #1
0
		private void Parse (IRunner runner)
		{
			char [] buffer = new char [4096];
			while (files.Count > 0) {
				string fileName = files.Pop ();
				using (StreamLineReader sr = new StreamLineReader (fileName)) {
					while (!sr.EndOfStream) {
						int length = sr.ReadLine (buffer, 0, buffer.Length);
                        ProcessLine(runner, buffer, length);
					}
				}
			}
			Resolve ();
			TearDown ();
		}
		private static Dictionary<string, string> ReadWithComments (StreamLineReader reader)
		{
			Dictionary<string, string> dict = new Dictionary<string, string> ();
			while (!reader.EndOfStream) {
				int length = reader.ReadLine (buffer, 0, buffer.Length);
				int pos = Array.IndexOf (buffer, '-');
				string key = new string (buffer, 0, pos);
				string comment = (buffer [length - 1] == '-') ? null :
					new string (buffer, pos + 1, length - pos - 1);
				dict.Add (key, comment);
			}
			return dict;
		}
		private static HashSet<string> Read (StreamLineReader reader)
		{
			HashSet<string> set = new HashSet<string> ();
			while (!reader.EndOfStream) {
				int length = reader.ReadLine (buffer, 0, buffer.Length);
				set.Add (new string (buffer, 0, length));
			}
			return set;
		}
		private void LoadDefinitions (string filename)
		{
			if (!File.Exists (filename))
				return;

			using (FileStream fs = File.OpenRead (filename)) 
			using (ZipInputStream zs = new ZipInputStream (fs))
			using (StreamLineReader sr = new StreamLineReader (zs)) {
				ZipEntry ze;
				while ((ze = zs.GetNextEntry ()) != null) {
					switch (ze.Name) {
					case "exception.txt":
						NotImplementedInternal = Read (sr);
						break;
					case "missing.txt":
						MissingInternal = Read (sr);
						break;
					case "monotodo.txt":
						TodoInternal = ReadWithComments (sr);
						break;
					default:
						break;
					}
				}
			}
		}