/// <summary>
        /// Determines whether the packet should be ignored.
        /// </summary>
        /// <param name="packet">The packet.</param>
        /// <returns>
        ///     <c>true</c> if packet should be ignored; otherwise, <c>false</c>.
        /// </returns>
        public override bool IsPacketIgnored(Packet packet)
        {
            bool bRet = true;

            if (m_sid != ID_NOT_SET)
            {
                ISessionIdPacket spak = packet as ISessionIdPacket;
                if (spak != null && spak.SessionId == m_sid)
                {
                    bRet = false;
                }
            }
            if (bRet && m_oid != ID_NOT_SET)
            {
                IObjectIdPacket pak = packet as IObjectIdPacket;
                if (pak != null)
                {
#warning TODO: Check performance?
//					int index = Array.IndexOf<ushort>(pak.ObjectIds, m_selfOID);
//					bRet = 0 > index;
                    // Check pet OID
                    foreach (ushort id in pak.ObjectIds)
                    {
                        if (id == m_oid)
                        {
                            bRet = false;
                            break;
                        }
                    }
                }
            }

            return(bRet);
        }
Example #2
0
        /// <summary>
        /// Determines whether the packet should be ignored.
        /// </summary>
        /// <param name="packet">The packet.</param>
        /// <returns>
        ///     <c>true</c> if packet should be ignored; otherwise, <c>false</c>.
        /// </returns>
        public bool IsPacketIgnored(Packet packet)
        {
            // Check whether message packets should be included
            if (includeMessagesCheckBox.Checked)
            {
                if (packet is StoC_0xAF_Message || packet is StoC_0x4D_SpellMessage_174)
                {
                    return(false);
                }
            }

            // Session Id
            ISessionIdPacket spak = packet as ISessionIdPacket;

            if (spak != null)
            {
                foreach (ListBoxOid boxOid in m_selectedOidsCache)
                {
                    if (spak.SessionId == boxOid.oid)
                    {
                        return(false);
                    }
                }
            }

            // Object Ids
            IObjectIdPacket pak = packet as IObjectIdPacket;

            if (pak != null)
            {
                // Check all entered OIDs
                foreach (ListBoxOid boxOid in m_selectedOidsCache)
                {
                    // ...in packet's list of OIDs
                    foreach (ushort id in pak.ObjectIds)
                    {
                        if (id == boxOid.oid)
                        {
                            return(false);
                        }
                    }
                }
            }

            // House Id
            IHouseIdPacket hpak = packet as IHouseIdPacket;

            if (hpak != null)
            {
                foreach (ListBoxOid boxOid in m_selectedOidsCache)
                {
                    if (hpak.HouseId == boxOid.oid)
                    {
                        return(false);
                    }
                }
            }

            // Keep Ids
            IKeepIdPacket kpak = packet as IKeepIdPacket;

            if (kpak != null)
            {
                // Check all entered OIDs
                foreach (ListBoxOid boxOid in m_selectedOidsCache)
                {
                    // ...in packet's list of OIDs
                    foreach (ushort id in kpak.KeepIds)
                    {
                        if (id == boxOid.oid)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }