static void PadROM(byte[] newfile, string outfile) { for (int m = 0; m < ROMMult.Length; m++) { int sizer = ROMMult[m]; if (sizer > newfile.Length) { byte[] final = FillArray(new byte[sizer]); LCompress.CopyBytes(newfile, final, true); File.WriteAllBytes(outfile, final); break; } } }
static void InsertSection(string outfile, byte[] data, int offset) { byte[] outf = File.ReadAllBytes(outfile); //outf = InsertBytes(outf, data, offset); int reqlen = (offset + data.Length); byte[] temp = new byte[outf.Length]; if (!((outf.Length - reqlen) >= 0)) { temp = new byte[reqlen]; } LCompress.CopyBytes(outf, temp, true); File.WriteAllBytes(outfile, temp); ReplaceSection(outfile, data, offset); }