當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。