1OpenFileDialog OFD =NewOpenFileDialog ();2Ofd. Filter ="(*.mp4) |*.mp4| (*.*)|*.*";3Ofd. Restoredirectory =true;4 if(OFD. ShowDialog () = =DialogResult.OK)5 { 6 Try7{//Open File8 9FileStream FileStream =NewFileStream (OFD. FileName, FileMode.Open, FileAccess.Read, fileshare.read);Ten One //read the file byte[] A - byte[] Brecord =New byte[filestream.length]; -FileStream.Read (Brecord,0, Brecord. Length); the byte[] Data1 = {123, the, the, the, -, the, the }; - byte[] Data2 = { the, the, the, -, the, the, the }; - - varData3 =New byte[Data1. Length + data2. Length +Brecord. Length]; +Stream s =NewMemoryStream (); -S.write (Data1,0, Data1. Length); +S.write (Brecord,0, Brecord. Length); AS.write (Data2,0, Data2. Length); atS.position =0; - intR = S.read (Data3,0, Data3. Length); - if(R >0) - { - //in this case, DATA3 is the merged value. - } in MC. Send (DATA3); - to Filestream.close (); + } - Catch(Exception ex) the { * MessageBox.Show (ex. Message.tostring ()); $ }Panax Notoginseng finally - { the //Sr. Close (); + //FS. Close (); A } the}
Get File data stream + overlay byte array (to byte array plus packet footer)