protected void ReadGameInfoListObject(LitJson.JsonReader reader, object context) { GameInfoListCallbackData data = context as GameInfoListCallbackData; switch (reader.Token) { case LitJson.JsonToken.PropertyName: { string key = reader.Value.ToString(); switch (key) { case "Status": { string val = JsonReadStringPropertyRHS(reader); data.status = (ErrorCode)Enum.Parse(typeof(ErrorCode), val); break; } case "List": { reader.Read(); JsonReadArray(reader, context, this.BeginGameInfoObject, this.ReadGameInfoObject, null); break; } } break; } default: { break; } } }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)) { string _json_text = LuaAPI.lua_tostring(L, 2); var gen_ret = new LitJson.JsonReader(_json_text); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.IO.TextReader>(L, 2)) { System.IO.TextReader _reader = (System.IO.TextReader)translator.GetObject(L, 2, typeof(System.IO.TextReader)); var gen_ret = new LitJson.JsonReader(_reader); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to LitJson.JsonReader constructor!")); }
static int _m_ToObject_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 1 && translator.Assignable <LitJson.JsonReader>(L, 1)) { LitJson.JsonReader _reader = (LitJson.JsonReader)translator.GetObject(L, 1, typeof(LitJson.JsonReader)); LitJson.JsonData gen_ret = LitJson.JsonMapper.ToObject(_reader); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 1 && translator.Assignable <System.IO.TextReader>(L, 1)) { System.IO.TextReader _reader = (System.IO.TextReader)translator.GetObject(L, 1, typeof(System.IO.TextReader)); LitJson.JsonData gen_ret = LitJson.JsonMapper.ToObject(_reader); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 1 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)) { string _json = LuaAPI.lua_tostring(L, 1); LitJson.JsonData gen_ret = LitJson.JsonMapper.ToObject(_json); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 2 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && translator.Assignable <System.Type>(L, 2)) { string _json = LuaAPI.lua_tostring(L, 1); System.Type _ConvertType = (System.Type)translator.GetObject(L, 2, typeof(System.Type)); object gen_ret = LitJson.JsonMapper.ToObject(_json, _ConvertType); translator.PushAny(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to LitJson.JsonMapper.ToObject!")); }
public void ReaderLitJson() { _stream.Seek(0, SeekOrigin.Begin); var json = new LitJson.JsonReader(_reader); while (json.Read()) { ; } }
static int _g_get_AllowSingleQuotedStrings(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); LitJson.JsonReader gen_to_be_invoked = (LitJson.JsonReader)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.AllowSingleQuotedStrings); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(1); }
static int _g_get_Value(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); LitJson.JsonReader gen_to_be_invoked = (LitJson.JsonReader)translator.FastGetCSObj(L, 1); translator.PushAny(L, gen_to_be_invoked.Value); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(1); }
static int _s_set_SkipNonMembers(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); LitJson.JsonReader gen_to_be_invoked = (LitJson.JsonReader)translator.FastGetCSObj(L, 1); gen_to_be_invoked.SkipNonMembers = LuaAPI.lua_toboolean(L, 2); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(0); }
protected void UnityIosGameInfoListCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); GameInfoListCallbackData data = new GameInfoListCallbackData(); JsonReadObject(reader, data, this.ReadGameInfoListObject); GameInfoList gameList = new GameInfoList(); gameList.List = data.games.ToArray(); GameNameListCallback(data.status, gameList); }
protected void UnityIosIngestListCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); IngestListCallbackData data = new IngestListCallbackData(); JsonReadObject(reader, data, this.ReadIngestServerObject); IngestList ingestList = new IngestList(); ingestList.List = data.servers.ToArray(); IngestListCallback(data.status, ingestList); }
protected void UnityIosUserInfoCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); Dictionary <string, string> dict = new Dictionary <string, string>(); reader.Read(); JsonReadFlatObjectIntoDictionary(reader, dict); ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]); UserInfo info = new UserInfo(); info.Name = dict["Name"]; info.DisplayName = dict["DisplayName"]; UserInfoDoneCallback(status, info); }
protected void UnityIosArchivingStateCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); Dictionary <string, string> dict = new Dictionary <string, string>(); reader.Read(); JsonReadFlatObjectIntoDictionary(reader, dict); ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]); ArchivingState state = new ArchivingState(); state.CureUrl = dict["CureUrl"]; state.RecordingEnabled = dict["RecordingEnabled"] != "0"; ArchivingStateDoneCallback(status, state); }
protected void UnityIosStreamInfoCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); Dictionary <string, string> dict = new Dictionary <string, string>(); reader.Read(); JsonReadFlatObjectIntoDictionary(reader, dict); ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]); StreamInfo info = new StreamInfo(); info.Viewers = int.Parse(dict["Viewers"]); info.StreamId = UInt64.Parse(dict["Id"]); StreamInfoDoneCallback(status, info); }
public void Load(string folder) { ProjectName = Path.GetFileName(folder); var settings_file = Path.Combine(folder, ProjectName + ".json"); if (!File.Exists(settings_file)) { return; } BaseDir = folder; string json = ""; using (StreamReader sr = new StreamReader(settings_file)) json = sr.ReadToEnd(); LitJson.JsonReader reader = new LitJson.JsonReader(json); Sprites = LitJson.JsonMapper.ToObject <List <Sprite> >(reader); }
protected void UnityIosRequestAuthTokenCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); Dictionary <string, string> dict = new Dictionary <string, string>(); reader.Read(); JsonReadFlatObjectIntoDictionary(reader, dict); ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]); AuthToken token = null; if (Error.Succeeded(status)) { token = new AuthToken(); token.Data = dict["Token"]; } RequestAuthTokenDoneCallback(status, token); }
static int _m_Close(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); LitJson.JsonReader gen_to_be_invoked = (LitJson.JsonReader)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Close( ); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
protected void ReadIngestServerObject(LitJson.JsonReader reader, object context) { IngestListCallbackData data = context as IngestListCallbackData; IngestServer server = data.servers.Last(); switch (reader.Token) { case LitJson.JsonToken.PropertyName: { string key = reader.Value.ToString(); string val = JsonReadStringPropertyRHS(reader); switch (key) { case "Name": { server.ServerName = val; break; } case "Url": { server.ServerUrl = val; break; } case "Default": { server.DefaultServer = val != "0" && val.ToLower() != "false"; break; } } break; } default: { break; } } }
protected void ReadGameInfoObject(LitJson.JsonReader reader, object context) { GameInfoListCallbackData data = context as GameInfoListCallbackData; GameInfo info = data.games.Last(); switch (reader.Token) { case LitJson.JsonToken.PropertyName: { string key = reader.Value.ToString(); string val = JsonReadStringPropertyRHS(reader); switch (key) { case "Name": { info.Name = val; break; } case "Id": { info.Id = int.Parse(val); break; } case "Popularity": { info.Popularity = int.Parse(val); break; } } break; } default: { break; } } }
static int _m_ToWrapper_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && translator.Assignable <LitJson.WrapperFactory>(L, 1) && translator.Assignable <LitJson.JsonReader>(L, 2)) { LitJson.WrapperFactory _factory = translator.GetDelegate <LitJson.WrapperFactory>(L, 1); LitJson.JsonReader _reader = (LitJson.JsonReader)translator.GetObject(L, 2, typeof(LitJson.JsonReader)); LitJson.IJsonWrapper gen_ret = LitJson.JsonMapper.ToWrapper(_factory, _reader); translator.PushAny(L, gen_ret); return(1); } if (gen_param_count == 2 && translator.Assignable <LitJson.WrapperFactory>(L, 1) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)) { LitJson.WrapperFactory _factory = translator.GetDelegate <LitJson.WrapperFactory>(L, 1); string _json = LuaAPI.lua_tostring(L, 2); LitJson.IJsonWrapper gen_ret = LitJson.JsonMapper.ToWrapper(_factory, _json); translator.PushAny(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to LitJson.JsonMapper.ToWrapper!")); }
protected void UnityIosLoginCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); Dictionary <string, string> dict = new Dictionary <string, string>(); reader.Read(); JsonReadFlatObjectIntoDictionary(reader, dict); ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]); ChannelInfo info = null; if (Error.Succeeded(status)) { info = new ChannelInfo(); info.Name = dict["Name"]; info.DisplayName = dict["DisplayName"]; info.ChannelUrl = dict["ChannelUrl"]; } LoginCallback(status, info); }
protected void UnityIosArchivingStateCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); Dictionary<string, string> dict = new Dictionary<string, string>(); reader.Read(); JsonReadFlatObjectIntoDictionary(reader, dict); ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]); ArchivingState state = new ArchivingState(); state.CureUrl = dict["CureUrl"]; state.RecordingEnabled = dict["RecordingEnabled"] != "0"; ArchivingStateDoneCallback(status, state); }
protected void UnityIosLoginCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); Dictionary<string, string> dict = new Dictionary<string, string>(); reader.Read(); JsonReadFlatObjectIntoDictionary(reader, dict); ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]); ChannelInfo info = null; if (Error.Succeeded(status)) { info = new ChannelInfo(); info.Name = dict["Name"]; info.DisplayName = dict["DisplayName"]; info.ChannelUrl = dict["ChannelUrl"]; } LoginCallback(status, info); }
protected void UnityIosRequestAuthTokenCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); Dictionary<string, string> dict = new Dictionary<string, string>(); reader.Read(); JsonReadFlatObjectIntoDictionary(reader, dict); ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]); AuthToken token = null; if (Error.Succeeded(status)) { token = new AuthToken(); token.Data = dict["Token"]; } RequestAuthTokenDoneCallback(status, token); }
private List<xFerParamater> getParametersPassed(string inputVal) { List<xFerParamater> _params = new List<xFerParamater>(); if (inputVal.Length > 0) { string paramtext = inputVal; try { LitJson.JsonReader reader = new LitJson.JsonReader(paramtext); string name = string.Empty; object val = new object(); while (reader.Read()) { if (name != string.Empty) { val = reader.Value; _params.Add(new xFerParamater(name, val.ToString())); name = string.Empty; } else { if (reader.Token.ToString() == "PropertyName") { name = reader.Value.ToString(); } } } } catch (Exception ex) { Console.WriteLine("query parameters failed."); } } return _params; }
protected void UnityIosUserInfoCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); Dictionary<string, string> dict = new Dictionary<string, string>(); reader.Read(); JsonReadFlatObjectIntoDictionary(reader, dict); ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]); UserInfo info = new UserInfo(); info.Name = dict["Name"]; info.DisplayName = dict["DisplayName"]; UserInfoDoneCallback(status, info); }
protected void UnityIosStreamInfoCallback(string message) { LitJson.JsonReader reader = new LitJson.JsonReader(message); Dictionary<string, string> dict = new Dictionary<string, string>(); reader.Read(); JsonReadFlatObjectIntoDictionary(reader, dict); ErrorCode status = (ErrorCode)Enum.Parse(typeof(ErrorCode), dict["Status"]); StreamInfo info = new StreamInfo(); info.Viewers = int.Parse(dict["Viewers"]); info.StreamId = UInt64.Parse(dict["Id"]); StreamInfoDoneCallback(status, info); }