Esempio n. 1
0
    void GetSaveAreaInfo()
    {
        //本地是否有上次登录的记录aaa
        string strServerID = sdConfDataMgr.Instance().GetSetting("serverID");
        string strIP       = sdConfDataMgr.Instance().GetSetting("IP");
        string strPort     = sdConfDataMgr.Instance().GetSetting("Port");
        string strName     = sdConfDataMgr.Instance().GetSetting("serverName");

        //没有上次登录的记录,推荐一个最新的区aaa
        if (strServerID.Length == 0 || strIP.Length == 0 || strPort.Length == 0 || strName.Length == 0)
        {
            List <JsonNode> lst = SDNetGlobal.m_lstSrvInfo;
            JsonNode        js  = null;
            foreach (JsonNode n in lst)
            {
                string id = n.Attribute("ServerID");
                if (id == SDNetGlobal.defaultServerID)
                {
                    js = n;
                    break;
                }
            }
            if (js == null)
            {
                js = lst[0];
            }

            //JsonNode js = SDNetGlobal.m_lstSrvInfo[SDNetGlobal.lastSelectServer];

            SDNetGlobal.serverId   = int.Parse(js.Attribute("ServerID"));
            SDNetGlobal.Login_IP   = js.Attribute("IP");
            SDNetGlobal.Login_Port = ushort.Parse(js.Attribute("Port"));
            SDNetGlobal.serverName = js.Attribute("ServerName");
            SDNetGlobal.SaveSrvInfo();
            //SDNetGlobal.serverId = 4;
        }
        else
        {
            SDNetGlobal.serverId   = int.Parse(strServerID);
            SDNetGlobal.Login_IP   = strIP;
            SDNetGlobal.Login_Port = ushort.Parse(strPort);
            SDNetGlobal.serverName = strName;
        }
    }
Esempio n. 2
0
    public void Parse(string text)
    {
        int      current = 0;
        JsonNode js      = new JsonNode();

        js.Parse(text, ref current);
        JsonNode areas = js.Find("Areas");

        notice        = areas.Attribute("AreaNotice");
        defaultServer = areas.Attribute("DefaultServerID");
        areas.FindListAttribute("address", cdnlist);
        areas.FindListHasAttibuteName("ServerID", serverlist);
        //areas.FindListHasAttibuteName("ServerStatus", serverlist);

        JsonNode PushString = areas.Find("PushString");

        if (PushString != null)
        {
            PushString.FindListAttribute("content", Pushlist);
        }
    }