예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            string url          = "";
            string AppKey       = "";
            string AppId        = "";
            bool   isOldVersion = false;

            GameChannel gameChannel = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channelDanle);

            if (gameChannel != null)
            {
                url          = gameChannel.Url;
                isOldVersion = "0.1".Equals(gameChannel.Version);
                GameSdkSetting setting = gameChannel.GetSetting(_retailID);
                if (setting != null)
                {
                    AppKey = setting.AppKey;
                    AppId  = setting.AppId;
                }
            }
            else
            {
                TraceLog.ReleaseWrite("The sdkChannelV2 Danle section is null.");
            }
            string sig    = AMD5(_token + "|" + AppKey);
            string Url    = Url = string.Format("{0}?app_id={1}&mid={2}&token={3}&sig={4}", url, AppId, _mid, _token, sig);
            string result = HttpRequestManager.GetStringData(Url, "GET");

            DanleSDK sdk = null;

            try
            {
                sdk = JsonUtils.Deserialize <DanleSDK>(result);
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }
            if (sdk == null || sdk.error_code != 0)
            {
                TraceLog.ReleaseWrite("Danlesdk login fail:{0},request url:{1}", result, Url);
                return(false);
            }

            string[] arr = SnsManager.LoginByRetail(_retailID, sdk.memberId);
            this.UserID     = arr[0];
            this.PassportID = arr[1];
            SessionID       = GetSessionId();
            return(true);
        }
예제 #2
0
        public override bool CheckLogin()
        {
            string url          = "";
            string AppKey       = "";
            string AppId        = "";
            bool   isOldVersion = false;
            var    sec          = SdkSectionFactory.SectionDanleV2;

            if (sec != null)
            {
                url          = sec.Url;
                isOldVersion = sec.IsOldVersion;
                var els = sec.Channels[_retailID];
                AppKey = els.AppKey;
                AppId  = els.AppId;
            }
            else
            {
                TraceLog.ReleaseWrite("The sdkChannelV2 Danle section is null.");
            }
            string sig    = AMD5(_token + "|" + AppKey);
            string Url    = Url = string.Format("{0}?app_id={1}&mid={2}&token={3}&sig={4}", url, AppId, _mid, _token, sig);
            string result = HttpRequestManager.GetStringData(Url, "GET");

            DanleSDK sdk = null;

            try
            {
                sdk = JsonUtils.Deserialize <DanleSDK>(result);
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }
            if (sdk == null || sdk.error_code != 0)
            {
                TraceLog.ReleaseWrite("Danlesdk login fail:{0},request url:{1}", result, Url);
                return(false);
            }

            string[] arr = SnsManager.LoginByRetail(_retailID, sdk.memberId);
            this.UserID     = arr[0];
            this.PassportID = arr[1];
            SessionID       = GetSessionId();
            return(true);
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            string      url          = "";
            string      AppKey       = "";
            string      AppId        = "";
            bool        isOldVersion = false;
            GameChannel gameChannel  = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channelDanle);

            if (gameChannel != null)
            {
                url          = gameChannel.Url;
                isOldVersion = "0.1".Equals(gameChannel.Version);
                GameSdkSetting setting = gameChannel.GetSetting(_retailID);
                if (setting != null)
                {
                    AppKey = setting.AppKey;
                    AppId  = setting.AppId;
                }
            }
            else
            {
                TraceLog.ReleaseWrite("The sdkChannel Danle section is null.");
            }
            string Url = "";

            if (isOldVersion)
            {
                string sig = AMD5(string.Format("api_key={0}&mid={1}&username={2}&sha256_pwd={3}&secret_key={4}", AppId, _mid, username, SHA256(Password), AppKey));
                string vc  = AMD5(string.Format("api_key={0}&mid={1}&username={2}&sig={3}", AppId, PassportID, username, sig));
                Url = string.Format("http://connect.d.cn/connect/json/member/login?api_key={0}&mid={1}&username={2}&vc={3}&sig={4}", AppId, _mid, username, vc, sig);
            }
            else
            {
                string sig = AMD5(string.Format("{0}|{1}", _token, AppKey));
                Url = string.Format("{0}?app_id={1}&mid={2}&token={3}&sig={4}", url, AppId, _mid, _token, sig);
            }
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);

            req.Method = "Get";
            WebResponse resp   = req.GetResponse();
            Stream      stream = resp.GetResponseStream();

            StreamReader reader = new StreamReader(stream);
            string       result = reader.ReadToEnd();

            DanleSDK sdk = null;

            try
            {
                sdk = JsonUtils.Deserialize <DanleSDK>(result);
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }
            if (sdk == null || sdk.error_code != 0)
            {
                TraceLog.ReleaseWrite("Danlesdk login fail:{0},request url:{1}", result, Url);
                return(false);
            }

            string[] arr = SnsManager.LoginByRetail(_retailID, sdk.memberId);
            this.UserID     = arr[0];
            this.PassportID = arr[1];
            SessionID       = GetSessionId();
            return(true);
        }