public static void Write(object o) { if (LogPath == null || !File.Exists(LogPath) || !LogPath.EndsWith(".txt")) { LogPath = Path.Combine(Directory.GetCurrentDirectory(), "BOILOG.txt"); } FileInfo lf = new FileInfo(LogPath); try { string result = o?.ToString() ?? "null"; File.AppendAllText(LogPath, result); } catch (IOException) { } }
public LogDetailViewModel(string logPath) { LogPath = Path.Combine(FolderFactory.LogFolder, logPath); CanExecuteClose = true; CanExecuteExport = true; ShowScoreItems = Visibility.Collapsed; ShowActivityItems = Visibility.Collapsed; if (File.Exists(LogPath) && LogPath.EndsWith(".xml")) { if (LogPath.Contains("Score")) { LogType = LogTypes.Score; ScoreItems = GetScoreItems(); ShowScoreItems = Visibility.Visible; } else if (LogPath.Contains("Activity")) { LogType = LogTypes.Activity; ActivityItems = GetActivityItems(); ShowActivityItems = Visibility.Visible; } } }