本文整理汇总了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;
}
}
示例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.");
}
示例3: OnRevised
public void OnRevised()
{
lock( this )
{
m_Revision = ++m_Foundation.LastRevision;
if( m_PacketCache != null )
m_PacketCache.Release();
m_PacketCache = null;
}
}
示例4: SetStatic
public static Packet SetStatic( Packet p )
{
p.SetStatic();
return p;
}
示例5: Release
public static void Release( Packet p )
{
if ( p != null )
p.Release();
}
示例6: Acquire
public static Packet Acquire( Packet p )
{
p.Acquire();
return p;
}
示例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();
}
示例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);
}
}
}
示例9: PacketInfo
public PacketInfo(NetState state, Packet packet)
{
State = state;
Packet = packet;
}
示例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 );
}
}