Ejemplo n.º 1
0
        /// <summary>
        /// Performs the actual disposing.
        /// </summary>
        /// <param name="Managed">True if disposing managed resources.  Otherise, false.</param>
        protected virtual void Dispose(bool Managed)
        {
            // Only dispose once
            if (Disposing)
            {
                return;
            }

            if (!Managed)
            {
            }

            // Disconnect and unsubscribe from the events
            Disconnect();

            // Dispose of the socket wrapper
            ClientInstance.Dispose();

            Disposing = true;
        }
Ejemplo n.º 2
0
        public void PacketFilterTest()
        {
            ServerInstance si = new ServerInstance(UOM.ServerName, false, 0, 32);
            ClientInstance ci = new ClientInstance(UOM.ServerName, false);

            ci.AddRecvFilterEvent += Ci_AddRecvFilterEvent;
            ci.SendPacketEvent    += Ci_SendPacketEvent;

            si.SendCommand(Command.AddRecvFilterConditional, new PacketFilterInfo(0xFF, new PacketFilterCondition[] { new PacketFilterCondition(2, new byte[] { 0x12, 0x34, 0x56, 0x78 }, 4) }).Serialize());

            byte[] packet = new byte[]
            {
                0xFF,
                0x01,
                0x12,
                0x34,
                0x56,
                0x78,
            };

            byte[] packet2 = new byte[]
            {
                0xFF,
                0x00,
                0x78,
                0x56,
                0x34,
                0x12,
            };

            si.SendCommand(Command.SendPacket, 0, (byte)PacketType.Server, packet);
            si.SendCommand(Command.SendPacket, 0, (byte)PacketType.Server, packet2);

            lock (m_FinishedLock)
            {
                Monitor.Wait(m_FinishedLock);
            }

            ci.Dispose();
            si.Dispose();
        }