本文整理汇总了C#中System.ByteBuffer.WriteByte方法的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer.WriteByte方法的具体用法?C# ByteBuffer.WriteByte怎么用?C# ByteBuffer.WriteByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ByteBuffer
的用法示例。
在下文中一共展示了ByteBuffer.WriteByte方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: write
public static byte[] write()
{
byte[] temp = init();
ByteBuffer buff = new ByteBuffer();
buff.WriteD(temp.Length + 4);
for (int i = 0; i < temp.Length - 1; i++)
{
buff.WriteByte(temp[i]);
}
buff.Resize(temp.Length + 4);
size = buff.Length();
return buff.Get_ByteArray();
}
示例2: OnMessage
public void OnMessage(ClientSession session, ByteBuffer buffer) {
string str = buffer.ReadString();
int uid = buffer.ReadInt();
ushort commandId = (ushort)Protocal.Login;
ByteBuffer newBuffer = new ByteBuffer();
newBuffer.WriteShort(commandId);
newBuffer.WriteByte(1);
newBuffer.WriteString(str);
SocketUtil.SendMessage(session, newBuffer);
session.uid = uid;
UserUtil.Add(uid, session);
Console.WriteLine("OnMessage--->>>" + str + uid);
}
示例3: 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);
}
示例4: PatchRawSection
void PatchRawSection(ByteBuffer buffer, MetadataBuilder metadata)
{
var position = base.position;
Align(4);
buffer.WriteBytes(base.position - position);
const byte fat_format = 0x40;
const byte more_sects = 0x80;
var flags = ReadByte();
if ((flags & fat_format) == 0)
{
buffer.WriteByte(flags);
PatchRawSmallSection(buffer, metadata);
}
else
PatchRawFatSection(buffer, metadata);
if ((flags & more_sects) != 0)
PatchRawSection(buffer, metadata);
}
示例5: PatchRawMethodBody
public ByteBuffer PatchRawMethodBody(MethodDefinition method, CodeWriter writer, out MethodSymbols symbols)
{
var buffer = new ByteBuffer();
symbols = new MethodSymbols(method.Name);
this.method = method;
reader.context = method;
MoveTo(method.RVA);
var flags = ReadByte();
MetadataToken local_var_token;
switch (flags & 0x3)
{
case 0x2: // tiny
buffer.WriteByte(flags);
local_var_token = MetadataToken.Zero;
symbols.code_size = flags >> 2;
PatchRawCode(buffer, symbols.code_size, writer);
break;
case 0x3: // fat
base.position--;
PatchRawFatMethod(buffer, symbols, writer, out local_var_token);
break;
default:
throw new NotSupportedException();
}
var symbol_reader = reader.module.symbol_reader;
if (symbol_reader != null && writer.metadata.write_symbols)
{
symbols.method_token = GetOriginalToken(writer.metadata, method);
symbols.local_var_token = local_var_token;
symbol_reader.Read(symbols);
}
return buffer;
}