public Position Load() { if (File.Exists(Position.fileName)) { string json_ = File.ReadAllText(Position.fileName); Position result = JsonConvert.DeserializeObject <Position>(json_); return(result); } else { RegistrationForm.MessageShow("Position.json isn't exist.", "Info", MessageBoxButtons.OK); return(null); } }
public Rotate Load() { if (File.Exists(Rotate.fileName)) { string json_ = File.ReadAllText(Rotate.fileName); Rotate result = new Rotate(); result = JsonConvert.DeserializeObject <Rotate>(json_); return(result); } else { RegistrationForm.MessageShow("Rotate.json isn't exist.", "Info", MessageBoxButtons.OK); return(null); } }
public AuthService Load(AuthService authService) { if (File.Exists(fileName)) { string json_ = File.ReadAllText(fileName); AuthService result = new AuthService(); result.users = JsonConvert.DeserializeObject <List <Auth> >(json_); return(result); } else { RegistrationForm.MessageShow("Users.json isn't exist.", "Info", MessageBoxButtons.OK); return(null); } }
public BackgroundAudio Load(BackgroundAudio backgroundAudio) { if (File.Exists(BackgroundAudio.JsonPathSave)) { string json_ = File.ReadAllText(BackgroundAudio.JsonPathSave); BackgroundAudio result = new BackgroundAudio(); result = JsonConvert.DeserializeObject <BackgroundAudio>(json_); return(result); } else { RegistrationForm.MessageShow("Users.json isn't exist.", "Info", MessageBoxButtons.OK); return(null); } }
public void Registration(string name, string password) { if (name == String.Empty && name.Count() < 3) { RegistrationForm.MessageShow("Register name error.", "Info", MessageBoxButtons.OK); return; } if (password == String.Empty && password.Count() < 8) { RegistrationForm.MessageShow("Register password error.", "Info", MessageBoxButtons.OK); return; } foreach (Auth user in users) { if (name == user.Name) { RegistrationForm.MessageShow("This name already exists.", "Info", MessageBoxButtons.OK); return; } } users.Add(new Auth(name, password)); }
public void Login(string name, string password) { if (name == String.Empty && name.Count() < 3) { RegistrationForm.MessageShow("Register name error.", "Info", MessageBoxButtons.OK); return; } if (password == String.Empty && password.Count() < 8) { RegistrationForm.MessageShow("Register password error.", "Info", MessageBoxButtons.OK); return; } foreach (Auth user in users) { if (name == user.Name) { if (user.Password == password) { current_user = new Auth(); current_user = user; RegistrationForm.MessageShow("Successful auth.", "Info", MessageBoxButtons.OK); RegistrationForm.MyForm.Close(); LoginForm.MyForm.Close(); Launcher.MyForm.Visible = false; GameMenu gameMenu = new GameMenu(); gameMenu.Show(); return; } else { RegistrationForm.MessageShow("Uncorrect password.", "Info", MessageBoxButtons.OK); return; } } } RegistrationForm.MessageShow("There is no user like you try to enter. Please check registration form.", "Info", MessageBoxButtons.OK); }