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