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


C# NetworkStream.WriteByte方法代码示例

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


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

示例1: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteDouble(stream, this.Unknown1);
            StreamHelper.WriteDouble(stream, this.Unknown2);
            StreamHelper.WriteDouble(stream, this.Unknown3);
            StreamHelper.WriteFloat(stream, this.Unknown4);
            StreamHelper.WriteInt(stream, Unknown5.Count);

            int i = (int)this.Unknown1;
            int j = (int)this.Unknown2;
            int k = (int)this.Unknown3;
            sbyte j1;
            for (IEnumerator<ChunkPosition> iter = this.Unknown5.GetEnumerator(); iter.MoveNext(); stream.WriteByte(j1))
            {
                ChunkPosition chunkpos = iter.Current;
                int l = chunkpos.X - i;
                int i1 = chunkpos.Y - j;
                j1 = (sbyte)(chunkpos.Z - k);
                stream.WriteByte((byte)l);
                stream.WriteByte((byte)i1);
            }

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:26,代码来源:Explosion.cs

示例2: Write

 public static void Write(ArrayList list, NetworkStream stream)
 {
     list.ToArray().ToList().ForEach(x =>
     {
         WatchableObject obj = (WatchableObject)x;
         int joined = ((obj.Type << 5) | (obj.Lower & 0x1f)) & 0xff;
         stream.WriteByte((byte)joined);
         switch (obj.Type)
         {
             case 0:
                 stream.WriteByte((byte)obj.Value);
                 break;
             case 1:
                 StreamHelper.WriteShort(stream, (short)obj.Value);
                 break;
             case 2:
                 StreamHelper.WriteInt(stream, (int)obj.Value);
                 break;
             case 3:
                 StreamHelper.WriteFloat(stream, (float)obj.Value);
                 break;
             case 4:
                 StreamHelper.WriteString(stream, (string)obj.Value);
                 break;
             case 5:
                 ItemStack stack = (ItemStack)obj.Value;
                 StreamHelper.WriteShort(stream, (short)stack.ItemID);
                 stream.WriteByte((byte)stack.StackSize);
                 StreamHelper.WriteShort(stream, (short)stack.ItemDamage);
                 break;
         }
     });
     stream.WriteByte(127);
 }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:34,代码来源:DataWatcher.cs

示例3: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte(this.WindowId);

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:8,代码来源:WindowClose.cs

示例4: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte((OnGround ? (byte)1 : (byte)0));

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:8,代码来源:Flying.cs

示例5: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.EntityID);
            stream.WriteByte(this.Unknown);

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:9,代码来源:Status.cs

示例6: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.X);
            StreamHelper.WriteInt(stream, this.Y);
            stream.WriteByte((Mode ? (byte)1 : (byte)0));

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:10,代码来源:PreChunk.cs

示例7: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteFloat(stream, this.Yaw);
            StreamHelper.WriteFloat(stream, this.Pitch);
            stream.WriteByte((OnGround ? (byte)1 : (byte)0));

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:10,代码来源:PlayerLook.cs

示例8: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte(this.WindowID);
            StreamHelper.WriteShort(stream, this.Bar);
            StreamHelper.WriteShort(stream, this.Progress);

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:10,代码来源:WindowProgress.cs

示例9: Write

 public void Write(ref NetworkStream stream)
 {
     // write all
     stream.Write(BitConverter.GetBytes(this.Year), 0, 2);
     stream.WriteByte(this.Month);
     stream.WriteByte(this.Day);
     stream.WriteByte(this.Hour);
     stream.WriteByte(this.Minute);
     stream.WriteByte(this.Second);
 }
开发者ID:RudyJ,项目名称:ODK-DarkEmu,代码行数:10,代码来源:GameTime.cs

示例10: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte(this.WindowID);
            StreamHelper.WriteShort(stream, this.Token);
            stream.WriteByte((byte)(this.Acknowledged ? 1 : 0));

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:10,代码来源:WindowToken.cs

示例11: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.EID);
            StreamHelper.WriteInt(stream, this.Target);
            stream.WriteByte(this.Button);

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:10,代码来源:Use.cs

示例12: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);
            StreamHelper.WriteInt(stream, this.Version); //version
            StreamHelper.WriteString(stream, this.Username); //username
            StreamHelper.WriteString(stream, this.ServerPassword); //server password
            StreamHelper.WriteLong(stream, this.MapSeed); //map seed
            stream.WriteByte(this.Dimension); //not used

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:11,代码来源:Login.cs

示例13: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte(this.WindowId);
            stream.WriteByte((byte)this.WindowType);
            StreamHelper.WriteString(stream, this.Title);
            stream.WriteByte(this.Slots);

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:11,代码来源:WindowOpen.cs

示例14: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.X);
            StreamHelper.WriteShort(stream, this.Y);
            StreamHelper.WriteInt(stream, this.Z);
            stream.WriteByte((byte)Instrument);
            stream.WriteByte(this.Pitch);

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:12,代码来源:Note.cs

示例15: Write

        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteDouble(stream, this.X);
            StreamHelper.WriteDouble(stream, this.Y);
            StreamHelper.WriteDouble(stream, this.Stance);
            StreamHelper.WriteDouble(stream, this.Z);
            stream.WriteByte((OnGround ? (byte)1 : (byte)0));

            stream.Flush();
        }
开发者ID:tgrochowicz,项目名称:mcsharpbot,代码行数:12,代码来源:PlayerPosition.cs


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