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


C# Network.Packet类代码示例

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


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

示例1: Compress

        public static Packet Compress(Packet p)
        {
            int length;
            byte[] source = p.Compile(false, out length);

            if (length > 100 && length < 60000)
            {
                byte[] dest = new byte[(int)(length * 1.001) + 10];
                int destSize = dest.Length;

                ZLibError error = Compression.Pack(dest, ref destSize, source, length, ZLibQuality.Default);

                if (error != ZLibError.Okay)
                {
                    Console.WriteLine("WARNING: Unable to compress admin packet, zlib error: {0}", error);
                    return p;
                }
                else
                {
                    return new AdminCompressedPacket(dest, destSize, length);
                }
            }
            else
            {
                return p;
            }
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:27,代码来源:Network.cs

示例2: Initialize

        public static void Initialize()
        {
            m_OldEFHandler = PacketHandlers.GetHandler(0xEF);
            PacketHandlers.Register(0xEF, 21, false, new Server.Network.OnPacketReceive(LoginServerSeed));
            PacketHandlers.Register(Config.EncapsulationHeader, 0, false, new Server.Network.OnPacketReceive(UOExtPacket));

            uint ip = (uint)(BitConverter.ToInt32(IPAddress.Parse(Config.IP).GetAddressBytes(), 0));

            m_UOExtSupport = new UOExtSupport();
            m_UOExtSupport.SetStatic();

            m_handler = UOExt.PacketHandler.Instatinate();

            Console.WriteLine("UOExt: Adapter started.");
        }
开发者ID:WildGenie,项目名称:uo-ext,代码行数:15,代码来源:UOExtAdapter.cs

示例3: OnRevised

		public void OnRevised()
		{
			lock( this )
			{
				m_Revision = ++m_Foundation.LastRevision;

				if( m_PacketCache != null )
					m_PacketCache.Release();

				m_PacketCache = null;
			}
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:12,代码来源:HouseFoundation.cs

示例4: SetStatic

 public static Packet SetStatic( Packet p )
 {
     p.SetStatic();
     return p;
 }
开发者ID:Leorgrium,项目名称:runuo,代码行数:5,代码来源:Packets.cs

示例5: Release

 public static void Release( Packet p )
 {
     if ( p != null )
         p.Release();
 }
开发者ID:Leorgrium,项目名称:runuo,代码行数:5,代码来源:Packets.cs

示例6: Acquire

 public static Packet Acquire( Packet p )
 {
     p.Acquire();
     return p;
 }
开发者ID:Leorgrium,项目名称:runuo,代码行数:5,代码来源:Packets.cs

示例7: SendToAll

		public void SendToAll( Packet p )
		{
			p.Acquire();

			for ( int i = 0; i < m_Members.Count; ++i )
				m_Members[i].Mobile.Send( p );

			if ( p is MessageLocalized || p is MessageLocalizedAffix || p is UnicodeMessage || p is AsciiMessage )
			{
				for ( int i = 0; i < m_Listeners.Count; ++i )
				{
					Mobile mob = m_Listeners[i];

					if ( mob.Party != this )
						mob.Send( p );
				}
			}

			p.Release();
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:20,代码来源:Party.cs

示例8: SendDetailedInfoTo

 public void SendDetailedInfoTo(NetState state)
 {
     if (state != null)
     {
         lock (this)
         {
             if (m_InfoPacket == null)
                 m_InfoPacket = new DesignStateDetailed(Serial, 0, Components.Min.X, Components.Min.Y, Components.Max.X, Components.Max.Y, Components.List);
             Packet p = m_InfoPacket;
             p.SetStatic();
             state.Send(p);
         }
     }
 }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:14,代码来源:BaseBuilding.cs

示例9: PacketInfo

			public PacketInfo(NetState state, Packet packet)
			{
				State = state;
				Packet = packet;
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:5,代码来源:HouseFoundation.cs

示例10: SendSingleClickTo

        public override void SendSingleClickTo( Mobile from )
        {
            if ( !IsMagic || !( m_Identified.Contains( from ) || from.AccessLevel > AccessLevel.Counselor ) )
            {
                base.SendSingleClickTo( from );
            }
            else
            {
                if ( m_MagicSingleClick == null )
                {
                    m_MagicSingleClick = new AsciiMessage( Serial, ItemID, MessageType.Label, 0x3B2, 3, "", BuildMagicSingleClick() );
                    m_MagicSingleClick.SetStatic();
                }

                from.NetState.Send( m_MagicSingleClick );
            }
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:17,代码来源:BaseArmor.cs


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