private void OnCreateProfile(object sender, RoutedEventArgs e) { //grab data string email = RegisterEmail.Text; string password = RegisterPassword.Text; string nickname = RegisterNickname.Text; string side = RegisterSide.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem: ", ""); //Create account ProfileSettings.AddProfile(email, password); //create folder int ID = ProfileSettings.GetProfile(email, password); string path = laucherSettings.GetServerLocation() + "/data/profiles"; string charactersJSON = "/character_" + ID + ".json"; Directory.CreateDirectory(Path.GetDirectoryName(path + charactersJSON)); //put contents into created files Uri charactersDefault = new Uri("pack://application:,,,/Resources/Data/characterDefault.json"); Tools.SaveFileStream(charactersDefault, path + charactersJSON); //edit character and release it path = path + charactersJSON; ProfileCharacters tempCharacter = new ProfileCharacters(path); tempCharacter.ChangeNickname(nickname); tempCharacter.ChangeSide(side); tempCharacter.SetProfileID(ID); tempCharacter = null;//remove temp characters data HideAllGrids(); LoginGrid.Visibility = Visibility.Visible; }
private void OnLogin(object sender, RoutedEventArgs e) { if (!ErrorHandler.isError(102)) { if (ProfileSettings.ListExists()) { if (ProfileSettings.CheckLoginApprove(LoginEmail.Text, LoginPassword.Text)) { //LoggedProfile = new ProfileSettings(Path.Combine(laucherSettings.GetServerLocation(), "data/profiles/" + ProfileSettings.GetProfile(LoginEmail.Text, LoginPassword.Text).ToString())); Set_LoginToken(LoginEmail.Text, LoginPassword.Text, true, 0); Characters = new ProfileCharacters(laucherSettings.GetServerLocation() + "/data/profiles/character_" + ProfileSettings.GetProfile(LoginToken.email, LoginToken.password) + ".json"); HideAllGrids(); AccountSettingsGrid.Visibility = Visibility.Visible; LoadAccountSettings(); ErrorHandler.RemoveError(ErrorType.error_noUserLikeThis); //LoggedIn = true; } else { ErrorHandler.AddError(ErrorType.error_noUserLikeThis); } ErrorHandler.RemoveError(ErrorType.error_Server_noLocation); } else { ErrorHandler.AddError(ErrorType.error_Server_noLocation); } } DisplayErrors(); }