public void StytoCSSnkoNTProjectCSSTest() { const string TestName = "nkoNT"; var cssFile = TestName + ".css"; string cssFileOutput = FileOutput(cssFile); string ssfFileInputPath = FileInput(TestName); ssfFileInputPath = Common.PathCombine(ssfFileInputPath, "gather"); ssfFileInputPath = Common.PathCombine(ssfFileInputPath, TestName + ".ssf"); StyToCss styToCssObj = new StyToCss(); styToCssObj.ConvertStyToCss("nkoNT", cssFileOutput, ssfFileInputPath); TextFileAssert.AreEqual(FileExpected(cssFile), FileOutput(cssFile), FileData.Get(FileOutput(cssFile))); }
private void ExportProcess(List<XmlDocument> usxBooksToExport, string publicationName, string format, string outputLocationPath, DialogResult result) { #if (TIME_IT) DateTime dt1 = DateTime.Now; // time this thing #endif bool success; var inProcess = new InProcess(0, 6); var curdir = Environment.CurrentDirectory; var myCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; inProcess.Text = "Scripture Export"; inProcess.Show(); inProcess.PerformStep(); inProcess.ShowStatus = true; inProcess.SetStatus("Processing Scripture Export"); string pubName = publicationName; MFormat = format; // Get the file name as set on the dialog. MOutputLocationPath = outputLocationPath; inProcess.PerformStep(); if (MFormat.StartsWith("theWord")) { ExportUsx(usxBooksToExport); } inProcess.PerformStep(); string cssFullPath = Common.PathCombine(MOutputLocationPath, pubName + ".css"); StyToCss styToCss = new StyToCss(); styToCss.ConvertStyToCss(_mProjectName, cssFullPath, string.Empty); string fileName = Common.PathCombine(MOutputLocationPath, pubName + ".xhtml"); inProcess.PerformStep(); if (File.Exists(fileName)) { // TODO: Localize string var msg = LocalizationManager.GetString("ParatextPathwayLink.ExportProcess.Message1", " already exists. Overwrite?", ""); result = MessageBox.Show(string.Format("{0}" + Environment.NewLine + msg, fileName), string.Empty, MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { fileName = Common.PathCombine(MOutputLocationPath, pubName + "-" + DateTime.Now.Second + ".xhtml"); } else if (result == DialogResult.No) { return; } } inProcess.PerformStep(); XmlDocument scrBooksDoc = CombineUsxDocs(usxBooksToExport, MFormat); inProcess.PerformStep(); if (string.IsNullOrEmpty(scrBooksDoc.InnerText)) { var message = LocalizationManager.GetString("ParatextPathwayLink.ExportProcess.Message2", "The current book has no content to export.", ""); MessageBox.Show(message, string.Empty, MessageBoxButtons.OK); return; } ConvertUsxToPathwayXhtmlFile(scrBooksDoc.InnerXml, fileName); success = true; Cursor.Current = myCursor; inProcess.PerformStep(); inProcess.Close(); PsExport exporter = new PsExport(); exporter.DataType = "Scripture"; exporter.Export(fileName); }
public void StytoCSSTest() { const string TestName = "default"; var cssFile = TestName + ".css"; string cssFileOutput = FileOutput(cssFile); StyToCss styToCssObj = new StyToCss(); styToCssObj.ConvertStyToCss(cssFileOutput); TextFileAssert.AreEqual(FileExpected(cssFile), FileOutput(cssFile), FileData.Get(FileOutput(cssFile))); }
private void StyConvert_Click(object sender, EventArgs e) { #if !Not7 StyToCss styToCss = new StyToCss(); styToCss.StyFullPath = txtCSSInput.Text; string outputCSS = txtCSSInput.Text.Replace(".sty", ".css"); styToCss.ConvertStyToCss("TestBed", outputCSS, string.Empty); MessageBox.Show(@"Exported in " + outputCSS); #endif }
private void ExportProcess(List <XmlDocument> usxBooksToExport, string publicationName, string format, string outputLocationPath, DialogResult result) { #if (TIME_IT) DateTime dt1 = DateTime.Now; // time this thing #endif var inProcess = new InProcess(0, 6); var myCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; inProcess.Text = "Scripture Export"; inProcess.Show(); inProcess.PerformStep(); inProcess.ShowStatus = true; inProcess.SetStatus("Processing Scripture Export"); string pubName = publicationName; MFormat = format; // Get the file name as set on the dialog. MOutputLocationPath = outputLocationPath; inProcess.PerformStep(); if (MFormat.StartsWith("theWord")) { ExportUsx(usxBooksToExport); } inProcess.PerformStep(); string cssFullPath = Common.PathCombine(MOutputLocationPath, pubName + ".css"); StyToCss styToCss = new StyToCss(); styToCss.ConvertStyToCss(_mDatabaseName, cssFullPath); string fileName = Common.PathCombine(MOutputLocationPath, pubName + ".xhtml"); inProcess.PerformStep(); if (File.Exists(fileName)) { var msg = LocalizationManager.GetString("ParatextPathwayLink.ExportProcess.Message1", " already exists. Overwrite?", ""); result = MessageBox.Show(string.Format("{0}" + Environment.NewLine + msg, fileName), string.Empty, MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { fileName = Common.PathCombine(MOutputLocationPath, pubName + "-" + DateTime.Now.Second + ".xhtml"); } else if (result == DialogResult.No) { return; } } inProcess.PerformStep(); XmlDocument scrBooksDoc = CombineUsxDocs(usxBooksToExport, MFormat); inProcess.PerformStep(); if (string.IsNullOrEmpty(scrBooksDoc.InnerText)) { var message = LocalizationManager.GetString("ParatextPathwayLink.ExportProcess.Message2", "The current book has no content to export.", ""); MessageBox.Show(message, string.Empty, MessageBoxButtons.OK); return; } ConvertUsxToPathwayXhtmlFile(scrBooksDoc.InnerXml, fileName); Cursor.Current = myCursor; inProcess.PerformStep(); inProcess.Close(); if (!Common.Testing) { PsExport exporter = new PsExport(); exporter.DataType = "Scripture"; exporter.Export(fileName); } }