C# file splitting and file merging
void SplitFile() { string sourceFile = "Old.mp4"; //Source file path string outputFile1 = ""; //First output file path (10KB) string outputFile2 = ""; //Second output file path (remainder) int firstFileSize = 10 * 1024; // The first file size is 10KB (10 * 1024 bytes) //Open source file using (FileStream sourceStream = (sourceFile)) { //Create the first output file using (FileStream outputStream1 = (outputFile1)) { // Read and write 10KB of data from the first file byte[] buffer = new byte[firstFileSize]; int bytesRead = (buffer, 0, ); (buffer, 0, bytesRead); } //Create a second output file using (FileStream outputStream2 = (outputFile2)) { //Read and write remaining data byte[] buffer = new byte[1024]; // 1KB buffer int bytesRead; while ((bytesRead = (buffer, 0, )) > 0) { (buffer, 0, bytesRead); } } } } void MergeFile() { string file1 = ""; //The first binary file path string file2 = ""; //Second binary file path string outputFile = "Merged.mp4"; // Merged file path //Open the output file stream using (FileStream outputStream = (outputFile)) { // Read and write the first file using (FileStream inputStream = (file1)) { (outputStream); // Copy the contents of the first file to the output file } // Read and write the second file using (FileStream inputStream = (file2)) { (outputStream); // Copy the contents of the second file to the output file } } }