public void ExecuteAfterStartupSteps() { try { var vm = newsViewModelFactory.CreateNewsViewModel(); vm.ShowIfAnyUnshownNews(); } catch (Exception exception) { logger.Error(exception, "Error at showing news"); userNotifier.NotifyWithMessageBox("Error at showing news, see logs for details.", NotifyKind.Warning); } try { wurmUnlimitedLogsDirChecker.HandleOldLogsDirContents(); } catch (Exception exception) { logger.Error(exception, "Error at HandleOldLogsDirContents"); userNotifier.NotifyWithMessageBox("Error at HandleOldLogsDirContents, see logs for details.", NotifyKind.Warning); } var version = waVersionInfoProvider.Get(); telemetry.TrackEvent($"Started: " + version); }
private void validateWurmGameClientConfigsToolStripMenuItem_Click(object sender, EventArgs e) { try { var validator = wurmClientValidatorFactory.CreateWurmClientValidator(); var result = validator.Validate(); if (result.Any()) { validator.ShowSummaryWindow(result); } else { userNotifier.NotifyWithMessageBox("No issues found"); } } catch (Exception exception) { logger.Error(exception, "Unable to validate game client configs."); userNotifier.NotifyWithMessageBox( $"Unable to validate game client configs due to error: {exception.Message}\r\nPlease check logs for details."); } }
public void HandleOldLogsDirContents() { if (wurmAssistantConfig.WurmUnlimitedMode && !warningShown) { var charactersWithOldLogs = wurmCharacters.All .Select(character => new { CharacterName = character.Name, LogsPath = wurmPaths.GetOldWuLogsDirFullPathForCharacter(character.Name) }) .Select(arg => new { CharacterName = arg.CharacterName, FileCount = Directory.Exists(arg.LogsPath) ? Directory.EnumerateFiles(arg.LogsPath).Count() : 0, LogsPath = arg.LogsPath }) .Where(arg => arg.FileCount > 0) .ToList(); if (charactersWithOldLogs.Any()) { userNotifier.NotifyWithMessageBox("Recently Wurm Unlimited has changed where it saves Wurm log files. " + "The old directory was named 'test_logs', while the new one is just 'logs'. " + $"Wurm Assistant has found some logs at the old directories for characters:\r\n\r\n" + $"{string.Join(",\r\n\r\n", charactersWithOldLogs.Select(arg => $"{arg.CharacterName} has {arg.FileCount} files at {arg.LogsPath}"))}.\r\n\r\n" + "While nothing will outright break because of this, some Wurm Assistant features " + "require log searches for some things, for example to find current skill levels. " + "If you notice any issue with eg. meditation timer or smilexamines, " + "consider moving/merging all log files from old directory to the new one."); } warningShown = true; FlagAsChanged(); } }