• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PacketDirection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PacketDirection的典型用法代码示例。如果您正苦于以下问题:C# PacketDirection类的具体用法?C# PacketDirection怎么用?C# PacketDirection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PacketDirection类属于命名空间,在下文中一共展示了PacketDirection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Write

        public static void Write(PacketDirection dir, byte[] data)
        {
            if (Config.PacketLog.Enable)
            {
                string header = "";

                switch (dir)
                {
                    case PacketDirection.ServerToPhoenix:
                        if (!Config.PacketLog.ServerToPhoenix) return;
                        header = "Server->Phoenix";
                        break;

                    case PacketDirection.PhoenixToServer:
                        if (!Config.PacketLog.PhoenixToServer) return;
                        header = "Phoenix->Server";
                        break;

                    case PacketDirection.ClientToPhoenix:
                        if (!Config.PacketLog.ClientToPhoenix) return;
                        header = "Client->Phoenix";
                        break;

                    case PacketDirection.PhoenixToClient:
                        if (!Config.PacketLog.PhoenixToClient) return;
                        header = "Phoenix->Client";
                        break;
                }

                string packet = BuildString(data).Trim().Replace(Environment.NewLine, "\n").Replace("\n", Environment.NewLine);

                Trace.WriteLine(packet, header);
            }
        }
开发者ID:greeduomacro,项目名称:phoenix,代码行数:34,代码来源:PacketLogging.cs


示例2: Identify

        override public IdentificationStatus Identify(int OpCode, int Size, PacketDirection Direction)
        {
            if((OpCode == OpManager.OpCodeNameToNumber("OP_ZoneEntry")) && (Direction == PacketDirection.ClientToServer))
                return IdentificationStatus.Yes;

            return IdentificationStatus.No;
        }
开发者ID:Xackery,项目名称:eqemuserver,代码行数:7,代码来源:PatchTestSep1-2010.cs


示例3: PacketAttribute

 public PacketAttribute(string name, PacketDirection direction, SessionType sessionType = SessionType.None, bool authRequired = true)
 {
     Name         = name;
     Direction    = direction;
     SessionType  = sessionType;
     AuthRequired = authRequired;
 }
开发者ID:MarechalBanane,项目名称:RelentlessZero,代码行数:7,代码来源:PacketAttribute.cs


示例4: Packet

 public Packet(uint Opcode, PacketDirection Direction, byte[] Data, DateTime Time)
 {
     this.Opcode = Opcode;
     this.Direction = Direction;
     this.Data = Data;
     this.Time = Time;
 }
开发者ID:Dramacydal,项目名称:SniffLib,代码行数:7,代码来源:Packet.cs


示例5: PackerHandlerAttribute

 public PackerHandlerAttribute(PacketHeader methodId, string name, int size, PacketDirection direction)
 {
     this.MethodId = (ushort)methodId;
     this.Name = name;
     this.Size = size;
     this.Direction = direction;
 }
开发者ID:GodLesZ,项目名称:FimbulwinterClient,代码行数:7,代码来源:Base.cs


示例6: ExploreItemPacket

        public override void ExploreItemPacket(StreamWriter outputStream, ByteStream buffer, PacketDirection direction)
        {
            buffer.SkipBytes(4);    // Skip type field.

            ExploreSubItem(outputStream, ref buffer);

            outputStream.WriteLine("");
        }
开发者ID:rumstil,项目名称:EQExtractor,代码行数:8,代码来源:PatchTestSep1-2010.cs


示例7: ExploreItemPacket

        public void ExploreItemPacket(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            Buffer.SkipBytes(4);    // Skip type field.

            ExploreSubItem(OutputStream, ref Buffer);

            OutputStream.WriteLine("");
        }
开发者ID:regneq,项目名称:projecteqemu,代码行数:8,代码来源:PatchTestSep1-2010.cs


示例8: ExploreNPCMoveUpdate

        public void ExploreNPCMoveUpdate(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            PositionUpdate PosUpdate;

            PosUpdate = Decode_OP_NPCMoveUpdate(Buffer.Buffer);

            OutputStream.WriteLine("SpawnID: {0}, X = {1}, Y = {2}, Z = {3}, Heading = {4}", PosUpdate.SpawnID, PosUpdate.p.x, PosUpdate.p.y, PosUpdate.p.z, PosUpdate.p.heading);
        }
开发者ID:Vaion,项目名称:Server,代码行数:8,代码来源:PatchJanuary16-2013.cs


示例9: ReadPacket

 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     ProtocolVersion = stream.ReadVarInt();
     ServerHostname = stream.ReadString();
     ServerPort = stream.ReadUInt16();
     NextState = (NetworkMode)stream.ReadVarInt();
     return NextState;
 }
开发者ID:umby24,项目名称:Craft.Net,代码行数:8,代码来源:Packets.cs


示例10: WritePacket

 public NetworkMode WritePacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     stream.WriteVarInt(ProtocolVersion);
     stream.WriteString(ServerHostname);
     stream.WriteUInt16(ServerPort);
     stream.WriteVarInt((int)NextState);
     return NextState;
 }
开发者ID:umby24,项目名称:Craft.Net,代码行数:8,代码来源:Packets.cs


示例11: TORCapturedPacket

 public TORCapturedPacket(int id, TORPacketType type, byte[] data, CaptureSession session, PacketDirection direction)
 {
     _id = id;
     _type = type;
     _data = data;
     _session = session;
     _direction = direction;
 }
开发者ID:Besyaka,项目名称:swtor-emu,代码行数:8,代码来源:TORCapturedPacket.cs


示例12: IPPacket

 public IPPacket(int index,
                 UInt32 resourceId,
                 PacketDirection direction,
                 IPEndPoint localEndpoint,
                 IPEndPoint remoteEndpoint,
                 byte[] bytes)
 {
     Initialize(index, DateTime.Now, resourceId, direction, localEndpoint, remoteEndpoint, bytes);
 }
开发者ID:SayHalou,项目名称:ospy,代码行数:9,代码来源:IPPacket.cs


示例13: ExploreCastSpell

        public override void ExploreCastSpell(StreamWriter outputStream, ByteStream buffer, PacketDirection direction)
        {
            UInt32 Slot = buffer.ReadUInt32();
            UInt32 SpellID = buffer.ReadUInt32();

            outputStream.WriteLine("Casting spell {0} from slot {1}", SpellID, Slot);

            outputStream.WriteLine("");
        }
开发者ID:rumstil,项目名称:EQExtractor,代码行数:9,代码来源:PatchJuly13-2010.cs


示例14: Create

        public PacketViewModel Create(PacketDirection packetDirection, byte[] packet)
        {
            Contract.Requires<ArgumentNullException>(packet != null);
            Contract.Requires<ArgumentNullException>(packet.Length >= 16);
            Contract.Ensures(Contract.Result<PacketViewModel>() != null);

            var packetType = this.packetInspectorService.FindType(packet);
            return new PacketViewModel(packetDirection, packet, packetType);
        }
开发者ID:gordonc64,项目名称:AO-Workbench,代码行数:9,代码来源:PacketFactory.cs


示例15: ExploreCastSpell

        public void ExploreCastSpell(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            UInt32 Slot = Buffer.ReadUInt32();
            UInt32 SpellID = Buffer.ReadUInt32();

            OutputStream.WriteLine("Casting spell {0} from slot {1}", SpellID, Slot);

            OutputStream.WriteLine("");
        }
开发者ID:Codex-NG,项目名称:Server,代码行数:9,代码来源:PatchJuly13-2010.cs


示例16: PacketViewModel

        public PacketViewModel(PacketDirection packetDirection, byte[] packet, Type packetType)
        {
            Contract.Requires<ArgumentNullException>(packet != null);
            Contract.Requires<ArgumentNullException>(packet.Length >= 16);

            this.packetDirection = packetDirection;
            this.packet = packet;
            this.packetType = packetType;
            this.timeStamp = DateTime.Now;
        }
开发者ID:gordonc64,项目名称:AO-Workbench,代码行数:10,代码来源:PacketViewModel.cs


示例17: Identify

        public override IdentificationStatus Identify(int OpCode, int Size, PacketDirection Direction)
        {
            if ((OpCode == OpManager.OpCodeNameToNumber("OP_ZoneEntry")) && (Direction == PacketDirection.ClientToServer))
                return IdentificationStatus.Tentative;

            if ((OpCode == OpManager.OpCodeNameToNumber("OP_SendAATable")) && (Direction == PacketDirection.ServerToClient) &&
                (Size == 120))
                return IdentificationStatus.Yes;

            return IdentificationStatus.No;
        }
开发者ID:Vaion,项目名称:Server,代码行数:11,代码来源:PatchDec7-2010.cs


示例18: Identify

        override public IdentificationStatus Identify(int OpCode, int Size, PacketDirection Direction)
        {
            if ((OpCode == OpManager.OpCodeNameToNumber("OP_ZoneEntry")) && (Direction == PacketDirection.ClientToServer))
                return IdentificationStatus.Tentative;

            if ((OpCode == OpManager.OpCodeNameToNumber("OP_PlayerProfile")) && (Direction == PacketDirection.ServerToClient) &&
                (Size == ExpectedPPLength))
                return IdentificationStatus.Yes;

            return IdentificationStatus.No;
        }
开发者ID:Xackery,项目名称:eqemuserver,代码行数:11,代码来源:PatchTestSep22-2010.cs


示例19: LogPacket

        public static string LogPacket(IPacket packet, PacketDirection direction)
        {
            var memory = new MemoryStream();
            var stream = new StreamWriter(memory);
            var type = packet.GetType();
            var fields = type.GetFields();
            // Log time, direction, name
            stream.Write(DateTime.Now.ToString("{hh:mm:ss.fff} "));
            if (direction == PacketDirection.Serverbound)
                stream.Write("[CLIENT->SERVER] ");
            else
                stream.Write("[SERVER->CLIENT] ");
            stream.Write(FormatPacketName(type.Name));
            stream.WriteLine();

            // Log fields
            foreach (var field in fields)
            {
                var name = field.Name;
                if (field.Name == "PacketId")
                    continue;
                name = AddSpaces(name);
                var fValue = field.GetValue(packet);

                if (!(fValue is Array))
                    stream.Write(string.Format(" {0} ({1})", name, field.FieldType.Name));
                else
                {
                    var array = fValue as Array;
                    stream.Write(string.Format(" {0} ({1}[{2}])", name,
                        array.GetType().GetElementType().Name, array.Length));
                }

                if (fValue is byte[])
                    stream.Write(": " + DumpArray(fValue as byte[]) + "\n");
                else if (fValue is Array)
                {
                    stream.Write(": ");
                    var array = fValue as Array;
                    foreach (var item in array)
                        stream.Write(string.Format("{0}, ", item.ToString()));
                    stream.WriteLine();
                }
                else if (fValue is string)
                    stream.Write(": \"" + fValue + "\"\n");
                else
                    stream.Write(": " + fValue + "\n");
            }
            stream.WriteLine();
            stream.Flush();
            return Encoding.UTF8.GetString(memory.GetBuffer().Take((int)memory.Length).ToArray());
        }
开发者ID:Booser,项目名称:Craft.Net,代码行数:52,代码来源:PacketLogger.cs


示例20: ExploreItemPacket

        public override void ExploreItemPacket(StreamWriter outputStream, ByteStream buffer, PacketDirection direction)
        {
            UInt32 StackSize = buffer.ReadUInt32();
            buffer.SkipBytes(4);
            UInt32 Slot = buffer.ReadUInt32();
            UInt32 MerchantSlot = buffer.ReadUInt32();
            UInt32 Price = buffer.ReadUInt32();
            Int32 Quantity = buffer.ReadInt32();
            buffer.SetPosition(68);
            string Name = buffer.ReadString(true);

            outputStream.WriteLine("Item: {0} at Slot: {1}", Name, Slot);
        }
开发者ID:rumstil,项目名称:EQExtractor,代码行数:13,代码来源:PatchJuly13-2010.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PacketHandler类代码示例发布时间:2022-05-24
下一篇:
C# PacketDestination类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap