Esempio n. 1
0
 private async Task<Session> Login(AuthenticationCredentials arg0)
 {
     int Id = Invoke("loginService", "login", new object[] { arg0.GetBaseTypedObject() });
     while (!results.ContainsKey(Id))
         await Task.Delay(10);
     TypedObject messageBody = results[Id].GetTO("data").GetTO("body");
     Session result = new Session(messageBody);
     results.Remove(Id);
     return result;
 }
Esempio n. 2
0
        private bool Login()
        {
            TypedObject result, body;

            // Login 1
            RiotObjects.Platform.Login.AuthenticationCredentials cred = new RiotObjects.Platform.Login.AuthenticationCredentials();
            cred.Password = password;
            cred.ClientVersion = clientVersion;
            cred.IpAddress = ipAddress;
            cred.SecurityAnswer = null;
            cred.Locale = locale;
            cred.Domain = "lolclient.lol.riotgames.com";
            cred.OldPassword = null;
            cred.AuthToken = authToken;

            if (useGarena)
            {
                cred.PartnerCredentials = "8393 " + garenaToken;
                cred.Username = userID;
            }
            else
            {
                cred.PartnerCredentials = null;
                cred.Username = user;
            }
            int id = Invoke("loginService", "login", new object[] { cred.GetBaseTypedObject() });

            result = GetResult(id);
            if (result["result"].Equals("_error"))
            {
                if (HandsFreeLeveler.Program.AutoUpdate)
                {
                    string newVersion = (string)result.GetTO("data").GetTO("rootCause").GetArray("substitutionArguments")[1];
                    if (newVersion != HandsFreeLeveler.Program.cversion)
                    {
                        XDocument settings = XDocument.Load("settings.xml");
                        settings.Element("HFL").Element("Paths").Element("GAMEVERSION").SetValue(newVersion);
                        settings.Save("settings.xml");

                        HandsFreeLeveler.Program.restartSystem();
                    }
                }
                else
                {
                    Error(GetErrorMessage(result), ErrorType.Login);
                }
                Disconnect();
                return false;
            }

            body = result.GetTO("data").GetTO("body");
            sessionToken = body.GetString("token");
            accountID = (int)body.GetTO("accountSummary").GetInt("accountId");

            // Login 2

            if (useGarena)
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(userID + ":" + sessionToken)), "auth", 8);
            else
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(user.ToLower() + ":" + sessionToken)), "auth", 8);

            body.type = "flex.messaging.messages.CommandMessage";

            id = Invoke(body);
            result = GetResult(id); // Read result and discard

            isLoggedIn = true;
            if (OnLogin != null)
                OnLogin(this, user, ipAddress);
            return true;
        }
Esempio n. 3
0
 /// 0.)
 private void Login(AuthenticationCredentials arg0, Session.Callback callback)
 {
     Session cb = new Session(callback);
     InvokeWithCallback("loginService", "login", new object[] { arg0.GetBaseTypedObject() }, cb);
 }
Esempio n. 4
0
        private bool Login()
        {
            TypedObject result, body;

            // Login 1
            RiotObjects.Platform.Login.AuthenticationCredentials cred = new RiotObjects.Platform.Login.AuthenticationCredentials();
            cred.Password       = password;
            cred.ClientVersion  = clientVersion;
            cred.IpAddress      = ipAddress;
            cred.SecurityAnswer = null;
            cred.Locale         = locale;
            cred.Domain         = "lolclient.lol.riotgames.com";
            cred.OldPassword    = null;
            cred.AuthToken      = authToken;

            if (useGarena)
            {
                cred.PartnerCredentials = "8393 " + garenaToken;
                cred.Username           = userID;
                cred.Password           = null;
            }
            else
            {
                cred.PartnerCredentials = null;
                cred.Username           = user;
            }
            int id = Invoke("loginService", "login", new object[] { cred.GetBaseTypedObject() });

            result = GetResult(id);
            if (result["result"].Equals("_error"))
            {
                if (RitoBot.Program.AutoUpdate)
                {
                    string newVersion = (string)result.GetTO("data").GetTO("rootCause").GetArray("substitutionArguments")[1];
                    if (newVersion != RitoBot.Program.cversion)
                    {
                        if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "config\\version.txt"))
                        {
                            File.Delete(AppDomain.CurrentDomain.BaseDirectory + "config\\version.txt");
                        }
                        var newcversion = File.CreateText("config\\version.txt");
                        newcversion.Write(newVersion);
                    }
                    Error("Volibot updated for version " + newVersion + ". Please restart.", ErrorType.General);
                }
                else
                {
                    Error(GetErrorMessage(result), ErrorType.Login);
                }
                Disconnect();
                return(false);
            }

            body         = result.GetTO("data").GetTO("body");
            sessionToken = body.GetString("token");
            accountID    = (int)body.GetTO("accountSummary").GetInt("accountId");

            // Login 2

            if (useGarena)
            {
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(userID + ":" + sessionToken)), "auth", 8);
            }
            else
            {
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(user.ToLower() + ":" + sessionToken)), "auth", 8);
            }

            body.type = "flex.messaging.messages.CommandMessage";

            id     = Invoke(body);
            result = GetResult(id); // Read result and discard

            isLoggedIn = true;
            if (OnLogin != null)
            {
                OnLogin(this, user, ipAddress);
            }
            return(true);
        }
Esempio n. 5
0
        private bool Login()
        {
            TypedObject result, body;

            // Login 1
            RiotObjects.Platform.Login.AuthenticationCredentials cred = new RiotObjects.Platform.Login.AuthenticationCredentials();
            cred.Password = password;
            cred.ClientVersion = clientVersion;
            cred.IpAddress = ipAddress;
            cred.SecurityAnswer = null;
            cred.Locale = locale;
            cred.Domain = "lolclient.lol.riotgames.com";
            cred.OldPassword = null;
            cred.AuthToken = authToken;

            if (useGarena)
            {
                cred.PartnerCredentials = "8393 " + garenaToken;
                cred.Username = userID;
            }
            else
            {
                cred.PartnerCredentials = null;
                cred.Username = user;
            }
            int id = Invoke("loginService", "login", new object[] { cred.GetBaseTypedObject() });

            result = GetResult(id);
            if (result["result"].Equals("_error"))
            {
                string newVersion = (string)result.GetTO("data").GetTO("rootCause").GetArray("substitutionArguments")[1];
                Error(GetErrorMessage(result), ErrorType.Login);
                Disconnect();
                return false;
            }

            body = result.GetTO("data").GetTO("body");
            sessionToken = body.GetString("token");
            accountID = (int)body.GetTO("accountSummary").GetInt("accountId");

            // Login 2

            if (useGarena)
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(userID + ":" + sessionToken)), "auth", 8);
            else
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(user.ToLower() + ":" + sessionToken)), "auth", 8);

            body.type = "flex.messaging.messages.CommandMessage";

            id = Invoke(body);
            result = GetResult(id); // Read result and discard

            isLoggedIn = true;
            if (OnLogin != null)
                OnLogin(this, user, ipAddress);
            return true;
        }
Esempio n. 6
0
        private bool Login()
        {
            TypedObject result, body;

            // Login 1
            RiotObjects.Platform.Login.AuthenticationCredentials cred = new RiotObjects.Platform.Login.AuthenticationCredentials();
            cred.Password       = password;
            cred.ClientVersion  = clientVersion;
            cred.IpAddress      = ipAddress;
            cred.SecurityAnswer = null;
            cred.Locale         = locale;
            cred.Domain         = "lolclient.lol.riotgames.com";
            cred.OldPassword    = null;
            cred.AuthToken      = authToken;

            if (useGarena)
            {
                cred.PartnerCredentials = "8393 " + garenaToken;
                cred.Username           = userID;
            }
            else
            {
                cred.PartnerCredentials = null;
                cred.Username           = user;
            }
            int id = Invoke("loginService", "login", new object[] { cred.GetBaseTypedObject() });

            result = GetResult(id);
            if (result["result"].Equals("_error"))
            {
                string newVersion = (string)result.GetTO("data").GetTO("rootCause").GetArray("substitutionArguments")[1];
                if (newVersion != LoLAutoQueue.Properties.Settings.Default.clientVer)
                {
                    LoLAutoQueue.Properties.Settings.Default.clientVer = newVersion;
                    LoLAutoQueue.Properties.Settings.Default.Save();
                    clientVersion = newVersion;
                    return(Login());
                }
                Error(GetErrorMessage(result), ErrorType.Login);
                Disconnect();
                return(false);
            }

            body         = result.GetTO("data").GetTO("body");
            sessionToken = body.GetString("token");
            accountID    = (int)body.GetTO("accountSummary").GetInt("accountId");

            // Login 2

            if (useGarena)
            {
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(userID + ":" + sessionToken)), "auth", 8);
            }
            else
            {
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(user.ToLower() + ":" + sessionToken)), "auth", 8);
            }

            body.type = "flex.messaging.messages.CommandMessage";

            id     = Invoke(body);
            result = GetResult(id); // Read result and discard

            isLoggedIn = true;
            if (OnLogin != null)
            {
                OnLogin(this, user, ipAddress);
            }
            return(true);
        }
Esempio n. 7
0
        private bool Login()
        {
            TypedObject result, body;

            // Login 1
            RiotObjects.Platform.Login.AuthenticationCredentials cred = new RiotObjects.Platform.Login.AuthenticationCredentials();
            cred.Password = password;
            cred.ClientVersion = clientVersion;
            cred.IpAddress = ipAddress;
            cred.SecurityAnswer = null;
            cred.Locale = locale;
            cred.Domain = "lolclient.lol.riotgames.com";
            cred.OldPassword = null;
            cred.AuthToken = authToken;

            if (useGarena)
            {
                cred.PartnerCredentials = "8393 " + garenaToken;
                cred.Username = userID;
                cred.Password = null;
            }
            else
            {
                cred.PartnerCredentials = null;
                cred.Username = user;
            }
            int id = Invoke("loginService", "login", new object[] { cred.GetBaseTypedObject() });

            result = GetResult(id);
            if (result["result"].Equals("_error"))
            {
                if (RitoBot.Program.AutoUpdate)
                {
                    string newVersion = (string)result.GetTO("data").GetTO("rootCause").GetArray("substitutionArguments")[1];
                    if (newVersion != RitoBot.Program.cversion)
                    {
                        if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "config\\version.txt"))
                        {
                            File.Delete(AppDomain.CurrentDomain.BaseDirectory + "config\\version.txt");
                        }
                        var newcversion = File.CreateText("config\\version.txt");
                        newcversion.Write(newVersion);
                    }
                    Error("Volibot updated for version " + newVersion + ". Please restart.", ErrorType.General);
                }
                else
                {
                    Error(GetErrorMessage(result), ErrorType.Login);
                }
                Disconnect();
                return false;
            }

            body = result.GetTO("data").GetTO("body");
            sessionToken = body.GetString("token");
            accountID = (int)body.GetTO("accountSummary").GetInt("accountId");

            // Login 2

            if (useGarena)
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(userID + ":" + sessionToken)), "auth", 8);
            else
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(user.ToLower() + ":" + sessionToken)), "auth", 8);

            body.type = "flex.messaging.messages.CommandMessage";

            id = Invoke(body);
            result = GetResult(id); // Read result and discard

            isLoggedIn = true;
            if (OnLogin != null)
                OnLogin(this, user, ipAddress);
            return true;
        }
Esempio n. 8
0
        private bool Login()
        {
            TypedObject result, body;

            // Login 1
            RiotObjects.Platform.Login.AuthenticationCredentials cred = new RiotObjects.Platform.Login.AuthenticationCredentials();
            cred.Password       = password;
            cred.ClientVersion  = clientVersion;
            cred.IpAddress      = ipAddress;
            cred.SecurityAnswer = null;
            cred.Locale         = locale;
            cred.Domain         = "lolclient.lol.riotgames.com";
            cred.OldPassword    = null;
            cred.AuthToken      = authToken;

            if (useGarena)
            {
                cred.PartnerCredentials = "8393 " + garenaToken;
                cred.Username           = userID;
            }
            else
            {
                cred.PartnerCredentials = null;
                cred.Username           = user;
            }
            int id = Invoke("loginService", "login", new object[] { cred.GetBaseTypedObject() });

            result = GetResult(id);
            if (result["result"].Equals("_error"))
            {
                //newVersion
                string newVersion            = (string)result.GetTO("data").GetTO("rootCause").GetArray("substitutionArguments")[1];
                HandsFreeLeveler.Smurf owner = HandsFreeLeveler.App.smurfList.First(smurf => (smurf.username == cred.Username));
                owner.log("Region information updated, restarting...");
                if (owner != null)
                {
                    owner.reconnect  = true;
                    owner.clientMask = newVersion;
                }
                Disconnect();
                if (owner != null)
                {
                    owner.start();
                }
                return(false);
            }

            body         = result.GetTO("data").GetTO("body");
            sessionToken = body.GetString("token");
            accountID    = (int)body.GetTO("accountSummary").GetInt("accountId");

            // Login 2

            if (useGarena)
            {
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(userID + ":" + sessionToken)), "auth", 8);
            }
            else
            {
                body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(user.ToLower() + ":" + sessionToken)), "auth", 8);
            }

            body.type = "flex.messaging.messages.CommandMessage";

            id     = Invoke(body);
            result = GetResult(id); // Read result and discard

            isLoggedIn = true;
            if (OnLogin != null)
            {
                OnLogin(this, user, ipAddress);
            }
            return(true);
        }