本文整理汇总了C#中System.IO.BinaryWriter.WriteOpcode方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryWriter.WriteOpcode方法的具体用法?C# BinaryWriter.WriteOpcode怎么用?C# BinaryWriter.WriteOpcode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryWriter
的用法示例。
在下文中一共展示了BinaryWriter.WriteOpcode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
if (Value == 0.0d)
output.WriteOpcode(MarshalOpcode.RealZero);
else
{
output.WriteOpcode(MarshalOpcode.Real);
output.Write(Value);
}
}
示例2: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
switch (Value)
{
case true:
output.WriteOpcode(MarshalOpcode.BoolTrue);
break;
case false:
output.WriteOpcode(MarshalOpcode.BoolFalse);
break;
}
}
示例3: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(MarshalOpcode.Token);
if (RawToken != null)
output.Write(RawToken);
else if (Token != null)
output.Write(Encoding.ASCII.GetBytes(Token));
else
throw new InvalidDataException("Fill either RawToken or Token with data for encoding");
}
示例4: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(MarshalOpcode.ChecksumedStream);
var ms = new MemoryStream();
var tmp = new BinaryWriter(ms);
Data.Encode(tmp);
var data = ms.ToArray();
Checksum = Adler32.Checksum(data);
output.Write(Checksum);
output.Write(data);
}
示例5: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(MarshalOpcode.SubStream);
var tempMs = new MemoryStream();
var temp = new BinaryWriter(tempMs);
temp.Write((byte)0x7E);
temp.Write((uint)0);
Data.Encode(temp);
output.WriteSizeEx((uint)tempMs.Length);
output.Write(tempMs.ToArray());
}
示例6: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(MarshalOpcode.SubStream);
var memoryStream = new MemoryStream();
var binaryWriter = new BinaryWriter(memoryStream);
binaryWriter.Write(Marshal.Process(Data));
output.WriteSizeEx((uint)memoryStream.Length);
output.Write(memoryStream.ToArray());
}
示例7: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
if (Value == 1)
output.WriteOpcode(MarshalOpcode.IntegerOne);
else if (Value == 0)
output.WriteOpcode(MarshalOpcode.IntegerZero);
else if (Value == -1)
output.WriteOpcode(MarshalOpcode.IntegerMinusOne);
else if (Value < 127)
{
output.WriteOpcode(MarshalOpcode.IntegerByte);
output.Write((byte)Value);
}
else if (Value < 32768)
{
output.WriteOpcode(MarshalOpcode.IntegerSignedShort);
output.Write((short)Value);
}
else
{
output.WriteOpcode(MarshalOpcode.IntegerLong);
output.Write(Value);
}
}
示例8: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(MarshalOpcode.Buffer);
output.WriteSizeEx(Data.Length);
output.Write(Data);
}
示例9: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(MarshalOpcode.Object);
new PyString(Name).Encode(output);
Arguments.Encode(output);
}
示例10: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(IsType2 ? MarshalOpcode.ObjectEx2 : MarshalOpcode.ObjectEx1);
Header.Encode(output);
// list
output.Write(PackedTerminator);
// dict
output.Write(PackedTerminator);
}
示例11: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(MarshalOpcode.SubStruct);
Definition.Encode(output);
}
示例12: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(MarshalOpcode.Dict);
output.WriteSizeEx(Dictionary.Count);
foreach (var pair in Dictionary)
{
pair.Value.Encode(output);
pair.Key.Encode(output);
}
}
示例13: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(MarshalOpcode.None);
}
示例14: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(IsType2 ? MarshalOpcode.ObjectEx2 : MarshalOpcode.ObjectEx1);
Header.Encode(output);
// list
if (List != null)
{
if (List.Count > 0)
{
foreach (PyObject item in List)
{
item.Encode(output);
}
}
}
output.Write(PackedTerminator);
// dict
if (Dictionary != null)
{
if (Dictionary.Count > 0)
{
foreach (var pair in Dictionary)
{
pair.Key.Encode(output);
pair.Value.Encode(output);
}
}
}
output.Write(PackedTerminator);
}
示例15: EncodeInternal
protected override void EncodeInternal(BinaryWriter output)
{
output.WriteOpcode(MarshalOpcode.IntegerLongLong);
output.Write(Value);
}