I want to know how I would convert from a decimal number located in a text box to hexadecimal and then to a byte array and write this array to the offset I want, using BinaryWriter.
My textBox11 decimal value is "101200001" and I need to write the it's Hexadecimal value, which is "06 08 30 81", into a file at a speciffic offset.
This is the what I have, but I'm missing the conversion from textBox11.Text to byteArray.
int index = listBox1.SelectedIndex;
int startOffset = 0x00000008;
int itemIDDiff = 0x00000328;
BinaryWriter bw = new BinaryWriter(File.Open(_FileName, FileMode.Open));
bw.BaseStream.Seek(startOffset + itemIDDiff * index, SeekOrigin.Begin);
bw.Write( /* textBox11.Text converted to HEX then to byte array? */ );
bw.Close();
This is part of the file that I need to write to:
00000330h: 02 00 00 00 00 00 00 00 4A 61 64 65 20 45 61 72 ; ........Jade Ear
00000340h: 72 69 6E 67 00 00 00 00 00 00 00 00 00 00 00 00 ; ring............
let's say I want to change the "02 00 00 00" to "06 08 30 81". How would I do this using the BinaryWriter?