Hex Editor - Binary File Editing Software for Windows
Docs

Working with Sequence Object

The created sequence object is empty. ISequence.Empty property is TRUE for empty sequences. You may use the ISequence.AddText and ISequence.AddData methods to add new data to a sequence, ISequence.Remove method to delete a part of the sequence and ISequence.Clear method to clear the sequence.

A copy of the sequence may be constructed with a call to the ISequence.Copy method. The ISequence.CreateSubSequence method, on the other hand, allows you to copy only part of the sequence.

Individual sequence bytes may be accessed and modified through the default ISequence.Value property. Current sequence size is retrieved through the ISequence.Length property. This same property may be used to change the size of the sequence, for example, to prepare the sequence before calling IFileDocument.Read method.

// Reading data from the document
var read_seq = fdoc.CreateSequence();
read_seq.Length = 1024;

fdoc.Read(read_seq.Data, 0, read_seq.Length);

// Performing Search & Replace
var find_seq = fdoc.CreateSequence(), rep_seq = fdoc.CreateSequence();

find_seq.AddData(SequenceDataBytes, 0x0d);
rep_seq.AddData(SequenceDataBytes, 0x0d, 0x0a);

var sel = fdoc.CreateEmptySelection();
sel.AddRange(0,fdoc.FileSize);

var occurrences = fdoc.ReplaceAll(find_seq.Data, find_seq.Length, rep_seq.Data, rep_seq.Length, false, sel);
alert(occurrences + " replacements made.");