Beispiel #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);
        }
Beispiel #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);

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

                json = RequestHandler.RequestAccount(data);
            }
            catch
            {
                return(-2);
            }

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

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

            return(1);
        }
 public static string RequestAccount(LoginRequestData data)
 {
     return(request.PostJson("/launcher/profile/get", Json.Serialize(data)));
 }
 public static string RequestRemove(LoginRequestData data)
 {
     return(request.PostJson("/launcher/profile/remove", Json.Serialize(data)));
 }