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(); } }
/// <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(); }
/// <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(); }
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); } } }
private void StopCommand_Executed(object sender, ExecutedRoutedEventArgs e) { ShowLoading(); try { SpyHelper.Stop(); } catch (Exception ex) { ShowNotification(NotificationType.Error, ex); } HideLoading(); }
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(); } }
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(); }
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(); } }
/// <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); }
/// <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 ); }
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(); } } }
private void LoadPacketWorker_DoWork(object sender, DoWorkEventArgs e) { SpyHelper.LoadBinary((string)e.Argument); }