本文整理汇总了C#中System.ByteBuffer.WriteUInt16方法的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer.WriteUInt16方法的具体用法?C# ByteBuffer.WriteUInt16怎么用?C# ByteBuffer.WriteUInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ByteBuffer
的用法示例。
在下文中一共展示了ByteBuffer.WriteUInt16方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PatchRawFatMethod
void PatchRawFatMethod(ByteBuffer buffer, MethodSymbols symbols, CodeWriter writer, out MetadataToken local_var_token)
{
var flags = ReadUInt16();
buffer.WriteUInt16(flags);
buffer.WriteUInt16(ReadUInt16());
symbols.code_size = ReadInt32();
buffer.WriteInt32(symbols.code_size);
local_var_token = ReadToken();
if (local_var_token.RID > 0)
{
var variables = symbols.variables = ReadVariables(local_var_token);
buffer.WriteUInt32(variables != null
? writer.GetStandAloneSignature(symbols.variables).ToUInt32()
: 0);
}
else
buffer.WriteUInt32(0);
PatchRawCode(buffer, symbols.code_size, writer);
if ((flags & 0x8) != 0)
PatchRawSection(buffer, writer.metadata);
}
示例2: PatchRawSmallSection
void PatchRawSmallSection(ByteBuffer buffer, MetadataBuilder metadata)
{
var length = ReadByte();
buffer.WriteByte(length);
Advance(2);
buffer.WriteUInt16(0);
var count = length / 12;
PatchRawExceptionHandlers(buffer, metadata, count, false);
}
示例3: PatchRawExceptionHandlers
void PatchRawExceptionHandlers(ByteBuffer buffer, MetadataBuilder metadata, int count, bool fat_entry)
{
const int fat_entry_size = 16;
const int small_entry_size = 6;
for (int i = 0; i < count; i++)
{
ExceptionHandlerType handler_type;
if (fat_entry)
{
var type = ReadUInt32();
handler_type = (ExceptionHandlerType)(type & 0x7);
buffer.WriteUInt32(type);
}
else
{
var type = ReadUInt16();
handler_type = (ExceptionHandlerType)(type & 0x7);
buffer.WriteUInt16(type);
}
buffer.WriteBytes(ReadBytes(fat_entry ? fat_entry_size : small_entry_size));
switch (handler_type)
{
case ExceptionHandlerType.Catch:
var exception = reader.LookupToken(ReadToken());
buffer.WriteUInt32(metadata.LookupToken(exception).ToUInt32());
break;
default:
buffer.WriteUInt32(ReadUInt32());
break;
}
}
}