/// <summary> /// Save the report to a temp file /// </summary> /// <returns>The path to the saved temp file.</returns> private static string GetReportTempPath(ToolMacroInfo toolMacroInfo) { SrmDocument doc = toolMacroInfo.Doc; string reportName = toolMacroInfo.ReportName; string toolTitle = toolMacroInfo.ToolTitle; if (String.IsNullOrEmpty(reportName)) { throw new Exception(string.Format(Resources.ToolMacros_GetReportTempPath_The_selected_tool_0_requires_a_selected_report_Please_select_a_report_for_this_tool_, toolTitle)); } var tempFilePath = GetReportTempPath(reportName, toolTitle); try { using (var saver = new FileSaver(tempFilePath)) { if (!saver.CanSave()) { throw new IOException(); } using (var writer = new StreamWriter(saver.SafeName)) { ToolDescriptionHelpers.GetReport(doc, reportName, toolTitle, toolMacroInfo.ProgressMonitor, writer); } saver.Commit(); return(tempFilePath); } } catch (Exception) { throw new IOException(Resources.ToolMacros_GetReportTempPath_Error_exporting_the_report__tool_execution_canceled_); } }
/// <summary> /// Get the path to the version of the program executable. /// </summary> /// <param name="toolMacroInfo">Wrapper that has a valid ProgramPathContainer.</param> /// <returns>Path to program executable that was saved in settings.</returns> private static string GetProgramPath(ToolMacroInfo toolMacroInfo) { ProgramPathContainer ppc = toolMacroInfo.programPathContainer; string path = null; if (ppc != null) { if (Settings.Default.ToolFilePaths.ContainsKey(ppc)) { path = Settings.Default.ToolFilePaths[ppc]; } if (path == null) { path = toolMacroInfo.FindProgramPath(ppc); } } return(path); }
private static string GetSkylineConnection(ToolMacroInfo arg) { return(GetSkylineConnection()); }
private static string GetToolDirectory(ToolMacroInfo arg) { return(String.IsNullOrEmpty(arg.ToolDirPath) ? null : arg.ToolDirPath); //Todo: danny escape spaces in this path. }