示例#1
0
        private void SaveCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                if (_SaveFileDialog == null)
                {
                    _SaveFileDialog        = new SaveFileDialog();
                    _SaveFileDialog.Filter = "Binary files (*.bin)|*.bin";
                }

                if (_SaveFileDialog.ShowDialog(this) == true)
                {
                    ShowLoading();
                    SpyHelper.SaveBinary(_SaveFileDialog.FileName);
                }
            }
            catch (Exception ex)
            {
                ShowNotification(NotificationType.Error, ex);
            }
            finally
            {
                HideLoading();
            }
        }
示例#2
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();
        }
示例#3
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();
        }
示例#4
0
        private void dataGrid_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.Delete)
            {
                var packet = PacketsView.SelectedValue as UltimaPacket;

                if (packet != null)
                {
                    SpyHelper.RemovePacket(packet);
                }
            }
        }
示例#5
0
        private void StopCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ShowLoading();

            try
            {
                SpyHelper.Stop();
            }
            catch (Exception ex)
            {
                ShowNotification(NotificationType.Error, ex);
            }

            HideLoading();
        }
示例#6
0
        private void AttachCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                ProcessListWindow window = new ProcessListWindow();

                if (window.ShowDialog() == true)
                {
                    ShowLoading();
                    SpyHelper.Attach(window.Selected);
                    InitializeAssets();
                }
            }
            catch (Exception ex)
            {
                ShowNotification(NotificationType.Error, ex);
            }
            finally
            {
                HideLoading();
            }
        }
示例#7
0
        private void FindRelatives_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ShowLoading();

            try
            {
                if (e.Parameter is UltimaPacket && e.Parameter is IUltimaEntity)
                {
                    IUltimaEntity entity = (IUltimaEntity)e.Parameter;

                    RelativesWindow window = new RelativesWindow();
                    window.Packet    = (UltimaPacket)e.Parameter;
                    window.Relatives = SpyHelper.FindEntities(entity.Serial);
                    window.WireEvents(SpyHelper);
                    window.Show();
                }
            }
            catch (Exception ex)
            {
                ShowNotification(NotificationType.Error, ex);
            }

            HideLoading();
        }
示例#8
0
        private void StartCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                if (SpyHelper.IsPaused)
                {
                    ShowLoading();
                    SpyHelper.Resume();
                }
                else
                {
                    if (_OpenFileDialog == null)
                    {
                        _OpenFileDialog = new OpenFileDialog();
                        _OpenFileDialog.CheckFileExists = true;
                    }

                    _OpenFileDialog.Filter = "Executable files (*.exe)|*.exe";

                    if (_OpenFileDialog.ShowDialog(this) == true)
                    {
                        ShowLoading();
                        SpyHelper.Start(_OpenFileDialog.FileName);
                        InitializeAssets();
                    }
                }
            }
            catch (Exception ex)
            {
                ShowNotification(NotificationType.Error, ex);
            }
            finally
            {
                HideLoading();
            }
        }
示例#9
0
 /// <summary>
 /// Wires events for realtime relative display.
 /// </summary>
 /// <param name="spyHelper">Spy helper.</param>
 public void WireEvents(SpyHelper spyHelper)
 {
     spyHelper.OnPacket += new Action <UltimaPacket>(SpyHelper_OnPacket);
 }
示例#10
0
 /// <summary>
 /// Wires events for realtime relative display.
 /// </summary>
 /// <param name="spyHelper">Spy helper.</param>
 public void WireEvents( SpyHelper spyHelper )
 {
     spyHelper.OnPacket += new Action<UltimaPacket>( SpyHelper_OnPacket );
 }
示例#11
0
        private void GenerateCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (_SaveFileDialog == null)
            {
                _SaveFileDialog                 = new SaveFileDialog();
                _SaveFileDialog.Filter          = "C# Source File (*.cs)|*.cs";
                _SaveFileDialog.CheckPathExists = true;
                _SaveFileDialog.Title           = "Save Class";
            }

            if (_SaveFileDialog.ShowDialog() == true)
            {
                try
                {
                    App.Window.ShowLoading();

                    if (e.Parameter is GenericGumpPacket)
                    {
                        GenericGumpPacket gump = (GenericGumpPacket)e.Parameter;

                        using (FileStream stream = File.Open(_SaveFileDialog.FileName, FileMode.Create, FileAccess.Write, FileShare.None))
                        {
                            UltimaGumpGenerator.Generate(stream, gump);
                        }
                    }
                    else if (e.Parameter is WorldObjectPacket)
                    {
                        WorldObjectPacket             item       = (WorldObjectPacket)e.Parameter;
                        QueryPropertiesResponsePacket properties = SpyHelper.FindFirstPacket(item.Serial, typeof(QueryPropertiesResponsePacket)) as QueryPropertiesResponsePacket;

                        using (FileStream stream = File.Open(_SaveFileDialog.FileName, FileMode.Create, FileAccess.Write, FileShare.None))
                        {
                            UltimaItemGenerator.Generate(stream, item.ObjectID, item.Hue, item.Amount, properties);
                        }
                    }
                    else if (e.Parameter is ContainerItem)
                    {
                        ContainerItem item = (ContainerItem)e.Parameter;
                        QueryPropertiesResponsePacket properties = SpyHelper.FindFirstPacket(item.Serial, typeof(QueryPropertiesResponsePacket)) as QueryPropertiesResponsePacket;

                        using (FileStream stream = File.Open(_SaveFileDialog.FileName, FileMode.Create, FileAccess.Write, FileShare.None))
                        {
                            UltimaItemGenerator.Generate(stream, item.ItemID, item.Hue, item.Amount, properties);
                        }
                    }
                    else if (e.Parameter is MobileIncommingPacket)
                    {
                        MobileIncommingPacket mobile = (MobileIncommingPacket)e.Parameter;
                        MobileNamePacket      name   = SpyHelper.FindFirstPacket(mobile.Serial, typeof(MobileNamePacket)) as MobileNamePacket;

                        using (FileStream stream = File.Open(_SaveFileDialog.FileName, FileMode.Create, FileAccess.Write, FileShare.None))
                        {
                            UltimaMobileGenerator.Generate(stream, mobile, name);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ShowNotification(NotificationType.Error, ex);
                }
                finally
                {
                    HideLoading();
                }
            }
        }
示例#12
0
 private void LoadPacketWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     SpyHelper.LoadBinary((string)e.Argument);
 }