public AuthenticationInfo Do() { var client = new YggdrasilClient(AuthServer, ClientToken); if (client.Authenticate(Email, Password, Token, TwitchEnabled)) { return(new AuthenticationInfo { AccessToken = client.AccessToken, UserType = client.AccountType, DisplayName = client.DisplayName, Properties = client.Properties, UUID = client.UUID }); } return(new AuthenticationInfo { Error = "验证错误" }); }
public AuthenticationInfo Do() { var client = new YggdrasilClient(AuthServer, ClientToken); var LoginError = client.AuthToken(AccessToken, UUID, DisplayName); if (LoginError == null) { return(new AuthenticationInfo { AccessToken = client.AccessToken, UserType = client.AccountType, DisplayName = client.DisplayName, Properties = client.Properties, UUID = client.UUID }); } return(new AuthenticationInfo { Error = LoginError.Message }); }
public AuthenticationInfo Do() { var client = new YggdrasilClient(AuthServer, ClientToken); var LoginError = client.Authenticate(Email, Password, LauncherToken, Token, TwitchEnabled); if (LoginError == null) { return(new AuthenticationInfo { AccessToken = client.AccessToken, UserType = client.AccountType, DisplayName = client.DisplayName, Properties = client.Properties, UUID = client.UUID }); } return(new AuthenticationInfo { Error = LoginError.Message }); }
public Task <AuthenticationInfo> DoAsync(CancellationToken token) { var client = new YggdrasilClient(AuthServer, ClientToken); return(client.AuthenticateAsync(Email, Password, Token, TwitchEnabled, token).ContinueWith(task => { if ((task.Exception == null) && (task.Result)) { return new AuthenticationInfo { AccessToken = client.AccessToken, UserType = client.AccountType, DisplayName = client.DisplayName, Properties = client.Properties, UUID = client.UUID }; } return new AuthenticationInfo { Error = "验证错误" }; }, token)); }
public AuthenticationInfo Do() { var client = new YggdrasilClient(ClientToken); if (client.Authenticate(Email, Password, TwitchEnabled)) { return new AuthenticationInfo { AccessToken = client.AccessToken, UserType = client.AccountType, DisplayName = client.DisplayName, Properties = client.Properties, UUID = client.UUID }; } return new AuthenticationInfo { Error = "验证错误" }; }
public Task<AuthenticationInfo> DoAsync(CancellationToken token) { var client = new YggdrasilClient(ClientToken); return client.AuthenticateAsync(Email, Password, TwitchEnabled, token).ContinueWith(task => { if ((task.Exception == null) && (task.Result)) { return new AuthenticationInfo { AccessToken = client.AccessToken, UserType = client.AccountType, DisplayName = client.DisplayName, Properties = client.Properties, UUID = client.UUID }; } return new AuthenticationInfo { Error = "验证错误" }; }, token); }
public static void runSnipe() { long dateTimeOffset = 0; string currentDir = Directory.GetCurrentDirectory(); RestResponse response = new RestResponse(); List <int> list = new List <int>(); try { YggdrasilClient ygg = new YggdrasilClient(); var yggSession = ygg.Login(new AccountCredentials(email, password)); yggSession.AccessToken = accessToken; uuidOfUser = (string)JObject.Parse(sendJsonReq("https://api.mojang.com/users/profiles/minecraft/", yggSession.UserName, "", "", Method.GET, "").Content)["id"]; } catch (Exception e) { MessageBox.Show("An error has occured. Check your account credentials.", "Error"); Application.Exit(); } try { dateTimeOffset = Convert.ToInt64((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds) - 3283200; response = getName(nameSniped.ToLower(), dateTimeOffset.ToString()); var oldOwnerUUID = (string)JObject.Parse((string)response.Content)["id"]; response = sendJsonReq("https://api.mojang.com/user/profiles/", oldOwnerUUID + "/names", "", "", Method.GET, ""); int i = 0; JArray responseString = JsonConvert.DeserializeObject <JArray>(response.Content); foreach (var payload in responseString) { var stuff = (string)payload["name"]; if (stuff.ToLower() == nameSniped.ToLower()) { list.Add(i); } i++; } } catch (Exception e) { MessageBox.Show("An error has occured. Check that the name isn't a reclaim or not avaliable and try again.", "Error"); Application.Exit(); } try { var time2 = DateTimeOffset.FromUnixTimeMilliseconds(Convert.ToInt64((string)JArray.Parse(response.Content)[list[list.Count - 1] + 1]["changedToAt"]) + 3196800000).AddMilliseconds(0 - getPing("api.mojang.com")); time = time2.ToLocalTime().DateTime; if (multithread) { int i = 0; Parallel.For(0, threads, (p) => timerThread(p)); System.Timers.Timer t = new System.Timers.Timer((time - DateTime.Now).TotalMilliseconds + 28000 - getPing("api.mojang.com")); t.AutoReset = false; t.Elapsed += checkForFail; t.Enabled = true; } else { System.Timers.Timer t = new System.Timers.Timer((time - DateTime.Now).TotalMilliseconds - 2000 - getPing("api.mojang.com")); t.AutoReset = false; t.Elapsed += TimerElapsed; t.Enabled = true; } } catch (Exception e) { MessageBox.Show("An error has occured. Check that the name isn't a reclaim and try again.", "Error"); Application.Exit(); } }