Skip to content

Commit

Permalink
Export original and plaintext save files
Browse files Browse the repository at this point in the history
  • Loading branch information
Razzmatazzz committed Aug 3, 2023
1 parent a7ebcd7 commit 9934ef5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion RemnantSaveGuardian/Views/Pages/WorldAnalyzerPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ private void GameType_CollapsedExpanded(object sender, RoutedEventArgs e)
private void SavePlaintextButton_Click(object sender, RoutedEventArgs e)
{
System.Windows.Forms.FolderBrowserDialog openFolderDialog = new System.Windows.Forms.FolderBrowserDialog();
//openFolderDialog.SelectedPath = Properties.Settings.Default.GameFolder;
openFolderDialog.Description = Loc.T("Export save files as plaintext");
openFolderDialog.UseDescriptionForTitle = true;
System.Windows.Forms.DialogResult result = openFolderDialog.ShowDialog();
Expand All @@ -110,10 +109,13 @@ private void SavePlaintextButton_Click(object sender, RoutedEventArgs e)
return;
}
File.WriteAllText($@"{openFolderDialog.SelectedPath}\profile.txt", Save.GetProfileData());
File.Copy(Save.SaveProfilePath, $@"{openFolderDialog.SelectedPath}\profile.sav", true);
foreach (var filePath in Save.WorldSaves)
{
File.WriteAllText($@"{openFolderDialog.SelectedPath}\{filePath.Substring(filePath.LastIndexOf(@"\")).Replace(".sav", ".txt")}", RemnantSave.DecompressSaveAsString(filePath));
File.Copy(filePath, $@"{openFolderDialog.SelectedPath}\{filePath.Substring(filePath.LastIndexOf(@"\"))}", true);
}
Logger.Success(Loc.T($"Exported save files successfully to {openFolderDialog.SelectedPath}"));
}

private void Default_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion RemnantSaveGuardian/locales/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion RemnantSaveGuardian/locales/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
<value>Exit the game before restoring a save backup.</value>
</data>
<data name="Export save files as plaintext" xml:space="preserve">
<value>Export save files as plaintext</value>
<value>Export save files</value>
</data>
<data name="Game Folder" xml:space="preserve">
<value>Game Folder</value>
Expand Down

0 comments on commit 9934ef5

Please sign in to comment.