本文整理匯總了C#中System.ByteBuffer.ReadUInt32方法的典型用法代碼示例。如果您正苦於以下問題:C# ByteBuffer.ReadUInt32方法的具體用法?C# ByteBuffer.ReadUInt32怎麽用?C# ByteBuffer.ReadUInt32使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.ByteBuffer
的用法示例。
在下文中一共展示了ByteBuffer.ReadUInt32方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetLocalVarToken
static MetadataToken GetLocalVarToken(ByteBuffer buffer, MethodSymbols symbols)
{
if (symbols.variables.IsNullOrEmpty())
return MetadataToken.Zero;
buffer.position = 8;
return new MetadataToken(buffer.ReadUInt32());
}
示例2: PatchResourceDataEntry
void PatchResourceDataEntry(ByteBuffer resources)
{
var old_rsrc = GetImageResourceSection();
var rva = resources.ReadUInt32();
resources.position -= 4;
resources.WriteUInt32(rva - old_rsrc.VirtualAddress + rsrc.VirtualAddress);
}
示例3: PatchResourceDirectoryEntry
void PatchResourceDirectoryEntry(ByteBuffer resources)
{
resources.Advance(4);
var child = resources.ReadUInt32();
var position = resources.position;
resources.position = (int)child & 0x7fffffff;
if ((child & 0x80000000) != 0)
PatchResourceDirectoryTable(resources);
else
PatchResourceDataEntry(resources);
resources.position = position;
}
示例4: PatchRawCode
void PatchRawCode(ByteBuffer buffer, int code_size, CodeWriter writer)
{
var metadata = writer.metadata;
buffer.WriteBytes(ReadBytes(code_size));
var end = buffer.position;
buffer.position -= code_size;
while (buffer.position < end)
{
OpCode opcode;
var il_opcode = buffer.ReadByte();
if (il_opcode != 0xfe)
{
opcode = OpCodes.OneByteOpCode[il_opcode];
}
else
{
var il_opcode2 = buffer.ReadByte();
opcode = OpCodes.TwoBytesOpCode[il_opcode2];
}
switch (opcode.OperandType)
{
case OperandType.ShortInlineI:
case OperandType.ShortInlineBrTarget:
case OperandType.ShortInlineVar:
case OperandType.ShortInlineArg:
buffer.position += 1;
break;
case OperandType.InlineVar:
case OperandType.InlineArg:
buffer.position += 2;
break;
case OperandType.InlineBrTarget:
case OperandType.ShortInlineR:
case OperandType.InlineI:
buffer.position += 4;
break;
case OperandType.InlineI8:
case OperandType.InlineR:
buffer.position += 8;
break;
case OperandType.InlineSwitch:
var length = buffer.ReadInt32();
buffer.position += length * 4;
break;
case OperandType.InlineString:
var @string = GetString(new MetadataToken(buffer.ReadUInt32()));
buffer.position -= 4;
buffer.WriteUInt32(
new MetadataToken(
TokenType.String,
metadata.user_string_heap.GetStringIndex(@string)).ToUInt32());
break;
case OperandType.InlineSig:
var call_site = GetCallSite(new MetadataToken(buffer.ReadUInt32()));
buffer.position -= 4;
buffer.WriteUInt32(writer.GetStandAloneSignature(call_site).ToUInt32());
break;
case OperandType.InlineTok:
case OperandType.InlineType:
case OperandType.InlineMethod:
case OperandType.InlineField:
var provider = reader.LookupToken(new MetadataToken(buffer.ReadUInt32()));
buffer.position -= 4;
buffer.WriteUInt32(metadata.LookupToken(provider).ToUInt32());
break;
}
}
}