There is a file 3.exe, in which 2 more files are written: 1.ehe and 2.ehe (added to the end byte-by-bye), you need to “pull out” separately 1.ehe and 2.ehe, that's the whole complexity. 1.ehe can be obtained in this way: starting from copying from the weight of 3.ehe without these 2 files and before the beginning of 2.ehe, copying 2.ehe is similar. But then the whole difficulty, how to understand where 2. ehe begins? there was an idea to write to the end of the file the size of 3.ehe without these 2 files + the size of 1.ehe, thereby get the beginning of the file 2.ehe, but the maximum value is 255 and nothing happened, it is written 0. Can you suggest how best to implement?
I hope that I have explained clearly, if not, then write, I will try differently.
Code example:
var fil2 = File.ReadAllBytes(@"2.exe"); var fil1 = File.ReadAllBytes(@"1.exe"); using (FileStream fs = new FileStream(@"bin.exe", FileMode.Append, FileAccess.Write)) { fs.Write(fil2, 0, fil2.Length); fs.Flush(); fs.Close(); } var rezd = new byte[4] { 5, 55, 56, (byte)fil2.Length }; using (FileStream fs = new FileStream(@"bin.exe", FileMode.Append, FileAccess.Write)) { fs.Write(fil1, 0, fil1.Length); fs.Write(rezd, 0, rezd.Length); fs.Flush(); fs.Close(); }