Example #1
0
        /// <summary>
        /// Checks if packet is displayed in packet list.
        /// </summary>
        /// <param name="packet">Packet to check.</param>
        /// <returns>True if visible, false otherwise.</returns>
        public bool IsDisplayed(UltimaPacket packet)
        {
            UltimaPacketFilterTable  table      = Table;
            UltimaPacketFilterTable  childTable = null;
            IUltimaPacketFilterEntry item       = null;
            int i = 0;

            do
            {
                item       = table[packet.Data[i++]];
                childTable = item as UltimaPacketFilterTable;

                if (childTable != null)
                {
                    if (!childTable.IsChecked)
                    {
                        return(false);
                    }

                    table = childTable;
                }
            }while (childTable != null);

            UltimaPacketFilterEntry entry = item as UltimaPacketFilterEntry;

            if (entry != null)
            {
                return(entry.IsVisible && entry.IsChecked && entry.IsDisplayed(packet));
            }

            return(false);
        }
        private bool EntryFilter(object item)
        {
            if (item != null)
            {
                IUltimaPacketFilterEntry entry = item as IUltimaPacketFilterEntry;

                if (entry != null)
                {
                    return(entry.IsVisible && !entry.IsFiltered);
                }
            }

            return(true);
        }
        /// <summary>
        /// Checks if all children are checked.
        /// </summary>
        public void AreAllChecked()
        {
            bool areAllChecked = true;

            for (int i = 1; i < _Children.Length; i++)
            {
                IUltimaPacketFilterEntry entry = _Children[i];

                if (entry.IsVisible && !entry.IsChecked)
                {
                    areAllChecked = false;
                    break;
                }
            }

            _IsBusy   = true;
            IsChecked = areAllChecked;
            _IsBusy   = false;
        }
Example #4
0
        /// <summary>
        /// Checks if packet is displayed in packet list.
        /// </summary>
        /// <param name="packet">Packet to check.</param>
        /// <returns>True if visible, false otherwise.</returns>
        public bool IsDisplayed(UltimaPacket packet)
        {
            UltimaPacketFilterTable  table      = Table;
            UltimaPacketFilterTable  childTable = null;
            IUltimaPacketFilterEntry item       = null;
            int i = 0;


            //the filter is now correctly filtering the subcommands but this is the best way to find cmd.subcmd[.subsubcmd]
            string[] sids = packet.Ids.Split('.');
            byte[]   ids  = new byte[sids.Length];
            foreach (string s in sids)
            {
                ids[i++] = Convert.ToByte(s.Substring(0, 2), 16);
            }

            i = 0;
            do
            {
                item       = table[ids[i++]];
                childTable = item as UltimaPacketFilterTable;

                if (childTable != null)
                {
                    if (childTable.IsChecked)
                    {
                        return(true);
                    }

                    table = childTable;
                }
            }while (childTable != null && i < ids.Length);

            UltimaPacketFilterEntry entry = item as UltimaPacketFilterEntry;

            if (entry != null)
            {
                return(entry.IsVisible && entry.IsChecked && entry.IsDisplayed(packet));
            }

            return(false);
        }