I have now loaded the Binary file into a byte array and converted it to string. Here is an example of how the string would look:
537465766554686F6D70736F6E07200F0707BA024A00FF494845433A4B4838410C485855545352344B552B23424A64323202080A0C52050606317486233E001317010F0801010201010101020101010101010101010101010101010101010101010101010101090101080F0109090908080909080108080108010F42656E466F64656E0720160707C10F090B4800CA4B42524F4C48444B553D4B41380A03054A3C554A524B4064323204065205030606317186373E001317010F0801010209080801020101010101010101010101010101010101010101010101010101010101080F0108080108080809080808080908010F
I want to search this string for the pattern: 08010F
I then want to extract the string between the patterns.
Please Help
537465766554686F6D70736F6E07200F0707BA024A00FF494845433A4B4838410C485855545352344B552B23424A64323202080A0C52050606317486233E001317010F0801010201010101020101010101010101010101010101010101010101010101010101090101080F0109090908080909080108080108010F42656E466F64656E0720160707C10F090B4800CA4B42524F4C48444B553D4B41380A03054A3C554A524B4064323204065205030606317186373E001317010F0801010209080801020101010101010101010101010101010101010101010101010101010101080F0108080108080809080808080908010F
I want to search this string for the pattern: 08010F
I then want to extract the string between the patterns.
Code:
openFileDialog1.ShowDialog();
string path = openFileDialog1.FileName;
FileStream fs = new FileStream(path, FileMode.Open);
BinaryReader br = new BinaryReader(fs);
int length = (int)fs.Length;
br.BaseStream.Position = 0x0000E48E;
byte[] input = br.ReadBytes(length);
int pos1 = 0;
int pos2 = 0;
string sPattern = "08010F";
string converted = BitConverter.ToString(input).Replace("-", null);