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


C# PacketWriter.WriteMagic方法代码示例

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


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

示例1: GenerateSpawnBlob

        public override byte[] GenerateSpawnBlob()
        {
            PacketWriter writer = new PacketWriter();
            writer.WriteStruct(Header);
            writer.WritePosition(Position);
            writer.Write((UInt16)0);
            writer.WriteFixedLengthASCII(Name, 0x20);

            writer.Write(0); // Padding?
            writer.Write(new byte[0xC]); // Unknown, usually zero

            writer.Write((UInt16)0);
            writer.Write((UInt16)0);

            writer.Write((UInt32)0);
            writer.Write((UInt32)0);

            writer.Write((UInt32)1101004800); // Always this

            writer.Write((UInt32)0);
            writer.Write((UInt32)0);
            writer.Write((UInt32)0);

            writer.Write((UInt32)1);

            writer.WriteMagic(1, 0x9FCD, 0xE7);
            writer.Write((UInt32)0);

            return writer.ToArray();
        }
开发者ID:ChowZenki,项目名称:PolarisServer,代码行数:30,代码来源:PSOObject.cs

示例2: DoShipList

        private void DoShipList(Socket socket)
        {
            var writer = new PacketWriter();
            var entries = new List<ShipEntry>();

            for (var i = 1; i < 11; i++)
            {
                var entry = new ShipEntry
                {
                    order = (ushort)i,
                    number = (uint)i,
                    status = ShipStatus.Online,
                    name = String.Format("Ship{0:0#}", i),
                    ip = PolarisApp.BindAddress.GetAddressBytes()
                };
                entries.Add(entry);
            }
            writer.WriteStruct(new PacketHeader(Marshal.SizeOf(typeof(ShipEntry)) * entries.Count + 12, 0x11, 0x3D, 0x4,
                0x0));
            writer.WriteMagic((uint)entries.Count, 0xE418, 81);
            foreach (var entry in entries)
                writer.WriteStruct(entry);

            writer.Write((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds);
            writer.Write(1);

            socket.Send(writer.ToArray());
            socket.Close();
        }
开发者ID:Zenohate,项目名称:PolarisServer,代码行数:29,代码来源:QueryServer.cs


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