private void ResetButton_Click(object sender, System.EventArgs e) { var savegame = RegistryHandler.Load(); if (savegame == null) { MessageBox.Show("There is no saved Profile!", "No Savegame found", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("The active profile will be DELETED!\nDo you want to DELETE the active profile?\n", "DELETE profile?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) != DialogResult.Yes) { return; } RegistryHandler.Save(null); }
private void SaveButton_Click(object sender, System.EventArgs e) { var savegame = RegistryHandler.Load(); if (savegame == null) { MessageBox.Show("There is no Game to Save!", "Saved game not found!", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } using (var dialog = new SaveFileDialog()) { dialog.Filter = "Train Valley Savegame|*.tv2"; dialog.Title = "Save Train Valley profile"; dialog.ShowDialog(); if (!string.IsNullOrWhiteSpace(dialog.FileName)) { File.WriteAllBytes(dialog.FileName, savegame); } } MessageBox.Show("File saved!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); }