コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            string pwd = Password;

            try
            {
                pwd = new DESAlgorithmNew().DecodePwd(pwd, GameEnvironment.Setting.ClientDesDeKey);
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("Decode pwd error:{0}", ex);
            }
            pwd      = CryptoHelper.DES_Encrypt(pwd, GameEnvironment.Setting.ProductDesEnKey);
            Password = pwd;
            //快速登录
            UserID = SnsManager.LoginByDevice(PassportID, Password, DeviceID).ToString();

            if (!string.IsNullOrEmpty(UserID) && UserID != "0")
            {
                UserType = SnsManager.GetUserType(PassportID);
                if (string.IsNullOrEmpty(SessionID))
                {
                    SessionID = GetSessionId();
                }
                return(true);
            }
            //TraceLog.WriteError("LoginByDevice pid:{0},pwd:{1},device:{2},uid:{3}", PassportID, Password, DeviceID, UserID);
            return(false);
        }
コード例 #2
0
 public bool CheckLogin()
 {
     string[] arr = SnsManager.LoginByRetail(_retailID, _pid);
     this.UserID     = arr[0];
     this.PassportID = arr[1];
     this.SessionID  = GetSessionId();
     return(true);
 }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override bool CheckLogin()
 {
     string[] arr = SnsManager.LoginByRetail(_retailID, _retailUser);
     this.UserID     = arr[0];
     this.PassportID = arr[1];
     QihooUserID     = _retailUser;
     SessionID       = GetSessionId();
     return(true);
 }
コード例 #4
0
 /// <summary>
 /// 注册通行证
 /// </summary>
 /// <returns></returns>
 public override string GetRegPassport()
 {
     string[] userList = SnsManager.GetRegPassport(DeviceID, false);
     if (userList.Length == 2)
     {
         PassportID = userList[0];
         Password   = userList[1];
     }
     return(PassportID);
 }
コード例 #5
0
 /// <summary>
 /// 注册通行证
 /// </summary>
 /// <returns></returns>
 public override string GetRegPassport()
 {
     string[] userList = SnsManager.GetRegPassport(DeviceID);
     if (userList.Length == 2)
     {
         PassportID = userList[0];
         Password   = CryptoHelper.DES_Decrypt(userList[1], GameEnvironment.Setting.ProductDesEnKey);
     }
     return(PassportID);
 }
コード例 #6
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);
        }
コード例 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            if (string.IsNullOrEmpty(_uid))
            {
                TraceLog.ReleaseWrite("The ChannelGFansdk  uid is null.");
                return(false);
            }

            string[] arr = SnsManager.LoginByRetail(_retailID, _uid);
            this.UserID     = arr[0];
            this.PassportID = arr[1];
            SessionID       = GetSessionId();
            return(true);
        }
コード例 #8
0
ファイル: LoginDanLeV2.cs プロジェクト: dongliang/Scut
        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);
        }
コード例 #9
0
ファイル: LoginMIUI.cs プロジェクト: dongliang/Scut
        public override bool CheckLogin()
        {
            SetParameter("appId", AppId);
            SetParameter("session", _sid);
            SetParameter("uid", _retailUser);
            string sing = GetSign();

            sing = EncryptionManager.HMACSHA1Encrypt(sing, AppKey);
            string urlData = string.Format("appId={0}&session={1}&uid={2}&signature={3}",
                                           AppId,
                                           _sid,
                                           _retailUser,
                                           HttpUtility.UrlEncode(sing)
                                           );

            urlData = Url + "?" + urlData;
            string result = HttpRequestManager.GetStringData(urlData, "GET");

            try
            {
                if (!string.IsNullOrEmpty(result))
                {
                    var sdk = JsonUtils.Deserialize <SDKMIUIError>(result);
                    if (sdk == null || (!string.IsNullOrEmpty(sdk.errcode) && sdk.errcode != "200"))
                    {
                        TraceLog.ReleaseWrite("MIUIsdk login get user info fail:{0},errorCode:{1},request url:{2}", sdk.errMsg,
                                              sdk.errcode, urlData);
                        return(false);
                    }
                    string[] arr = SnsManager.LoginByRetail(_retailID, _sid);
                    this.UserID     = arr[0];
                    this.PassportID = arr[1];
                    QihooUserID     = _sid;
                    SessionID       = GetSessionId();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }
        }
コード例 #10
0
ファイル: Login36you.cs プロジェクト: yunjoker/Scut
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            //快速登录
            UserID = SnsManager.LoginByDevice(PassportID, Password, DeviceID).ToString();

            if (!string.IsNullOrEmpty(UserID) && UserID != "0")
            {
                UserType = SnsManager.GetUserType(PassportID);
                if (string.IsNullOrEmpty(SessionID))
                {
                    SessionID = GetSessionId();
                }
                return(true);
            }
            //TraceLog.WriteError("LoginByDevice pid:{0},pwd:{1},device:{2},uid:{3}", PassportID, Password, DeviceID, UserID);
            return(false);
        }
コード例 #11
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            int    Act  = 4;
            string Sign = string.Format("{0}{1}{2}{3}{4}", AppId.ToNotNullString(), Act, Uin.ToNotNullString(), SessionID.ToNotNullString(), AppKey.ToNotNullString());

            Sign = HashToMD5Hex(Sign);

            string urlData = string.Format("{0}?AppId={1}&Act={2}&Uin={3}&SessionID={4}&Sign={5}",
                                           Url.ToNotNullString(),
                                           AppId.ToNotNullString(),
                                           Act,
                                           Uin.ToNotNullString(),
                                           SessionID.ToNotNullString(),
                                           Sign.ToNotNullString()
                                           );

            string result = HttpPostManager.GetStringData(urlData);

            try
            {
                if (string.IsNullOrEmpty(result))
                {
                    TraceLog.ReleaseWrite("91sdk login fail result:{0},request url:{1}", result, urlData);
                    return(false);
                }
                SDKError sdk = JsonUtils.Deserialize <SDKError>(result);
                if (sdk.ErrorCode != "1")
                {
                    TraceLog.ReleaseWrite("91sdk login fail:{0},request url:{1}", sdk.ErrorDesc, urlData);
                    return(false);
                }
                string[] arr = SnsManager.LoginByRetail(_retailID, Uin);
                this.UserID     = arr[0];
                this.PassportID = arr[1];
                return(true);
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }

            //return !string.IsNullOrEmpty(UserID) && UserID != "0";
        }
コード例 #12
0
ファイル: LoginAnySdk.cs プロジェクト: suncle/Scut
        public override bool CheckLogin()
        {
            AccessToken = _token;
            string urlData = string.Format("{0}?access_token={1}",
                                           Url,
                                           AccessToken
                                           );
            string result = HttpRequestManager.GetStringData(urlData, "POST");

            try
            {
                if (!string.IsNullOrEmpty(result))
                {
                    var sdk = JsonUtils.Deserialize <AnySDKResult>(result);
                    if (!string.IsNullOrEmpty(sdk.data.error))
                    {
                        TraceLog.ReleaseWrite("360sdk login get user info fail:{0},errorCode:{1},request url:{2}", sdk.data.error,
                                              sdk.data.error_no, urlData);
                        return(false);
                    }
                    string[] arr = SnsManager.LoginByRetail(_retailID, sdk.data.id);
                    this.UserID     = arr[0];
                    this.PassportID = arr[1];
                    QihooUserID     = sdk.data.id;
                    SessionID       = GetSessionId();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                new BaseLog().SaveLog(e);
                return(false);
            }
        }
コード例 #13
0
ファイル: LoginMeiZu.cs プロジェクト: yunjoker/Scut
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            try
            {
                string sign        = Md5Encode(Md5Encode(AppKey + "_" + _token));
                string queryString = string.Format("{0}?sign={1}&token={2}&app_id={3}", loginCheckUrl, sign, _token, AppId);


                var conn = (HttpWebRequest)WebRequest.Create(queryString);
                conn.Timeout = 2000;
                WebResponse resp   = conn.GetResponse();
                Stream      stream = resp.GetResponseStream();
                String      result = "[]";
                if (stream != null)
                {
                    StreamReader reader = new StreamReader(stream, Encoding.UTF8);
                    result = reader.ReadToEnd();
                    stream.Close();
                }
                var rejson = result.ParseJson <Rejson>();
                if (rejson != null && rejson.state == "1")
                {
                    _retailUser = rejson.data.userid;
                    string[] arr = SnsManager.LoginByRetail(_retailID, _retailUser);
                    this.UserID     = arr[0];
                    this.PassportID = arr[1];
                    QihooUserID     = _retailUser;
                    SessionID       = GetSessionId();
                    return(true);
                }
            }
            catch (Exception e)
            {
                new BaseLog().SaveLog(e);
            }
            return(false);
        }
コード例 #14
0
ファイル: LoginND.cs プロジェクト: zhangxiangbing/Scut
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override bool CheckLogin()
 {
     try
     {
         if (!string.IsNullOrEmpty(_retailUser))
         {
             string[] arr = SnsManager.LoginByRetail(_retailID, _retailUser);
             this.UserID     = arr[0];
             this.PassportID = arr[1];
             QihooUserID     = _retailUser;
             SessionID       = GetSessionId();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         new BaseLog().SaveLog(e);
         return(false);
     }
 }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            string getAccessTokenUrl = string.Format("{0}?grant_type=authorization_code&code={1}&client_id={2}&client_secret={3}&redirect_uri=oob",
                                                     _aceessTokenUrl,
                                                     _code,
                                                     AppKey,
                                                     _appSecret);
            string resultGetToken = HttpRequestManager.GetStringData(getAccessTokenUrl, "GET");

            if (!string.IsNullOrEmpty(resultGetToken))
            {
                var sdkGetToken = JsonUtils.Deserialize <SDK360GetTokenError>(resultGetToken);
                if (!string.IsNullOrEmpty(sdkGetToken.error_code))
                {
                    TraceLog.ReleaseWrite("360sdk login get token fail:{0},errorCode:{1},request url:{2}", sdkGetToken.error,
                                          sdkGetToken.error_code, getAccessTokenUrl);
                    return(false);
                }
                AccessToken = sdkGetToken.access_token;
                RefeshToken = sdkGetToken.refresh_token;
                Scope       = sdkGetToken.scope;
                ExpiresIn   = Convert.ToInt32(sdkGetToken.expires_in);
            }
            else
            {
                return(false);
            }
            string urlData = string.Format("{0}?access_token={1}",
                                           Url,
                                           AccessToken
                                           );

            string result = HttpRequestManager.GetStringData(urlData, "GET");

            try
            {
                if (!string.IsNullOrEmpty(result))
                {
                    var sdk = JsonUtils.Deserialize <SDK360Error>(result);
                    if (!string.IsNullOrEmpty(sdk.error_code))
                    {
                        TraceLog.ReleaseWrite("360sdk login get user info fail:{0},errorCode:{1},request url:{2}", sdk.error,
                                              sdk.error_code, urlData);
                        return(false);
                    }
                    string[] arr = SnsManager.LoginByRetail(_retailID, sdk.id);
                    this.UserID     = arr[0];
                    this.PassportID = arr[1];
                    QihooUserID     = sdk.id;
                    SessionID       = GetSessionId();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }
        }
コード例 #16
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);
        }
コード例 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            if (string.IsNullOrEmpty(_sessionID))
            {
                return(false);
            }
            string      key         = _mobileType == MobileType.ptAndroid ? "android" : "ios";
            GameChannel gameChannel = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channelUC);

            if (gameChannel == null)
            {
                TraceLog.ReleaseWrite("The sdkChannel UC section is null.");
                return(false);
            }
            GameSdkSetting setting = gameChannel.GetSetting(key);

            if (setting == null)
            {
                TraceLog.ReleaseWrite("The sdkChannel UC section channelUC:{0} is null.", key);
                return(false);
            }

            string        id      = ((DateTime.Now - Convert.ToDateTime("1970-1-1")).TotalMilliseconds).ToString().Substring(0, 13);
            string        signSrc = setting.AppId + "sid=" + _sessionID + setting.AppKey;
            string        sign    = AMD5(signSrc);
            StringBuilder sb      = new StringBuilder();

            sb.Append("{");
            sb.Append("\"service\":\"").Append(gameChannel.Service).Append("\",");
            sb.Append("\"id\":\"").Append(id).Append("\",");
            sb.Append("\"game\":{");
            sb.Append("\"cpId\":\"").Append(setting.AppId).Append("\",");
            sb.Append("\"gameId\":\"").Append(setting.GameId).Append("\",");
            sb.Append("\"channelId\":\"").Append(gameChannel.ChannelId).Append("\",");
            sb.Append("\"serverId\":\"").Append(setting.ServerId).Append("\"},");
            sb.Append("\"data\":{");
            sb.Append("\"sid\":\"").Append(_sessionID).Append("\"},");
            sb.Append("\"encrypt\":\"").Append(encrypt).Append("\",");
            sb.Append("\"sign\":\"").Append(sign).Append("\"}");

            string result = httpPost(gameChannel.Url, sb.ToString(), Encoding.UTF8);
            UCInfo ucinfo = null;

            try
            {
                ucinfo = JsonUtils.Deserialize <UCInfo>(result);
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }
            if (ucinfo == null || ucinfo.state.code != "1")
            {
                TraceLog.ReleaseWrite("Danlesdk login fail:{0},request url:{1},param:{2},signsrc:{3}", result, gameChannel.Url, sb.ToString(), signSrc);
                return(false);
            }

            _retailUser = ucinfo.data.ucid;

            string[] arr = SnsManager.LoginByRetail(_retailID, _retailUser);
            this.UserID     = arr[0];
            this.PassportID = arr[1];
            return(true);
        }
コード例 #18
0
ファイル: LoginUC.cs プロジェクト: dongliang/Scut
        public bool CheckLogin()
        {
            if (string.IsNullOrEmpty(_sessionID))
            {
                return(false);
            }
            var sec = SdkSectionFactory.SectionUC;

            if (sec == null)
            {
                TraceLog.ReleaseWrite("The sdkChannel UC section is null.");
                return(false);
            }
            string key            = _mobileType == MobileType.ptAndroid ? "android" : "ios";
            var    channelElement = sec.Channels[key];

            if (channelElement == null)
            {
                TraceLog.ReleaseWrite("The sdkChannel UC section channelUC:{0} is null.", key);
                return(false);
            }

            string        id   = ((DateTime.Now - Convert.ToDateTime("1970-1-1")).TotalMilliseconds).ToString().Substring(0, 13);
            string        sign = AMD5(channelElement.CpId + "sid=" + _sessionID + channelElement.ApiKey);
            StringBuilder sb   = new StringBuilder();

            sb.Append("{");
            sb.Append("\"service\":\"").Append(sec.Service).Append("\",");
            sb.Append("\"id\":\"").Append(id).Append("\",");
            sb.Append("\"game\":{");
            sb.Append("\"cpId\":\"").Append(channelElement.CpId).Append("\",");
            sb.Append("\"gameId\":\"").Append(channelElement.GameId).Append("\",");
            sb.Append("\"channelId\":\"").Append(sec.ChannelId).Append("\",");
            sb.Append("\"serverId\":\"").Append(channelElement.ServerId).Append("\"},");
            sb.Append("\"data\":{");
            sb.Append("\"sid\":\"").Append(_sessionID).Append("\"},");
            sb.Append("\"encrypt\":\"").Append(encrypt).Append("\",");
            sb.Append("\"sign\":\"").Append(sign).Append("\"}");

            string result = httpPost(sec.Url, sb.ToString(), Encoding.UTF8);
            UCInfo ucinfo = null;

            try
            {
                ucinfo = JsonUtils.Deserialize <UCInfo>(result);
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }
            if (ucinfo == null || ucinfo.state.code != "1")
            {
                TraceLog.ReleaseWrite("Danlesdk login fail:{0},request url:{1},param:{2}", result, sec.Url, sb.ToString());
                return(false);
            }

            _retailUser = ucinfo.data.ucid;

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