我需要在十六进制文件中替换一些文本字符串。我已经使用过二进制编写器,但是当我向文件中添加更多内容时,偏移量会发生变化。因此,我必须继续固定偏移量。
我已经尝试过二进制编写器方法。
BinaryWriter BinaryWriter1 = new BinaryWriter((Stream) File.OpenWrite("[File]"));
for (int index = [Offset]; index <= [Offset]; ++index) {
BinaryWriter1.BaseStream.Position = (long) index;
BinaryWriter1.Write([Name of form].Byte1);
BinaryWriter1.Close();
}