Use more granular file opening

This commit is contained in:
Matt Nadareski
2022-12-22 22:03:32 -08:00
parent e2098f6f71
commit 63948767ef
44 changed files with 44 additions and 44 deletions

View File

@@ -17,7 +17,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -19,7 +19,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -20,7 +20,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -19,7 +19,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -20,7 +20,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -19,7 +19,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -20,7 +20,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -19,7 +19,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -25,7 +25,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -19,7 +19,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -17,7 +17,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -19,7 +19,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -18,7 +18,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -19,7 +19,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -19,7 +19,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -18,7 +18,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -20,7 +20,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -18,7 +18,7 @@ namespace BurnOutSharp.FileType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -57,7 +57,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -36,7 +36,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -46,7 +46,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -40,7 +40,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -47,7 +47,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -81,7 +81,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -39,7 +39,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -64,7 +64,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -35,7 +35,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -37,7 +37,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -40,7 +40,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -55,7 +55,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -39,7 +39,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -48,7 +48,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -31,7 +31,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -45,7 +45,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -52,7 +52,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -32,7 +32,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -71,7 +71,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -36,7 +36,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -72,7 +72,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -72,7 +72,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -35,7 +35,7 @@ namespace BurnOutSharp.PackerType
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}

View File

@@ -259,7 +259,7 @@ namespace BurnOutSharp
// Open the file and begin scanning
try
{
using (FileStream fs = File.OpenRead(file))
using (FileStream fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return GetInternalProtections(file, fs);
}

View File

@@ -541,7 +541,7 @@ namespace BurnOutSharp.Tools
{
try
{
using (Stream fileStream = File.OpenRead(file))
using (Stream fileStream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
var pex = PortableExecutable.Create(fileStream);
return GetInternalVersion(pex);

View File

@@ -207,7 +207,7 @@ namespace Test
/// </summary>
private static void PrintFileInfo(string file)
{
using (Stream stream = File.OpenRead(file))
using (Stream stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
// Read the first 4 bytes
byte[] magic = stream.ReadBytes(4);