Esempio n. 1
0
        private static void CreateErrorWindow(ErrorFromServer errorFromServer, Console windowToReturnFocusTo)
        {
            ErrorWindow errorWindow = new ErrorWindow(60, 14, errorFromServer.Message, errorFromServer.ErrorId.ToString(), windowToReturnFocusTo);

            errorWindow.TitleAlignment = HorizontalAlignment.Center;
            errorWindow.Title          = "Server Error";
            errorWindow.CanDrag        = true;
            errorWindow.IsVisible      = true;
            errorWindow.UseKeyboard    = true;
            errorWindow.CenterWithinParent();
        }
Esempio n. 2
0
        private static void CreateAccount2()
        {
            //Steamworks.SteamAPI.Init();
            string steamId = Steamworks.SteamUser.GetSteamID().ToString();

            //var newUser = new AccountData() { SteamAccountId = "Babster", aType = AccountData.ActionType.CreateUser };
            ServerAuth.RegisterBindingModel newUser = new ServerAuth.RegisterBindingModel();
            newUser.Email           = steamId;
            newUser.DisplayName     = Steamworks.SteamFriends.GetPersonaName();
            newUser.Name            = newUser.DisplayName;
            newUser.SteamId         = steamId;
            newUser.Password        = "";
            newUser.ConfirmPassword = "";

            using (var client = new HttpClient())
            {
                ServerAuth.RegisterBindingModel model = new ServerAuth.RegisterBindingModel();
                var postTask = client.PostAsJsonAsync <ServerAuth.RegisterBindingModel>(ServerAuth.ServerAddress + "/api/Account/Register", newUser);
                postTask.Wait();

                var result = postTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var resString = result.Content.ReadAsStringAsync().Result;
                    ServerAuth.RegisterBindingModel insertedUser = JsonConvert.DeserializeObject <ServerAuth.RegisterBindingModel>(resString);
                    Console.WriteLine("Account {0} inserted with additional data: {1}", insertedUser.SteamId, insertedUser.Password);
                    System.IO.File.WriteAllText("pwd.txt", insertedUser.Password);
                }
                else
                {
                    var             resString = result.Content.ReadAsStringAsync().Result;
                    ErrorFromServer res       = JsonConvert.DeserializeObject <ErrorFromServer>(resString);
                    Console.WriteLine("Error registering account: {0}", res.ExceptionMessage);
                }
            }

            Console.WriteLine("*********************************");
            Console.WriteLine("");
        }
Esempio n. 3
0
 public GetAccessTokenResult(bool success, AccessToken token, ErrorFromServer error)
 {
     this.Success = success;
     this.Token   = token;
     this.Error   = error;
 }