/// <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; }
/// <summary> /// Loads entry from stream. /// </summary> /// <param name="reeader">Reader to read from.</param> public void Load( BinaryReader reader ) { try { // Supress changed event _IsBusy = true; // Read if ( _Parent == null ) reader.ReadBoolean(); IsVisible = reader.ReadBoolean(); IsChecked = reader.ReadBoolean(); foreach ( IUltimaPacketFilterEntry o in _Children ) { bool type = reader.ReadBoolean(); if ( type ) { UltimaPacketFilterTable table = o as UltimaPacketFilterTable; if ( table == null ) table = new UltimaPacketFilterTable( null, null, null, -1 ); // Dummy table.Load( reader ); } else { UltimaPacketFilterEntry entry = o as UltimaPacketFilterEntry; if ( entry == null ) entry = new UltimaPacketFilterEntry( null, null, null, -1 ); // Dummy entry.Load( reader ); } } } finally { _IsBusy = false; } }
/// <summary> /// Constructs a new instance of UltimaPacketFilterProperty. /// </summary> /// <param name="parent">Property parent.</param> public UltimaPacketFilterProperty( UltimaPacketFilterEntry parent ) { _Parent = parent; }