public string PageQuery(string strSvr, string strURL, PacketDataWapper wapper)
        {
            string json_data = "null";

            if (wapper.pk_data != null)
            {
                json_data = JsonMapper.ToJson(wapper.pk_data);
            }
            wapper.hash = ServerParam.getShaStrToS(json_data);

            Dictionary <string, string> dicPostData = new Dictionary <string, string>();

            dicPostData.Add("seq", seq.ToString());
            dicPostData.Add("hash", wapper.hash);
            dicPostData.Add("data", json_data);
            string result = PageQuery(strSvr, strURL, dicPostData, Encoding.GetEncoding("iso-8859-1"));

            if (wapper.pk_data != null && wapper.pk_data.cmd == "ToS_AUTH")
            {
                seq = 1;
            }
            else
            {
                seq++;
            }
            return(result);
        }
Beispiel #2
0
        public void doLogin(object o)
        {
            Account curAcc = (Account)o;

            if (curAcc == null)
            {
                return;
            }
            curAcc.bIsLogined = false;
            Dictionary <string, string> pkg_data = new Dictionary <string, string>();
            Match  m      = null;
            string result = "";

            // CheckSvr
            pkg_data.Add("OSTYPE", "I");
            string param = CreateQueryString(pkg_data);

            PacketDataWapper wapper = new PacketDataWapper();

            wapper.pk_data = null;
            result         = curAcc.PageQuery(ServerParam.strCheckSvr, ServerParam.strCheckUrl + "?" + param, wapper);

            m = Regex.Match(result, "\"URL\":\"(.*?)\"", RegexOptions.Singleline);
            if (!m.Success)
            {
                return;
            }
            string url = m.Groups[1].Value.Replace("\\", "");

            m = Regex.Match(url, "http://(.*?)/(.*?)php", RegexOptions.Singleline);
            if (!m.Success)
            {
                return;
            }
            ServerParam.strGameSvr  = m.Groups[1].Value;
            ServerParam.strStartUrl = m.Groups[2].Value + "php";

            // ----------------------------------------------------------------------------------------------------
            // GameStart
            PacketStart pk_start = new PacketStart();

            pk_start.cmd           = "ToS_START";
            pk_start.clientVersion = "I2.14";

            wapper.pk_data = pk_start;
            result         = curAcc.PageQuery(ServerParam.strGameSvr, ServerParam.strStartUrl, wapper);

            // ----------------------------------------------------------------------------------------------------
            // GameAuth
            PacketAuth pk_auth = new PacketAuth();

            pk_auth.cmd           = "ToS_AUTH";
            pk_auth.userId        = "89793590877302032";
            pk_auth.kakaoToken    = "DsMp3scEgTftAQ1V398XAorIE7a06VsUEi7Yfrv1/zlLlghArpqTVctV2vJ9StWKgJ6u4eaicxza1oiSKE2aHoa+3U/yWnfNsivwBLzIalk0+eLkOpeVVQ==";
            pk_auth.clientVersion = "I2.14";
            pk_auth.friends       = new string[] { "89455177694208000", "89428422561973665" };
            pk_auth.deviceName    = "UNKNOWN";
            pk_auth.osInfo        = "0.0";
            pk_auth.macAddress    = "";
            pk_auth.appId         = "";
            pk_auth.osId          = "";

            //wapper.hash = "9dbdb3f035a7b55f96bd61efa75b60e692745453";
            wapper.pk_data = pk_auth;
            result         = curAcc.PageQuery(ServerParam.strGameSvr, ServerParam.strAuthUrl, wapper);
            DebugLog(result);

            curAcc.bIsLogined = true;
            curAcc.QrySta     = QueryStatus.Logined;
            DebugLog("已成功登陆!");
        }