本文整理汇总了C#中dnSpy.HexEditor.HexDocument.Read方法的典型用法代码示例。如果您正苦于以下问题:C# HexDocument.Read方法的具体用法?C# HexDocument.Read怎么用?C# HexDocument.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dnSpy.HexEditor.HexDocument
的用法示例。
在下文中一共展示了HexDocument.Read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HexBoxUndoCommand
public HexBoxUndoCommand(HexBox hexBox, HexBoxPosition origCaretPos, ulong offset, byte[] origData, string descr)
{
this.doc = hexBox.Document;
this.hexBoxWeakRef = new WeakReference(hexBox);
this.origCaretPos = origCaretPos;
this.newCaretPos = hexBox.CaretPosition;
this.offset = offset;
this.origData = origData;
this.newData = doc.Read(offset, origData.Length);
this.descr = descr;
this.canExecute = false;
}
示例2: Write
static void Write(HexDocument doc, Stream target, ulong start, ulong end)
{
const int MAX_BUFFER_LENGTH = 1024 * 64;
byte[] buffer = new byte[end - start >= MAX_BUFFER_LENGTH ? MAX_BUFFER_LENGTH : (int)(end - start + 1)];
ulong offs = start;
while (offs <= end) {
ulong bytesLeft = offs == 0 && end == ulong.MaxValue ? ulong.MaxValue : end - offs + 1;
int bytesToRead = bytesLeft >= (ulong)buffer.Length ? buffer.Length : (int)bytesLeft;
doc.Read(offs, buffer, 0, bytesToRead);
target.Write(buffer, 0, bytesToRead);
ulong nextOffs = offs + (ulong)bytesToRead;
if (nextOffs < offs)
break;
offs = nextOffs;
}
}