public BZNTokenNestedString(string name, IBZNToken[][] values) { this.name = name; this.values = values; }
private IBZNToken ReadStringValueSub(Stream filestream, string rawLine) { string[] line = rawLine.Split(' '); if (line[1] == "=") { string name = line[0]; //bool isArray = false; if (ComplexStringTokenSizeMap.ContainsKey(name)) { int count = 1; IBZNToken[][] values = new IBZNToken[count][]; for (int subSectionCounter = 0; subSectionCounter < count; subSectionCounter++) { values[subSectionCounter] = new IBZNToken[ComplexStringTokenSizeMap[name]]; for (int constructCounter = 0; constructCounter < ComplexStringTokenSizeMap[name]; constructCounter++) { string rawLineInner = ReadLine(filestream).TrimEnd('\r', '\n').TrimStart(); values[subSectionCounter][constructCounter] = ReadStringValueSub(filestream, rawLineInner); } } return new BZNTokenNestedString(name, values); } else { string value = line[2]; //Console.WriteLine("ASCII\t\"{0}\"\tValidation: {1}", value, name); return new BZNTokenString(name, new string[] { value }); } } else if (line[2] == "=") { string name = line[0]; //bool isArray = true; int count = int.Parse(line[1].Substring(1, line[1].Length - 2)); if (count == 0) return new BZNTokenString(name, new string[0]); if (ComplexStringTokenSizeMap.ContainsKey(name)) { IBZNToken[][] values = new IBZNToken[count][]; for (int subSectionCounter = 0; subSectionCounter < count; subSectionCounter++) { values[subSectionCounter] = new IBZNToken[ComplexStringTokenSizeMap[name]]; for (int constructCounter = 0; constructCounter < ComplexStringTokenSizeMap[name]; constructCounter++) { string rawLineInner = ReadLine(filestream).TrimEnd('\r', '\n').TrimStart(); values[subSectionCounter][constructCounter] = ReadStringValueSub(filestream, rawLineInner); } } return new BZNTokenNestedString(name, values); } else { string[] values = new string[count]; for (int lineNum = 0; lineNum < count; lineNum++) { values[lineNum] = ReadLine(filestream).TrimEnd('\r', '\n'); } //Console.WriteLine("ASCII\t[0] \"{0}\"\tValidation: {1}", values[0], name); //for (int x = 0; x < values.Length; x++) //{ // Console.WriteLine("ASCII\t[{1}] \"{0}\"", values[x], x); //} return new BZNTokenString(name, values); } } else { throw new Exception("Error reading ASCII data, \"=\" not found where expected."); } }