Skip to content

Commit 99f4909

Browse files
authored
Missing or moved files shouldn't cause an issue (#5)
1 parent 482644a commit 99f4909

File tree

14 files changed

+36
-29
lines changed

14 files changed

+36
-29
lines changed

BurnOutSharp/BurnOutSharp.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>BurnOutSharp</id>
5-
<version>1.03.8.1</version>
5+
<version>1.03.8.2</version>
66
<title>BurnOutSharp</title>
77
<authors>Matt Nadareski, Gernot Knippen</authors>
88
<owners>Matt Nadareski, Gernot Knippen</owners>

BurnOutSharp/EVORE.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private struct Section
3737

3838
private static Process StartSafe(string file)
3939
{
40-
if (file == null)
40+
if (file == null || !File.Exists(file))
4141
return null;
4242

4343
Process startingprocess = new Process();
@@ -59,7 +59,7 @@ private static Process StartSafe(string file)
5959

6060
private static string MakeTempFile(string file, string sExtension = ".exe")
6161
{
62-
if (file == null)
62+
if (file == null || !File.Exists(file))
6363
return string.Empty;
6464

6565
FileInfo filei = new FileInfo(file);
@@ -75,7 +75,7 @@ private static string MakeTempFile(string file, string sExtension = ".exe")
7575

7676
private static bool IsEXE(string file)
7777
{
78-
if (file == null)
78+
if (file == null || !File.Exists(file))
7979
return false;
8080

8181
BinaryReader breader = new BinaryReader(File.OpenRead(file));
@@ -199,7 +199,7 @@ private static uint RVA2Offset(uint RVA, Section[] sections)
199199

200200
public static string SearchProtectDiscVersion(string file)
201201
{
202-
if (file == null)
202+
if (file == null || !File.Exists(file))
203203
return string.Empty;
204204

205205
Process exe = new Process();
@@ -357,7 +357,7 @@ public static string SearchProtectDiscVersion(string file)
357357

358358
public static string SearchSafeDiscVersion(string file)
359359
{
360-
if (file == null)
360+
if (file == null || !File.Exists(file))
361361
return string.Empty;
362362

363363
Process exe = new Process();

BurnOutSharp/ProtectionType/CDCops.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static string CheckPath(string path, IEnumerable<string> files, bool isDi
4949

5050
private static string GetVersion(string file, int position)
5151
{
52-
if (file == null)
52+
if (file == null || !File.Exists(file))
5353
return string.Empty;
5454

5555
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))

BurnOutSharp/ProtectionType/DVDCops.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static string CheckContents(string file, string fileContent)
1515

1616
private static string GetVersion(string file, int position)
1717
{
18-
if (file == null)
18+
if (file == null || !File.Exists(file))
1919
return string.Empty;
2020

2121
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))

BurnOutSharp/ProtectionType/InnoSetup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static string CheckContents(string file, string fileContent)
1717

1818
private static string GetVersion(string file)
1919
{
20-
if (file == null)
20+
if (file == null || !File.Exists(file))
2121
return string.Empty;
2222

2323
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))

BurnOutSharp/ProtectionType/JoWooDXProt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static string CheckContents(string file, string fileContent)
2727

2828
private static string GetVersion(string file, int position)
2929
{
30-
if (file == null)
30+
if (file == null || !File.Exists(file))
3131
return string.Empty;
3232

3333
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))

BurnOutSharp/ProtectionType/ProtectDisc.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static string CheckContents(string file, string fileContent)
4141

4242
private static string GetVersionBuild6till8(string file, int position)
4343
{
44-
if (file == null)
44+
if (file == null || !File.Exists(file))
4545
return string.Empty;
4646

4747
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
@@ -93,7 +93,7 @@ private static string GetVersionBuild6till8(string file, int position)
9393
private static string GetVersionBuild76till10(string file, int position, out int irefBuild)
9494
{
9595
irefBuild = 0;
96-
if (file == null)
96+
if (file == null || !File.Exists(file))
9797
return string.Empty;
9898

9999
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))

BurnOutSharp/ProtectionType/SafeDisc.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,22 @@ public static string CheckPath(string path, IEnumerable<string> files, bool isDi
3939
// TODO: These are all cop-outs that don't check the existence of the other files
4040
if (files.Count(f => Path.GetFileName(f).Equals("DPLAYERX.DLL", StringComparison.OrdinalIgnoreCase)) > 0)
4141
{
42-
return GetDPlayerXVersion(path);
42+
string file = files.First(f => Path.GetFileName(f).Equals("DPLAYERX.DLL", StringComparison.OrdinalIgnoreCase));
43+
return GetDPlayerXVersion(file);
4344
}
4445
else if (files.Count(f => Path.GetFileName(f).Equals("drvmgt.dll", StringComparison.OrdinalIgnoreCase)) > 0)
4546
{
46-
return GetDrvmgtVersion(path);
47+
string file = files.First(f => Path.GetFileName(f).Equals("drvmgt.dll", StringComparison.OrdinalIgnoreCase));
48+
return GetDrvmgtVersion(file);
4749
}
4850
else if (files.Count(f => Path.GetFileName(f).Equals("secdrv.sys", StringComparison.OrdinalIgnoreCase)) > 0)
4951
{
50-
return GetSecdrvVersion(path);
52+
string file = files.First(f => Path.GetFileName(f).Equals("secdrv.sys", StringComparison.OrdinalIgnoreCase));
53+
return GetSecdrvVersion(file);
54+
}
55+
else if (path.EndsWith(".SafeDiscDVD.bundle", StringComparison.OrdinalIgnoreCase))
56+
{
57+
return "SafeDisc for Macintosh";
5158
}
5259
}
5360
else
@@ -97,7 +104,7 @@ public static string CheckPath(string path, IEnumerable<string> files, bool isDi
97104

98105
private static string GetDPlayerXVersion(string file)
99106
{
100-
if (file == null)
107+
if (file == null || !File.Exists(file))
101108
return string.Empty;
102109

103110
FileInfo fi = new FileInfo(file);
@@ -125,7 +132,7 @@ private static string GetDPlayerXVersion(string file)
125132

126133
private static string GetDrvmgtVersion(string file)
127134
{
128-
if (file == null)
135+
if (file == null || !File.Exists(file))
129136
return string.Empty;
130137

131138
FileInfo fi = new FileInfo(file);
@@ -153,7 +160,7 @@ private static string GetDrvmgtVersion(string file)
153160

154161
private static string GetSecdrvVersion(string file)
155162
{
156-
if (file == null)
163+
if (file == null || !File.Exists(file))
157164
return string.Empty;
158165

159166
FileInfo fi = new FileInfo(file);
@@ -187,7 +194,7 @@ private static string GetSecdrvVersion(string file)
187194

188195
private static string GetVersion(string file, int position)
189196
{
190-
if (file == null)
197+
if (file == null || !File.Exists(file))
191198
return string.Empty;
192199

193200
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))

BurnOutSharp/ProtectionType/SecuROM.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static string CheckPath(string path, IEnumerable<string> files, bool isDi
8080

8181
private static string GetV4Version(string file, int position)
8282
{
83-
if (file == null)
83+
if (file == null || !File.Exists(file))
8484
return string.Empty;
8585

8686
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
@@ -106,7 +106,7 @@ private static string GetV4Version(string file, int position)
106106

107107
private static string GetV5Version(string file, int position)
108108
{
109-
if (file == null)
109+
if (file == null || !File.Exists(file))
110110
return string.Empty;
111111

112112
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
@@ -135,7 +135,7 @@ private static string GetV5Version(string file, int position)
135135

136136
private static string GetV7Version(string file)
137137
{
138-
if (file == null)
138+
if (file == null || !File.Exists(file))
139139
return string.Empty;
140140

141141
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))

BurnOutSharp/ProtectionType/SolidShield.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public static string CheckPath(string path, IEnumerable<string> files, bool isDi
131131

132132
private static string GetVersion(string file, int position)
133133
{
134-
if (file == null)
134+
if (file == null || !File.Exists(file))
135135
return string.Empty;
136136

137137
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))

0 commit comments

Comments
 (0)