public static void LoadActiveTable() { GlobalWin.Sound.StopSound(); OpenFileDialog OpenFileDialog1 = new OpenFileDialog(); OpenFileDialog1.DefaultExt = "act"; OpenFileDialog1.Title = "Open ActiveTable File"; OpenFileDialog1.Filter = "ACT files|*.act"; OpenFileDialog1.RestoreDirectory = true; if (OpenFileDialog1.ShowDialog() == DialogResult.OK) { currentFilename = OpenFileDialog1.FileName.ToString(); } else { GlobalWin.Sound.StartSound(); return; } FileStream FS; BinaryFormatter bformatter = new BinaryFormatter(); FS = File.Open(currentFilename, FileMode.OpenOrCreate); ActiveTableObject act = (ActiveTableObject)bformatter.Deserialize(FS); FS.Close(); SetActiveTable(act); GlobalWin.Sound.StartSound(); }
public static void SetActiveTable(ActiveTableObject act) { FirstInit = true; ActiveTableGenerated = act.data; ActiveTableReady = true; RTC_Core.coreForm.lbFreezeEngineActiveTableSize.Text = "Active table size: " + ActiveTableGenerated.Length.ToString(); RTC_Core.coreForm.cbFreezeEngineActive.Checked = true; }
public static void SaveActiveTable(bool IsQuickSave) { GlobalWin.Sound.StopSound(); GC.Collect(); GC.WaitForPendingFinalizers(); if (!IsQuickSave) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.DefaultExt = "act"; saveFileDialog1.Title = "Save ActiveTable File"; saveFileDialog1.Filter = "ACT files|*.act"; saveFileDialog1.RestoreDirectory = true; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { currentFilename = saveFileDialog1.FileName; //sks.ShortFilename = sks.Filename.Substring(sks.Filename.LastIndexOf("\\") + 1, sks.Filename.Length - (sks.Filename.LastIndexOf("\\") + 1)); } else { GlobalWin.Sound.StartSound(); return; } } ActiveTableObject act = new ActiveTableObject(ActiveTableGenerated); FileStream FS; BinaryFormatter bformatter = new BinaryFormatter(); FS = File.Open(currentFilename, FileMode.OpenOrCreate); bformatter.Serialize(FS, act); FS.Close(); GC.Collect(); GC.WaitForPendingFinalizers(); GlobalWin.Sound.StartSound(); }
public static void SubstractActiveTable() { GlobalWin.Sound.StopSound(); string tempFilename; OpenFileDialog OpenFileDialog1 = new OpenFileDialog(); OpenFileDialog1.DefaultExt = "act"; OpenFileDialog1.Title = "Open ActiveTable File"; OpenFileDialog1.Filter = "ACT files|*.act"; OpenFileDialog1.RestoreDirectory = true; if (OpenFileDialog1.ShowDialog() == DialogResult.OK) { tempFilename = OpenFileDialog1.FileName.ToString(); } else { return; } FileStream FS; BinaryFormatter bformatter = new BinaryFormatter(); FS = File.Open(tempFilename, FileMode.OpenOrCreate); ActiveTableObject act = (ActiveTableObject)bformatter.Deserialize(FS); FS.Close(); long[] substractiveActiveTable = act.data; List <long> newActiveTable = new List <long>(); GC.Collect(); GC.WaitForPendingFinalizers(); foreach (long item in ActiveTableGenerated) { bool found = false; foreach (long testItem in substractiveActiveTable) { if (item == testItem) { found = true; break; } } if (!found) { newActiveTable.Add(item); } } ActiveTableGenerated = newActiveTable.ToArray(); RTC_Core.coreForm.lbFreezeEngineActiveTableSize.Text = "Active table size: " + ActiveTableGenerated.Length.ToString(); GC.Collect(); GC.WaitForPendingFinalizers(); GlobalWin.Sound.StartSound(); }