示例#1
0
        public int Remove()
        {
            LoginRequestData data = new LoginRequestData(SelectedAccount.email, SelectedAccount.password);
            string           json = "FAILED";

            try
            {
                json = RequestHandler.RequestAccount(data);

                if (json != "OK")
                {
                    return(-1);
                }
            }
            catch
            {
                return(-1);
            }

            SelectedAccount = null;

            launcherConfig.Email    = "";
            launcherConfig.Password = "";
            JsonHandler.SaveLauncherConfig(launcherConfig);
            return(1);
        }
示例#2
0
        public int Login(string email, string password)
        {
            LoginRequestData data = new LoginRequestData(email, password);
            string           id   = "FAILED";
            string           json = "";

            try
            {
                id   = RequestHandler.RequestLogin(data);
                json = RequestHandler.RequestAccount(data);

                if (id == "FAILED")
                {
                    return(-1);
                }
            }
            catch
            {
                return(-2);
            }

            SelectedAccount = Json.Deserialize <AccountInfo>(json);
            RequestHandler.ChangeSession(SelectedAccount.id);

            launcherConfig.Email    = email;
            launcherConfig.Password = password;
            JsonHandler.SaveLauncherConfig(launcherConfig);

            return(1);
        }
示例#3
0
        private void InitializeLauncher()
        {
            launcherConfig = JsonHandler.LoadLauncherConfig();
            monitor        = new ProcessMonitor("EscapeFromTarkov", 1000, aliveCallback: null, exitCallback: GameExitCallback);
            serverManager  = new ServerManager();
            accountManager = new Account(launcherConfig);
            gameStarter    = new GameStarter();

            if (launcherConfig.Servers.Count == 0)
            {
                launcherConfig.Servers.Add("https://127.0.0.1");
                JsonHandler.SaveLauncherConfig(launcherConfig);
            }

            ShowServerSelectView();
        }
示例#4
0
        public int ChangePassword(string password)
        {
            ChangeRequestData data = new ChangeRequestData(SelectedAccount.email, SelectedAccount.password, password);
            string            json = "FAILED";

            try
            {
                json = RequestHandler.RequestChangePassword(data);

                if (json != "OK")
                {
                    return(-1);
                }
            }
            catch
            {
                return(-2);
            }

            SelectedAccount.password = password;
            launcherConfig.Password  = password;
            JsonHandler.SaveLauncherConfig(launcherConfig);
            return(1);
        }
示例#5
0
        public int ChangeEmail(string email)
        {
            ChangeRequestData data = new ChangeRequestData(SelectedAccount.email, SelectedAccount.password, email);
            string            json = "FAILED";

            try
            {
                json = RequestHandler.RequestChangeEmail(data);

                if (json != "OK")
                {
                    return(-1);
                }
            }
            catch
            {
                return(-2);
            }

            launcherConfig.Email  = email;
            SelectedAccount.email = email;
            JsonHandler.SaveLauncherConfig(launcherConfig);
            return(1);
        }