本文整理汇总了C#中StreamWriter.WriteInt32方法的典型用法代码示例。如果您正苦于以下问题:C# StreamWriter.WriteInt32方法的具体用法?C# StreamWriter.WriteInt32怎么用?C# StreamWriter.WriteInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamWriter
的用法示例。
在下文中一共展示了StreamWriter.WriteInt32方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
public void Serialize(
StreamWriter streamWriter,
SerializationContext serializationContext,
object value,
PropertyMetaData propertyMetaData = null)
{ if (value == null)
{
return;
}
var ftinfo = value as FollowTargetInfo;
if (ftinfo != null)
{
streamWriter.WriteByte(ftinfo.FollowInfoType);
streamWriter.WriteByte(ftinfo.MoveType);
streamWriter.WriteInt32((int)ftinfo.Target.Type);
streamWriter.WriteInt32(ftinfo.Target.Instance);
streamWriter.WriteByte(ftinfo.Dummy);
streamWriter.WriteInt32(ftinfo.Dummy1);
streamWriter.WriteSingle(ftinfo.X);
streamWriter.WriteSingle(ftinfo.Y);
streamWriter.WriteSingle(ftinfo.Z);
}
var fcinfo = value as FollowCoordinateInfo;
if (fcinfo != null)
{
streamWriter.WriteByte(fcinfo.FollowInfoType);
streamWriter.WriteByte(fcinfo.MoveMode);
streamWriter.WriteByte(fcinfo.CoordinateCount);
streamWriter.WriteSingle(fcinfo.CurrentCoordinates.X);
streamWriter.WriteSingle(fcinfo.CurrentCoordinates.Y);
streamWriter.WriteSingle(fcinfo.CurrentCoordinates.Z);
streamWriter.WriteSingle(fcinfo.EndCoordinates.X);
streamWriter.WriteSingle(fcinfo.EndCoordinates.Y);
streamWriter.WriteSingle(fcinfo.EndCoordinates.Z);
}
}
示例2: Serialize
public void Serialize(
StreamWriter streamWriter,
SerializationContext serializationContext,
object value,
PropertyMetaData propertyMetaData = null)
{
var header = (Header)value;
streamWriter.WriteUInt16(header.MessageId);
streamWriter.WriteInt16((short)header.PacketType);
streamWriter.WriteInt16(header.Unknown);
streamWriter.WriteInt16(header.Size);
streamWriter.WriteInt32(header.Sender);
streamWriter.WriteInt32(header.Receiver);
}
示例3: Serialize
public void Serialize(
StreamWriter streamWriter,
SerializationContext serializationContext,
object value,
PropertyMetaData propertyMetaData = null)
{
if (value == null)
{
return;
}
var playfieldVendorInfo = (PlayfieldVendorInfo)value;
streamWriter.WriteInt32((int)playfieldVendorInfo.Unknown1.Type);
streamWriter.WriteInt32(playfieldVendorInfo.Unknown1.Instance);
streamWriter.WriteInt32(playfieldVendorInfo.Unknown2);
streamWriter.WriteInt32(playfieldVendorInfo.VendorCount);
streamWriter.WriteInt32(playfieldVendorInfo.FirstVendorId);
}
示例4: Serialize
public void Serialize(
StreamWriter streamWriter,
SerializationContext serializationContext,
object value,
PropertyMetaData propertyMetaData = null)
{
var mess = (GenericCmdMessage)value;
streamWriter.WriteInt32((int)mess.N3MessageType);
streamWriter.WriteIdentity(mess.Identity);
streamWriter.WriteByte(mess.Unknown);
streamWriter.WriteInt32(mess.Temp1);
streamWriter.WriteInt32(mess.Count);
streamWriter.WriteInt32((int)mess.Action);
streamWriter.WriteInt32(mess.Temp4);
streamWriter.WriteIdentity(mess.User);
foreach (Identity id in mess.Target)
{
streamWriter.WriteIdentity(id);
}
}
示例5: Serialize
public void Serialize(
StreamWriter streamWriter,
SerializationContext serializationContext,
object value,
PropertyMetaData propertyMetaData = null)
{
if ((this.arraySizeType == ArraySizeType.NoSerialization)|| (this.arraySizeType==ArraySizeType.NullTerminated))
{
return;
}
var array = value as Array;
var length = array != null ? array.Length : ((string)value).Length;
switch (this.arraySizeType)
{
case ArraySizeType.NoSerialization:
break;
case ArraySizeType.Byte:
streamWriter.WriteByte((byte)length);
break;
case ArraySizeType.Int16:
streamWriter.WriteInt16((short)length);
break;
case ArraySizeType.Int32:
streamWriter.WriteInt32(length);
break;
case ArraySizeType.X3F1:
streamWriter.WriteInt32((length + 1) * 0x03F1);
break;
default:
throw new ArgumentOutOfRangeException();
}
}