/// <summary> /// Try to open the log file in notepad++. If that fails then try to open it in notepad. If that fails then display a notification. /// </summary> public static void OpenLogFile() { string logFilePath = LogHelper.GetLogPath("", "");//Get default log file path. string textEditorPath = @"C:\Program Files (x86)\Notepad++\notepad++.exe"; if (!File.Exists(textEditorPath)) { textEditorPath = @"C:\Program Files\Notepad++\notepad++.exe"; if (!File.Exists(textEditorPath)) { string windir = Environment.GetEnvironmentVariable("WINDIR"); textEditorPath = windir + @"\notepad.exe"; } } try { System.Diagnostics.Process prc = new System.Diagnostics.Process(); prc.StartInfo.FileName = textEditorPath; prc.StartInfo.Arguments = logFilePath; prc.Start(); } catch { MessageBox.Show("Could Not Open Log File at " + logFilePath + ". Try manually opening the file.", "oops", MessageBoxButtons.OK); } }