Наследование: IJsonWrapper
Пример #1
1
 public static OSD DeserializeJson(JsonData json)
 {
     switch (json.GetJsonType())
     {
         case JsonType.Boolean:
             return OSD.FromBoolean((bool)json);
         case JsonType.Int:
             return OSD.FromInteger((int)json);
         case JsonType.Long:
             return OSD.FromLong((long)json);
         case JsonType.Double:
             return OSD.FromReal((double)json);
         case JsonType.String:
             string str = (string)json;
             if (String.IsNullOrEmpty(str))
                 return new OSD();
             else
                 return OSD.FromString(str);
         case JsonType.Array:
             OSDArray array = new OSDArray(json.Count);
             for (int i = 0; i < json.Count; i++)
                 array.Add(DeserializeJson(json[i]));
             return array;
         case JsonType.Object:
             OSDMap map = new OSDMap(json.Count);
             foreach (KeyValuePair<string, JsonData> kvp in json)
                 map.Add(kvp.Key, DeserializeJson(kvp.Value));
             return map;
         case JsonType.None:
         default:
             return new OSD();
     }
 }
		public IEnumerator Post (string url) {
			// HEADERはHashtableで記述
			Hashtable header = new Hashtable ();
			header.Add ("Content-Type", "application/json; charset=UTF-8");
			
			// LitJsonを使いJSONデータを生成
			JsonData obj = new JsonData();
			obj["itemName"] = "katana";
			obj["itemType"] = "buki";
			obj["price"] = 300;
			obj["attack"] = "10";
			obj["defense"] = "0";
			obj["description"] = "atk";
			
			// シリアライズする(LitJson.JsonData→JSONテキスト)
			string postJsonStr = obj.ToJson();
			Debug.Log(postJsonStr);
			byte[] postBytes = Encoding.Default.GetBytes (postJsonStr);
			
			// 送信開始
			WWW www = new WWW (url, postBytes, header);
			yield return www;
			
			// 成功
			if (ErrorCheck(www)) {
				Debug.Log("WWW Ok!: " + www.data);
			}
			// 失敗
			else{
				Debug.Log("WWW Error: "+ www.error);          
			}
		}
Пример #3
0
 public TooManyFollows(JsonData warning)
 {
     var warn = warning.GetValue<JsonData>("warning");
     Code = warn.GetValue<string>("code");
     Message = warn.GetValue<string>("message");
     UserID = warn.GetValue<ulong>("user_id");
 }
Пример #4
0
        public Relationship(JsonData relJson)
        {
            if (relJson == null) return;

            ScreenName = relJson.GetValue<string>("screen_name");
            Name = relJson.GetValue<string>("name");
            RetweetsWanted = relJson.GetValue<bool>("want_retweets");
            AllReplies = relJson.GetValue<bool>("all_replies");
            MarkedSpam = relJson.GetValue<bool>("marked_spam");
            ID = relJson.GetValue<ulong>("id");
            Blocking = relJson.GetValue<bool>("blocking");
            NotificationsEnabled = relJson.GetValue<bool>("notifications_enabled");
            CanDm = relJson.GetValue<bool>("can_dm");
            Muting = relJson.GetValue<bool>("muting", false);

            var connections = relJson.GetValue<JsonData>("connections");
            if (connections != null)
                Connections =
                    (from JsonData connection in connections
                     select connection.ToString())
                    .ToList();
            else
                Connections = new List<string>();

            FollowedBy = 
                relJson.GetValue<bool>("followed_by") ||
                Connections.Contains("followed_by");
            Following = 
                relJson.GetValue<bool>("following") ||
                Connections.Contains("following");
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                int status = 0;
                string msg = "未知错误";
                int wkpID = Convert.ToInt32(Request.Params["wkpID"]);
                float wlpReal = float.Parse(Request.Params["wlpReal"]);
                int wlpAdmin = Convert.ToInt32(Session["adminID"].ToString());
                string wlpTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                LNSql lnSql = new LNSql();
                lnSql.conn.Open();
                try
                {
                    lnSql.cmd.CommandText = "update wkPay_tb set wlpReal=@wlpReal , wlpAdmin=@wlpAdmin,wlpTime=@wlpTime where wkpID=" + wkpID;
                    lnSql.cmd.Parameters.AddWithValue("@wlpReal", wlpReal);
                    lnSql.cmd.Parameters.AddWithValue("@wlpAdmin", wlpAdmin);
                    lnSql.cmd.Parameters.AddWithValue("@wlpTime", wlpTime);
                    lnSql.cmd.Parameters.AddWithValue("@wkpID", wkpID);
                    lnSql.cmd.ExecuteNonQuery();
                    status = 1;
                    msg = "保存成功!";
                }
                catch (Exception ex)
                {
                    msg = ex.Message;
                }
                finally
                {
                    lnSql.conn.Close();
                    JsonData jsonData = new JsonData();
                    jsonData["status"] = status;
                    jsonData["msg"] = msg;
                    string echoString = jsonData.ToJson();

                    Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                    Response.Write(echoString);
                    Response.End();
                }

            }
            else
            {
                int wkpID = Convert.ToInt32(Request.Params["did"]);
                LNSql lnSql = new LNSql();
                lnSql.conn.Open();
                lnSql.cmd.CommandText = "select wlpReal from wkPay_tb where wkpID=" + wkpID;
                lnSql.dr = lnSql.cmd.ExecuteReader();
                if (lnSql.dr.Read())
                {
                    if (lnSql.dr["wlpReal"] != null)
                    {
                        this.wlpReal.Text = lnSql.dr["wlpReal"].ToString();
                    }
                }

                lnSql.conn.Close();
                this.wkpID.Value = wkpID.ToString();
            }
        }
Пример #6
0
        public void ProcessRequest(HttpContext context)
        {
            if (context.Session["SlipAdmin"] == null)
            {
                //保存出错

                context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                context.Response.StatusCode = 401;
                context.Response.StatusDescription = "您没有登录或登录超时,请重新登录!";
                context.Response.End();
            }
            int status = 0;
            string msg = "未知错误";
            DataModal dm = new DataModal();
            try
            {
                int ef =dm.DeleteNews(context.Request.Params["nids"]);
                status = 1;
                msg = "成功删除" + ef + "条记录";

            }
            catch (Exception ex)
            {
                status = 2;
                msg = ex.Message;
            }

            JsonData jd = new JsonData();
            jd["status"] = status;
            jd["msg"] = msg;
            context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
            context.Response.Write(jd.ToJson());
            context.Response.End();
        }
Пример #7
0
 private void OnAgentServiceConfigCallBack(NetWorkHttp.CallBackArgs args)
 {
     if (args.HasError)
     {
         ShowMessage("提示", "网络连接失败");
     }
     else
     {
         if (args.Value.code < 0)
         {
             ShowMessage("错误", args.Value.msg);
             return;
         }
         List <TransferData> lstData = new List <TransferData>();
         if (args.Value.data == null || args.Value.data.Count == 0)
         {
             return;
         }
         for (int i = 0; i < args.Value.data.Count; i++)
         {
             LitJson.JsonData jsonData    = args.Value.data[i];
             string           id          = jsonData["id"].ToString();     //ID
             string           textWX      = jsonData["wx"].ToString();     //微信号
             string           phoneNumber = jsonData["tel"].ToString();    //电话
             string           remark      = jsonData["remark"].ToString(); //地区
             string           status      = jsonData["status"].ToString(); //状态
             TransferData     data        = new TransferData();
             data.SetValue("wx", textWX);
             data.SetValue("tel", phoneNumber);
             lstData.Add(data);
         }
         m_UIAgentServiceWindow.SetUI(lstData, OnBtnInfoClick);
     }
 }
Пример #8
0
        public AspectRatio(JsonData aspectRatio)
        {
            if (aspectRatio == null) return;

            Width = (int) aspectRatio[WidthIndex];
            Height = (int) aspectRatio[HeightIndex];
        }
Пример #9
0
    private static string GetClassConstructor(string className, LitJson.JsonData masterJsonData)
    {
        string constructor = @"
        public $0($1) : base($2)
        {
$3
        }
        ";

        string args = "";

        foreach (KeyValuePair <string, LitJson.JsonData> t in masterJsonData["masterHeader"])
        {
            args += string.Format("{0} {1},", t.Value, t.Key);
        }
        args = args.TrimEnd(',');

        string properitiesSetter = "";

        foreach (KeyValuePair <string, LitJson.JsonData> t in masterJsonData["masterHeader"])
        {
            if (PRIMARY_KEY == t.Key)
            {
                continue;
            }
            properitiesSetter += string.Format(@"           this.{0} = {1};", t.Key, t.Key) + System.Environment.NewLine;
        }

        constructor = constructor.Replace("$0", className);
        constructor = constructor.Replace("$1", args);
        constructor = constructor.Replace("$2", PRIMARY_KEY);
        constructor = constructor.Replace("$3", properitiesSetter);
        return(constructor);
    }
Пример #10
0
    private static void CreateMasterElementClassScript(string masterName, LitJson.JsonData masterJsonData)
    {
        string classContent =
            @"// GENERATED BY SCRIPT! DO NOT EDIT!
using System;

namespace Master
{
    [Serializable]
    public class $0 : MasterElement<$1>
    {
        $2
        
        $3
    }
}
            ";

        classContent = classContent.Replace("$0", masterName);
        classContent = classContent.Replace("$1", GetClassPrimaryKeyType(masterJsonData));
        classContent = classContent.Replace("$2", GetClassProperties(masterJsonData));
        classContent = classContent.Replace("$3", GetClassConstructor(masterName, masterJsonData));

        string path = string.Format("{0}/{1}.cs", MASTER_GENERATED_PATH, masterName);

        System.IO.File.WriteAllText(path, classContent);
    }
Пример #11
0
        public static void createResource()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            DirectoryInfo             di = new DirectoryInfo(Global.PATH + "/res");
            var jd = new LitJson.JsonData();

            FileInfo[] fs = di.GetFiles("*", SearchOption.TopDirectoryOnly);

            foreach (FileInfo fi in fs)
            {
                if (fi.Name.Contains(".manifest"))
                {
                    continue;
                }

                string pPath = "res/" + fi.Name;
                jd[pPath.Replace("/", "@").Replace("\\", "@")] = pPath;
            }


            getJsonData(jd, "");
            JsonWriter writer = new JsonWriter(sb);

            writer.PrettyPrint = true;
            writer.IndentValue = 4;
            jd.ToJson(writer);



            string result = CoccosHelper.Properties.Resources.tpl.Replace("#1#", sb.ToString());

            File.WriteAllText(Global.PATH + "/src/resource.js", result);
        }
Пример #12
0
        /// <summary>
        /// Parses the mod's information from Json, loading any required references, and returns its <see cref="ModInfo"/> object.
        /// </summary>
        /// <param name="j">Json Data to load the <see cref="ModInfo"/> from</param>
        /// <param name="path">The path to the mod</param>
        /// <returns>The <see cref="ModInfo"/> of the mod</returns>
        public static ModInfo ParseModInfo(JsonData j, string path)
        {
            var refs = new List<IReference>();

            if (j.Has("dllReferences"))
                foreach (object s in j["dllReferences"])
                    refs.Add(new AssemblyReference(s.ToString(), path));
            if (j.Has("modReferences"))
                foreach (object s in j["modReferences"])
                    refs.Add(new ModReference(s.ToString()));

            string internalName = j.GetOrExn<string>("internalName");

            return new ModInfo(
                path,
                internalName,
                j.GetOrDef("displayName", internalName),
                j.GetOrDef("author", "<unspecified>"),
                j.GetOrDef("version", "0.0.0.0"),
                j.GetOrDef<string>("description"),
                j.GetOrExn<string>("asmFileName"),
                j.GetOrExn<string>("modDefTypeName"),
                refs.ToArray()
            );
        }
Пример #13
0
 private void button1_Click(object sender, EventArgs e)
 {
     JsonData pjd = new JsonData();
     pjd["OPCODE"] = (Int32)GameOpcode.CreateSprite;
     pjd["UUID"] = game.SelfUUID;
     Program.SendDataSingle(pjd.ToJson(), game.SelfUUID);
 }
Пример #14
0
 public Stall(JsonData stall)
 {
     var warning = stall.GetValue<JsonData>("user_withheld");
     Code = warning.GetValue<string>("code");
     Message = warning.GetValue<string>("message");
     PercentFull = warning.GetValue<int>("percent_full");
 }
Пример #15
0
    public string GetDialogStringOrigin(string dialog)
    {
        LitJson.JsonData getData = LitJson.JsonMapper.ToObject(dialog);
        string           rst     = getData["dialogAction"]["message"]["data"]["message"].ToString();

        return(rst);
    }
Пример #16
0
    IEnumerator WaitToCheckRoleName()
    {
        while (curHttpResult == HttpResult.ConnectContinue)
        {
            yield return(new WaitForEndOfFrame());
        }

        if (curHttpResult == HttpResult.ConnectException)
        {
            GameApp.Instance.CommonMsgDlg.OpenSimpleMsgBox(StringBuilderTool.ToInfoString("连接异常!\nWaitToCheckRoleName\n", ConnectExceptionInfo));
            Clear();
            yield break;
        }
        else
        {
            LitJson.JsonData jsonRes = LitJson.JsonMapper.ToObject(platformRetStrInfo);
            if (jsonRes["status"].ToString() == "0")
            {
                //GameApp.Instance.CommonHintDlg.OpenHintBox("角色名可用!");
            }
            else
            {
                //GameApp.Instance.CommonMsgDlg.OpenSimpleMsgBox("角色名不可用!");
            }
        }

        Clear();
    }
Пример #17
0
    /*
     * {
     *          "x":
     *          "y":
     *          "z":
     *          "direction"
     * }
     */
    public void updatePlatform(string ret)
    {
        LitJson.JsonData x = LitJson.JsonMapper.ToObject(ret);
        //print("updatePlatform ret: " + ret);
        if (x["return"].ToString() != "success")
        {
            print("updatePlatform failed");
        }
        if (x["data"] != null)
        {
            lock (platformLock) {
                for (int i = platformQueue.Count; i < x["data"].Count; i++)
                {
                    platformQueue.Insert(platformQueue.Count, x["data"][i].ToString());
                }
            }
        }

        if (gameStatus == GameStatus.GAME_OVER || gameStatus == GameStatus.PLAY_AGAIN ||
            gameStatus == GameStatus.GAME_WIN)
        {
            return;
        }

        System.Action <string> callback = updatePlatform;
        StartCoroutine(HttpHelper.HttpHelper.updatePlatformStatus(yourName.roomId,
                                                                  syncPlatIndex,
                                                                  playerList[yourName.playerId].currentPlatformIndex,
                                                                  callback));
    }
Пример #18
0
    //------------------------------------------------------------------------------------------------------------------------------//
    List <VenueData> CreateVenues(LitJson.JsonData json)
    {
        List <VenueData> venues = new List <VenueData> ();
        var venuesJ             = json["response"]["groups"][0]["items"];

        for (int i = 0; i < venuesJ.Count; i++)
        {
            var venueJ = venuesJ[i]["venue"];

            VenueData data = new VenueData();
            data.id    = (string)venueJ["id"];
            data.title = (string)venueJ["name"];

            try{
                data.photo_prefix = (string)venueJ["featuredPhotos"]["items"][0]["prefix"];
                data.photo_suffix = (string)venueJ["featuredPhotos"]["items"][0]["suffix"];
            }catch (System.Exception e) {
                Debug.Log(e);
            }

            venues.Add(data);
        }

        return(venues);
    }
Пример #19
0
    /**
     * 反射序列化
     *
     *
     * public static T PopulateEntityFromCollection<T>(T entity,object obj) where T:new(){
     *      Type oType = Type.GetType(entity);
     *      LitJson.JsonData json = (LitJson.JsonData)obj;
     *
     *      //var mMainFieldRule = new FieldRuleInfo[dtGet.Rows.Count];
     *      foreach(string key in json){
     *
     *                      //这里直接获取类的字段名称,然后把数据库里对应字段的值赋值给它
     *                      FieldInfo fieldInfo = oType.GetField(key,
     *                                                            BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance| BindingFlags.Static);
     *
     *                      if(fieldInfo != null){
     *                              //fieldInfo.SetValue(entity, json[key].ToString());
     *                      }
     *      }
     *
     *      return entity;
     * }
     * */



    /**
     * 反射序列化
     *
     * */
    public static T PopulateEntityFromCollection <T>(T entity, object obj) where T : new()
    {
        if (entity == null)
        {
            entity = new T();
        }
        Type type = typeof(T);

        PropertyInfo[] propertys1 = type.GetProperties();

        LitJson.JsonData json = (LitJson.JsonData)obj;
        foreach (PropertyInfo pi in propertys1)
        {
            //for(int i= 0;i<pi.Length;i++){
            //PropertyInfo item = pi[i];
            object value = null;
            if (((IDictionary)json).Contains(pi.Name))
            {
                value = json[pi.Name];
            }


            if (value != null)
            {
                Type   valueType = pi.PropertyType;
                object tt        = Util.ChangeType(value, valueType);        //object tt = Convert.ChangeType(value,item.PropertyType);//单纯这句不行

                //item.SetValue(entity,Convert.ChangeType(item.ToString(), valueType),null);
                pi.SetValue(entity, Convert.ChangeType(tt.ToString(), valueType), null);
                //item.SetValue(item,tt,null);
            }
        }

        return(entity);
    }
Пример #20
0
 private void GetInformation()
 {
     try
     {
         Hashtable ht = new Hashtable();
         ht.Add("serverName", serverName);
         ht.Add("method", "GetUnitVisitLocationByDeptId");
         //string[] strarr = (TokenKey("") + "," + DeptId).Split(',');
         ht.Add("params", (TokenKey() + "," + DeptId));
         string Jsonresult = RZMRequest.Get.QueryGetWebServiceTostring(InterfaceIp, RequestAction, ht);
         LogHelper.WriteLog(Jsonresult);
         Console.WriteLine(Jsonresult);
         List <string>    hst     = new List <string>();
         LitJson.JsonData json    = LitJson.JsonMapper.ToObject(Jsonresult);
         string           saveStr = "{\"position\":[";
         foreach (JsonData item in json["back"])
         {
             saveStr += "{\"positionId\":\"" + item["positionId"] + "\",\"positionName\":\"" + item["positionName"] + "\"},";
         }
         saveStr = saveStr.Remove(saveStr.LastIndexOf(',')) + "],\"updatetime\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"}";
         RedisCacheHelper.Add("GetUnitVisitLocationByDeptId", saveStr, DateTime.Now);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex, "Action:GetUnitVisitLocationByDeptId");
         Console.WriteLine("Action:GetUnitVisitLocationByDeptId    " + ex.Message);
     }
 }
Пример #21
0
 public JsonData ToJsonData()
 {
     JsonData jsonData = new JsonData();
     jsonData["queryRankType"] = this.queryRankType;
     jsonData["QUERY_RANK_TYPE_SCORE"] = this.queryRankScope;
     return jsonData;
 }
Пример #22
0
    bool serverListUpdate = false;//是否成功更新了服务器,如果更新了,选择的服务器为第一个服务器,否则不设定服务器
    IEnumerator UpdateServiceList()
    {
        UnityWebRequest vFile = new UnityWebRequest();

        vFile.url     = string.Format(Main.strFile, Main.strHost, Main.port, Main.strProjectUrl, Main.strServices);
        vFile.timeout = 2;
        DownloadHandlerBuffer dH = new DownloadHandlerBuffer();

        vFile.downloadHandler = dH;
        yield return(vFile.Send());

        if (vFile.isNetworkError || vFile.responseCode != 200 || string.IsNullOrEmpty(dH.text))
        {
            Debug.LogError(string.Format("update version file error:{0} or responseCode:{1}", vFile.error, vFile.responseCode));
            vFile.Dispose();
            Update = null;
            CombatData.Ins.Servers.Clear();
            for (int i = 0; i < GameStateMgr.Ins.gameStatus.ServerList.Count; i++)
            {
                CombatData.Ins.Servers.Add(GameStateMgr.Ins.gameStatus.ServerList[i]);
            }
            serverListUpdate = false;
            OnGetServerListDone();
            yield break;
        }
        serverListUpdate = true;
        CombatData.Ins.Servers.Clear();
        LitJson.JsonData js = LitJson.JsonMapper.ToObject(dH.text);
        for (int i = 0; i < js["services"].Count; i++)
        {
            ServerInfo s = new ServerInfo();
            if (!int.TryParse(js["services"][i]["port"].ToString(), out s.ServerPort))
            {
                continue;
            }
            if (!int.TryParse(js["services"][i]["type"].ToString(), out s.type))
            {
                continue;
            }
            if (s.type == 0)
            {
                s.ServerHost = js["services"][i]["addr"].ToString();
            }
            else
            {
                s.ServerIP = js["services"][i]["addr"].ToString();
            }
            s.ServerName = js["services"][i]["name"].ToString();
            CombatData.Ins.Servers.Add(s);
        }
        Update = null;

        //合并所有服务器到全局变量里
        for (int i = 0; i < GameStateMgr.Ins.gameStatus.ServerList.Count; i++)
        {
            CombatData.Ins.Servers.Add(GameStateMgr.Ins.gameStatus.ServerList[i]);
        }

        OnGetServerListDone();
    }
Пример #23
0
    static int ToJson(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, typeof(LitJson.JsonData)))
            {
                LitJson.JsonData obj = (LitJson.JsonData)ToLua.ToObject(L, 1);
                string           o   = obj.ToJson();
                LuaDLL.lua_pushstring(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, typeof(LitJson.JsonData), typeof(LitJson.JsonWriter)))
            {
                LitJson.JsonData   obj  = (LitJson.JsonData)ToLua.ToObject(L, 1);
                LitJson.JsonWriter arg0 = (LitJson.JsonWriter)ToLua.ToObject(L, 2);
                obj.ToJson(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: LitJson.JsonData.ToJson"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #24
0
        public static void test()
        {
            string s = "{'name': 'david'}";

            LitJson.JsonData x = LitJson.JsonMapper.ToObject(s);
            Debug.Log(x["name"]);
        }
Пример #25
0
    static int Equals(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, typeof(LitJson.JsonData), typeof(LitJson.JsonData)))
            {
                LitJson.JsonData obj  = (LitJson.JsonData)ToLua.ToObject(L, 1);
                LitJson.JsonData arg0 = (LitJson.JsonData)ToLua.ToObject(L, 2);
                bool             o    = obj != null?obj.Equals(arg0) : arg0 == null;

                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, typeof(LitJson.JsonData), typeof(object)))
            {
                LitJson.JsonData obj  = (LitJson.JsonData)ToLua.ToObject(L, 1);
                object           arg0 = ToLua.ToVarObject(L, 2);
                bool             o    = obj != null?obj.Equals(arg0) : arg0 == null;

                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: LitJson.JsonData.Equals"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #26
0
    //JSON Array의 값이 JSON Object 일때 키와 값이 맞는 JSON Object를 리턴
    static public LitJson.JsonData GetJsonArrayForKey(LitJson.JsonData jsonData, string key, object value)
    {
        if (jsonData.IsArray == false)
        {
            return(null);
        }

        for (int jsonCnt = 0; jsonCnt < jsonData.Count; jsonCnt++)
        {
            if (jsonData[jsonCnt].Keys.Contains(key))
            {
                if (value.GetType() == typeof(int))
                {
                    if ((int)jsonData[jsonCnt][key] == (int)value)
                    {
                        return(jsonData[jsonCnt]);
                    }
                }
                else
                {
                    if (jsonData[jsonCnt][key].ToString() == (string)value)
                    {
                        return(jsonData[jsonCnt]);
                    }
                }
            }
        }
        return(null);
    }
Пример #27
0
 public Delete(JsonData delete)
 {
     var del = delete.GetValue<JsonData>("delete");
     var status = del.GetValue<JsonData>("status");
     StatusID = status.GetValue<ulong>("id");
     UserID = status.GetValue<ulong>("user_id");
 }
Пример #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ( Session["SlipAdmin"] == null)
            {
                //保存出错

                Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                Response.StatusCode = 402;
                Response.StatusDescription = "您没有登录或登录超时,请重新登录!";
                Response.End();
            }
            if (IsPostBack)
            {
                JsonData jd = new JsonData();

                int status = 0;
                string msg = "未知状态";
                Support spt = new Support();
                DataModal dm = new DataModal();
                try
                {
                    spt.supportID = Convert.ToInt32(Request.Form["supportID"]);
                    spt.supportTitle = Request.Form["supportTitle"];
                    spt.supportContent = Request.Form["supportContent"];
                    dm.SaveSupport(spt);
                    status = 1;
                    msg = "保存成功!";
                }
                catch (Exception ex)
                {
                    msg = "错误:" + ex.Message;
                }

                jd["stauts"] = status;
                jd["msg"] = msg;
                Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                Response.Write(jd.ToJson());
                Response.End();
            }
            else
            {
                int id = 1;
                if (Request.Params["id"] == null || Request.Params["id"] == "")
                {
                    id = 1;
                }
                else
                {
                    id = Convert.ToInt32(Request.Params["id"]);
                }

                Support spt = new Support();
                DataModal dm = new DataModal();
                spt = dm.GetSupport(id);
                this.supportContent.Text = spt.supportContent;
               this.supportID.Value = spt.supportID.ToString();
               this.supportTitle.Text = spt.supportTitle;
               this.supportTitle.ReadOnly = true;
            }
        }
Пример #29
0
 public string Marshal()
 {
     JsonData data = new JsonData();
     data["S"] = Pattern;
     data["E"] = Deadline;
     return data.ToJson();
 }
Пример #30
0
    public LitJson.JsonData jsonData(string path)
    {
        string Jsonstring = File.ReadAllText(path);

        LitJson.JsonData _data = JsonMapper.ToObject(Jsonstring);
        return(_data);
    }
Пример #31
0
    protected void onDataUploadResult(LitJson.JsonData data, object userData)
    {
        if (data == null || data.ToJson() == "")
        {
            return;
        }
        string guid   = userData as string;
        string result = data["result"].ToString();

        if (result == "fail")
        {
            mSqlLiteLock.waitForUnlock();
            mSQLite.updateData(mTableName, new string[] { "uploaded" }, new object[] { 0 }, new string[] { "guid = '" + guid + "'" });
            mSqlLiteLock.unlock();
            // 上传失败,设置为未上传状态
            mSendLock.waitForUnlock();
            mLogSendList[guid].mState = LOG_STATE.LS_UNUPLOAD;
            mSendLock.unlock();
        }
        else if (result == "success")
        {
            mSqlLiteLock.waitForUnlock();
            mSQLite.updateData(mTableName, new string[] { "uploaded" }, new object[] { 1 }, new string[] { "guid = '" + guid + "'" });
            mSqlLiteLock.unlock();
            // 上传成功,移除该条信息
            mSendLock.waitForUnlock();
            mLogSendList.Remove(guid);
            mSendLock.unlock();
        }
    }
Пример #32
0
        public Friendship(JsonData friendJson)
        {
            if (friendJson == null) return;

            TargetRelationship = new Relationship(friendJson.GetValue<JsonData>("target"));
            SourceRelationship = new Relationship(friendJson.GetValue<JsonData>("source"));
        }
Пример #33
0
 /// <summary>
 /// 获取token和openid
 /// </summary>
 /// <param name="code"></param>
 public void GetOpenidAndAccessTokenFromCode(string code)
 {
     try
     {
         //构造获取openid及access_token的url
         WxPayAPI.WxPayData data = new WxPayAPI.WxPayData();
         data.SetValue("appid", appid);
         data.SetValue("secret", secret);
         data.SetValue("code", code);
         data.SetValue("grant_type", "authorization_code");
         string url = "https://api.weixin.qq.com/sns/oauth2/access_token?" + data.ToUrl();
         //请求url以获取数据
         string result = WxPayAPI.HttpService.Get(url);
         //Log.Debug(this.GetType().ToString(), "GetOpenidAndAccessTokenFromCode response : " + result);
         //保存access_token,用于收货地址获取
         LitJson.JsonData jd = JsonMapper.ToObject(result);
         token = (string)jd["access_token"];
         //获取用户openid
         openid = (string)jd["openid"];
     }
     catch (Exception ex)
     {
         WxPayAPI.Log.Error(this.GetType().ToString(), ex.ToString());
         //throw new WxPayAPI.WxPayException(ex.ToString());
     }
 }
Пример #34
0
 public void Deserialize(string json)
 {
     data = JsonMapper.ToObject(json);
     IShip ww = JsonMapper.ToObject<VikingShip>(data.ToJson());
    
 
 }
Пример #35
0
    public static List <string[]> ConvertJsonToStringList(string objectName, string json)
    {
        List <string[]> list = new List <string[]>();

        if (json == null)
        {
            return(list);
        }

        if (json.StartsWith("\""))
        {
            json = json.Remove(0, 1);
            json = json.Remove(json.Length - 1, 1);
        }

        json = json.Replace("\"\"", "\"");

        LitJson.JsonData jsondata = LitJson.JsonMapper.ToObject(json);
        LitJson.JsonData item     = jsondata[objectName];

        for (int i = 0; i < item.Count; i++)
        {
            string[] arrstr = new string[item[i].Count];

            for (int j = 0; j < item[i].Count; j++)
            {
                arrstr[j] = item[i][j].ToString();
            }

            list.Add(arrstr);
        }

        return(list);
    }
Пример #36
0
    public void LoadGrid(LitJson.JsonData json)
    {
        if (json != null)
        {
            if (json["newVersion"] != null)
            {
                newVersion = json["newVersion"]["v"].ToString();
                apkUrl     = json["newVersion"]["url"].ToString();
            }

            if (json["moreGame"] != null)
            {
                for (int i = 0; i < json["moreGame"].Count; i++)
                {
                    AdGame g = new AdGame();
                    g.Name    = json["moreGame"][i]["Name"].ToString();
                    g.Url     = json["moreGame"][i]["Url"].ToString();
                    g.Preview = json["moreGame"][i]["Preview"].ToString();
                    g.Desc    = json["moreGame"][i]["Desc"].ToString();
                    g.Query   = json["moreGame"][i]["Query"].ToString();
                    moreGame.Add(g);
                }
            }

            if (json["Notice"] != null)
            {
                notice = json["Notice"].ToString();
            }
        }
    }
Пример #37
0
        /// <summary>
        /// 发送模板消息
        /// </summary>
        /// <param name="UserOpenid"></param>
        /// <param name="MsgTemplate"></param>
        /// <param name="Data"></param>
        /// <param name="ReturnUrl"></param>
        public static void SendMsg(string UserOpenid, string MsgTemplate, object Data, string ReturnUrl = "")
        {
            try
            {
                string url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="
                             + WxPayConfig.APPID + "&secret=" + WxPayConfig.APPSECRET;
                //请求url以获取数据
                string resultStr = HttpService.Get(url);

                //保存access_token,用于收货地址获取
                LitJson.JsonData jd = LitJson.JsonMapper.ToObject(resultStr);
                if (((System.Collections.IDictionary)jd).Contains("access_token"))
                {
                    //判断是否有key
                    var      access_token = (string)jd["access_token"];
                    MsgModel msgData      = new MsgModel()
                    {
                        template_id = MsgTemplate,
                        touser      = UserOpenid,
                        url         = ReturnUrl,
                        data        = Data
                    };
                    // 发送模板消息
                    SendMsgPoth(JsonHelper.SerializeObject(msgData), access_token);
                }
                else
                {
                    MYLog.Debug("发送消息通知:" + SessionTools.UserName, "获取AccessToken结果:" + resultStr);
                }
            }
            catch (Exception ex)
            {
                MYLog.Error("发送消息通知:" + SessionTools.UserName, ex.ToString());
            }
        }
Пример #38
0
        private void ConvertExcel(string fullPath,string fileName)
        {
            FileStream fs = File.Open(fullPath,FileMode.Open,FileAccess.Read);
            IExcelDataReader dataReader =   ExcelReaderFactory.CreateOpenXmlReader(fs);
            DataSet ds = dataReader.AsDataSet();
            int row = ds.Tables[0].Rows.Count;
            JsonData jd_root = new JsonData();
            jd_root["name"] = fileName.Substring(0,fileName.Length - 5);
            for(int i = 2;i<row;i++)
            {
                JsonData sub_jd = new JsonData();
                var obj = ds.Tables[0].Rows[i];
                object[] arr_objs = obj.ItemArray;
                for(int j = 0;j<arr_objs.Length;j++)
                {
                    object value = arr_objs[j];
                    string key = ds.Tables[0].Rows[0][j].ToString();
                    string type = ds.Tables[0].Rows[1][j].ToString();

                    if(type == "int")
                    {
                        sub_jd[key] = Convert.ToInt32(value);
                    }else if(type == "string")
                    {
                        sub_jd[key] = Convert.ToString(value);
                    }
                }
                jd_root[ds.Tables[0].Rows[i][0].ToString()] = sub_jd;
            }

            WriteToJson(fileName, JsonMapper.ToJson(jd_root));
        }
Пример #39
0
        public static void createResource()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            DirectoryInfo di = new DirectoryInfo(Global.PATH + "/res");
            var jd = new LitJson.JsonData();
            FileInfo[] fs = di.GetFiles("*", SearchOption.TopDirectoryOnly);

            foreach (FileInfo fi in fs)
            {
                if (fi.Name.Contains(".manifest"))
                {
                    continue;
                }

                string pPath = "res/" + fi.Name;
                jd[pPath.Replace("/", "@").Replace("\\", "@")] = pPath;
            }


            getJsonData(jd,"");
            JsonWriter writer = new JsonWriter(sb);
            writer.PrettyPrint = true;
            writer.IndentValue = 4;
            jd.ToJson(writer);
             
            

 
            string result = CoccosHelper.Properties.Resources.tpl.Replace("#1#", sb.ToString());
            File.WriteAllText(Global.PATH + "/src/resource.js", result);

        }
Пример #40
0
        public RelatedResults(JsonData resultsJson)
        {
            if (resultsJson == null) return;

            ResultAnnotations = new Annotation(resultsJson.GetValue<JsonData>("annotations"));
            Score = resultsJson.GetValue<double>("score");
            Kind = resultsJson.GetValue<string>("kind");
            JsonData value = resultsJson.GetValue<JsonData>("value");
            ValueAnnotations = new Annotation(value.GetValue<JsonData>("annotations"));
            Retweeted = value.GetValue<bool>("retweeted");
            InReplyToScreenName = value.GetValue<string>("in_reply_to_screen_name");
            var contributors = value.GetValue<JsonData>("contributors");
            Contributors =
                contributors == null ?
                    new List<Contributor>() :
                    (from JsonData contributor in contributors
                     select new Contributor(contributor))
                    .ToList();
            Coordinates = new Coordinate(value.GetValue<JsonData>("coordinates"));
            Place = new Place(value.GetValue<JsonData>("place"));
            User = new User(value.GetValue<JsonData>("user"));
            RetweetCount = value.GetValue<int>("retweet_count");
            IDString = value.GetValue<string>("id_str");
            InReplyToUserID = value.GetValue<ulong>("in_reply_to_user_id");
            Favorited = value.GetValue<bool>("favorited");
            InReplyToStatusIDString = value.GetValue<string>("in_reply_to_status_id_str");
            InReplyToStatusID = value.GetValue<ulong>("in_reply_to_status_id");
            Source = value.GetValue<string>("source");
            CreatedAt = value.GetValue<string>("created_at").GetDate(DateTime.MaxValue);
            InReplyToUserIDString = value.GetValue<string>("in_reply_to_user_id_str");
            Truncated = value.GetValue<bool>("truncated");
            Geo = new Geo(value.GetValue<JsonData>("geo"));
            Text = value.GetValue<string>("text");
        }
Пример #41
0
 public Disconnect(JsonData json)
 {
     var disconnect = json.GetValue<JsonData>("disconnect");
     Code = disconnect.GetValue<int>("code");
     StreamName = disconnect.GetValue<string>("stream_name");
     Reason = disconnect.GetValue<string>("reason");
 }
    public static void GenerateDitherRGB565(string texPath)
    {
        Texture2D srcTex = new Texture2D(2, 2, TextureFormat.RGBA32, false);

        srcTex.LoadImage(File.ReadAllBytes(texPath));
        Texture2D RGB565Tex;

        FontInfo.bHasFont = false;
        if (texPath.Contains("_UIAtlas"))
        {
            string           txtPath = texPath.Replace(".png", ".txt");
            LitJson.JsonData jd      = LitJson.JsonMapper.ToObject(File.ReadAllText(txtPath));
            jd = jd["frames"]["FTFont.png"]["frame"];
            FontInfo.bHasFont = true;
            FontInfo.x        = System.Convert.ToInt32(jd["x"].ToString());
            FontInfo.y        = System.Convert.ToInt32(jd["y"].ToString());
            FontInfo.w        = System.Convert.ToInt32(jd["w"].ToString());
            FontInfo.h        = System.Convert.ToInt32(jd["h"].ToString());
        }
        RGB565Tex = CompressRGB565(srcTex);

        //WriteAndImportAlphaTexture(packed565Tex, texPath, TextureImporterFormat.RGBA16);
        string path = GenTextureName(texPath, "");

        WriteTextureToFile(RGB565Tex, path);
        ImportTexture(path, TextureImporterFormat.RGB16);
    }
Пример #43
0
    /// <summary>
    /// 初始化
    /// </summary>
    void Init()
    {
        string jsonPath = Application.persistentDataPath + "/" + Const.ConfigFile;

        if (!System.IO.File.Exists(jsonPath))
        {
            Debug.LogError("Can't get Config.json file.");
            return;
        }

        string content = System.IO.File.ReadAllText(jsonPath);

        LitJson.JsonReader reader = new LitJson.JsonReader(content);
        m_config = LitJson.JsonMapper.ToObject(reader);

        if (m_config == null)
        {
            Debug.LogError("Config Json Data structure error.");
        }
        else
        {
            try
            {
                Const.UpdateMode = (bool)m_config["update_mode"];
            }
            catch (Exception err)
            {
                Debug.LogError(err.Message);
            }
        }
    }
Пример #44
0
    public void S2C_OnGetSDKBindInfo(Pt _info)
    {
        pt_login_data_a002 msg = _info as pt_login_data_a002;

        if (msg != null)
        {
//			Debug.Log("S2C_OnGetSDKBindInfo:"+msg.data);
            LynSdkManager.Instance.LynUserInfoBind(msg.data);
            if (msg.data.Contains("data"))
            {
                LitJson.JsonData jsonData = LitJson.JsonMapper.ToObject(msg.data);
                string           data     = (string)jsonData["data"]["data"];
                string[]         arr      = data.Split('|');
                if (arr.Length > 0)
                {
                    platformID = arr[arr.Length - 1];
                    Debug.Log(platformID);
                }
            }
            else
            {
                Debug.LogError("数据结构错误:" + msg.data);
            }
        }
    }
Пример #45
0
    LitJson.JsonData UnSerialize(string jsonString)
    {
        int i;

        LitJson.JsonData data = LitJson.JsonMapper.ToObject(jsonString);

        mask = Resources.Load(data["mask"].ToString()) as Texture2D;
        for (i = 0; i <= 2; i++)
        {
            teamTextures[i] = Resources.Load(data["textures"][i].ToString()) as Texture2D;
        }

        colorIndexes = new int[3];
        for (i = 0; i <= 1; i++)
        {
            int colorNum = (int)(data["colors"][i]);
            colorIndexes[i] = colorNum;
            teamColors[i]   = Globals.colorChoices[colorNum];
        }

        int glowNum = (int)(data["colors"][2]);

        teamColors[2] = Globals.glowChoices[glowNum];

        return(data);
    }
Пример #46
0
    private static void CreateMasterElementCollectionClassScript(string masterName, LitJson.JsonData masterJsonData)
    {
        string classContent =
            @"// GENERATED BY SCRIPT! DO NOT EDIT!
using System;

namespace Master
{
    [Serializable]
    public partial class $0Collection : MasterElementCollection<$1, $2>
    {
        $3
    }
}
            ";

        classContent = classContent.Replace("$0", masterName);
        classContent = classContent.Replace("$1", GetClassPrimaryKeyType(masterJsonData));
        classContent = classContent.Replace("$2", masterName);
        classContent = classContent.Replace("$3", GetLoadFromJsonFunction(masterName, masterJsonData));

        string path = string.Format("{0}/{1}Collection.cs", MASTER_GENERATED_PATH, masterName);

        System.IO.File.WriteAllText(path, classContent);
    }
Пример #47
0
    //接收识别到的结果
    void Result(string message)
    {
        Debug.Log(message);

        LitJson.JsonData _data   = LitJson.JsonMapper.ToObject(message);
        LitJson.JsonData _person = _data ["facemodels"];

        Debug.Log("识别到的人数" + _person.Count);

        for (int i = 0; i < _person.Count; i++)
        {
            people.facerectanglex     = (int)_person[i]["facerectanglex"];
            people.facerectangley     = (int)_person[i]["facerectangley"];
            people.facerectanglewidth = (int)_person[i]["facerectanglewidth"];
            people.facerectangleheigh = (int)_person[i]["facerectangleheight"];
            people.lefteyex           = (int)_person[i]["lefteye"]["x"];
            people.lefteyey           = (int)_person[i]["lefteye"]["y"];
            people.righteyex          = (int)_person[i]["righteye"]["x"];
            people.righteyey          = (int)_person[i]["righteye"]["y"];
            people.mouthx             = (int)_person[i]["mouth"]["x"];
            people.mouthy             = (int)_person[i]["mouth"]["y"];

            _message = "识别第" + i + "个人,"
                       + "他的脸框坐标x,y是" + (int)_person[i]["facerectanglex"] + "和" + (int)_person[i]["facerectangley"]
                       + "他的脸框坐标宽,高是" + (int)_person[i]["facerectanglewidth"] + "和" + (int)_person[i]["facerectangleheight"]
                       + "他的左眼坐标x,y是" + (int)_person[i]["lefteye"]["x"] + "和" + (int)_person[i]["lefteye"]["y"]
                       + "他的右眼坐标x,y是" + (int)_person[i]["righteye"]["x"] + "和" + (int)_person[i]["righteye"]["y"]
                       + "他的嘴巴坐标x,y是" + (int)_person[i]["mouth"]["x"] + "和" + (int)_person[i]["mouth"]["y"]
            ;

            Debug.Log("信息:" + _message);
        }
    }
Пример #48
0
        public static EvYield Parse(JsonData j, string key = "ev_yield")
        {
            JsonData v = j[key];

            if (v.GetJsonType() == JsonType.String)
            {
                string val = (string)v;

                string[] split = val.Split(' ');
                int amt;

                if (split.Length > 1)
                {
                    string cat = split[1];

                    for (int i = 2; i < split.Length; i++)
                        cat += " " + split[i];

                    if (Int32.TryParse(split[0], out amt))
                        return new EvYield(amt, cat);
                    else
                        return new EvYield(0, cat);
                }
                else if (split.Length > 0 && Int32.TryParse(split[0], out amt))
                    return new EvYield(amt, String.Empty);
                else
                    return new EvYield(  0, String.Empty);
            }

            return new EvYield((int)v, String.Empty);
        }
Пример #49
0
    public TerritorySkillData(LitJson.JsonData json)
    {
        //string text = string.Empty;
        id = json["id"].ToStringJ();

        name = json["name"].ToStringJ();

        string _deployState = json["deployState"].ToStringJ();

        deployState = (TerritoryHeroDeployState)(System.Enum.Parse(typeof(TerritoryHeroDeployState), _deployState));

        applyType = json["applyType"].ToStringJ();

        fillterCategory = json["fillterCategory"].ToStringJ();

        fillterItem = json["fillterItem"].ToStringJ();

        stat = json["stat"].ToStringJ();

        statModifyType = json["statModifyType"].ToStringJ();

        formula = json["formula"].ToStringJ();

        description = json["description"].ToStringJ();
    }
Пример #50
0
    static public bool JsonDataContainsKey(LitJson.JsonData data, string key)
    {
        bool result = false;

        if (data == null)
        {
            return(result);
        }

        if (!data.IsObject)
        {
            return(result);
        }

        IDictionary tdictionary = data as IDictionary;

        if (tdictionary == null)
        {
            return(result);
        }

        if (tdictionary.Contains(key))
        {
            result = true;
        }
        return(result);
    }
Пример #51
0
    static int set_Item(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3 && TypeChecker.CheckTypes(L, typeof(LitJson.JsonData), typeof(int), typeof(LitJson.JsonData)))
            {
                LitJson.JsonData obj  = (LitJson.JsonData)ToLua.ToObject(L, 1);
                int arg0              = (int)LuaDLL.lua_tonumber(L, 2);
                LitJson.JsonData arg1 = (LitJson.JsonData)ToLua.ToObject(L, 3);
                obj[arg0] = arg1;
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, typeof(LitJson.JsonData), typeof(string), typeof(LitJson.JsonData)))
            {
                LitJson.JsonData obj  = (LitJson.JsonData)ToLua.ToObject(L, 1);
                string           arg0 = ToLua.ToString(L, 2);
                LitJson.JsonData arg1 = (LitJson.JsonData)ToLua.ToObject(L, 3);
                obj[arg0] = arg1;
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: LitJson.JsonData.set_Item"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #52
0
 public static OSD DeserializeJson(JsonData json)
 {
     switch (json.GetJsonType())
     {
         case JsonType.Boolean:
             return OSD.FromBoolean((bool)json);
         case JsonType.Int:
             return OSD.FromInteger((int)json);
         case JsonType.Long:
             return OSD.FromLong((long)json);
         case JsonType.Double:
             return OSD.FromReal((double)json);
         case JsonType.String:
             string str = (string)json;
             if (String.IsNullOrEmpty(str))
                 return new OSD();
             else
                 return OSD.FromString(str);
         case JsonType.Array:
             OSDArray array = new OSDArray(json.Count);
             for (int i = 0; i < json.Count; i++)
                 array.Add(DeserializeJson(json[i]));
             return array;
         case JsonType.Object:
             OSDMap map = new OSDMap(json.Count);
             IDictionaryEnumerator e = ((IOrderedDictionary)json).GetEnumerator();
             while (e.MoveNext())
                 map.Add((string)e.Key, DeserializeJson((JsonData)e.Value));
             return map;
         case JsonType.None:
         default:
             return new OSD();
     }
 }
Пример #53
0
        public override string GenerateSkillAppendData()
        {
            JsonData data = new JsonData();
            data["damage"] = GetCalculatedDamage();
            data["energy"] = this.skillEnergyCost;

            return data.ToJson();
        }
Пример #54
0
        static JsonData AddColour(JsonData data, Color c)
        {
            data.Add((int)c.R);
            data.Add((int)c.G);
            data.Add((int)c.B);

            return data;
        }
Пример #55
0
 internal Coordinate(JsonData coord)
 {
     if (coord == null) return;
     var jsonLatitude = coord[LatitudePos];
     Latitude = jsonLatitude.IsDouble ? (double)jsonLatitude : (int)jsonLatitude;
     var jsonLongitude = coord[LongitudePos];
     Longitude = jsonLongitude.IsDouble ? (double)jsonLongitude : (int)jsonLongitude;
 }
Пример #56
0
 public FriendsList(JsonData friends)
 {
     Friends =
         friends == null ? new List<ulong>() :
         (from JsonData friend in friends.GetValue<JsonData>("friends")
          select (ulong)friend)
         .ToList();
 }
Пример #57
0
 public SavedSearch(JsonData searchJson)
 {
     Query = searchJson.GetValue<string>("query");
     Name = searchJson.GetValue<string>("name");
     Postition = searchJson.GetValue<int>("position");
     IDString = searchJson.GetValue<string>("id_str");
     CreatedAt = searchJson.GetValue<string>("created_at").GetDate(DateTime.MaxValue);
 }
Пример #58
0
 private JsonType GetJsonType(JsonData data)
 {
     if (data == null)
     {
         return JsonType.Object;
     }
     return data.GetJsonType();
 }
Пример #59
0
        public override string GenerateSkillAppendData()
        {
            JsonData json = new JsonData();
            json["lastRound"] = this.lastRound;
            json["allLastRound"] = this.allLastRound;

            return json.ToJson();
        }
Пример #60
0
        protected PlayerCard EquipedCard; //装备了该装备的英雄

        #endregion Fields

        #region Methods

        public string GenerateEquipAppend()
        {
            JsonData json = new JsonData();

            //----这里实现装备附加值的添加

            return json.ToJson();
        }