private object ParseByToken(GA_MiniJSON.Parser.TOKEN token) { switch (token) { case GA_MiniJSON.Parser.TOKEN.CURLY_OPEN: return((object)this.ParseObject()); case GA_MiniJSON.Parser.TOKEN.SQUARED_OPEN: return((object)this.ParseArray()); case GA_MiniJSON.Parser.TOKEN.STRING: return((object)this.ParseString()); case GA_MiniJSON.Parser.TOKEN.NUMBER: return(this.ParseNumber()); case GA_MiniJSON.Parser.TOKEN.TRUE: return((object)true); case GA_MiniJSON.Parser.TOKEN.FALSE: return((object)false); case GA_MiniJSON.Parser.TOKEN.NULL: return((object)null); default: return((object)null); } }
private List <object> ParseArray() { List <object> objectList = new List <object>(); this.json.Read(); bool flag = true; while (flag) { GA_MiniJSON.Parser.TOKEN nextToken = this.NextToken; switch (nextToken) { case GA_MiniJSON.Parser.TOKEN.NONE: return((List <object>)null); case GA_MiniJSON.Parser.TOKEN.SQUARED_CLOSE: flag = false; continue; case GA_MiniJSON.Parser.TOKEN.COMMA: continue; default: object byToken = this.ParseByToken(nextToken); objectList.Add(byToken); continue; } } return(objectList); }
private Dictionary <string, object> ParseObject() { Dictionary <string, object> strs = new Dictionary <string, object>(); this.json.Read(); while (true) { GA_MiniJSON.Parser.TOKEN nextToken = this.NextToken; if (nextToken == GA_MiniJSON.Parser.TOKEN.NONE) { return(null); } if (nextToken == GA_MiniJSON.Parser.TOKEN.CURLY_CLOSE) { return(strs); } if (nextToken != GA_MiniJSON.Parser.TOKEN.COMMA) { string str = this.ParseString(); if (str == null) { return(null); } if (this.NextToken != GA_MiniJSON.Parser.TOKEN.COLON) { break; } this.json.Read(); strs[str] = this.ParseValue(); } } return(null); }
private List <object> ParseArray() { List <object> objs = new List <object>(); this.json.Read(); bool flag = true; while (flag) { GA_MiniJSON.Parser.TOKEN nextToken = this.NextToken; if (nextToken == GA_MiniJSON.Parser.TOKEN.NONE) { return(null); } if (nextToken == GA_MiniJSON.Parser.TOKEN.SQUARED_CLOSE) { flag = false; } else { if (nextToken == GA_MiniJSON.Parser.TOKEN.COMMA) { continue; } objs.Add(this.ParseByToken(nextToken)); } } return(objs); }
private object ParseByToken(GA_MiniJSON.Parser.TOKEN token) { switch (token) { case GA_MiniJSON.Parser.TOKEN.CURLY_OPEN: { return(this.ParseObject()); } case GA_MiniJSON.Parser.TOKEN.CURLY_CLOSE: case GA_MiniJSON.Parser.TOKEN.SQUARED_CLOSE: case GA_MiniJSON.Parser.TOKEN.COLON: case GA_MiniJSON.Parser.TOKEN.COMMA: { return(null); } case GA_MiniJSON.Parser.TOKEN.SQUARED_OPEN: { return(this.ParseArray()); } case GA_MiniJSON.Parser.TOKEN.STRING: { return(this.ParseString()); } case GA_MiniJSON.Parser.TOKEN.NUMBER: { return(this.ParseNumber()); } case GA_MiniJSON.Parser.TOKEN.TRUE: { return(true); } case GA_MiniJSON.Parser.TOKEN.FALSE: { return(false); } case GA_MiniJSON.Parser.TOKEN.NULL: { return(null); } default: { return(null); } } }