当前位置: 首页>>代码示例>>C#>>正文


C# StreamWriter.WriteByte方法代码示例

本文整理汇总了C#中StreamWriter.WriteByte方法的典型用法代码示例。如果您正苦于以下问题:C# StreamWriter.WriteByte方法的具体用法?C# StreamWriter.WriteByte怎么用?C# StreamWriter.WriteByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StreamWriter的用法示例。


在下文中一共展示了StreamWriter.WriteByte方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Serialize

 public void Serialize(
     StreamWriter streamWriter, 
     SerializationContext serializationContext, 
     object value, 
     PropertyMetaData propertyMetaData = null)
 {
     streamWriter.WriteByte((byte)value);
 }
开发者ID:gordonc64,项目名称:AOtomation.Messaging,代码行数:8,代码来源:ByteSerializer.cs

示例2: 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);
            }
        }
开发者ID:gordonc64,项目名称:AOtomation.Messaging,代码行数:37,代码来源:FollowInfoSerializer.cs

示例3: 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);
     }
 }
开发者ID:gordonc64,项目名称:AOtomation.Messaging,代码行数:20,代码来源:GenericCmdSerializer.cs

示例4: 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();
            }
        }
开发者ID:gordonc64,项目名称:AOtomation.Messaging,代码行数:34,代码来源:ArraySizeSerializer.cs


注:本文中的StreamWriter.WriteByte方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。