public CSharpJsStateMapper(CefBrowserHandler browser, StatisticsService statisticsService, GeneralStateService generalStateService, PositionTrackerService positionTrackerService) { _browser = browser; _statisticsService = statisticsService; _generalStateService = generalStateService; _positionTrackerService = positionTrackerService; _settings = new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, Culture = System.Globalization.CultureInfo.InvariantCulture, ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() }; }
public MessageProcessorCore( DamageParsingService damageParsingService, PositionTrackerService positionTrackerService, GeneralStateService generalStateService, AppSettings appSettings ) { _processors = new List <IMessageProcessor> { new GdLogMessageProcessor(appSettings, damageParsingService), new PlayerPositionTrackerProcessor(positionTrackerService, appSettings), new GdGameEventProcessor(generalStateService), new PlayerDetectionProcessor(damageParsingService, appSettings), new DetectPlayerHitpointsProcessor(damageParsingService, appSettings), new PlayerResistMonitor(damageParsingService, appSettings) }; _registerWindowDelegate = CustomWndProc; _injectorCallbackDelegate = InjectorCallback; _window = new RegisterWindow("GDDamageWindowClass", _registerWindowDelegate); _injector = new InjectionHelper(new BackgroundWorker(), _injectorCallbackDelegate, false, "Grim Dawn", string.Empty, "Hook.dll"); _appSettings = appSettings; }
public GdGameEventProcessor(GeneralStateService generalStateService) { _generalStateService = generalStateService; }
public Form1(CefBrowserHandler browser, AppSettings appSettings, bool showDevtools) { InitializeComponent(); _browser = browser; _appSettings = appSettings; _generalStateService = new GeneralStateService(_appSettings); _showDevtools = showDevtools; _messageProcessorCore = new MessageProcessorCore(_damageParsingService, _positionTrackerService, _generalStateService, _appSettings); _statisticsService = new StatisticsService(_damageParsingService); _browser.JsPojo.OnSave += JsPojoOnOnSave; _browser.JsPojo.OnSetLightMode += (sender, args) => { bool isDarkMode = (args as LightModeArgument)?.IsDarkMode ?? false; Properties.Settings.Default.DarkModeEnabled = isDarkMode; Properties.Settings.Default.Save(); }; _browser.JsPojo.OnLog += (sender, args) => { string data = (args as SaveParseArgument)?.Data; Logger.Warn(data); ExceptionReporter.ReportIssue(data); }; _nameSuggestionService = new NameSuggestionService(GlobalSettings.BineroHost); _cSharpJsStateMapper = new CSharpJsStateMapper(_browser, _statisticsService, _generalStateService, _positionTrackerService); _browser.JsPojo.OnRequestData += (sender, _args) => { RequestDataArgument args = _args as RequestDataArgument; long start; if (long.TryParse(args.TimestampStart, out start)) { long end; if (long.TryParse(args.TimestampEnd, out end)) { _cSharpJsStateMapper.RequestData(args.Type, start, end, args.EntityId, args.Callback); } else { Logger.Warn($"Could not parse timestamp {args.TimestampEnd} received for {args.Type}"); } } else { Logger.Warn($"Could not parse timestamp {args.TimestampStart} received for {args.Type}"); } }; #if !DEBUG webViewPanel.Parent.Controls.Remove(webViewPanel); Controls.Clear(); if (_showDevtools) { Controls.Add(btnShowDevtools); } Controls.Add(webViewPanel); bool itemAssistantInstalled = Directory.Exists(GlobalSettings.ItemAssistantFolder) || new Random().Next(10) < 8; if (itemAssistantInstalled) { webViewPanel.Location = new Point { X = 0, Y = 0 }; webViewPanel.Width = this.ClientSize.Width; webViewPanel.Height = this.ClientSize.Height; } else { var labels = new[] { "Is your stash full? Try Item Assistant!", "Need a larger stash? Try Item Assistant!", "Having trouble finding space for all your loot? Try Item Assistant!", "Having trouble finding space for all your items? Try Item Assistant!", "Need extra item storage? Try Item Assistant!", }; var idx = new Random().Next(0, labels.Length); linkItemAssistant.Text = labels[idx]; const int margin = 5; webViewPanel.Location = new Point { X = 0, Y = linkItemAssistant.Height + margin * 2 }; webViewPanel.Width = this.ClientSize.Width; webViewPanel.Height = this.ClientSize.Height - linkItemAssistant.Height - margin * 2; Controls.Add(linkItemAssistant); } #else linkItemAssistant.Hide(); #endif _timerReportUsage = new System.Timers.Timer(); _timerReportUsage.Start(); _timerReportUsage.Elapsed += (a1, a2) => { if (Thread.CurrentThread.Name == null) { Thread.CurrentThread.Name = "CleanupThread"; } _damageParsingService.Cleanup(); }; _timerReportUsage.Interval = 60 * 1000 * 5; _timerReportUsage.AutoReset = true; _timerReportUsage.Start(); }