diff --git a/src/BsDiffTool/Program.cs b/src/BsDiffTool/Program.cs index afdb380..bb5879a 100644 --- a/src/BsDiffTool/Program.cs +++ b/src/BsDiffTool/Program.cs @@ -1,31 +1,22 @@ using BsDiff; -namespace BsDiffTool +// check for correct usage +if (args.Length != 3) { - public sealed class Program - { - public static void Main(string[] args) - { - // check for correct usage - if (args.Length != 3) - { - Console.Error.WriteLine("bsdiff oldfile newfile patchfile"); - return; - } + Console.Error.WriteLine("bsdiff oldfile newfile patchfile"); + return; +} - var oldFile = args[0]; - var newFile = args[1]; - var patchFile = args[2]; +var oldFile = args[0]; +var newFile = args[1]; +var patchFile = args[2]; - try - { - using (var output = new FileStream(patchFile, FileMode.Create)) - BinaryPatch.Create(File.ReadAllBytes(oldFile), File.ReadAllBytes(newFile), output); - } - catch (FileNotFoundException ex) - { - Console.Error.WriteLine("Could not open '{0}'.", ex.FileName); - } - } - } +try +{ + using (var output = new FileStream(patchFile, FileMode.Create)) + BinaryPatch.Create(File.ReadAllBytes(oldFile), File.ReadAllBytes(newFile), output); +} +catch (FileNotFoundException ex) +{ + Console.Error.WriteLine("Could not open '{0}'.", ex.FileName); } diff --git a/src/BsPatchTool/Program.cs b/src/BsPatchTool/Program.cs index 57663bb..a0e2d3a 100644 --- a/src/BsPatchTool/Program.cs +++ b/src/BsPatchTool/Program.cs @@ -1,31 +1,23 @@ using BsDiff; -namespace BsPatchTool; - -public sealed class Program +// check for correct usage +if (args.Length != 3) { - public static void Main(string[] args) - { - // check for correct usage - if (args.Length != 3) - { - Console.Error.WriteLine("bsdiff oldfile newfile patchfile"); - return; - } + Console.Error.WriteLine("bsdiff oldfile newfile patchfile"); + return; +} - var oldFile = args[0]; - var newFile = args[1]; - var patchFile = args[2]; +var oldFile = args[0]; +var newFile = args[1]; +var patchFile = args[2]; - try - { - using (var input = new FileStream(oldFile, FileMode.Open, FileAccess.Read, FileShare.Read)) - using (var output = new FileStream(newFile, FileMode.Create)) - BinaryPatch.Apply(input, () => new FileStream(patchFile, FileMode.Open, FileAccess.Read, FileShare.Read), output); - } - catch (FileNotFoundException ex) - { - Console.Error.WriteLine("Could not open '{0}'.", ex.FileName); - } - } +try +{ + using (var input = new FileStream(oldFile, FileMode.Open, FileAccess.Read, FileShare.Read)) + using (var output = new FileStream(newFile, FileMode.Create)) + BinaryPatch.Apply(input, () => new FileStream(patchFile, FileMode.Open, FileAccess.Read, FileShare.Read), output); +} +catch (FileNotFoundException ex) +{ + Console.Error.WriteLine("Could not open '{0}'.", ex.FileName); }