public static bool StartNetworkCapture(MainWindowViewModel mainWindowViewModel, TrackingController trackingController) { try { _mainWindowViewModel = mainWindowViewModel; builder = ReceiverBuilder.Create(); //builder.AddResponseHandler(new UseLootChestEventHandler(trackingController)); builder.AddEventHandler(new NewSimpleItemEventHandler(trackingController)); builder.AddEventHandler(new NewEquipmentItemEventHandler(trackingController)); builder.AddEventHandler(new OtherGrabbedLootEventHandler(trackingController)); builder.AddEventHandler(new InventoryDeleteItemEventHandler(trackingController)); builder.AddEventHandler(new InventoryPutItemEventHandler(trackingController)); builder.AddEventHandler(new TakeSilverEventHandler(trackingController)); builder.AddEventHandler(new UpdateFameEventHandler(trackingController)); builder.AddEventHandler(new UpdateMoneyEventHandler(trackingController)); builder.AddEventHandler(new UpdateReSpecPointsEventHandler(trackingController)); builder.AddEventHandler(new UpdateCurrencyEventHandler(trackingController)); builder.AddEventHandler(new DiedEventHandler(trackingController)); builder.AddEventHandler(new NewLootChestEventHandler(trackingController)); builder.AddEventHandler(new LootChestOpenedEventHandler(trackingController)); builder.AddEventHandler(new InCombatStateUpdateEventHandler(trackingController)); builder.AddEventHandler(new NewShrineEventHandler(trackingController)); builder.AddRequestHandler(new UseShrineEventHandler(trackingController)); builder.AddResponseHandler(new ChangeClusterResponseHandler(trackingController)); builder.AddEventHandler(new HealthUpdateEventHandler(trackingController)); builder.AddEventHandler(new PartyDisbandedEventHandler(trackingController)); builder.AddEventHandler(new PartyChangedOrderEventHandler(trackingController)); builder.AddResponseHandler(new PartyMakeLeaderEventHandler(trackingController)); builder.AddEventHandler(new NewCharacterEventHandler(trackingController)); builder.AddEventHandler(new SiegeCampClaimStartEventHandler(trackingController)); builder.AddEventHandler(new NewMobEventHandler(trackingController)); builder.AddEventHandler(new LeaveEventHandler(trackingController)); builder.AddEventHandler(new CharacterEquipmentChangedEventHandler(trackingController)); builder.AddEventHandler(new ActiveSpellEffectsUpdateEventHandler(trackingController)); builder.AddEventHandler(new PartySilverGainedEventHandler(trackingController)); builder.AddEventHandler(new UpdateFactionStandingEventHandler(trackingController)); //builder.AddResponseHandler(new TestHandler()); //builder.AddEventHandler(new TestHandler2()); //builder.AddRequestHandler(new TestHandler3()); builder.AddResponseHandler(new JoinResponseHandler(trackingController, _mainWindowViewModel)); _receiver = builder.Build(); _capturedDevices.AddRange(CaptureDeviceList.Instance); return(StartDeviceCapture()); } catch (Exception e) { ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod().DeclaringType, e); Log.Error(MethodBase.GetCurrentMethod().DeclaringType, e); _mainWindowViewModel.SetErrorBar(Visibility.Visible, LanguageController.Translation("PACKET_HANDLER_ERROR_MESSAGE")); _mainWindowViewModel.StopTracking(); return(false); } }
public static bool StartNetworkCapture(MainWindowViewModel mainWindowViewModel, TrackingController trackingController, ValueCountUpTimer valueCountUpTimerTimer) { try { _mainWindowViewModel = mainWindowViewModel; builder = ReceiverBuilder.Create(); builder.AddEventHandler(new TakeSilverEventHandler()); builder.AddEventHandler(new UpdateFameEventHandler(trackingController, valueCountUpTimerTimer.FameCountUpTimer)); builder.AddEventHandler(new UpdateMoneyEventHandler(trackingController, valueCountUpTimerTimer.SilverCountUpTimer)); builder.AddEventHandler(new UpdateReSpecPointsEventHandler(trackingController, valueCountUpTimerTimer.ReSpecPointsCountUpTimer)); builder.AddEventHandler(new DiedEventHandler(trackingController)); builder.AddEventHandler(new NewLootChestEventHandler(trackingController)); builder.AddEventHandler(new LootChestOpenedEventHandler(trackingController)); builder.AddEventHandler(new InCombatStateUpdateEventHandler(trackingController)); builder.AddEventHandler(new NewShrineEventHandler(trackingController)); builder.AddResponseHandler(new ChangeClusterResponseHandler()); builder.AddEventHandler(new HealthUpdateEventHandler(trackingController)); builder.AddEventHandler(new PartyDisbandedEventHandler()); builder.AddEventHandler(new NewCharacterEventHandler()); builder.AddEventHandler(new PartySilverGainedEventHandler()); //builder.AddEventHandler(new NewLootEventHandler()); //builder.AddResponseHandler(new TestHandler()); //builder.AddEventHandler(new TestHandler2()); //builder.AddRequestHandler(new TestHandler3()); builder.AddResponseHandler(new JoinResponseHandler(trackingController, _mainWindowViewModel)); _receiver = builder.Build(); _capturedDevices.AddRange(CaptureDeviceList.Instance); return(StartDeviceCapture()); } catch (Exception e) { Log.Error(nameof(StartDeviceCapture), e); _mainWindowViewModel.SetErrorBar(Visibility.Visible, LanguageController.Translation("PACKET_HANDLER_ERROR_MESSAGE")); _mainWindowViewModel.StopTracking(); return(false); } }