protected void CreateDictionaryForMIDs(PublicationInformation projInfo) { var output = new DictionaryForMIDsStreamWriter(projInfo); Debug.Assert(output.Directory != null); string assemblyPath = Common.AssemblyPath; var DictionaryForMIDsPath = Path.Combine(assemblyPath, "Dic4Mid"); if (!Directory.Exists(DictionaryForMIDsPath)) { DictionaryForMIDsPath = Path.Combine(Path.GetDirectoryName(assemblyPath), "Dic4Mid"); } var creatorPath = Common.PathCombine(DictionaryForMIDsPath, "DfM-Creator"); FolderTree.Copy(creatorPath, output.Directory); const string prog = "java"; SubProcess.RedirectOutput = LogName; var args1 = string.Format(@"-jar DfM-Creator.jar -DictionaryGeneration .{0}main.txt . .", Path.DirectorySeparatorChar); SubProcess.RunCommand(output.Directory, prog, args1, true); var args2 = string.Format(@"-jar DfM-Creator.jar -JarCreator .{0}dictionary{0} .{0}Empty_Jar-Jad{0} .", Path.DirectorySeparatorChar); SubProcess.RunCommand(output.Directory, prog, args2, true); }
protected void SetUp() { Common.Testing = true; //_styleName = new Styles(); //_util = new Utility(); _projInfo = new PublicationInformation(); _progressBar = new ProgressBar(); string testPath = PathPart.Bin(Environment.CurrentDirectory, "/OpenOfficeConvert/TestFiles"); _inputPath = Common.PathCombine(testPath, "input"); _outputPath = Common.PathCombine(testPath, "output"); _expectedPath = Common.PathCombine(testPath, "expected"); _expectedlinuxPath = Common.PathCombine(testPath, "expectedlinux"); Common.DeleteDirectory(_outputPath); Directory.CreateDirectory(_outputPath); FolderTree.Copy(FileInput("Pictures"), FileOutput("Pictures")); _projInfo.ProgressBar = _progressBar; _projInfo.OutputExtension = "odt"; _projInfo.ProjectInputType = "Dictionary"; _projInfo.IsFrontMatterEnabled = false; _projInfo.FinalOutput = "odt"; Common.SupportFolder = ""; Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, "/../../DistFIles"); Common.ProgBase = PathPart.Bin(Environment.CurrentDirectory, "/../../DistFiles"); // for masterDocument Common.UseAfterBeforeProcess = false; _styleFile = "styles.xml"; _contentFile = "content.xml"; _isLinux = Common.IsUnixOS(); if (!_isLinux) { LoadParam("Dictionary", "false"); } }
protected void SetUpAll() { Common.Testing = true; Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, @"/../../DistFiles"); Common.SupportFolder = ""; Common.ProgBase = Common.ProgInstall; _projInfo = new PublicationInformation(); _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/OpenOfficeConvert/TestFiles"); _inputPath = Common.PathCombine(_testFolderPath, "input"); _outputPath = Common.PathCombine(_testFolderPath, "output"); if (Directory.Exists(_outputPath)) { Directory.Delete(_outputPath, true); } Directory.CreateDirectory(_outputPath); _projInfo.ProjectPath = _testFolderPath; _projInfo.OutputExtension = "odt"; string pathwayDirectory = Path.GetDirectoryName(Common.AssemblyPath); string styleSettingFile = Common.PathCombine(pathwayDirectory, "StyleSettings.xml"); ValidateXMLVersion(styleSettingFile); Common.ProgInstall = pathwayDirectory; Param.LoadSettings(); Param.SetValue(Param.InputType, "Scripture"); Param.LoadSettings(); }
/// <summary> /// Exports the input files to the chosen destination /// </summary> /// <param name="mainXhtml">main dictionary content</param> /// <param name="jobFileName">css file with style info</param> /// <param name="outPath">destination path</param> public void SeExport(string mainXhtml, string jobFileName, string outPath) { Debug.Assert(mainXhtml.IndexOf(Path.DirectorySeparatorChar) < 0, mainXhtml + " should be just name"); Debug.Assert(jobFileName.IndexOf(Path.DirectorySeparatorChar) < 0, jobFileName + " should be just name"); Common.ShowMessage = !Common.Testing; var projInfo = new PublicationInformation(); var mainSection = File.Exists(Common.PathCombine(outPath, mainXhtml)); projInfo.DefaultCssFileWithPath = Common.PathCombine(outPath, jobFileName); projInfo.ProjectInputType = "Scripture"; projInfo.FromPlugin = true; projInfo.DictionaryPath = outPath; projInfo.SelectedTemplateStyle = _selectedCssFromTemplate; if (mainSection) { projInfo.DefaultXhtmlFileWithPath = Common.PathCombine(outPath, mainXhtml); string DictionaryName = Common.PathCombine(Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath), Path.GetFileNameWithoutExtension(projInfo.DefaultXhtmlFileWithPath)); projInfo.DictionaryOutputName = DictionaryName; projInfo.IsOpenOutput = !Common.Testing; projInfo.ProjectName = Path.GetFileNameWithoutExtension(mainXhtml); SetExtraProcessingValue(projInfo); Backend.Launch(Destination, projInfo); } }
protected void ReformatData(PublicationInformation projInfo) { var outFile = new DictionaryForMIDsStreamWriter(projInfo); outFile.Open(); var className = projInfo.IsLexiconSectionExist ? "definition" : "headref"; var input = Input(projInfo); var sensePath = projInfo.IsLexiconSectionExist ? "//*[@class = 'entry']//*[@id]" : "//*[@class = 'headref']/parent::*"; if (input.Fw83()) { sensePath = "//*[@entryguid]"; } foreach (XmlNode sense in input.SelectNodes(sensePath)) { if (!DictionaryForMIDsRec.HasChildClass(sense, className)) { continue; } var rec = new DictionaryForMIDsRec { CssClass = CssClass, Styles = ContentStyles }; rec.AddHeadword(sense); rec.AddBeforeSense(sense); rec.AddSense(sense); rec.AddAfterSense(sense); rec.AddReversal(sense, className); outFile.WriteLine(rec.Rec); } outFile.Close(); }
protected void SetUp() { Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, @"/../../DistFiles"); Common.SupportFolder = ""; Common.ProgBase = Common.ProgInstall; Common.Testing = true; _projInfo = new PublicationInformation(); string testPath = PathPart.Bin(Environment.CurrentDirectory, "/GoBibleConvert/TestFiles"); _inputPath = Common.PathCombine(testPath, "Input"); _outputPath = Common.PathCombine(testPath, "output"); string pathwayDirectory = Common.AssemblyPath; string styleSettingFile = Common.PathCombine(pathwayDirectory, "StyleSettings.xml"); if (!File.Exists(styleSettingFile)) { styleSettingFile = Path.GetDirectoryName(Common.AssemblyPath); styleSettingFile = Common.PathCombine(styleSettingFile, "StyleSettings.xml"); } Common.Testing = true; ValidateXMLVersion(styleSettingFile); InputType = "Scripture"; Common.ProgInstall = pathwayDirectory; Param.LoadSettings(); Param.SetValue(Param.InputType, InputType); Param.LoadSettings(); }
public DictionaryForMIDsInput(PublicationInformation projInfo) { Xml = LoadXmlDocument(projInfo); Nsmgr = GetNamespaceManager(Xml); _isLexicon = projInfo.IsLexiconSectionExist; _fw83 = Xml.SelectSingleNode("//@entryguid") != null; }
private static void SettingProcessExportFile(PublicationInformation projectInfo, List <string> files) { if (string.IsNullOrEmpty(projectInfo.DefaultXhtmlFileWithPath) && files.Count > 0) { projectInfo.DefaultXhtmlFileWithPath = files[0]; } if (!string.IsNullOrEmpty(projectInfo.ProjectPath)) { if (!string.IsNullOrEmpty(projectInfo.DefaultXhtmlFileWithPath) && !Path.IsPathRooted(projectInfo.DefaultXhtmlFileWithPath)) { projectInfo.DefaultXhtmlFileWithPath = Common.PathCombine(projectInfo.ProjectPath, projectInfo.DefaultXhtmlFileWithPath); } if (!string.IsNullOrEmpty(projectInfo.DefaultCssFileWithPath) && !Path.IsPathRooted(projectInfo.DefaultCssFileWithPath)) { projectInfo.DefaultRevCssFileWithPath = Common.PathCombine(projectInfo.ProjectPath, projectInfo.DefaultCssFileWithPath); } for (int n = 0; n < files.Count; n++) { if (!Path.IsPathRooted(files[n])) { files[n] = Common.PathCombine(projectInfo.ProjectPath, files[n]); } } } }
public void CreateRampTest() { ExportGoBible target = new ExportGoBible(); // TODO: Initialize to an appropriate value PublicationInformation projInfo = null; // TODO: Initialize to an appropriate value target.CreateRamp(projInfo); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { const string LANGUAGE = "language"; const string PUBLICATIONID = "PublicationId"; //Get host from request var routeData = filterContext.RouteData; //Read {language} part from routedata var language = "it_en"; //TODO: Default from web.config? if (routeData.Values != null && routeData.Values[LANGUAGE] != null) { language = routeData.Values[LANGUAGE].ToString(); } //Get publicationId based on this language int publicationId = 0; if (!publicationIds.TryGetValue(language, out publicationId)) { //Read publicationId from Broker var pubId = PublicationInformation.GetIdFromPublicationUrl(language); //Add it if (pubId != 0) { if (!publicationIds.TryAdd(language, pubId)) { //TODO: Log it! LoggerService.Error("Could not store publicationId in the ConcurrentDictionary!", DD4T.ContentModel.Logging.LoggingCategory.Controller, language); } if (!filterContext.RouteData.Values.ContainsKey(PUBLICATIONID)) { filterContext.RouteData.Values.Add(PUBLICATIONID, pubId); } else { //Update it, because it could differ between requests filterContext.RouteData.Values[PUBLICATIONID] = pubId; } } } else { if (!filterContext.RouteData.Values.ContainsKey(PUBLICATIONID)) { filterContext.RouteData.Values.Add(PUBLICATIONID, publicationId); } else { //Update it, because it could differ between requests filterContext.RouteData.Values[PUBLICATIONID] = publicationId; } } base.OnActionExecuting(filterContext); }
public void VernacularNameOfRevTest() { var projInfo = new PublicationInformation { DefaultXhtmlFileWithPath = _testFiles.Input("FlexRev.xhtml"), IsLexiconSectionExist = false }; var input = new DictionaryForMIDsInput(projInfo); Assert.AreEqual("English", input.VernacularName()); }
public void Fw82Test() { var projInfo = new PublicationInformation { DefaultXhtmlFileWithPath = _testFiles.Input("wasp.xhtml") }; var result = new DictionaryForMIDsInput(projInfo); Assert.IsFalse(result.Fw83()); }
public void VernacularIsoTest() { var projInfo = new PublicationInformation { DefaultXhtmlFileWithPath = _testFiles.Input("wasp.xhtml"), IsLexiconSectionExist = true }; var input = new DictionaryForMIDsInput(projInfo); Assert.AreEqual("bzh", input.VernacularIso()); }
public void VernacularNameFw83Test() { var projInfo = new PublicationInformation { DefaultXhtmlFileWithPath = _testFiles.Input("w1.xhtml"), IsLexiconSectionExist = true }; var input = new DictionaryForMIDsInput(projInfo); Assert.AreEqual("Buang, Mapos", input.VernacularName()); }
public void AnalysisIsoOfRevTest() { var projInfo = new PublicationInformation { DefaultXhtmlFileWithPath = _testFiles.Input("FlexRev.xhtml"), IsLexiconSectionExist = false }; var input = new DictionaryForMIDsInput(projInfo); Assert.AreEqual("seh", input.AnalysisIso()); }
public void AnalysisNameFw83Test() { var projInfo = new PublicationInformation { DefaultXhtmlFileWithPath = _testFiles.Input("w1.xhtml"), IsLexiconSectionExist = true }; var input = new DictionaryForMIDsInput(projInfo); Assert.AreEqual("English", input.AnalysisName()); }
protected DictionaryForMIDsInput Input(PublicationInformation projInfo) { if (_DictionaryForMIDsInput != null) { return(_DictionaryForMIDsInput); } _DictionaryForMIDsInput = new DictionaryForMIDsInput(projInfo); return(_DictionaryForMIDsInput); }
public void AnalysisNameOfFw83RevTest() { var projInfo = new PublicationInformation { DefaultXhtmlFileWithPath = _testFiles.Input("FlexRev83.xhtml"), IsLexiconSectionExist = false }; var input = new DictionaryForMIDsInput(projInfo); Assert.AreEqual("Buang, Mapos", input.AnalysisName()); }
public void MoveJarFileTest() { Common.Testing = true; PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Copy("sena3-imba.xhtml"); FolderTree.Copy(_testFiles.Input("DfM_enseh_SIL"), _testFiles.Output("DfM_enseh_SIL")); MoveJarFile(projInfo); Assert.True(File.Exists(_testFiles.Output("DfM_enseh_SIL.jar"))); }
protected void CreateArchiveSubmission(PublicationInformation projInfo, InProcess inProcess, string epub3Path) { inProcess.SetStatus("Archive"); var ramp = new Ramp { ProjInputType = projInfo.ProjectInputType }; ramp.Create(projInfo.DefaultXhtmlFileWithPath, ".zip", projInfo.ProjectInputType); inProcess.PerformStep(); }
public DictionaryForMidsProperties(PublicationInformation projInfo, DictionaryForMIDsStyle contentStyles) { var myPath = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath); Debug.Assert(myPath != null); _styles = contentStyles; Sw = new StreamWriter(Common.PathCombine(myPath, "DictionaryForMIDs.properties")); DictionaryAbbreviation = "SIL"; Language1NumberOfContentDeclarations = _styles.NumStyles; }
public SiteMapNode GetPublicationNode(IPage page) { string publicationUrl = PublicationInformation.GetPublicationUrlByUri(page.Publication.Id); //var publicationNode = RootNode.ChildNodes.Cast<TridionSiteMapNode>().FirstOrDefault(tsn => publicationUrl.Equals(String.Format("{0}/", tsn.Url))); //return publicationNode; return(ReadSitemapFromXml(publicationUrl, String.Format("{0}{1}", publicationUrl, SiteMapPath))); }
public void CopySupportFolder(PublicationInformation projInfo) { Common.SupportFolder = ""; const string postPath = @"/en_US/Scripts"; string scriptsFolderWithPath = Common.PathCombine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Adobe/InDesign/"); string versionName = GetVersionFolderName(scriptsFolderWithPath); scriptsFolderWithPath = scriptsFolderWithPath + versionName + postPath; CopyFolderWithFiles(Common.PathCombine(projInfo.TempOutputFolder, "Scripts"), scriptsFolderWithPath); }
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 SelectNodesTest() { var projInfo = new PublicationInformation { DefaultXhtmlFileWithPath = _testFiles.Input("wasp.xhtml") }; var result = new DictionaryForMIDsInput(projInfo); var nodes = result.SelectNodes("//*[@class='sense']"); Assert.IsNotNull(nodes); Assert.AreEqual(5, nodes.Count); }
private void SetReverseExistValue(PublicationInformation projInfo) { if (_fromNUnit) { projInfo.IsReversalExist = !_fromNUnit; } else { projInfo.IsReversalExist = Param.Value[Param.ReversalIndex] == "True"; } }
private void SetExtraProcessingValue(PublicationInformation projInfo) { if (_fromNUnit) { projInfo.IsExtraProcessing = _fromNUnit; } else { projInfo.IsExtraProcessing = Param.Value[Param.ExtraProcessing] == "True"; } }
protected void CreateProperties(PublicationInformation projInfo) { var input = Input(projInfo); var myProps = new DictionaryForMidsProperties(projInfo, ContentStyles); myProps.SetLanguage(1, input.VernacularIso(), input.VernacularName()); myProps.SetLanguage(2, input.AnalysisIso(), input.AnalysisName()); myProps.InfoText = GetInfo(); myProps.Write(); myProps.Close(); }
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); }
protected static XmlDocument LoadXmlDocument(PublicationInformation projInfo) { var xml = new XmlDocument { XmlResolver = FileStreamXmlResolver.GetNullResolver() }; var streamReader = new StreamReader(projInfo.DefaultXhtmlFileWithPath); xml.Load(streamReader); streamReader.Close(); return(xml); }