/// <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;
        }
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            UltimaPacketFilter filter = Filter;

            if (filter != null)
            {
                try
                {
                    if (_SaveFileDialog == null)
                    {
                        _SaveFileDialog                 = new SaveFileDialog();
                        _SaveFileDialog.Filter          = "SpyUO filter (*.filter)|*.filter";
                        _SaveFileDialog.CheckPathExists = true;
                        _SaveFileDialog.Title           = "Save Filter";
                    }

                    if (_SaveFileDialog.ShowDialog(App.Current.MainWindow) == true)
                    {
                        filter.Save(_SaveFileDialog.FileName);
                    }
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex);
                }
            }
        }
Example #3
0
        private static void Filter_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            UltimaPacketFilter filter = d as UltimaPacketFilter;

            if (filter != null)
            {
                filter.Table.Filter(filter.Filter);
            }
        }
Example #4
0
        private static void Active_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            UltimaPacketFilter filter = d as UltimaPacketFilter;

            if (filter != null)
            {
                filter.OnChange();
            }
        }
Example #5
0
        /// <summary>
        /// Constructs a new instance of MainWindow.
        /// </summary>
        public MainWindow()
        {
            _Notifications = new ObservableCollection<Notification>();
            _SpyHelper = new SpyHelper();
            _SpyHelper.PacketsView.Filter += new Predicate<object>( Filter_Displayed );
            _Filter = new UltimaPacketFilter();
            _Filter.Changed += new EventHandler( Filter_Changed );

            InitializeComponent();
        }
Example #6
0
        /// <summary>
        /// Constructs a new instance of MainWindow.
        /// </summary>
        public MainWindow()
        {
            _Notifications = new ObservableCollection <Notification>();
            _SpyHelper     = new SpyHelper();
            _SpyHelper.PacketsView.Filter += new Predicate <object>(Filter_Displayed);
            _Filter          = new UltimaPacketFilter();
            _Filter.Changed += new EventHandler(Filter_Changed);

            InitializeComponent();
        }
Example #7
0
        /// <summary>
        /// Constructs a new instance of UltimaPacketFilterEntry.
        /// </summary>
        /// <param name="owner">Owner.</param>
        /// <param name="parent">Entry parent.</param>
        /// <param name="index">Entry index.</param>
        /// <param name="definition">Packet definition.</param>
        public UltimaPacketFilterEntry(UltimaPacketDefinition definition, UltimaPacketFilter owner, UltimaPacketFilterTable parent, int index)
        {
            _Definition = definition;
            _Owner      = owner;
            _Parent     = parent;
            Index       = index;

            if (definition != null)
            {
                IsVisible = true;
                IsChecked = true;
            }
        }
Example #8
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;
        }
Example #9
0
        private static void ShowAll_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            UltimaPacketFilter filter = d as UltimaPacketFilter;

            if (filter != null && !filter._IsBusy)
            {
                if (filter.ShowAll)
                {
                    filter.Table.ShowAll();
                }
                else
                {
                    filter.Table.HideUnknown();
                }

                filter.OnChange();
            }
        }