Skip to content

Commit ca23650

Browse files
author
John
committed
Fixed the savegame.unencrypted path issue
1 parent 7f678a3 commit ca23650

File tree

5 files changed

+17
-32
lines changed

5 files changed

+17
-32
lines changed

DoomEternal.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class DoomEternal
1414
public const int SteamGameID = 782330;
1515
public static string SteamSavePath = Path.Combine(Utilities.GetSteamPath(), "userdata");
1616
public static string BnetSavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Saved Games", "id Software", "DOOMEternal", "base", "savegame");
17+
public static string BnetSavePathUnencrypted = Path.Combine(BnetSavePath, "savegame.unencrypted", Environment.UserName);
1718

1819
public const string BackupPassword = "doometernalbackup";
1920

@@ -22,7 +23,7 @@ public class DoomEternal
2223
public static void EnumerateSaves() {
2324
Saves = new DoomEternalSaveCollection();
2425
if (Directory.Exists(BnetSavePath)) {
25-
Saves.Add(new DoomEternalSave("savegame.unencrypted", BnetSavePath, DoomEternalSavePlatform.BethesdaNet));
26+
Saves.Add(new DoomEternalSave("savegame.unencrypted", BnetSavePathUnencrypted, DoomEternalSavePlatform.BethesdaNet));
2627
foreach (var single in Directory.GetDirectories(BnetSavePath, "*.*", SearchOption.TopDirectoryOnly)) {
2728
if (Utilities.CheckUUID(Path.GetFileNameWithoutExtension(single)))
2829
Saves.Add(new DoomEternalSave(Path.GetFileNameWithoutExtension(single), BnetSavePath, DoomEternalSavePlatform.BethesdaNet));

Form1.cs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@ public Form1() {
1313

1414
private void Form1_Load(object sender, EventArgs e) {
1515
DoomEternal.EnumerateSaves();
16-
bool res = false;
17-
// add tabs back if the games exist
18-
if(Directory.Exists(DoomEternal.BnetSavePath) || Directory.Exists(DoomEternal.SteamSavePath)) {
19-
res = true;
20-
}
21-
if(!res) {
16+
17+
if(!Directory.Exists(DoomEternal.BnetSavePath) && !Directory.Exists(DoomEternal.BnetSavePathUnencrypted) && !Directory.Exists(DoomEternal.SteamSavePath)) {
2218
MessageBox.Show("DOOM Eternal wasn't found on your computer!\r\nThe program will now exit...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
2319
Application.Exit();
2420
}
@@ -37,8 +33,7 @@ private void actionOkBtn_Click(object sender, EventArgs e) {
3733
var suf = new SelectForm("Select Import Destination");
3834
if (suf.ShowDialog() == DialogResult.OK) {
3935
if (suf.SelectedSave.Identifier == "savegame.unencrypted") {
40-
// Directory.CreateDirectory(Path.Combine(DoomEternal.SavePath, "savegame.unencrypted"));
41-
Utilities.Unarchive(ofd.FileName, Path.Combine(DoomEternal.BnetSavePath, "savegame.unencrypted"));
36+
Utilities.Unarchive(ofd.FileName, DoomEternal.BnetSavePathUnencrypted);
4237
} else {
4338
if (suf.SelectedSave.Platform == DoomEternalSavePlatform.BethesdaNet) {
4439
Directory.CreateDirectory("tmp");
@@ -57,7 +52,7 @@ private void actionOkBtn_Click(object sender, EventArgs e) {
5752
}
5853
}
5954
break;
60-
}
55+
}
6156
case "Export Backup": {
6257
var suf = new SelectForm("Select Export Source");
6358
if(suf.ShowDialog() == DialogResult.OK) {
@@ -69,7 +64,7 @@ private void actionOkBtn_Click(object sender, EventArgs e) {
6964
sfd.FileName = "backup.zip";
7065
if (sfd.ShowDialog() == DialogResult.OK) {
7166
if (suf.SelectedSave.Identifier == "savegame.unencrypted") {
72-
Utilities.Archive(sfd.FileName, Path.Combine(DoomEternal.BnetSavePath, "savegame.unencrypted"));
67+
Utilities.Archive(sfd.FileName, DoomEternal.BnetSavePathUnencrypted);
7368
} else {
7469
if(suf.SelectedSave.Platform == DoomEternalSavePlatform.BethesdaNet) {
7570
Directory.CreateDirectory("tmp");
@@ -88,21 +83,21 @@ private void actionOkBtn_Click(object sender, EventArgs e) {
8883
}
8984
}
9085
break;
91-
}
86+
}
9287
case "Transfer": {
9388
var tf = new TransferForm();
9489
if(tf.ShowDialog() == DialogResult.OK) {
9590
// messy :'(
9691
if (tf.SrcSave.Identifier == "savegame.unencrypted") {
9792
if (tf.DstSave.Platform == DoomEternalSavePlatform.BethesdaNet)
98-
DoomEternal.BnetBulkEncrypt(Path.Combine(DoomEternal.BnetSavePath, "savegame.unencrypted"), tf.DstSave.Identifier);
93+
DoomEternal.BnetBulkEncrypt(DoomEternal.BnetSavePathUnencrypted, tf.DstSave.Identifier);
9994
else if (tf.DstSave.Platform == DoomEternalSavePlatform.Steam)
100-
DoomEternal.SteamBulkEncrypt(Path.Combine(DoomEternal.BnetSavePath, "savegame.unencrypted"), tf.DstSave.Identifier);
95+
DoomEternal.SteamBulkEncrypt(DoomEternal.BnetSavePathUnencrypted, tf.DstSave.Identifier);
10196
} else if (tf.DstSave.Identifier == "savegame.unencrypted") {
10297
if (tf.SrcSave.Platform == DoomEternalSavePlatform.BethesdaNet)
103-
DoomEternal.BnetBulkDecrypt(tf.SrcSave.Identifier, Path.Combine(DoomEternal.BnetSavePath, "savegame.unencrypted"));
98+
DoomEternal.BnetBulkDecrypt(tf.SrcSave.Identifier, DoomEternal.BnetSavePathUnencrypted);
10499
else if (tf.SrcSave.Platform == DoomEternalSavePlatform.Steam)
105-
DoomEternal.SteamBulkDecrypt(tf.SrcSave.Identifier, Path.Combine(DoomEternal.BnetSavePath, "savegame.unencrypted"));
100+
DoomEternal.SteamBulkDecrypt(tf.SrcSave.Identifier, DoomEternal.BnetSavePathUnencrypted);
106101
} else {
107102
if (tf.SrcSave.Platform == DoomEternalSavePlatform.BethesdaNet && tf.DstSave.Platform == DoomEternalSavePlatform.BethesdaNet) // bnet to bnet
108103
DoomEternal.BnetBulkTransfer(tf.SrcSave.Identifier, tf.DstSave.Identifier);
@@ -116,7 +111,7 @@ private void actionOkBtn_Click(object sender, EventArgs e) {
116111
MessageBox.Show("Transfer success!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
117112
}
118113
break;
119-
}
114+
}
120115
}
121116
}
122117
}

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.2.0.1")]
36-
[assembly: AssemblyFileVersion("1.2.0.1")]
35+
[assembly: AssemblyVersion("1.2.0.2")]
36+
[assembly: AssemblyFileVersion("1.2.0.2")]

SelectForm.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ private void SelectForm_Load(object sender, EventArgs e) {
2020
if (selectComboBox.Items.Count > 0) {
2121
selectComboBox.SelectedIndex = 0;
2222
}
23-
if (!Directory.Exists(Path.Combine(DoomEternal.BnetSavePath, "savegame.unencrypted"))) {
24-
selectComboBox.Items.Remove("savegame.unencrypted");
25-
}
2623
}
2724

2825
private void selectOkBtn_Click(object sender, EventArgs e) {

TransferForm.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@ private void TransferForm_Load(object sender, EventArgs e) {
2020
DoomEternal.EnumerateSaves();
2121
uids = DoomEternal.Saves.GetIdentifiers();
2222

23-
if (!Directory.Exists(Path.Combine(DoomEternal.BnetSavePath, "savegame.unencrypted")))
24-
srcComboBox.Items.Remove("savegame.unencrypted");
2523
srcComboBox.Items.AddRange(uids);
2624

2725
dstComboBox.Items.AddRange(uids);
28-
//dstComboBox.Items.Add("savegame.unencrypted");
2926

3027
if (srcComboBox.Items.Count > 0)
3128
srcComboBox.SelectedIndex = 0;
@@ -44,7 +41,7 @@ private void transferOkBtn_Click(object sender, EventArgs e) {
4441
}
4542

4643
if(SrcSave.Platform == DoomEternalSavePlatform.BethesdaNet) {
47-
if (!Directory.Exists(Path.Combine(DoomEternal.BnetSavePath, SrcSave.Identifier))) {
44+
if (!Directory.Exists(Path.Combine(DoomEternal.BnetSavePath, SrcSave.Identifier)) && !Directory.Exists(Path.Combine(DoomEternal.BnetSavePathUnencrypted, SrcSave.Identifier))) {
4845
MessageBox.Show("Source directory doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
4946
return;
5047
}
@@ -56,7 +53,7 @@ private void transferOkBtn_Click(object sender, EventArgs e) {
5653
}
5754

5855
if (DstSave.Platform == DoomEternalSavePlatform.BethesdaNet) {
59-
if (!Directory.Exists(Path.Combine(DoomEternal.BnetSavePath, DstSave.Identifier))) {
56+
if (!Directory.Exists(Path.Combine(DoomEternal.BnetSavePath, DstSave.Identifier)) && !Directory.Exists(Path.Combine(DoomEternal.BnetSavePathUnencrypted, DstSave.Identifier))) {
6057
MessageBox.Show("Destination directory doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
6158
return;
6259
}
@@ -67,11 +64,6 @@ private void transferOkBtn_Click(object sender, EventArgs e) {
6764
}
6865
}
6966

70-
//if(dstComboBox.Text == "savegame.unencrypted") {
71-
// if (!Directory.Exists(Path.Combine(DoomEternal.BnetSavePath, dstComboBox.Text)))
72-
// Directory.CreateDirectory(Path.Combine(DoomEternal.BnetSavePath, dstComboBox.Text));
73-
//}
74-
7567
DialogResult = DialogResult.OK;
7668
}
7769

0 commit comments

Comments
 (0)