-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |