Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string myData = File.ReadAllText("hexData.txt");
- string newData;
- int remainder = myData.Length%500;
- byte[] data_toWrite=newByte[250];
- for(int i=0;i<myData.Length-remainder; i+=500)
- {
- newData = myData.Substring(i,500);
- data_toWrite = StringToByteArray(newData);
- File.WriteAllBytes("video.mjpeg",data_toWrite);
- }
- newData = myData.Substring(myData.Length-remainder,remainder);
- data_toWrite = StringToByteArray(newData);
- File.WriteAllBytes("video.mjpeg",data_toWrite);
- public static byte[] StringToByteArray(String hex)
- {
- int NumberChars = hex.Length;
- byte[] bytes = new byte[NumberChars / 2];
- for (int i = 0; i < NumberChars; i += 2)
- bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
- return bytes;
- }
Add Comment
Please, Sign In to add comment