Created
July 15, 2017 03:46
-
-
Save Tustin/fe1a75b81a3c0f4e2db9694214334ac0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System; | |
using System.IO; | |
namespace pkg_merge | |
{ | |
public class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Directory.GetFiles("pkgs"); | |
byte[] buffer = new byte[1024 * 1024]; | |
using (var br = new BinaryReader(File.Open("pkgs/UP2050-CUSA01340_00-DUNDEF2000000PS4-A0151-V0100_0.pkg", FileMode.Open))) | |
using (var br2 = new BinaryWriter(File.Open("pkgs/test.pkg", FileMode.Append))) | |
{ | |
long fileSize = br.BaseStream.Length; | |
long totalRead = 0; | |
while (totalRead < fileSize) | |
{ | |
var read = br.Read(buffer, 0, buffer.Length); | |
br2.Write(buffer, 0, buffer.Length); | |
totalRead += read; | |
Console.Write($"Read {totalRead}/{fileSize} bytes\r"); | |
} | |
} | |
Console.WriteLine("\r\ndone"); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment