protected DictionaryForMIDsInput Input(PublicationInformation projInfo) { if (_DictionaryForMIDsInput != null) { return(_DictionaryForMIDsInput); } _DictionaryForMIDsInput = new DictionaryForMIDsInput(projInfo); return(_DictionaryForMIDsInput); }
public void AddHeadwordWithPicturePresentTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("hornbill.xhtml"); var input = new DictionaryForMIDsInput(projInfo); var sense = input.SelectNodes("//*[@class = 'entry']//*[@id]")[0]; var rec = new DictionaryForMIDsRec(); rec.AddHeadword(sense); Assert.AreEqual("dagol ", rec.Rec); }
public void AddAfterTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-ipa.xhtml"); projInfo.DefaultCssFileWithPath = _testFiles.Input("sena3-ipa.css"); var cssTree = new CssTree(); CssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true); var ContentStyles = new DictionaryForMIDsStyle(); var rec = new DictionaryForMIDsRec { CssClass = CssClass, Styles = ContentStyles }; var input = new DictionaryForMIDsInput(projInfo); var node = input.SelectNodes("//*[@class = 'xsensenumber']")[0]; rec.AddAfter(node); Assert.AreEqual(") ", rec.Rec); }
public void AddStyleTagTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-imba.xhtml"); projInfo.DefaultCssFileWithPath = _testFiles.Input("sena3-imba.css"); var cssTree = new CssTree(); CssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true); var ContentStyles = new DictionaryForMIDsStyle(); var rec = new DictionaryForMIDsRec {CssClass = CssClass, Styles = ContentStyles}; var input = new DictionaryForMIDsInput(projInfo); var node = input.SelectNodes("//*[@class = 'partofspeech']//text()")[0]; rec.AddStyleTag(node); Assert.AreEqual(2, ContentStyles.NumStyles); }
public void AddStyleTagLangTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("wasp.xhtml"); projInfo.DefaultCssFileWithPath = _testFiles.Input("wasp.css"); var cssTree = new CssTree(); CssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true); var ContentStyles = new DictionaryForMIDsStyle(); var rec = new DictionaryForMIDsRec { CssClass = CssClass, Styles = ContentStyles }; var input = new DictionaryForMIDsInput(projInfo); var node = input.SelectNodes("(//*[@class='xitem'])/*")[1]; rec.AddStyleTag(node); Assert.AreEqual(2, ContentStyles.NumStyles); Assert.AreEqual("153,51,102", rec.Styles.FontColor(2)); }
public bool Export(PublicationInformation projInfo) { bool success = false; projInfo.OutputExtension = "jar"; if (projInfo == null || string.IsNullOrEmpty(projInfo.DefaultXhtmlFileWithPath) || string.IsNullOrEmpty(projInfo.DefaultCssFileWithPath)) { return false; } WorkDir = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath); _isUnixOS = Common.UnixVersionCheck(); var inProcess = new InProcess(0, 8); var curdir = Environment.CurrentDirectory; var myCursor = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; inProcess.Show(); inProcess.PerformStep(); LoadParameters(); inProcess.PerformStep(); LoadCss(projInfo); _DictionaryForMIDsInput = null; inProcess.PerformStep(); ReformatData(projInfo); inProcess.PerformStep(); CreateProperties(projInfo); inProcess.PerformStep(); CreateDictionaryForMIDs(projInfo); inProcess.PerformStep(); CreateSubmission(projInfo); inProcess.PerformStep(); ReportReults(projInfo); inProcess.PerformStep(); success = true; } catch (Exception ex) { var msg = LocalizationManager.GetString("ExportDictionaryForMIDs.ExportClick.Message", "{0} Display partial results?", ""); string caption = LocalizationManager.GetString("ExportDictionaryForMIDs.ExportClick.Caption", "Report: Failure", ""); var result = Utils.MsgBox(string.Format(msg, ex.Message), caption, MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (result == DialogResult.Yes) { DisplayOutput(projInfo); } } inProcess.Close(); Environment.CurrentDirectory = curdir; Cursor.Current = myCursor; CleanUp(projInfo.DefaultXhtmlFileWithPath); if (Common.Testing == false) { MoveJarFile(projInfo); CreateRAMP(projInfo); } return success; }
protected DictionaryForMIDsInput Input(PublicationInformation projInfo) { if (_DictionaryForMIDsInput != null) return _DictionaryForMIDsInput; _DictionaryForMIDsInput = new DictionaryForMIDsInput(projInfo); return _DictionaryForMIDsInput; }
public bool Export(PublicationInformation projInfo) { Param.SetLoadType = projInfo.ProjectInputType; Param.LoadSettings(); bool success = false; projInfo.OutputExtension = "jar"; if (projInfo == null || string.IsNullOrEmpty(projInfo.DefaultXhtmlFileWithPath) || string.IsNullOrEmpty(projInfo.DefaultCssFileWithPath)) { return(false); } WorkDir = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath); _isUnixOS = Common.UnixVersionCheck(); var inProcess = new InProcess(0, 7); var curdir = Environment.CurrentDirectory; var myCursor = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; inProcess.Show(); inProcess.PerformStep(); LoadCss(projInfo); _DictionaryForMIDsInput = null; inProcess.PerformStep(); ReformatData(projInfo); inProcess.PerformStep(); CreateProperties(projInfo); inProcess.PerformStep(); CreateDictionaryForMIDs(projInfo); inProcess.PerformStep(); CreateSubmission(projInfo); inProcess.PerformStep(); ReportReults(projInfo); inProcess.PerformStep(); success = true; } catch (Exception ex) { var msg = LocalizationManager.GetString("ExportDictionaryForMIDs.ExportClick.Message", "{0} Display partial results?", ""); string caption = LocalizationManager.GetString("ExportDictionaryForMIDs.ExportClick.Caption", "Report: Failure", ""); var result = Utils.MsgBox(string.Format(msg, ex.Message), caption, MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (result == DialogResult.Yes) { DisplayOutput(projInfo); } } inProcess.Close(); Environment.CurrentDirectory = curdir; Cursor.Current = myCursor; CleanUp(projInfo.DefaultXhtmlFileWithPath); if (Common.Testing == false) { MoveJarFile(projInfo); CreateRAMP(projInfo); Common.CleanupExportFolder(projInfo.DefaultXhtmlFileWithPath, ".txt,.xhtml,.css,.log,.jar,.jad,.properties,.xml", String.Empty, "pictures"); } return(success); }
public void AddBeforeSenseTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("hornbill.xhtml"); var input = new DictionaryForMIDsInput(projInfo); var sense = input.SelectNodes("//*[@class = 'entry']//*[@id]")[0]; var rec = new DictionaryForMIDsRec(); rec.AddBeforeSense(sense); Assert.AreEqual(@"{{\[sample \] ", rec.Rec); }
public void AnalysisNameTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-imba.xhtml"); projInfo.IsLexiconSectionExist = true; var input = new DictionaryForMIDsInput(projInfo); var result = input.AnalysisName(); Assert.AreEqual("Portuguese", result); }
public void VernacularNameTest() { const string sKey = @"Software\SIL\Pathway"; const string keyName = "WritingSystemStore"; var lgFullPath = _testFiles.Output("seh.ldml"); var lgDirectory = Path.GetDirectoryName(lgFullPath); Debug.Assert(!string.IsNullOrEmpty(lgDirectory)); RegistryKey oKey = Registry.CurrentUser.OpenSubKey(sKey, true); RegistryKey myKey = oKey ?? Registry.CurrentUser.CreateSubKey(sKey); Debug.Assert(myKey != null); var oVal = (oKey == null) ? null : oKey.GetValue(keyName, null); myKey.SetValue(keyName, lgDirectory); var wr = new StreamWriter(lgFullPath); wr.Write(@"<?xml version=""1.0"" encoding=""utf-8""?> <ldml><special xmlns:palaso=""urn://palaso.org/ldmlExtensions/v1""> <palaso:languageName value=""Sena"" /> </special></ldml>"); wr.Close(); PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-imba.xhtml"); projInfo.IsLexiconSectionExist = true; var input = new DictionaryForMIDsInput(projInfo); var result = input.VernacularName(); if (oKey == null) { Registry.CurrentUser.DeleteSubKey(sKey); } else if (oVal == null) { oKey.DeleteValue(keyName); } else { oKey.SetValue(keyName, oVal); } Assert.AreEqual("Sena", result); }
public void VernacularIsoTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-imba.xhtml"); projInfo.IsLexiconSectionExist = true; var input = new DictionaryForMIDsInput(projInfo); var result = input.VernacularIso(); Assert.AreEqual("seh", result); }
public void AddReversalTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-imba.xhtml"); var input = new DictionaryForMIDsInput(projInfo); var sense = input.SelectNodes("//*[@class = 'entry']/xhtml:div")[0]; var rec = new DictionaryForMIDsRec(); rec.AddReversal(sense, "definition"); Assert.AreEqual("\tcantar", rec.Rec); }