private static void OnShowCommandLine(object parameter) { var programDescription = GetProgramDescription(parameter); if (CanLaunch(programDescription)) { var title = string.Format(Resources.Strings.ShowJzIntvCommandLineCommand_DialogTitle_Format, programDescription.Name); var message = string.Format(Resources.Strings.ShowJzIntvCommandLineCommand_DialogMessage_Format, programDescription.Name); var dialog = ReportDialog.Create(title, message); dialog.ShowSendEmailButton = false; var options = GetCommandLineOptionsForRom(programDescription); var jzIntvPath = ConfigurationCommandGroup.ResolvePathSetting(JzIntvLauncherConfiguration.Instance.EmulatorPath); var commandLine = jzIntvPath + ' ' + options.BuildCommandLineArguments(programDescription.Rom.RomPath, false); dialog.ReportText = string.Format(Resources.Strings.ShowJzIntvCommandLineCommand_CommandLineMessage_Format, programDescription.Name, commandLine); dialog.ShowDialog(Resources.Strings.ReportErrorDialogButtonText); } }
private void GetDeviceErrorAndCrashLogsComplete(ErrorLog errorLog, CrashLog crashLog) { var hasErrorLog = (errorLog != null) && !errorLog.IsEmpty; var hasCrashLog = crashLog != null; if (hasErrorLog || hasCrashLog) { var reportText = (new System.Text.StringBuilder(Resources.Strings.CrashReporter_DetailHeader)).AppendLine(); if (Device != null) { reportText.AppendLine("Device Primary Firmware Version: " + FirmwareRevisions.FirmwareVersionToString(Device.FirmwareRevisions.Primary, false)); reportText.AppendLine("Device Secondary Firmware Version: " + FirmwareRevisions.FirmwareVersionToString(Device.FirmwareRevisions.Secondary, false)); reportText.AppendLine("Device Current Firmware Version: " + FirmwareRevisions.FirmwareVersionToString(Device.FirmwareRevisions.Current, false)); } else { reportText.AppendLine("Device firmware versions unavailable"); } reportText.AppendLine(Resources.Strings.CrashReporter_Detail_DeviceId + " " + Device.UniqueId); var timestamp = PathUtils.GetTimeString(true); reportText.AppendLine(Resources.Strings.CrashReporter_Detail_Timestamp + " " + timestamp); var errorReportFiles = new List <string>(); if (hasCrashLog) { var crashLogFileName = string.Empty; try { System.IO.Directory.CreateDirectory(Configuration.Instance.ErrorLogDirectory); crashLogFileName = PathUtils.EnsureUniqueFileName(System.IO.Path.Combine(Configuration.Instance.ErrorLogDirectory, CrashLog.CrashLogFileName)); using (var crashLogFile = System.IO.File.Create(crashLogFileName)) { using (var writer = new ASCIIBinaryWriter(crashLogFile)) { crashLog.Serialize(writer); } } errorReportFiles.Add(crashLogFileName); } catch (System.Exception) { // We got an error trying to write the error log... } finally { if (!System.IO.File.Exists(crashLogFileName)) { crashLogFileName = Resources.Strings.CrashReporter_Detail_CrashLogUnavailable; } } reportText.AppendLine().AppendFormat(Resources.Strings.CrashReporter_Detail_FirmwareCrashFormat, crashLogFileName); } if (hasErrorLog) { if (hasCrashLog) { reportText.AppendLine(); } var errorLogFileName = string.Empty; try { System.IO.Directory.CreateDirectory(Configuration.Instance.ErrorLogDirectory); errorLogFileName = PathUtils.EnsureUniqueFileName(System.IO.Path.Combine(Configuration.Instance.ErrorLogDirectory, "ErrorLog.txt")); using (var errorLogFile = System.IO.File.Create(errorLogFileName)) { using (var writer = new ASCIIBinaryWriter(errorLogFile)) { errorLog.SerializeToTextFile(Device.FirmwareRevisions.Current, writer); } } errorReportFiles.Add(errorLogFileName); } catch (System.Exception) { // TODO Really? All exceptions? Perhaps be a bit more selective here. } finally { if (!System.IO.File.Exists(errorLogFileName)) { errorLogFileName = Resources.Strings.CrashReporter_Detail_ErrorLogUnavailable; } } var errorLogText = errorLog.GetDetailedErrorReport(Device.FirmwareRevisions.Current); reportText.AppendLine().AppendFormat(System.Globalization.CultureInfo.CurrentCulture, Resources.Strings.CrashReporter_Detail_ErrorLogFormat, errorLogText, errorLogFileName); } var title = Resources.Strings.CrashReporter_Title; var message = Resources.Strings.CrashReporter_Message; var reportDialog = ReportDialog.Create(title, message); reportDialog.TextWrapping = OSTextWrapping.Wrap; reportDialog.ReportText = reportText.ToString(); errorReportFiles.ForEach(f => reportDialog.Attachments.Add(f)); if (hasErrorLog || hasCrashLog) { var cc = new List <string>(); cc.Add("*****@*****.**"); reportDialog.EmailCCRecipients = cc; } reportDialog.ShowDialog(Resources.Strings.Close); } }
private static void SyncHostToDeviceCompleteDialog(bool cancelled, bool didShowProgress, LtoFlashViewModel ltoFlashViewModel, IDictionary <string, FailedOperationException> warnings) { ltoFlashViewModel.HostPCMenuLayout.ShowOverlay = false; bool showDialog = true; if (cancelled && (ltoFlashViewModel.ActiveLtoFlashDevice.Device.FileSystem.Status == LfsDirtyFlags.None)) { showDialog = false; } if (showDialog) { var title = cancelled ? Resources.Strings.SyncHostToDeviceCommandCancelled_Title : Resources.Strings.SyncHostToDeviceCommandComplete_Title; var message = string.Empty; if (cancelled) { if (ltoFlashViewModel.ActiveLtoFlashDevice.Device.FileSystem.Status == LfsDirtyFlags.None) { message = Resources.Strings.SyncHostToDeviceCommandCancelledNoChanges_Message; } else { message = Resources.Strings.SyncHostToDeviceCommandCancelled_Message; } } else { message = Resources.Strings.SyncHostToDeviceCommandComplete_Message; } var result = OSMessageBoxResult.Yes; if ((warnings != null) && warnings.Any()) { var reportDialog = ReportDialog.Create(title, message); reportDialog.ShowSendEmailButton = false; var warningsBuilder = new System.Text.StringBuilder(Resources.Strings.SyncHostToDeviceCommand_WarningMessage).AppendLine().AppendLine(); foreach (var warning in warnings) { warningsBuilder.AppendFormat(Resources.Strings.SyncHostToDeviceCommand_WarningFormat, warning.Key, warning.Value.Message).AppendLine().AppendLine(); } if (SingleInstanceApplication.SharedSettings.ShowDetailedErrors) { warningsBuilder.AppendLine(Resources.Strings.SyncHostToDeviceCommand_WarningDetailHeader).AppendLine("------------------------------------------------"); foreach (var exception in warnings.Values) { warningsBuilder.AppendLine(exception.ToString()).AppendLine(); } } reportDialog.ReportText = warningsBuilder.ToString(); reportDialog.TextWrapping = OSTextWrapping.Wrap; reportDialog.ShowDialog(Resources.Strings.OK); } else { var buttons = cancelled ? OSMessageBoxButton.YesNo : OSMessageBoxButton.OK; result = OSMessageBox.Show(message, title, buttons); } if (cancelled && (result == OSMessageBoxResult.Yes) && CanSyncHostToDevicePreview(ltoFlashViewModel)) { SyncHostToDevicePreview(ltoFlashViewModel); } } ltoFlashViewModel.ActiveLtoFlashDevice.Device.GetFileSystemStatistics(GetFileSystemStatisticsErrorHandler); }