/// <summary>
        /// Constructs a new instance of UltimaPacketFilterTable.
        /// </summary>
        /// <param name="definition">Table definition.</param>
        /// <param name="owner">Owner.</param>
        /// <param name="parent">Table parent.</param>
        /// <param name="index">Table index.</param>
        public UltimaPacketFilterTable(UltimaPacketTable definition, UltimaPacketFilter owner = null, UltimaPacketFilterTable parent = null, int index = -1)
        {
            _Definition = definition;
            _Owner      = owner;
            _Parent     = parent;
            Index       = index;

            if (parent == null)
            {
                IsVisible = true;
            }

            // Initialize children
            IsBusy = true;

            if (definition != null)
            {
                _Children = new IUltimaPacketFilterEntry[definition.Length];

                for (int i = 0; i < definition.Length; i++)
                {
                    object item = definition[i];

                    if (item != null)
                    {
                        UltimaPacketTableEntry entry = item as UltimaPacketTableEntry;

                        if (entry != null)
                        {
                            if (entry.FromServer != null)
                            {
                                _Children[i] = new UltimaPacketFilterEntry(entry.FromServer, owner, this, i);
                            }
                            else if (entry.FromClient != null)
                            {
                                _Children[i] = new UltimaPacketFilterEntry(entry.FromClient, owner, this, i);
                            }
                            else
                            {
                                _Children[i] = new UltimaPacketFilterEntry(null, owner, this, i);
                            }
                        }
                        else
                        {
                            _Children[i] = new UltimaPacketFilterTable((UltimaPacketTable)item, owner, this, i);
                        }
                    }
                    else
                    {
                        _Children[i] = new UltimaPacketFilterEntry(null, owner, this, i);
                    }
                }
            }
            else
            {
                _Children = new IUltimaPacketFilterEntry[Byte.MaxValue + 1];
            }

            IsBusy = false;
        }
示例#2
0
        /// <summary>
        /// Initializes filter structure.
        /// </summary>
        public void Initialize()
        {
            UltimaPacketTable table = UltimaPacket.PacketTable;

            if (table == null)
            {
                throw new SpyException("Y U NO initialize packet definitions");
            }

            Table = new UltimaPacketFilterTable(table, this);
        }
示例#3
0
        /// <summary>
        /// Constructs a new instance of UltimaPacketFilterTable.
        /// </summary>
        /// <param name="definition">Table definition.</param>
        /// <param name="owner">Owner.</param>
        /// <param name="parent">Table parent.</param>
        /// <param name="index">Table index.</param>
        public UltimaPacketFilterTable( UltimaPacketTable definition, UltimaPacketFilter owner = null, UltimaPacketFilterTable parent = null, int index = - 1 )
        {
            _Definition = definition;
            _Owner = owner;
            _Parent = parent;
            Index = index;

            if ( parent == null )
                IsVisible = true;

            // Initialize children
            IsBusy = true;

            if ( definition != null )
            {
                _Children = new IUltimaPacketFilterEntry[ definition.Length ];

                for ( int i = 0; i < definition.Length; i++ )
                {
                    object item = definition[ i ];

                    if ( item != null )
                    {
                        UltimaPacketTableEntry entry = item as UltimaPacketTableEntry;

                        if ( entry != null )
                        {
                            if ( entry.FromServer != null )
                                _Children[ i ] = new UltimaPacketFilterEntry( entry.FromServer, owner, this, i );
                            else if ( entry.FromClient != null )
                                _Children[ i ] = new UltimaPacketFilterEntry( entry.FromClient, owner, this, i );
                            else
                                _Children[ i ] = new UltimaPacketFilterEntry( null, owner, this, i );
                        }
                        else
                            _Children[ i ] = new UltimaPacketFilterTable( (UltimaPacketTable) item, owner, this, i );
                    }
                    else
                        _Children[ i ] = new UltimaPacketFilterEntry( null, owner, this, i );
                }
            }
            else
                _Children = new IUltimaPacketFilterEntry[ Byte.MaxValue + 1 ];

            IsBusy = false;
        }