Skip to content

Commit 3634730

Browse files
author
John Dong
authored
Merge pull request #4 from theace0296/master
Made checks for both versions to stop exception when battlenet version doesn't exist
2 parents 11a008f + 5a22812 commit 3634730

4 files changed

Lines changed: 18 additions & 13 deletions

File tree

DOOMSaveManager.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
<WarningLevel>4</WarningLevel>
4949
</PropertyGroup>
5050
<ItemGroup>
51-
<Reference Include="BouncyCastle.Crypto">
52-
<HintPath>lib\BouncyCastle.Crypto.dll</HintPath>
51+
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
52+
<HintPath>packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
5353
</Reference>
5454
<Reference Include="ICSharpCode.SharpZipLib, Version=1.2.0.246, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
5555
<HintPath>packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>

DoomEternal.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,22 @@ public class DoomEternal
2121

2222
public static void EnumerateSaves() {
2323
Saves = new DoomEternalSaveCollection();
24-
foreach(var single in Directory.GetDirectories(BnetSavePath, "*.*", SearchOption.TopDirectoryOnly)) {
25-
if(Utilities.CheckUUID(Path.GetFileNameWithoutExtension(single)))
26-
Saves.Add(new DoomEternalSave(Path.GetFileNameWithoutExtension(single), BnetSavePath, DoomEternalSavePlatform.BethesdaNet));
24+
if (Directory.Exists(BnetSavePath)) {
25+
Saves.Add(new DoomEternalSave("savegame.unencrypted", BnetSavePath, DoomEternalSavePlatform.BethesdaNet));
26+
foreach (var single in Directory.GetDirectories(BnetSavePath, "*.*", SearchOption.TopDirectoryOnly)) {
27+
if (Utilities.CheckUUID(Path.GetFileNameWithoutExtension(single)))
28+
Saves.Add(new DoomEternalSave(Path.GetFileNameWithoutExtension(single), BnetSavePath, DoomEternalSavePlatform.BethesdaNet));
29+
}
2730
}
28-
foreach(var steamId3 in Directory.GetDirectories(SteamSavePath, "*.*", SearchOption.TopDirectoryOnly)) {
29-
Console.WriteLine(Path.GetFileNameWithoutExtension(steamId3));
30-
foreach(var single in Directory.GetDirectories(steamId3, "*.*", SearchOption.TopDirectoryOnly)) {
31-
if (Path.GetFileNameWithoutExtension(single) == SteamGameID.ToString())
32-
Saves.Add(new DoomEternalSave((int.Parse(Path.GetFileNameWithoutExtension(steamId3)) + 76561197960265728).ToString(), SteamSavePath, DoomEternalSavePlatform.Steam));
31+
if (Directory.Exists(SteamSavePath)) {
32+
foreach (var steamId3 in Directory.GetDirectories(SteamSavePath, "*.*", SearchOption.TopDirectoryOnly)) {
33+
Console.WriteLine(Path.GetFileNameWithoutExtension(steamId3));
34+
foreach (var single in Directory.GetDirectories(steamId3, "*.*", SearchOption.TopDirectoryOnly)) {
35+
if (Path.GetFileNameWithoutExtension(single) == SteamGameID.ToString())
36+
Saves.Add(new DoomEternalSave((int.Parse(Path.GetFileNameWithoutExtension(steamId3)) + 76561197960265728).ToString(), SteamSavePath, DoomEternalSavePlatform.Steam));
37+
}
3338
}
3439
}
35-
Saves.Add(new DoomEternalSave("savegame.unencrypted", BnetSavePath, DoomEternalSavePlatform.BethesdaNet));
3640
}
3741

3842
#region Bethesda.net
@@ -153,4 +157,4 @@ public static void SteamToBnetTransfer(string fromId, string toId) {
153157
}
154158
#endregion
155159
}
156-
}
160+
}

Form1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private void Form1_Load(object sender, EventArgs e) {
1515
DoomEternal.EnumerateSaves();
1616
bool res = false;
1717
// add tabs back if the games exist
18-
if(Directory.Exists(DoomEternal.BnetSavePath)) {
18+
if(Directory.Exists(DoomEternal.BnetSavePath) || Directory.Exists(DoomEternal.SteamSavePath)) {
1919
res = true;
2020
}
2121
if(!res) {

packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3+
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
34
<package id="SharpZipLib" version="1.2.0" targetFramework="net472" />
45
</packages>

0 commit comments

Comments
 (0)