public virtual void readList(StreamReader input, List <object> scope) { this.listInQuotes = false; this.listIgnoreNextChar = false; while (!input.EndOfStream) { char c = (char)input.Read(); if (this.listIgnoreNextChar) { KeyValueTableReader.builder.Append(c); this.listIgnoreNextChar = false; } else if (c == '\\') { this.listIgnoreNextChar = true; } else if (c == '"') { if (this.listInQuotes) { this.listInQuotes = false; string item = KeyValueTableReader.builder.ToString(); scope.Add(item); } else { this.listInQuotes = true; KeyValueTableReader.builder.Length = 0; } } else if (this.listInQuotes) { KeyValueTableReader.builder.Append(c); } else if (c == '{') { KeyValueTableReader item2 = new KeyValueTableReader(input); scope.Add(item2); } else if (c == ']') { return; } } }
public virtual void readDictionary(StreamReader input, Dictionary <string, object> scope) { this.dictionaryKey = null; this.dictionaryInQuotes = false; this.dictionaryIgnoreNextChar = false; while (!input.EndOfStream) { char c = (char)input.Read(); if (this.dictionaryIgnoreNextChar) { KeyValueTableReader.builder.Append(c); this.dictionaryIgnoreNextChar = false; } else if (c == '\\') { this.dictionaryIgnoreNextChar = true; } else if (c == '"') { if (this.dictionaryInQuotes) { this.dictionaryInQuotes = false; if (string.IsNullOrEmpty(this.dictionaryKey)) { this.dictionaryKey = KeyValueTableReader.builder.ToString(); } else { string value = KeyValueTableReader.builder.ToString(); if (!scope.ContainsKey(this.dictionaryKey)) { scope.Add(this.dictionaryKey, value); } if (!this.canContinueReadDictionary(input, scope)) { return; } this.dictionaryKey = null; } } else { this.dictionaryInQuotes = true; KeyValueTableReader.builder.Length = 0; } } else if (this.dictionaryInQuotes) { KeyValueTableReader.builder.Append(c); } else if (c == '{') { object obj; if (scope.TryGetValue(this.dictionaryKey, out obj)) { KeyValueTableReader keyValueTableReader = (KeyValueTableReader)obj; keyValueTableReader.readDictionary(input, keyValueTableReader.table); } else { KeyValueTableReader keyValueTableReader2 = new KeyValueTableReader(input); obj = keyValueTableReader2; scope.Add(this.dictionaryKey, keyValueTableReader2); } if (!this.canContinueReadDictionary(input, scope)) { return; } this.dictionaryKey = null; } else { if (c == '}') { return; } if (c == '[') { object obj2; if (!scope.TryGetValue(this.dictionaryKey, out obj2)) { obj2 = new List <object>(); scope.Add(this.dictionaryKey, obj2); } this.readList(input, (List <object>)obj2); if (!this.canContinueReadDictionary(input, scope)) { return; } this.dictionaryKey = null; } } } }