public bool SaveChanges(bool JustMemory = false, string path = "") { if (path == "" || path == null) { SaveFileDialog SFD = new SaveFileDialog { DefaultExt = ".sav", Filter = "T2 Save (.sav)|*.sav|All files (*.*)|*.*", FileName = (loadedSave.FilePath == null) ? loadedSave.TempName : System.IO.Path.GetFileNameWithoutExtension(loadedSave.FilePath) }; if (SFD.ShowDialog() == DialogResult.OK) { path = SFD.FileName; loadedSave.name = this.fieldSaveName.Text; loadedSave.lives = (int)this.fieldBuzzLives.Value; loadedSave.health = (int)this.fieldBuzzHealth.Value; loadedSave.health = (int)this.fieldBuzzHealth.Value; loadedSave.cameratype = (radioCameraActive.Checked) ? 192 : 128; loadedSave.musicVolume = trackMusic.Value; loadedSave.soundVolume = trackSound.Value; loadedSave.lastlevel = (int)fieldLastLevel.Value; loadedSave.tokensraw = F_Save.ConvertBinTokensToRawTokens(loadedSave.tokens); loadedSave.unlocksraw = F_Save.TokUnlockToInt(loadedSave.unlocks); if (JustMemory == false) { return(loadedSave.Export(path ?? loadedSave.FilePath)); } } } return(false); }
/// <summary> /// [<seealso cref="Main.Unsafe"/>] This function does not do any saftey checks and you must contract integrity yourself /// </summary> /// <param name="file">The file to load into the visual editor</param> public void LoadFile(F_Save save) { loadedSave = save; this.fieldSaveName.Text = save.name; this.fieldBuzzLives.Value = save.lives; this.fieldBuzzHealth.Value = save.health; this.t2Control_HealthMeter1.Health = save.health; this.toggleBuzzGod.Checked = save.health > 32766; radioCameraActive.Checked = (save.cameratype == (int)F_Save.CameraType.active); labelMusicVolume.Text = "Music Volume: " + save.musicVolume.ToString(); trackMusic.Value = save.musicVolume; labelSoundVolume.Text = "Sound Volume: " + save.soundVolume.ToString(); trackSound.Value = save.soundVolume; fieldLevel.SelectedIndex = 0; }
public T2Control_SaveEditor(F_Save file) { InitializeComponent(); this.Dock = DockStyle.Fill; this.t2Control_HealthMeter1.HealthChanged += new EventHandler(HealthBarChanged); LoadFile(file); checkTokHamm.MouseUp += tokenMouseUp; checkTokCollect.MouseUp += tokenMouseUp; checkTokRC.MouseUp += tokenMouseUp; checkTokMyst.MouseUp += tokenMouseUp; checkTokBoss.MouseUp += tokenMouseUp; toggleInvisibleTokens.MouseUp += tokenMouseUp; checkUnlockShield.MouseUp += unlockMouseUp; checkUnlockRocket.MouseUp += unlockMouseUp; checkUnlockDisc.MouseUp += unlockMouseUp; checkUnlockHover.MouseUp += unlockMouseUp; checkUnlockGrapple.MouseUp += unlockMouseUp; }
F_Save loadedSave = null; //THIS IS NOT A NEW SAVE IT IS A REFERENCE /// <summary> /// [<seealso cref="Main.Unsafe"/>] This function does not do any saftey checks and you must contract any integrity yourself /// </summary> /// <param name="file">The file to load into the visual editor</param> public void LoadFile(F_Save save) { loadedSave = save; //trackMusic.BackColor = XF.GetTransparentColor(this); this.fieldSaveName.Text = save.name; this.fieldBuzzLives.Value = save.lives; this.fieldBuzzHealth.Value = save.health; this.t2Control_HealthMeter1.Health = save.health; this.t2Control_HealthMeter1.CalculateHealth(save.health); this.toggleBuzzGod.Checked = save.health > 32766; radioCameraActive.Checked = (save.cameratype == (int)F_Save.CameraType.active); labelMusicVolume.Text = "Music Volume: " + save.musicVolume.ToString(); trackMusic.Value = save.musicVolume; labelSoundVolume.Text = "Sound Volume: " + save.soundVolume.ToString(); trackSound.Value = save.soundVolume; fieldLastLevel.Value = save.lastlevel; fieldLevel.SelectedIndex = 0; fieldMovies.Items[0].Checked = true; }
/// <summary>Process and Return a file based on a file path. Returns <seealso cref="F_Base"/>, you MUST cast it yourself using the correct cast.</summary> /// <param name="path"></param> public static F_Base ProcessFile(string path) { string ext = Path.GetExtension(path).ToLower(); F_Base file; if (ext == ".ngn") { file = new F_NGN().Import(path); } else if (ext == ".sav") { file = F_Save.ImportSave(path); } else { //throw new TypeInitializationException("None", null); file = null; } return(file); }
public static F_Base CreateFile(FileTypes fileType, TabController tabController, string fileName = "") { F_Base file; if (fileType == FileTypes.NGN) { file = new F_NGN(); } else if (fileType == FileTypes.Save) { file = new F_Save(true); } else { file = null; throw new TypeInitializationException("None", null); } if (fileName == "") { file.TempName = TabController.CalculateUntitledTabName(fileType, tabController); } return(file); }
private void butSetSaveNameTL_Click(object sender, EventArgs e) { fieldSaveName.Text = "TOK " + F_Save.GetTokenCount(F_Save.ConvertBinTokensToRawTokens(loadedSave.tokens)) + " LEV " + fieldLastLevel.Value.ToString(); }