/// <summary> /// Have the utility do what it does. /// </summary> public void Export(string outFullName) { #region Set up progress reporting #if (TIME_IT) DateTime dt1 = DateTime.Now; // time this thing #endif var myCursor = Common.UseWaitCursor(); var curdir = Environment.CurrentDirectory; var inProcess = Common.SetupProgressReporting(5, "Export Process"); #endregion Set up progress reporting #region Process start inProcess.SetStatus("Export Process Started"); inProcess.PerformStep(); Common.SetupLocalization(); Debug.Assert(DataType == "Scripture" || DataType == "Dictionary", "DataType must be Scripture or Dictionary"); Debug.Assert(outFullName.IndexOf(Path.DirectorySeparatorChar) >= 0, "full path for output must be given"); string caption = LocalizationManager.GetString("PsExport.ExportClick.Caption", "Pathway Export", ""); #endregion try { #region Simplify Export Files inProcess.SetStatus("Simplify Export Files"); inProcess.PerformStep(); //get xsltFile from ExportThroughPathway.cs string revFileName = string.Empty; var outDir = Path.GetDirectoryName(outFullName); SimplifyExportFiles(outFullName, inProcess); #endregion #region Setting up Css and Xhtml inProcess.SetStatus("Setting up Css and Xhtml"); inProcess.PerformStep(); string supportPath = GetSupportPath(); Backend.Load(Common.AssemblyPath); LoadProgramSettings(supportPath); LoadDataTypeSettings(); DefaultProjectFileSetup(outDir); SubProcess.BeforeProcess(outFullName); var mainXhtml = Path.GetFileNameWithoutExtension(outFullName) + ".xhtml"; var mainFullName = Common.PathCombine(outDir, mainXhtml); Debug.Assert(mainFullName.IndexOf(Path.DirectorySeparatorChar) >= 0, "Path for input file missing"); if (string.IsNullOrEmpty(mainFullName) || !File.Exists(mainFullName)) { return; } string cssFullName; if (GetCSSFileName(outFullName, outDir, mainFullName, out cssFullName)) { return; } _selectedCssFromTemplate = Path.GetFileNameWithoutExtension(cssFullName); string fluffedCssFullName; if (Path.GetFileNameWithoutExtension(outFullName) == "FlexRev") { fluffedCssFullName = GetFluffedCssFullName(GetRevFullName(outFullName), outDir, cssFullName); } else { fluffedCssFullName = GetFluffedCssFullName(outFullName, outDir, cssFullName); revFileName = GetRevFullName(outDir); } string fluffedRevCssFullName = string.Empty; if (revFileName.Length > 0) { fluffedRevCssFullName = GetFluffedCssFullName(revFileName, outDir, cssFullName); } DestinationSetup(); SetDefaultLanguageFontandBaseFontSize(fluffedCssFullName, mainFullName, revFileName, fluffedRevCssFullName); //Common.StreamReplaceInFile(fluffedCssFullName, "\\2B27", "\\25C6"); WritePublishingInformationFontStyleinCSS(fluffedCssFullName); #endregion #region Close Reporting inProcess.Close(); Environment.CurrentDirectory = curdir; Cursor.Current = myCursor; #endregion Close Reporting if (DataType == "Scripture") { Common.GetFontFeatures(); SeExport(mainXhtml, Path.GetFileName(fluffedCssFullName), outDir); } else if (DataType == "Dictionary") { string revFullName = GetRevFullName(outDir); DeExport(outFullName, fluffedCssFullName, revFullName, fluffedRevCssFullName); } } catch (InvalidStyleSettingsException err) { if (_fromNUnit) { Console.WriteLine(string.Format(err.ToString(), err.FullFilePath), "Pathway Export"); } else { Utils.MsgBox(string.Format(err.ToString(), err.FullFilePath), caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } return; } catch (UnauthorizedAccessException err) { if (_fromNUnit) { Console.WriteLine(string.Format(err.ToString(), "Sorry! You might not have permission to use this resource.")); } else { var msg = LocalizationManager.GetString("PsExport.ExportClick.Message", "Sorry! You might not have permission to use this resource.", ""); Utils.MsgBox(string.Format(err.ToString(), msg), caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } return; } catch (Exception ex) { if (_fromNUnit) { Console.WriteLine(ex.ToString()); } else { if (ex.ToString().IndexOf("Module1.xml") == -1) { Utils.MsgBox(ex.ToString(), caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } } return; } finally { } }