本文整理汇总了C#中dnSpy.Contracts.Hex.HexBuffer类的典型用法代码示例。如果您正苦于以下问题:C# HexBuffer类的具体用法?C# HexBuffer怎么用?C# HexBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HexBuffer类属于dnSpy.Contracts.Hex命名空间,在下文中一共展示了HexBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HexField
protected HexField(HexBuffer buffer, string parentName, string name, HexPosition start, int size) {
this.buffer = buffer;
this.parentName = parentName;
IsVisible = true;
Name = name;
Span = new HexSpan(start, (ulong)size);
}
示例2: Write
public static void Write(HexBuffer buffer, HexPosition position, byte[] data) {
if (buffer == null)
throw new ArgumentNullException(nameof(buffer));
if (data == null || data.Length == 0)
return;
buffer.Replace(position, data);
}
示例3: HexVersionImpl
public HexVersionImpl(HexBuffer buffer, int versionNumber, int reiteratedVersionNumber) {
if (buffer == null)
throw new ArgumentNullException(nameof(buffer));
Buffer = buffer;
VersionNumber = versionNumber;
ReiteratedVersionNumber = reiteratedVersionNumber;
}
示例4: Create
public override HexBufferLineFormatter Create(HexBuffer buffer, HexBufferLineFormatterOptions options) {
if (buffer == null)
throw new ArgumentNullException(nameof(buffer));
if (options == null)
throw new ArgumentNullException(nameof(options));
return new HexBufferLineFormatterImpl(buffer, options);
}
示例5: MemoryVM
MemoryVM(ITheDebugger theDebugger, HexBufferFactoryService hexBufferFactoryService, HexBufferStreamFactoryService hexBufferStreamFactoryService) {
this.theDebugger = theDebugger;
this.hexBufferStreamFactoryService = hexBufferStreamFactoryService;
debuggerStream = new DebuggerHexBufferStream();
debuggerStream.UnderlyingStreamChanged += DebuggerStream_UnderlyingStreamChanged;
Buffer = hexBufferFactoryService.Create(debuggerStream, hexBufferFactoryService.DefaultMemoryTags, disposeStream: true);
theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
InitializeHexStream();
}
示例6: MetaDataTableNode
public MetaDataTableNode(HexBuffer buffer, MDTable mdTable, IMetaData md)
: base(HexSpan.FromBounds((ulong)mdTable.StartOffset, (ulong)mdTable.EndOffset)) {
Buffer = buffer;
TableInfo = mdTable.TableInfo;
var stringsHeapSpan = HexSpan.FromBounds((ulong)md.StringsStream.StartOffset, (ulong)md.StringsStream.EndOffset);
var guidHeapSpan = HexSpan.FromBounds((ulong)md.GuidStream.StartOffset, (ulong)md.GuidStream.EndOffset);
MetaDataTableVM = MetaDataTableVM.Create(this, buffer, Span.Start, mdTable, stringsHeapSpan, guidHeapSpan);
MetaDataTableVM.FindMetaDataTable = FindMetaDataTable;
}
示例7: MetaDataTableVM
protected MetaDataTableVM(object owner, HexBuffer buffer, HexPosition startOffset, MDTable mdTable, HexSpan stringsHeapSpan, HexSpan guidHeapSpan) {
this.buffer = buffer;
this.stringsHeapSpan = stringsHeapSpan;
this.guidHeapSpan = guidHeapSpan;
Owner = owner;
Span = new HexSpan(startOffset, (ulong)mdTable.Rows * mdTable.RowSize);
Rows = mdTable.Rows;
TableInfo = CreateTableInfo(mdTable.TableInfo);
Collection = new VirtualizedList<MetaDataTableRecordVM>((int)Rows, CreateItem);
}
示例8: StorageStreamNode
public StorageStreamNode(HexBuffer buffer, StreamHeader sh, int streamNumber, DotNetStream knownStream, IMetaData md)
: base(HexSpan.FromBounds((ulong)sh.StartOffset, (ulong)sh.EndOffset)) {
StreamNumber = streamNumber;
StorageStreamType = GetStorageStreamType(knownStream);
storageStreamVM = new StorageStreamVM(buffer, Span.Start, (int)(Span.Length - 8).ToUInt64());
var tblStream = knownStream as TablesStream;
if (tblStream != null)
newChild = new TablesStreamNode(buffer, tblStream, md);
}
示例9: TablesStreamNode
public TablesStreamNode(HexBuffer buffer, TablesStream tblStream, IMetaData md)
: base(HexSpan.FromBounds((ulong)tblStream.StartOffset, (ulong)tblStream.MDTables[0].StartOffset)) {
tablesStreamVM = new TablesStreamVM(buffer, tblStream);
newChildren = new List<TreeNodeData>();
foreach (var mdTable in tblStream.MDTables) {
if (mdTable.Rows != 0)
newChildren.Add(new MetaDataTableNode(buffer, mdTable, md));
}
}
示例10: ImageSectionHeaderVM
public ImageSectionHeaderVM(object owner, HexBuffer buffer, HexPosition startOffset)
: base(owner) {
NameVM = new StringHexField(buffer, Name, "Name", startOffset + 0, Encoding.UTF8, 8);
VirtualSizeVM = new UInt32HexField(buffer, Name, "VirtualSize", startOffset + 8);
VirtualAddressVM = new UInt32HexField(buffer, Name, "VirtualAddress", startOffset + 0x0C);
SizeOfRawDataVM = new UInt32HexField(buffer, Name, "SizeOfRawData", startOffset + 0x10);
PointerToRawDataVM = new UInt32HexField(buffer, Name, "PointerToRawData", startOffset + 0x14);
PointerToRelocationsVM = new UInt32HexField(buffer, Name, "PointerToRelocations", startOffset + 0x18);
PointerToLinenumbersVM = new UInt32HexField(buffer, Name, "PointerToLinenumbers", startOffset + 0x1C);
NumberOfRelocationsVM = new UInt16HexField(buffer, Name, "NumberOfRelocations", startOffset + 0x20);
NumberOfLinenumbersVM = new UInt16HexField(buffer, Name, "NumberOfLinenumbers", startOffset + 0x22);
CharacteristicsVM = new UInt32FlagsHexField(buffer, Name, "Characteristics", startOffset + 0x24);
CharacteristicsVM.Add(new BooleanHexBitField("TYPE_DSECT", 0));
CharacteristicsVM.Add(new BooleanHexBitField("TYPE_NOLOAD", 1));
CharacteristicsVM.Add(new BooleanHexBitField("TYPE_GROUP", 2));
CharacteristicsVM.Add(new BooleanHexBitField("TYPE_NO_PAD", 3));
CharacteristicsVM.Add(new BooleanHexBitField("TYPE_COPY", 4));
CharacteristicsVM.Add(new BooleanHexBitField("CNT_CODE", 5));
CharacteristicsVM.Add(new BooleanHexBitField("CNT_INITIALIZED_DATA", 6));
CharacteristicsVM.Add(new BooleanHexBitField("CNT_UNINITIALIZED_DATA", 7));
CharacteristicsVM.Add(new BooleanHexBitField("LNK_OTHER", 8));
CharacteristicsVM.Add(new BooleanHexBitField("LNK_INFO", 9));
CharacteristicsVM.Add(new BooleanHexBitField("TYPE_OVER", 10));
CharacteristicsVM.Add(new BooleanHexBitField("LNK_REMOVE", 11));
CharacteristicsVM.Add(new BooleanHexBitField("LNK_COMDAT", 12));
CharacteristicsVM.Add(new BooleanHexBitField("RESERVED", 13));
CharacteristicsVM.Add(new BooleanHexBitField("NO_DEFER_SPEC_EXC", 14));
CharacteristicsVM.Add(new BooleanHexBitField("GPREL", 15));
CharacteristicsVM.Add(new BooleanHexBitField("MEM_SYSHEAP", 16));
CharacteristicsVM.Add(new BooleanHexBitField("MEM_PURGEABLE", 17));
CharacteristicsVM.Add(new BooleanHexBitField("MEM_LOCKED", 18));
CharacteristicsVM.Add(new BooleanHexBitField("MEM_PRELOAD", 19));
CharacteristicsVM.Add(new IntegerHexBitField("Alignment", 20, 4, AlignInfos));
CharacteristicsVM.Add(new BooleanHexBitField("LNK_NRELOC_OVFL", 24));
CharacteristicsVM.Add(new BooleanHexBitField("MEM_DISCARDABLE", 25));
CharacteristicsVM.Add(new BooleanHexBitField("MEM_NOT_CACHED", 26));
CharacteristicsVM.Add(new BooleanHexBitField("MEM_NOT_PAGED", 27));
CharacteristicsVM.Add(new BooleanHexBitField("MEM_SHARED", 28));
CharacteristicsVM.Add(new BooleanHexBitField("MEM_EXECUTE", 29));
CharacteristicsVM.Add(new BooleanHexBitField("MEM_READ", 30));
CharacteristicsVM.Add(new BooleanHexBitField("MEM_WRITE", 31));
hexFields = new HexField[] {
NameVM,
VirtualSizeVM,
VirtualAddressVM,
SizeOfRawDataVM,
PointerToRawDataVM,
PointerToRelocationsVM,
PointerToLinenumbersVM,
NumberOfRelocationsVM,
NumberOfLinenumbersVM,
CharacteristicsVM,
};
}
示例11: StorageStreamVM
public StorageStreamVM(HexBuffer buffer, HexPosition startOffset, int stringLen) {
IOffsetVM = new UInt32HexField(buffer, Name, "iOffset", startOffset + 0);
ISizeVM = new UInt32HexField(buffer, Name, "iSize", startOffset + 4);
RCNameVM = new StringHexField(buffer, Name, "rcName", startOffset + 8, Encoding.ASCII, stringLen);
hexFields = new HexField[] {
IOffsetVM,
ISizeVM,
RCNameVM,
};
}
示例12: StorageHeaderVM
public StorageHeaderVM(HexBuffer buffer, HexPosition startOffset) {
FFlagsVM = new ByteFlagsHexField(buffer, Name, "fFlags", startOffset + 0);
FFlagsVM.Add(new BooleanHexBitField("ExtraData", 0));
PadVM = new ByteHexField(buffer, Name, "pad", startOffset + 1);
IStreamsVM = new UInt16HexField(buffer, Name, "iStreams", startOffset + 2);
hexFields = new HexField[] {
FFlagsVM,
PadVM,
IStreamsVM,
};
}
示例13: OnDocumentSaved
void OnDocumentSaved(HexBuffer buffer) {
lock (lockObj) {
object dictObj;
bool b = filenameToBuffer.TryGetValue(buffer.Name, out dictObj);
Debug.Assert(b);
if (!b)
return;
if (dictObj is WeakReference) {
Debug.Assert(((WeakReference)dictObj).Target == buffer);
return;
}
Debug.Assert(buffer == dictObj);
filenameToBuffer[buffer.Name] = new WeakReference(buffer);
}
}
示例14: Create
public override WpfHexViewHost Create(HexBuffer buffer, string group, string subGroup, Guid? menuGuid) {
if (buffer == null)
throw new ArgumentNullException(nameof(buffer));
if (group == null)
throw new ArgumentNullException(nameof(group));
if (subGroup == null)
throw new ArgumentNullException(nameof(subGroup));
var roles = hexEditorFactoryService.CreateTextViewRoleSet(hexEditorFactoryService.DefaultRoles.Concat(new[] { group, subGroup }));
var options = new HexViewCreatorOptions {
MenuGuid = menuGuid,
};
var hexView = hexEditorFactoryService.Create(buffer, roles, options);
GetDefaultLocalOptions(hexView).WriteTo(hexView);
return hexEditorFactoryService.CreateHost(hexView, false);
}
示例15: GetValidSpans
protected IEnumerable<HexSpan> GetValidSpans(HexBuffer buffer, HexPosition start, HexPosition upperBounds) {
var pos = start;
bool fullSpan = true;
while (pos < HexPosition.MaxEndPosition) {
var span = buffer.GetNextValidSpan(pos, upperBounds, fullSpan);
if (span == null)
break;
var newStart = HexPosition.Max(pos, span.Value.Start);
var newEnd = HexPosition.Min(upperBounds, span.Value.End);
if (newStart < newEnd)
yield return HexSpan.FromBounds(newStart, newEnd);
pos = span.Value.End;
fullSpan = false;
}
}