private void btnActivate_Click(object sender, EventArgs e) { this.btnStop.Enabled = true; this.btnActivate.Enabled = false; this.btnSelectLabelOutputDirectory.Enabled = false; this.btnOCRDirectory.Enabled = false; this.cbTotalKills.Enabled = false; this.cbTotalDeaths.Enabled = false; this.cbKillDeathRatio.Enabled = false; this.cbTotalWins.Enabled = false; this.btnAddDeath.Enabled = true; this.btnRemoveDeath.Enabled = true; this.btnAddKill.Enabled = true; this.btnRemoveKill.Enabled = true; totalProcessingTime = 0; totalScreenProcessed = 0; imagesToProcess.Clear(); SetKillsLabel("0"); SetDeathsLabel("0"); SetAverageProcessingTimeLabel("0"); SetTotalImagesScannedLabel("0"); /* * We basically need to watch the OCR directory now for any changes * Anytime an image is added, send it thru the OCR service and figure out what happened * Then delete the image after so we dont clog up disk space */ directoryWatcher = new FileSystemWatcher(); directoryWatcher.Path = applicationSettings.ScreenshotDirectory; directoryWatcher.NotifyFilter = NotifyFilters.LastWrite; directoryWatcher.Filter = "*.jpg"; directoryWatcher.Changed += new FileSystemEventHandler(OnScreenshotDetected); directoryWatcher.EnableRaisingEvents = true; PUBGStats = new PUBGStats(); SettingsService.WriteStatsToFiles(applicationSettings, PUBGStats); }
public static void WriteStatsToFiles(ApplicationSettings applicationSettings, PUBGStats stats) { File.WriteAllText(applicationSettings.TotalKillsFilePath, stats.Kills.ToString()); File.WriteAllText(applicationSettings.TotalDeathsFilePath, stats.Deaths.ToString()); File.WriteAllText(applicationSettings.KillDeathRatioFilePath, stats.KillDeathRatio.ToString()); File.WriteAllText(applicationSettings.TotalWinsFilePath, stats.Wins.ToString()); }