/// <summary> /// Writes the final changes made by the user. /// </summary> private void WriteFinalisedArchive() { #if !DEBUG try { #endif if (CheckBoxDark_CreateMod.Checked) { // Seed used for randomisation - use anyway, even if not randomised. string seed = TextBoxDark_Seed.Text.UseSafeFormattedCharacters(), // Root of the mod directory. modRoot = Path.Combine(Program.WorkingDirectory, $"Character Swap ({seed})"), // Full path to archives for directory creation. modFullPath = Path.Combine(modRoot, "core", "archives"); // Create mod structure. Directory.CreateDirectory(modFullPath); // Write mod config with seed. ModHelper.WriteConfig(Path.Combine(modRoot, "mod.ini"), seed); // Save archive as mod with swapped characters. LoadedArchive.Save(Path.Combine(modFullPath, "player.arc")); } else { if (CheckBoxDark_OverwriteArchive.Checked) { // Overwrite original archive with swapped characters. LoadedArchive.Save(ArchivePath, true); } else { // Write to new archive with swapped characters. LoadedArchive.Save($"{ArchivePath}.swap", true); } } MarathonMessageBox.Show ( "Finished processing your character swap - have fun!", "Processing Complete", MessageBoxButtons.OK, MessageBoxIcon.Information ); #if !DEBUG } catch (Exception ex) { MarathonMessageBox.Show ( $"Failed to save archive data...\n\n{ex}", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } #endif }