예제 #1
0
        protected void SetUp()
        {
            _stylesXML = new InStyles();
            _storyXML = new InStory();
            _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles");
            _outputPath = Common.PathCombine(_testFolderPath, "output");
            _outputStyles = Common.PathCombine(_outputPath, "Resources");
            _outputStory = Common.PathCombine(_outputPath, "Stories");
            _outputSpread = Common.PathCombine(_outputPath, "Spreads");
            projInfo.TempOutputFolder = _outputPath;
            _cssProperty = new Dictionary<string, Dictionary<string, string>>();
            _cssTree = new CssTree();

            _inputCSS1 = Common.DirectoryPathReplace(_testFolderPath + "/input/Page1.css");
            _inputCSS2 = Common.DirectoryPathReplace(_testFolderPath + "/input/Page2.css");

            _facingPages.Add("Spread_1.xml");
            _facingPages.Add("Spread_2.xml");
            _facingPages.Add("Spread_3.xml");

            _singlePages.AddRange(_facingPages);
            _singlePages.Add("Spread_4.xml");
            _singlePages.Add("Spread_5.xml");

            _columnClass.Add("t1");
            _columnClass.Add("t2");
            _columnClass.Add("t3");
        }
예제 #2
0
 protected void SetUp()
 {
     _cssTree = new CssTree();
     _stylesXML = new InStyles();
     _cssProperty = new Dictionary<string, Dictionary<string, string>>();
     _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles");
     _outputPath = Common.PathCombine(_testFolderPath, "output");
     _outputResourcePath = Common.PathCombine(_outputPath, "Resources");
 }
예제 #3
0
        protected void SetUp()
        {
            _graphicXML = new InGraphic();
            _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles");
            ClassProperty = _expected;  //Note: All Reference address initialized here
            _output = Common.PathCombine(_testFolderPath, "output");

            _cssProperty = new Dictionary<string, Dictionary<string, string>>();
            _cssTree = new CssTree();
        }
예제 #4
0
 protected void SetUp()
 {
     _stylesXML = new InStyles();
     _expectedList = new ArrayList();
     _designmapXML = new InDesignMap();
     _idAllClass = new Dictionary<string, Dictionary<string, string>>();
     _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles");
     ClassProperty = _expected;
     _outputPath = Common.PathCombine(_testFolderPath, "output");
     _outputStyles = Common.PathCombine(_outputPath, "Resources");
     _outputMasterSpreads = Common.PathCombine(_outputPath, "MasterSpreads");
     _cssProperty = new Dictionary<string, Dictionary<string, string>>();
     _cssTree = new CssTree();
 }
 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);
 }
예제 #7
0
 protected void SetUp()
 {
     _stylesXML = new InStyles();
     _storyXML = new InStory();
     _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles");
     ClassProperty = _expected;  //Note: All Reference address initialized here
     _output = Common.PathCombine(_testFolderPath, "output");
     _outputPath = Common.PathCombine(_testFolderPath, "output");
     _outputStyles = Common.PathCombine(_outputPath, "Resources");
     _outputStory = Common.PathCombine(_outputPath, "Stories");
     projInfo.TempOutputFolder = _outputPath;
     _cssProperty = new Dictionary<string, Dictionary<string, string>>();
     _cssTree = new CssTree();
 }
 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));
 }
예제 #9
0
        private Dictionary <string, Dictionary <string, string> > MergeProcessInCSSforMasterPage(string fileName, Dictionary <string, Dictionary <string, string> > cssClass)
        {
            Dictionary <string, Dictionary <string, string> > mergedCssClass = cssClass;

            if (cssClass.Count > 0)
            {
                string flexCSs = Common.PathCombine(Path.GetDirectoryName(fileName), "FlexRev.css");
                Dictionary <string, Dictionary <string, string> > cssClass1 = new Dictionary <string, Dictionary <string, string> >();
                CssTree cssTree = new CssTree();
                cssClass1 = cssTree.CreateCssProperty(flexCSs, true);
                foreach (string clsName in cssClass1.Keys)
                {
                    if (!mergedCssClass.ContainsKey(clsName))
                    {
                        mergedCssClass.Add(clsName, cssClass1[clsName]);
                    }
                }
                Dictionary <string, string> pageBreakProperty = new Dictionary <string, string>();
                pageBreakProperty.Add("page-break-after", "always");
                mergedCssClass.Add("mergeBreak", pageBreakProperty);
            }
            return(mergedCssClass);
        }
예제 #10
0
        protected void SetUp()
        {
            _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles");
            _inputCSS1 = Common.PathCombine(_testFolderPath, "input/MasterSpread.css");
            _stylesXML = new InStyles();
            _masterSpreadXML = new InMasterSpread();
            _idAllClass = new Dictionary<string, Dictionary<string, string>>();
            _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles");
            ClassProperty = _expected;
            _outputPath = Common.PathCombine(_testFolderPath, "output");
            _outputSpread = Common.PathCombine(_outputPath, "MasterSpreads");
            _outputStyle = Common.PathCombine(_outputPath, "Resources");
            _outputStory = Common.PathCombine(_outputPath, "Stories");
            _cssProperty = new Dictionary<string, Dictionary<string, string>>();
            _cssTree = new CssTree();

            _listofMasterPages = new ArrayList
                                     {
                                         "MasterSpread_First.xml",
                                         "MasterSpread_All.xml",
                                         "MasterSpread_Left.xml",
                                         "MasterSpread_Right.xml"
                                     };
        }
예제 #11
0
        /// <summary>
        /// Method to get the font-size from the Pathway Configuration Tool Set property in BaseFontSize "
        /// and append the fontsize in end of the input css file.
        /// </summary>
        /// <param name="inputXhtmlFileName">Passing the input xhtml file</param>
        /// <param name="inputCssFileName">Passing input css file</param>
        /// <param name="isFLEX">FLEX / Paratext</param>
        /// <param name="inputRevFileName">rev xhtml</param>
        /// <param name="inputRevCssFileName">Merged rev css to include the font list which used for mergedmain css file</param>
        public static void SetBaseFontSize(string inputXhtmlFileName, string inputCssFileName, bool isFLEX, string revFileName, string inputRevCssFileName)
        {
            try
            {
                Dictionary <string, Dictionary <string, string> > cssClass = new Dictionary <string, Dictionary <string, string> >();
                CssTree cssTree      = new CssTree();
                string  baseFontSize = string.Empty;
                cssClass = cssTree.CreateCssProperty(inputCssFileName, true);

                if (cssClass.ContainsKey("basefontsize") && cssClass["basefontsize"].ContainsKey("font-size"))
                {
                    baseFontSize = cssClass["basefontsize"]["font-size"];
                }
                StringBuilder mainProperty = new StringBuilder();
                StringBuilder revProperty  = new StringBuilder();

                if (!string.IsNullOrEmpty(baseFontSize))
                {
                    mainProperty = GetCssStyleNewProperties(inputXhtmlFileName, mainProperty, baseFontSize);

                    if (!string.IsNullOrEmpty(revFileName) && File.Exists(revFileName))
                    {
                        revProperty = GetCssStyleNewProperties(revFileName, revProperty, baseFontSize);
                    }
                }
                Common.FileInsertText(inputCssFileName, mainProperty.ToString());
                if (File.Exists(inputRevCssFileName))
                {
                    Common.FileInsertText(inputRevCssFileName, revProperty.ToString());
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.InnerException);
            }
        }
예제 #12
0
        public bool Export(PublicationInformation projInfo)
        {
            bool success;
            bool isUnixOS = Common.UnixVersionCheck();
            //try
            //{
            var regPrinceKey = RegPrinceKey;

            if (regPrinceKey != null || isUnixOS)
            {
                var curdir = Environment.CurrentDirectory;
                projInfo.OutputExtension = "pdf";
                _pdfSymbols.Load(XmlReader.Create(Common.UsersXsl("PdfSymbols.xsl")));
                PreExportProcess preProcessor = new PreExportProcess(projInfo);
                if (isUnixOS)
                {
                    projInfo.DefaultXhtmlFileWithPath =
                        Common.RemoveDTDForLinuxProcess(projInfo.DefaultXhtmlFileWithPath, "pdfconvert");
                }
                Environment.CurrentDirectory = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath);

                preProcessor.IncludeHyphenWordsOnXhtml(preProcessor.ProcessedXhtml);
                preProcessor.GetTempFolderPath();
                preProcessor.ImagePreprocess(false, delegate(string s, string to) { ImageMods.ResizeImage(s, to, 1, 1); });
                preProcessor.ReplaceSlashToREVERSE_SOLIDUS();
                if (projInfo.SwapHeadword)
                {
                    preProcessor.SwapHeadWordAndReversalForm();
                }
                preProcessor.MovePictureAsLastChild(preProcessor.ProcessedXhtml);
                preProcessor.SetNonBreakInVerseNumber(preProcessor.ProcessedXhtml);
                preProcessor.ReplaceProcessForPrinceOutput(preProcessor.ProcessedXhtml);
                Common.ApplyXsltArgs = new XsltArgumentList();
                Common.ApplyXsltArgs.AddParam("avPath", string.Empty, new Uri(projInfo.ProjectPath).AbsoluteUri);
                Common.ApplyXslt(preProcessor.ProcessedXhtml, _pdfSymbols);
                Common.ApplyXsltArgs = null;
                RenameAudioVisual(projInfo.ProjectPath, Path.GetDirectoryName(preProcessor.ProcessedXhtml));

                preProcessor.MoveCallerToPrevText(preProcessor.ProcessedXhtml);
                string tempFolder = Path.GetDirectoryName(preProcessor.ProcessedXhtml);
                var    mc         = new MergeCss {
                    OutputLocation = tempFolder
                };

                if (projInfo.IsReversalExist && File.Exists(projInfo.DefaultRevCssFileWithPath))
                {
                    Common.CopyContent(projInfo.DefaultCssFileWithPath, projInfo.DefaultRevCssFileWithPath);
                }

                string mergedCSS = mc.Make(projInfo.DefaultCssFileWithPath, "Temp1.css");
                preProcessor.ReplaceStringInCss(mergedCSS);
                preProcessor.InsertPropertyInCSS(mergedCSS);
                preProcessor.RemoveDeclaration(mergedCSS, ".pictureRight > .picture");
                preProcessor.RemoveDeclaration(mergedCSS, "div.pictureLeft > img.picture");
                preProcessor.HandleNewFieldworksChangeInCss(mergedCSS);
                mergedCSS = preProcessor.RemoveTextIndent(mergedCSS);

                if (isUnixOS)
                {
                    Common.StreamReplaceInFile(mergedCSS, "Scheherazade Graphite Alpha", "Scheherazade");
                }

                Dictionary <string, Dictionary <string, string> > cssClass = new Dictionary <string, Dictionary <string, string> >();
                CssTree cssTree = new CssTree();
                cssTree.OutputType = Common.OutputType.PDF;
                cssClass           = cssTree.CreateCssProperty(mergedCSS, true);
                if (cssClass.ContainsKey("@page") && cssClass["@page"].ContainsKey("-ps-hide-versenumber-one"))
                {
                    string value = cssClass["@page"]["-ps-hide-versenumber-one"];
                    if (value.ToLower() == "true")
                    {
                        preProcessor.RemoveVerseNumberOne(preProcessor.ProcessedXhtml, mergedCSS);
                    }
                }
                if (cssClass.ContainsKey("@page:left-top-left") && cssClass["@page:left-top-left"].ContainsKey("-ps-referenceformat"))
                {
                    string value = cssClass["@page:left-top-left"]["-ps-referenceformat"];
                    if (value.ToLower().Contains("gen 1"))
                    {
                        ReplaceBookNametoBookCode(preProcessor.ProcessedXhtml);
                    }
                }

                string xhtmlFileName = Path.GetFileNameWithoutExtension(projInfo.DefaultXhtmlFileWithPath);
                string defaultCSS    = Path.GetFileName(mergedCSS);
                Common.SetDefaultCSS(preProcessor.ProcessedXhtml, defaultCSS);

                _processedXhtml = preProcessor.ProcessedXhtml;
                if (projInfo.IsReversalExist && projInfo.IsLexiconSectionExist)
                {
                    var reversalFile = Path.GetDirectoryName(_processedXhtml);
                    reversalFile = Common.PathCombine(reversalFile, "FlexRev.xhtml");
                    Common.SetDefaultCSS(reversalFile, defaultCSS);
                }

                if (!ExportPrince(projInfo, xhtmlFileName, isUnixOS, regPrinceKey, defaultCSS))
                {
                    return(false);
                }

                Environment.CurrentDirectory = curdir;
                if (!projInfo.DefaultXhtmlFileWithPath.ToLower().Contains("local"))
                {
                    //Copyright information added in PDF files
                        #pragma warning disable 168
                    Common.InsertCopyrightInPdf(Common.PathCombine(Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath), xhtmlFileName + ".pdf"), "Prince XML", projInfo.ProjectInputType);
                        #pragma warning restore 168
                }
                else
                {
                    string pdfFileName = xhtmlFileName + ".pdf";
                    pdfFileName = Common.PathCombine(Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath), pdfFileName);

                    if (!Common.Testing && File.Exists(pdfFileName))
                    {
                        // ReSharper disable RedundantAssignment
                        success = true;
                        // ReSharper restore RedundantAssignment
                        Process.Start(pdfFileName);
                    }
                }
                success = true;
            }
            else
            {
                success = false || Common.Testing;
            }
            //}
            //catch (Exception)
            //{
            //    success = false;
            //}
            return(success);
        }
예제 #13
0
		protected void ParseCSS(string cssPath, string loadType)
		{
			_cssPath = cssPath;
			_loadType = loadType;
			cssTree = new CssTree();
			Common.SamplePath = Param.Value["SamplePath"].Replace("Samples", "Styles");
			if (string.IsNullOrEmpty(_cssPath)) return;
			_cssClass = cssTree.CreateCssProperty(_cssPath, true);
		}
예제 #14
0
        private Dictionary<string, Dictionary<string, string>> GetCssClass(string input, string output)
        {
            projInfo.DefaultCssFileWithPath = input;
            projInfo.TempOutputFolder = _outputPath;

            Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);

            Dictionary<string, Dictionary<string, string>> idAllClass = new Dictionary<string, Dictionary<string, string>>();
            LOStyles ooStyles = new LOStyles();

            idAllClass = ooStyles.CreateStyles(projInfo, cssClass, output);
            return cssClass;
        }
예제 #15
0
        public bool ExportReversalIndex(PublicationInformation projInfo)
        {

            if (projInfo.IsReversalExist)
            {
                var revFile = Common.PathCombine(projInfo.ProjectPath, "FlexRev.xhtml");
                if (!File.Exists(revFile))
                {
                    return false;
                }

                if (File.Exists(revFile))
                {
                    if (Common.UnixVersionCheck())
                    {
                        Common.RemoveDTDForLinuxProcess(revFile, "xelatex");
                    }
                }

                projInfo.DefaultXhtmlFileWithPath = revFile;
                PreExportProcess preProcessor = new PreExportProcess(projInfo);
                preProcessor.SetLangforLetter(projInfo.DefaultXhtmlFileWithPath);

                CheckFontFamilyAvailable(projInfo.DefaultRevCssFileWithPath);

                Dictionary<string, Dictionary<string, string>> cssClass =
                    new Dictionary<string, Dictionary<string, string>>();
                CssTree cssTree = new CssTree();
                cssTree.OutputType = Common.OutputType.XELATEX;
                cssClass = cssTree.CreateCssProperty(projInfo.DefaultRevCssFileWithPath, true);
                string fileNameXhtml = Path.GetFileNameWithoutExtension(revFile);
                string xeLatexRevesalIndexFile = Common.PathCombine(projInfo.ProjectPath, fileNameXhtml + ".tex");
                _reversalIndexTexFileName = xeLatexRevesalIndexFile;
                StreamWriter xeLatexFile = new StreamWriter(xeLatexRevesalIndexFile);
                Dictionary<string, List<string>> classInlineStyle = new Dictionary<string, List<string>>();
                XeLaTexStyles xeLaTexStyles = new XeLaTexStyles();
                xeLaTexStyles.LangFontDictionary = _langFontCodeandName;
                classInlineStyle = xeLaTexStyles.CreateXeTexStyles(projInfo, xeLatexFile, cssClass);
                int pageWidth = Common.GetPictureWidth(cssClass, projInfo.ProjectInputType);

                XeLaTexContent xeLaTexContent = new XeLaTexContent();
                xeLaTexContent.IsUnix = _isUnixOs;
                Dictionary<string, List<string>> classInlineText = xeLaTexStyles._classInlineText;
                Dictionary<string, Dictionary<string, string>> newProperty = xeLaTexContent.CreateContent(projInfo,
                                                                                                          cssClass,
                                                                                                          xeLatexFile,
                                                                                                          classInlineStyle,
                                                                                                          cssTree
                                                                                                              .SpecificityClass,
                                                                                                          cssTree
                                                                                                              .CssClassOrder,
                                                                                                          classInlineText,
                                                                                                          pageWidth);

                _xelatexDocumentOpenClosedRequired = true; //Don't change the place.
                CloseDocument(xeLatexFile, false, string.Empty);
                string include = xeLaTexStyles.PageStyle.ToString();
                ModifyXeLaTexStyles modifyXeLaTexStyles = new ModifyXeLaTexStyles();
                modifyXeLaTexStyles.XelatexDocumentOpenClosedRequired = true;
                modifyXeLaTexStyles.ProjectType = projInfo.ProjectInputType;
	            bool createPageNumber = false;
	            if (projInfo.DefaultXhtmlFileWithPath.IndexOf("PreserveFlexRev.xhtml") > 0)
		            createPageNumber = true;

                modifyXeLaTexStyles.ModifyStylesXML(projInfo.ProjectPath, xeLatexFile, newProperty, cssClass,
													xeLatexRevesalIndexFile, include, _langFontCodeandName, createPageNumber);
                _xeLaTexPropertyFullFontStyleList = modifyXeLaTexStyles.XeLaTexPropertyFontStyleList;

                if (newProperty.ContainsKey("TableofContent") && newProperty["TableofContent"].Count > 0)
                {
                    foreach (var tocSection in newProperty["TableofContent"])
                    {
                        if (tocSection.Key.Contains("PageStock"))
                        {
                            _tocPropertyList.Add(tocSection.Key, tocSection.Value);
                        }
                    }
                }
                return true;
            }
            return false;
        }
예제 #16
0
 protected void SetupEach()
 {
     _cssTree = new CssTree();
 }
예제 #17
0
        public void FileComparisionTest(string fileName, string fileNo)
        {
            PublicationInformation projInfo = new PublicationInformation();

            projInfo.ProjectPath = Path.GetDirectoryName(_inputXHTML);
            projInfo.DefaultXhtmlFileWithPath = _inputXHTML;
            projInfo.DefaultCssFileWithPath = _inputCSS;
            projInfo.ProjectInputType = "Scripture";
            PreExportProcess preProcessor = new PreExportProcess(projInfo);
            preProcessor.GetTempFolderPath();
            preProcessor.ImagePreprocess(false);
            preProcessor.InsertHiddenChapterNumber();
            preProcessor.InsertHiddenVerseNumber();
            projInfo.DefaultXhtmlFileWithPath = preProcessor.ProcessedXhtml;
            projInfo.DefaultCssFileWithPath = preProcessor.ProcessedCss;

            Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
            preProcessor.InsertEmptyXHomographNumber(cssClass);

            Dictionary<string, Dictionary<string, string>> idAllClass = new Dictionary<string, Dictionary<string, string>>();
            InStyles inStyles = new InStyles();
            projInfo.TempOutputFolder = _outputPath;
            idAllClass = inStyles.CreateIDStyles(Common.PathCombine(_outputPath, "Resources"), cssClass);

            InGraphic inGraphic = new InGraphic();
            inGraphic.CreateIDGraphic(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass, cssTree.cssBorderColor);

            InStory inStory = new InStory();
            Dictionary<string, ArrayList> StyleName = inStory.CreateStory(projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder);

            InMasterSpread inMasterSpread = new InMasterSpread();
            ArrayList masterPageNames = inMasterSpread.CreateIDMasterSpread(Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads"), idAllClass, headwordStyles);

            InSpread inSpread = new InSpread();
            inSpread.CreateIDSpread(Common.PathCombine(projInfo.TempOutputFolder, "Spreads"), idAllClass, StyleName["ColumnClass"]);

            InDesignMap inDesignMap = new InDesignMap();
            inDesignMap.CreateIDDesignMap(projInfo.TempOutputFolder, StyleName["ColumnClass"].Count, masterPageNames, StyleName["TextVariables"], StyleName["CrossRef"], string.Empty);

            InPreferences inPreferences = new InPreferences();
            inPreferences.CreateIDPreferences(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), idAllClass);

            // Compare files
            string expectedFolder = Common.PathCombine(_testFolderPath, "Expected\\" + fileName);

            string output = Common.PathCombine(projInfo.TempOutputFolder, "Stories\\Story_" + fileNo + ".xml");
            string expected = Common.PathCombine(expectedFolder, "Stories\\Story_" + fileNo + ".xml");
            XmlAssert.AreEqual(output, expected, " Story_"+ fileNo + ".xml is not matching");

            output = Common.PathCombine(projInfo.TempOutputFolder, "Resources\\styles.xml");
            expected = Common.PathCombine(expectedFolder, "Resources\\styles.xml");
            XmlAssert.AreEqual(output, expected, " styles.xml is not matching");
            output = Common.PathCombine(projInfo.TempOutputFolder, "Resources\\Graphic.xml");
            expected = Common.PathCombine(expectedFolder, "Resources\\Graphic.xml");
            XmlAssert.AreEqual(output, expected, " Graphic.xml is not matching");
            
            output = Common.PathCombine(projInfo.TempOutputFolder, "Resources\\Preferences.xml");
            expected = Common.PathCombine(expectedFolder, "Resources\\Preferences.xml");
            XmlAssert.AreEqual(output, expected, " Preferences.xml is not matching");

            output = Common.PathCombine(projInfo.TempOutputFolder, "Spreads\\Spread_1.xml");
            expected = Common.PathCombine(expectedFolder, "Spreads\\Spread_1.xml");
            XmlAssert.AreEqual(output, expected, " Spread_1.xml is not matching");
            
            output = Common.PathCombine(projInfo.TempOutputFolder, "Spreads\\Spread_2.xml");
            expected = Common.PathCombine(expectedFolder, "Spreads\\Spread_2.xml");
            XmlAssert.AreEqual(output, expected, " Spread_2.xml is not matching");
            
            output = Common.PathCombine(projInfo.TempOutputFolder, "Spreads\\Spread_3.xml");
            expected = Common.PathCombine(expectedFolder, "Spreads\\Spread_3.xml");
            XmlAssert.AreEqual(output, expected, " Spread_3.xml is not matching");

            output = Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads\\MasterSpread_All.xml");
            expected = Common.PathCombine(expectedFolder, "MasterSpreads\\MasterSpread_All.xml");
            XmlAssert.AreEqual(output, expected, " MasterSpread_All.xml is not matching");
            
            output = Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads\\MasterSpread_First.xml");
            expected = Common.PathCombine(expectedFolder, "MasterSpreads\\MasterSpread_First.xml");
            XmlAssert.AreEqual(output, expected, " MasterSpread_First.xml is not matching");
        }
예제 #18
0
        private Dictionary<string, Dictionary<string, string>> WrittingTexFile(PublicationInformation projInfo, string fileName, out string xeLatexFullFile,
                                           out StreamWriter xeLatexFile, out XeLaTexStyles xeLaTexStyles,
                                           out Dictionary<string, Dictionary<string, string>> newProperty)
        {
            CheckFontFamilyAvailable(projInfo.DefaultCssFileWithPath);

            Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssTree.OutputType = Common.OutputType.XELATEX;
            cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
            int pageWidth = Common.GetPictureWidth(cssClass, projInfo.ProjectInputType);

            xeLatexFullFile = Common.PathCombine(projInfo.ProjectPath, fileName + ".tex");
            xeLatexFile = new StreamWriter(xeLatexFullFile);

            Dictionary<string, List<string>> classInlineStyle = new Dictionary<string, List<string>>();
            xeLaTexStyles = new XeLaTexStyles();
            xeLaTexStyles.LangFontDictionary = _langFontCodeandName;
            classInlineStyle = xeLaTexStyles.CreateXeTexStyles(projInfo, xeLatexFile, cssClass);

            XeLaTexContent xeLaTexContent = new XeLaTexContent();
            xeLaTexContent.IsUnix = _isUnixOs;
            Dictionary<string, List<string>> classInlineText = xeLaTexStyles._classInlineText;
            newProperty = xeLaTexContent.CreateContent(projInfo, cssClass, xeLatexFile, classInlineStyle,
                                                       cssTree.SpecificityClass, cssTree.CssClassOrder, classInlineText,
                                                       pageWidth);

            if (projInfo.IsReversalExist)
            {
                var revFile = Common.PathCombine(Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath), "FlexRev.xhtml");
                string fileNameXhtml = Path.GetFileNameWithoutExtension(revFile);
                string reversalFileName = fileNameXhtml + ".tex";

                CloseDocument(xeLatexFile, true, reversalFileName);
            }
            else
            {
                CloseDocument(xeLatexFile, false, string.Empty);
            }
            return cssClass;
        }
예제 #19
0
 protected void SetUp()
 {
     _InsertMacro = new InInsertMacro();
     _cssTree = new CssTree();
     _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles");
 }
예제 #20
0
        private string GetStyleOutput(string file)
        {
            LOContent contentXML = new LOContent();
            LOStyles stylesXML = new LOStyles();
            string fileOutput = _index > 0 ? file + _index + ".css" : file + ".css";

            //string input = FileInput(file + ".css");
            string input = FileInput(fileOutput);

            _projInfo.DefaultCssFileWithPath = input;
            _projInfo.TempOutputFolder = _outputPath;

            Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssClass = cssTree.CreateCssProperty(input, true);

            //StyleXML
            string styleOutput = FileOutput(file + _styleFile);
            Dictionary<string, Dictionary<string, string>> idAllClass = stylesXML.CreateStyles(_projInfo, cssClass, styleOutput);

            // ContentXML
            var pageSize = new Dictionary<string, string>();
            pageSize["height"] = cssClass["@page"]["page-height"];
            pageSize["width"] = cssClass["@page"]["page-width"];
            _projInfo.DefaultXhtmlFileWithPath = FileInput(file + ".xhtml");
            _projInfo.TempOutputFolder = FileOutput(file);
            _projInfo.HideSpaceVerseNumber = stylesXML.HideSpaceVerseNumber;

            PreExportProcess preProcessor = new PreExportProcess(_projInfo);
            preProcessor.GetTempFolderPath();
            _projInfo.DefaultXhtmlFileWithPath = preProcessor.ProcessedXhtml;
            if (Param.HyphenEnable)
                preProcessor.IncludeHyphenWordsOnXhtml(_projInfo.DefaultXhtmlFileWithPath);

            AfterBeforeProcess afterBeforeProcess = new AfterBeforeProcess();
            afterBeforeProcess.RemoveAfterBefore(_projInfo, cssClass, cssTree.SpecificityClass, cssTree.CssClassOrder);

            contentXML.CreateStory(_projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder, 325, pageSize);
            _projInfo.TempOutputFolder = _projInfo.TempOutputFolder + _contentFile;
            return styleOutput;
        }
예제 #21
0
        protected void LoadCss(PublicationInformation projInfo)
        {
            var cssTree = new CssTree();

            CssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
        }
예제 #22
0
        public bool ExportCopyright(PublicationInformation projInfo, string mainXhtmlFileWithPath)
        {
            if (_copyrightInformation)
            {
                var preProcess = new PreExportProcess(projInfo);
                var processFolder = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath);
                preProcess.CopyCopyrightPage(processFolder);
                string copyRightFilePath = Common.PathCombine(processFolder, "File2Cpy.xhtml");

                if (copyRightFilePath.Trim().Length <= 0 && !File.Exists(copyRightFilePath))
                {
                    return false;
                }
                if (File.Exists(copyRightFilePath))
                {
                    if (Common.UnixVersionCheck())
                    {
                        string draftTempFileName = Path.GetFileName(copyRightFilePath);
                        draftTempFileName = Common.PathCombine(Path.GetTempPath(), draftTempFileName);
                        if (!File.Exists(draftTempFileName))
                        {
                            File.Copy(copyRightFilePath, draftTempFileName, true);
                            Common.RemoveDTDForLinuxProcess(draftTempFileName, "xelatex");
                        }
                        projInfo.DefaultXhtmlFileWithPath = draftTempFileName;
                        copyRightFilePath = draftTempFileName;
                    }
                    else
                    {
                        projInfo.DefaultXhtmlFileWithPath = copyRightFilePath;
                    }
                }
                else
                {
                    return false;
                }

                string filepath = Path.GetFullPath(copyRightFilePath);

                Dictionary<string, Dictionary<string, string>> cssClass =
                    new Dictionary<string, Dictionary<string, string>>();
                CssTree cssTree = new CssTree();
                cssTree.OutputType = Common.OutputType.XELATEX;
                cssClass = cssTree.CreateCssProperty(Common.PathCombine(filepath, "copy.css"), true);
                string fileNameXhtml = Path.GetFileNameWithoutExtension(copyRightFilePath);
                string xeLatexCopyrightFile = Common.PathCombine(projInfo.ProjectPath, fileNameXhtml + ".tex");
                _copyrightTexFileName = xeLatexCopyrightFile;
                int pageWidth = Common.GetPictureWidth(cssClass, projInfo.ProjectInputType);

                StreamWriter xeLatexFile = new StreamWriter(xeLatexCopyrightFile);
                Dictionary<string, List<string>> classInlineStyle = new Dictionary<string, List<string>>();
                XeLaTexStyles xeLaTexStyles = new XeLaTexStyles();
                xeLaTexStyles.LangFontDictionary = _langFontCodeandName;
                classInlineStyle = xeLaTexStyles.CreateXeTexStyles(projInfo, xeLatexFile, cssClass);

                XeLaTexContent xeLaTexContent = new XeLaTexContent();
                xeLaTexContent.IsUnix = _isUnixOs;
                Dictionary<string, List<string>> classInlineText = xeLaTexStyles._classInlineText;
                xeLaTexContent.CreateContent(projInfo, cssClass, xeLatexFile, classInlineStyle, cssTree.SpecificityClass, cssTree.CssClassOrder, classInlineText, pageWidth);

                _xelatexDocumentOpenClosedRequired = true; //Don't change the place.
                CloseDocument(xeLatexFile, false, string.Empty);
                ModifyXeLaTexStyles modifyXeLaTexStyles = new ModifyXeLaTexStyles();
                modifyXeLaTexStyles.XelatexDocumentOpenClosedRequired = true;
                modifyXeLaTexStyles.ProjectType = projInfo.ProjectInputType;

                string copyright = GetLanguageInfo(mainXhtmlFileWithPath, projInfo);
                InsertInFile(xeLatexCopyrightFile, "copyright information", copyright);

                return true;
            }
            return false;
        }
예제 #23
0
        public void MultiLangHeader3()
        {
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/MultiLangHeader3.xhtml");
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/MultiLangHeader3.css");

            PublicationInformation projInfo = new PublicationInformation();

            projInfo.ProjectPath = Path.GetDirectoryName(_inputXHTML);
            projInfo.DefaultXhtmlFileWithPath = _inputXHTML;
            projInfo.DefaultCssFileWithPath = _inputCSS;

            PreExportProcess preProcessor = new PreExportProcess(projInfo);
            preProcessor.GetTempFolderPath();
            preProcessor.ImagePreprocess(false);
            preProcessor.ReplaceInvalidTagtoSpan("_AllComplexFormEntryBackRefs|LexEntryRef_PrimaryLexemes", "span");
            preProcessor.InsertHiddenChapterNumber();
            preProcessor.InsertHiddenVerseNumber();
            preProcessor.GetDefinitionLanguage();

            projInfo.DefaultXhtmlFileWithPath = preProcessor.ProcessedXhtml;
            projInfo.DefaultCssFileWithPath = preProcessor.ProcessedCss;

            Dictionary<string, Dictionary<string, string>> cssClass =
                new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
            preProcessor.InsertEmptyXHomographNumber(cssClass);

            Dictionary<string, Dictionary<string, string>> idAllClass =
                new Dictionary<string, Dictionary<string, string>>();
            InStyles inStyles = new InStyles();
            projInfo.TempOutputFolder = _outputPath;
            idAllClass = inStyles.CreateIDStyles(Common.PathCombine(_outputPath, "Resources"), cssClass);

            InGraphic inGraphic = new InGraphic();
            inGraphic.CreateIDGraphic(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass,
                                      cssTree.cssBorderColor);

            InStory inStory = new InStory();
            Dictionary<string, ArrayList> StyleName =
                inStory.CreateStory(projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder);

            InMasterSpread inMasterSpread = new InMasterSpread();
            ArrayList masterPageNames =
                inMasterSpread.CreateIDMasterSpread(Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads"),
                                                    idAllClass, StyleName["TextVariables"]);

            InSpread inSpread = new InSpread();
            inSpread.CreateIDSpread(Common.PathCombine(projInfo.TempOutputFolder, "Spreads"), idAllClass,
                                    StyleName["ColumnClass"]);

            InDesignMap inDesignMap = new InDesignMap();
            inDesignMap.CreateIDDesignMap(projInfo.TempOutputFolder, StyleName["ColumnClass"].Count, masterPageNames,
                                          StyleName["TextVariables"], StyleName["CrossRef"], string.Empty);

            InPreferences inPreferences = new InPreferences();
            inPreferences.CreateIDPreferences(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), idAllClass);

            string classname = "dTextVariablenFirst1";
            string output = Common.PathCombine(projInfo.TempOutputFolder, "designmap.xml");
            string xPath = "//TextVariable[@Self = \"" + classname + "\"]";
            XmlNode node = Common.GetXmlNodeInDesignNamespace(output, xPath);
            string result = node.InnerXml;
            string expected = "<MatchCharacterStylePreference TextBefore=\"\" TextAfter=\"\" AppliedCharacterStyle=\"CharacterStyle/headword\" SearchStrategy=\"FirstOnPage\" ChangeCase=\"None\" DeleteEndPunctuation=\"false\" />";
            Assert.AreEqual(expected, result, "MultiLangHeader1 test failed");

            classname = "dTextVariablenLast1";
            output = Common.PathCombine(projInfo.TempOutputFolder, "designmap.xml");
            xPath = "//TextVariable[@Self = \"" + classname + "\"]";
            node = Common.GetXmlNodeInDesignNamespace(output, xPath);
            result = node.InnerXml;
            expected = "<MatchCharacterStylePreference TextBefore=\"\" TextAfter=\"\" AppliedCharacterStyle=\"CharacterStyle/headword\" SearchStrategy=\"LastOnPage\" ChangeCase=\"None\" DeleteEndPunctuation=\"false\" />";
            Assert.AreEqual(expected, result, "MultiLangHeader1 test failed");
        }
예제 #24
0
 private Dictionary<string, Dictionary<string, string>> MergeProcessInCSSforMasterPage(string fileName, Dictionary<string, Dictionary<string, string>> cssClass)
 {
     Dictionary<string, Dictionary<string, string>> mergedCssClass = cssClass;
     if(cssClass.Count > 0)
     {
         string flexCSs = Common.PathCombine(Path.GetDirectoryName(fileName), "FlexRev.css");
         Dictionary<string, Dictionary<string, string>> cssClass1 = new Dictionary<string, Dictionary<string, string>>();
         CssTree cssTree = new CssTree();
         cssClass1 = cssTree.CreateCssProperty(flexCSs, true);
         foreach (string clsName in cssClass1.Keys)
         {
             if(!mergedCssClass.ContainsKey(clsName))
             {
                 mergedCssClass.Add(clsName, cssClass1[clsName]);
             }
         }
         Dictionary<string, string> pageBreakProperty = new Dictionary<string, string>();
         pageBreakProperty.Add("page-break-after", "always");
         mergedCssClass.Add("mergeBreak", pageBreakProperty);
     }
     return mergedCssClass;
 }
예제 #25
0
        private void ExportProcess(string file)
        {
            string input = FileInput(file + ".xhtml");
            _projInfo.DefaultXhtmlFileWithPath = input;
            _langFontCodeandName = new Dictionary<string, string>();
            GetXhtmlFileFontCodeandFontName(_projInfo.DefaultXhtmlFileWithPath);
            input = FileInput(file + ".css");
            _projInfo.DefaultCssFileWithPath = input;

            _projInfo.TempOutputFolder = _outputPath;
            _projInfo.OutputExtension = ".tex";

            Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssTree.OutputType = Common.OutputType.XELATEX;
            cssClass = cssTree.CreateCssProperty(input, true);
            int pageWidth = Common.GetPictureWidth(cssClass, _projInfo.ProjectInputType);

            string xetexFullFile = Common.PathCombine(_outputPath, file + ".tex");
            StreamWriter xetexFile = new StreamWriter(xetexFullFile);

            XeLaTexStyles styles = new XeLaTexStyles();
            _classInlineStyle = styles.CreateXeTexStyles(_projInfo, xetexFile, cssClass);

            XeLaTexContent content = new XeLaTexContent();
            Dictionary<string, List<string>> classInlineText = styles._classInlineText;
            Dictionary<string, Dictionary<string, string>> newProperty = content.CreateContent(_projInfo, cssClass, xetexFile, _classInlineStyle, cssTree.SpecificityClass, cssTree.CssClassOrder, classInlineText, pageWidth);

            CloseFile(xetexFile);

            ModifyXeLaTexStyles modifyXeTexStyles = new ModifyXeLaTexStyles();
            modifyXeTexStyles.ModifyStylesXML(_projInfo.ProjectPath, xetexFile, newProperty, cssClass, xetexFullFile, string.Empty, _langFontCodeandName,true);

        }
예제 #26
0
        /// <summary>
        /// Convert XHTML to ODT
        /// </summary>
        public bool Export(PublicationInformation projInfo)
        {
            PreExportProcess preProcessor = new PreExportProcess(projInfo);
            preProcessor.GetTempFolderPath();
            preProcessor.InsertEmptyHeadwordForReversal(preProcessor.ProcessedXhtml);
            MergeProcessInXHTMLforMasterPage(preProcessor.ProcessedXhtml);
            preProcessor.PreserveSpace();
            preProcessor.ImagePreprocess(true);
            preProcessor.ReplaceInvalidTagtoSpan("_AllComplexFormEntryBackRefs|LexEntryRef_PrimaryLexemes", "span");
            preProcessor.InsertHiddenChapterNumber();
            preProcessor.InsertHiddenVerseNumber();
            preProcessor.GetDefinitionLanguage();
            var exportTitle = GetExportTitle();
            string fileName = exportTitle.ToString();
            if (exportTitle.ToString() == string.Empty)
            {
                fileName = Path.GetFileNameWithoutExtension(projInfo.DefaultXhtmlFileWithPath);
            }
            projInfo.DefaultXhtmlFileWithPath = preProcessor.ProcessedXhtml;
            projInfo.DefaultCssFileWithPath = preProcessor.ProcessedCss;
            projInfo.ProjectPath = Path.GetDirectoryName(preProcessor.ProcessedXhtml);

            Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
            cssClass = MergeProcessInCSSforMasterPage(projInfo.DefaultCssFileWithPath, cssClass);
            preProcessor.InsertEmptyXHomographNumber(cssClass);

            //To insert the variable for macro use
            InInsertMacro insertMacro = new InInsertMacro();
            insertMacro.InsertMacroVariable(projInfo, cssClass);

            Dictionary<string, Dictionary<string, string>> idAllClass = new Dictionary<string, Dictionary<string, string>>();
            InStyles inStyles = new InStyles();
            idAllClass = inStyles.CreateIDStyles(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass);

            InGraphic inGraphic = new InGraphic();
            inGraphic.CreateIDGraphic(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass, cssTree.cssBorderColor);

            InStory inStory = new InStory();
            Dictionary<string, ArrayList> StyleName = inStory.CreateStory(projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder);

            InMasterSpread inMasterSpread = new InMasterSpread();
            ArrayList masterPageNames = inMasterSpread.CreateIDMasterSpread(Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads"), idAllClass, StyleName["TextVariables"]);
            
            InSpread inSpread = new InSpread();
            inSpread.CreateIDSpread(Common.PathCombine(projInfo.TempOutputFolder, "Spreads"), idAllClass, StyleName["ColumnClass"]);

            InDesignMap inDesignMap = new InDesignMap();
            inDesignMap.CreateIDDesignMap(projInfo.TempOutputFolder, StyleName["ColumnClass"].Count, masterPageNames, StyleName["TextVariables"], StyleName["CrossRef"], projInfo.ProjectInputType);

            InMetaData inMetaData = new InMetaData();
            inMetaData.SetDateTimeinMetaDataXML(projInfo.TempOutputFolder);

            InPreferences inPreferences = new InPreferences();
            inPreferences.CreateIDPreferences(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), idAllClass);

            SubProcess.AfterProcess(projInfo.ProjectFileWithPath);
            fileName = Common.ReplaceSymbolToUnderline(fileName);
            string ldmlFullName = Common.PathCombine(projInfo.DictionaryPath, fileName + ".idml");
            Compress(projInfo.TempOutputFolder, ldmlFullName);

            Common.CleanupExportFolder(ldmlFullName, ".tmp,.de", "layout.css", String.Empty);

            CreateRAMP(projInfo);

            Common.CleanupExportFolder(ldmlFullName, ".css,.xhtml,.xml", String.Empty, String.Empty);

            if (projInfo.IsOpenOutput)
                Launch(ldmlFullName);

            
            return true;
        }
예제 #27
0
        private string GetStyleOutput(PublicationInformation projInfo)
        {
            LOContent contentXML = new LOContent();
            LOStyles stylesXML = new LOStyles();
            projInfo.TempOutputFolder = _outputPath;
            string file = Path.GetFileNameWithoutExtension(_projInfo.DefaultXhtmlFileWithPath);

            Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);

            //StyleXML
            string fileOutput = _index > 0 ? file + _index + _styleFile : file + _styleFile;
            //string styleOutput = FileOutput(file + _styleFile);
            string styleOutput = FileOutput(fileOutput);
            Dictionary<string, Dictionary<string, string>> idAllClass = stylesXML.CreateStyles(_projInfo, cssClass, styleOutput);

            // ContentXML
            var pageSize = new Dictionary<string, string>();
            pageSize["height"] = cssClass["@page"]["page-height"];
            pageSize["width"] = cssClass["@page"]["page-width"];
            _projInfo.TempOutputFolder = FileOutput(file);
            contentXML.CreateStory(_projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder, 325, pageSize);
            _projInfo.TempOutputFolder = _projInfo.TempOutputFolder + _contentFile;
            return styleOutput;
        }
예제 #28
0
        /// <summary>
        /// Convert XHTML to ODT and ODM
        /// </summary>
        public bool ExportODT(PublicationInformation projInfo)
        {
            string defaultXhtml = projInfo.DefaultXhtmlFileWithPath;
            projInfo.OutputExtension = "odt";
            Common.OdType = Common.OdtType.OdtChild;
            bool returnValue = false;
            string strFromOfficeFolder = Common.PathCombine(Common.GetPSApplicationPath(), "OfficeFiles" + Path.DirectorySeparatorChar + projInfo.ProjectInputType);
            projInfo.TempOutputFolder = Common.PathCombine(Path.GetTempPath(), "OfficeFiles" + Path.DirectorySeparatorChar + projInfo.ProjectInputType);
            Common.DeleteDirectory(projInfo.TempOutputFolder);
            string strStylePath = Common.PathCombine(projInfo.TempOutputFolder, "styles.xml");
            string strContentPath = Common.PathCombine(projInfo.TempOutputFolder, "content.xml");
            CopyOfficeFolder(strFromOfficeFolder, projInfo.TempOutputFolder);
            string strMacroPath = Common.PathCombine(projInfo.TempOutputFolder, "Basic/Standard/Module1.xml");
            string outputFileName;
            string outputPath = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath);
            VerboseClass verboseClass = VerboseClass.GetInstance();
            if (projInfo.FileSequence != null && projInfo.FileSequence.Count > 1)
            {
                projInfo.OutputExtension = "odm";  // Master Document
                Common.OdType = Common.OdtType.OdtMaster;
                if (projInfo.DictionaryOutputName == null)
                    projInfo.DictionaryOutputName = projInfo.DefaultXhtmlFileWithPath.Replace(Path.GetExtension(projInfo.DefaultXhtmlFileWithPath), "");
                outputFileName = Common.PathCombine(outputPath, projInfo.DictionaryOutputName); // OdtMaster is created in Dictionary Name
            }
            else
            {
                // All other OdtChild files are created in the name of Xhtml or xml file Names.
                if (projInfo.DictionaryOutputName == null)
                {
                    outputFileName = projInfo.DefaultXhtmlFileWithPath.Replace(Path.GetExtension(projInfo.DefaultXhtmlFileWithPath), "");
                }
                else
                {
                    string inputFileName = Path.GetFileNameWithoutExtension(projInfo.DefaultXhtmlFileWithPath);
                    outputFileName = Common.PathCombine(outputPath, inputFileName);
                    Common.OdType = Common.OdtType.OdtNoMaster; // to all the Page property process
                }
            }

            string cssFile = projInfo.DefaultCssFileWithPath;
            SetBookReferenceDivInCss(cssFile);
            var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(defaultXhtml);
            if (projInfo.DefaultRevCssFileWithPath != null && projInfo.DefaultRevCssFileWithPath.Trim().Length > 0)
            {
                if (fileNameWithoutExtension != null && fileNameWithoutExtension.ToLower() == "flexrev")
                {
                    cssFile = projInfo.DefaultRevCssFileWithPath;
                }
            }


            PreExportProcess preProcessor = new PreExportProcess(projInfo);
            if (fileNameWithoutExtension != null && fileNameWithoutExtension.ToLower() == "flexrev")
            {
                preProcessor.InsertEmptyDiv(preProcessor.ProcessedXhtml);
                preProcessor.InsertSpanAfterLetter(preProcessor.ProcessedXhtml);
            }
            preProcessor.IncludeHyphenWordsOnXhtml(preProcessor.ProcessedXhtml);
            preProcessor.GetTempFolderPath();
            preProcessor.GetDefaultLanguage(projInfo);
            projInfo.DefaultXhtmlFileWithPath = preProcessor.PreserveSpace();
            InsertFrontMatter(projInfo);
            preProcessor.MoveBookcodeFRTtoFront(projInfo.DefaultXhtmlFileWithPath);
            preProcessor.GetfigureNode();
            preProcessor.InsertKeepWithNextOnStyles(cssFile);
            preProcessor.InsertBookPageBreak();
            preProcessor.ArrangeImages();
            isMultiLanguageHeader = preProcessor.GetMultiLanguageHeader();

            Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssTree.OutputType = Common.OutputType.ODT;
            cssClass = cssTree.CreateCssProperty(cssFile, true);
            SetHeaderFontName(projInfo, cssClass);
            HandledInCss(ref projInfo, ref cssClass);
            int pageWidth = GetPictureWidth(cssClass);
            // BEGIN Generate Styles.Xml File
            Dictionary<string, Dictionary<string, string>> idAllClass = new Dictionary<string, Dictionary<string, string>>();
            LOStyles inStyles = new LOStyles();
            inStyles.MultiLanguageHeader = isMultiLanguageHeader;
            idAllClass = inStyles.CreateStyles(projInfo, cssClass, "styles.xml");
            projInfo.IncludeFootnoteSymbol = inStyles.CustomFootnoteCaller;
            projInfo.IncludeXRefSymbol = inStyles.CustomXRefCaller;
            projInfo.SplitFileByLetter = inStyles.SplitFileByLetter;
            projInfo.HideSpaceVerseNumber = inStyles.HideSpaceVerseNumber;
            //To set Constent variables for User Desire
            string fname = Common.GetFileNameWithoutExtension(projInfo.DefaultXhtmlFileWithPath);
            string macroFileName = Common.PathCombine(projInfo.DictionaryPath, fname);

            string isToc;
            var isCoverImageInserted = EditCssValues(idAllClass, out isToc);


            _refFormat = Common.GetReferenceFormat(idAllClass, _refFormat);
            IncludeTextinMacro(strMacroPath, _refFormat, macroFileName, projInfo.IsExtraProcessing, isCoverImageInserted, isToc);

            // BEGIN Generate Meta.Xml File
            var metaXML = new LOMetaXML(projInfo.ProjectInputType);
            metaXML.CreateMeta(projInfo);
            // BEGIN Generate Content.Xml File 
            var cXML = new LOContent();
            preProcessor.MovePictureAsLastChild(preProcessor.ProcessedXhtml);
            preProcessor.ImagePreprocess(false);
            preProcessor.ReplaceSlashToREVERSE_SOLIDUS();
            if (projInfo.SwapHeadword)
                preProcessor.SwapHeadWordAndReversalForm();

            Dictionary<string, string> pageSize = new Dictionary<string, string>();
            pageSize["height"] = cssClass["@page"]["page-height"];
            pageSize["width"] = cssClass["@page"]["page-width"];

            projInfo.DefaultXhtmlFileWithPath = preProcessor.ProcessedXhtml;

            AfterBeforeProcess afterBeforeProcess = new AfterBeforeProcess();
            afterBeforeProcess.RemoveAfterBefore(projInfo, cssClass, cssTree.SpecificityClass, cssTree.CssClassOrder);

            projInfo.TempOutputFolder += Path.DirectorySeparatorChar;
            cXML._multiLanguageHeader = isMultiLanguageHeader;

            cXML.CreateStory(projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder, pageWidth, pageSize);
            PostProcess(projInfo);

            if (projInfo.FileSequence != null && projInfo.FileSequence.Count > 1)
            {
                var ul = new OOUtility();
                ul.CreateMasterContents(strContentPath, projInfo.FileSequence);
            }

            if (projInfo.MoveStyleToContent)
                MoveStylesToContent(strStylePath, strContentPath);

            var mODT = new ZipFolder();
            string fileNameNoPath = outputFileName + "." + projInfo.OutputExtension;
            mODT.CreateZip(projInfo.TempOutputFolder, fileNameNoPath, verboseClass.ErrorCount);

            projInfo.DictionaryOutputName = fileNameNoPath;
            try
            {
                if (File.Exists(fileNameNoPath))
                {
                    returnValue = true;
                    if (projInfo.IsOpenOutput)
                    {
                        Common.OpenOutput(fileNameNoPath);
                    }
                }
            }
            catch (System.ComponentModel.Win32Exception ex)
            {
                if (ex.NativeErrorCode == 1155)
                {
                    string installedLocation = string.Empty;
                    if (File.Exists(fileNameNoPath))
                    {
                        installedLocation = fileNameNoPath;
                        var msg = new[] { "LibreOffice application from http://www.libreoffice.org site.\nAfter downloading and installing Libre Office, please consult release notes about how to change the macro security setting to enable the macro that creates the headers." };
                        LocDB.Message("errInstallFile", "The output has been saved in " + installedLocation + ".", "Please install " + msg, msg, LocDB.MessageTypes.Error, LocDB.MessageDefault.First);
                        return false;
                    }
                    else
                    {
                        var msg = new[] { "LibreOffice application from http://www.libreoffice.org site.\nAfter downloading and installing Libre Office, please consult release notes about how to change the macro security setting to enable the macro that creates the headers." };
                        LocDB.Message("errInstallFile", "Please install " + msg, msg, LocDB.MessageTypes.Error, LocDB.MessageDefault.First);
                        return false;
                    }
                }
            }
            finally
            {
                projInfo.DefaultXhtmlFileWithPath = defaultXhtml;
                if (preProcessor != null)
                {
                    DirectoryInfo di = new DirectoryInfo(preProcessor.GetCreatedTempFolderPath);
                    Common.CleanDirectory(di);
                }
                if (projInfo.TempOutputFolder != null)
                {
                    DirectoryInfo di = new DirectoryInfo(projInfo.TempOutputFolder);
                    Common.CleanDirectory(di);
                }
            }
            return returnValue;
        }
예제 #29
0
        /// <summary>
        /// Convert XHTML to ODT
        /// </summary>
        public bool Export(PublicationInformation projInfo)
        {
            PreExportProcess preProcessor = new PreExportProcess(projInfo);

            preProcessor.GetTempFolderPath();
            preProcessor.InsertEmptyHeadwordForReversal(preProcessor.ProcessedXhtml);
            MergeProcessInXHTMLforMasterPage(preProcessor.ProcessedXhtml);
            preProcessor.PreserveSpace();
            preProcessor.ImagePreprocess(true);
            preProcessor.ReplaceInvalidTagtoSpan("_AllComplexFormEntryBackRefs|LexEntryRef_PrimaryLexemes", "span");
            preProcessor.InsertHiddenChapterNumber();
            preProcessor.InsertHiddenVerseNumber();
            preProcessor.GetDefinitionLanguage();
            var    exportTitle = GetExportTitle();
            string fileName    = exportTitle.ToString();

            if (exportTitle.ToString() == string.Empty)
            {
                fileName = Path.GetFileNameWithoutExtension(projInfo.DefaultXhtmlFileWithPath);
            }
            projInfo.DefaultXhtmlFileWithPath = preProcessor.ProcessedXhtml;
            projInfo.DefaultCssFileWithPath   = preProcessor.ProcessedCss;
            projInfo.ProjectPath = Path.GetDirectoryName(preProcessor.ProcessedXhtml);

            Dictionary <string, Dictionary <string, string> > cssClass = new Dictionary <string, Dictionary <string, string> >();
            CssTree cssTree = new CssTree();

            cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
            cssClass = MergeProcessInCSSforMasterPage(projInfo.DefaultCssFileWithPath, cssClass);
            preProcessor.InsertEmptyXHomographNumber(cssClass);

            //To insert the variable for macro use
            InInsertMacro insertMacro = new InInsertMacro();

            insertMacro.InsertMacroVariable(projInfo, cssClass);

            Dictionary <string, Dictionary <string, string> > idAllClass = new Dictionary <string, Dictionary <string, string> >();
            InStyles inStyles = new InStyles();

            idAllClass = inStyles.CreateIDStyles(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass);

            InGraphic inGraphic = new InGraphic();

            inGraphic.CreateIDGraphic(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass, cssTree.cssBorderColor);

            InStory inStory = new InStory();
            Dictionary <string, ArrayList> StyleName = inStory.CreateStory(projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder);

            InMasterSpread inMasterSpread  = new InMasterSpread();
            ArrayList      masterPageNames = inMasterSpread.CreateIDMasterSpread(Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads"), idAllClass, StyleName["TextVariables"]);

            InSpread inSpread = new InSpread();

            inSpread.CreateIDSpread(Common.PathCombine(projInfo.TempOutputFolder, "Spreads"), idAllClass, StyleName["ColumnClass"]);

            InDesignMap inDesignMap = new InDesignMap();

            inDesignMap.CreateIDDesignMap(projInfo.TempOutputFolder, StyleName["ColumnClass"].Count, masterPageNames, StyleName["TextVariables"], StyleName["CrossRef"], projInfo.ProjectInputType);

            InMetaData inMetaData = new InMetaData();

            inMetaData.SetDateTimeinMetaDataXML(projInfo.TempOutputFolder);

            InPreferences inPreferences = new InPreferences();

            inPreferences.CreateIDPreferences(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), idAllClass);

            SubProcess.AfterProcess(projInfo.ProjectFileWithPath);
            fileName = Common.ReplaceSymbolToUnderline(fileName);
            string ldmlFullName = Common.PathCombine(projInfo.DictionaryPath, fileName + ".idml");

            Compress(projInfo.TempOutputFolder, ldmlFullName);

            Common.CleanupExportFolder(ldmlFullName, ".tmp,.de", "layout.css", String.Empty);

            CreateRAMP(projInfo);

            Common.CleanupExportFolder(ldmlFullName, ".css,.xhtml,.xml", String.Empty, String.Empty);

            if (projInfo.IsOpenOutput)
            {
                Launch(ldmlFullName);
            }


            return(true);
        }
예제 #30
0
        /// <summary>
        /// Convert XHTML to ODT
        /// </summary>
        public bool Export(PublicationInformation projInfo)
        {
            publicationInfo = projInfo;
            string defaultXhtml = projInfo.DefaultXhtmlFileWithPath;
            GeneratedPdfFileName = defaultXhtml;
            projInfo.OutputExtension = "odt";
            Common.OdType = Common.OdtType.OdtChild;
            bool returnValue = false;
            VerboseClass verboseClass = VerboseClass.GetInstance();
            _isFromExe = Common.CheckExecutionPath();
            var glossorywords = WriteGlossaryLink(projInfo);
            GlossaryLinkReferencing(projInfo, glossorywords);
            Common.DeleteDirectoryWildCard(Path.GetTempPath(), "SilPathwaytmp*");

            string strFromOfficeFolder = Common.FromRegistry("OfficeFiles" + Path.DirectorySeparatorChar + projInfo.ProjectInputType);
            projInfo.TempOutputFolder = Common.PathCombine(Path.GetTempPath(), "OfficeFiles" + Path.DirectorySeparatorChar + projInfo.ProjectInputType);
            CopyOfficeFolder(strFromOfficeFolder, projInfo.TempOutputFolder);
            Dictionary<string, string> dictSecName = new Dictionary<string, string>();

            Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);

            if (cssClass.ContainsKey("@page") && cssClass["@page"].ContainsKey("-ps-fileproduce"))
            {
                projInfo.FileToProduce = cssClass["@page"]["-ps-fileproduce"];
            }

            if (projInfo.FromPlugin && projInfo.IsReversalExist)
            {
                dictSecName = CreatePageDictionary(projInfo);
            }
            else
            {
                dictSecName = GetPageSectionSteps();
            }
            dictSecName = SplitXhtmlAsMultiplePart(projInfo, dictSecName);

            if (dictSecName.Count > 1)
            {
                GeneratedPdfFileName = dictSecName["Main"];
                ExportODM(publicationInfo.ProgressBar);
            }
            else
            {
                publicationInfo.DictionaryOutputName = publicationInfo.ProjectName;
                returnValue = ExportODT(publicationInfo);
            }

            if (publicationInfo.FinalOutput != null && publicationInfo.FinalOutput.ToLower() == "pdf")
            {
                publicationInfo.OutputExtension = "pdf";
                Common.InsertCopyrightInPdf(defaultXhtml, "LibreOffice", projInfo.ProjectInputType);
            }
            else
            {
                Common.CleanupExportFolder(publicationInfo.DefaultXhtmlFileWithPath, ".tmp,.de,.exe,.jar,.xml", "layout.css", string.Empty);
                CreateRAMP();
                Common.CleanupExportFolder(publicationInfo.DefaultXhtmlFileWithPath, ".css,.xhtml,.xml", String.Empty, String.Empty);
            }
            return returnValue;
        }
예제 #31
0
        /// <summary>
        /// Inserting After & Before content to XHTML file
        /// </summary>
        private void InsertBeforeAfterInXhtml(PublicationInformation projInfo)
        {
            if (projInfo == null) return;
            if (projInfo.DefaultXhtmlFileWithPath == null || projInfo.DefaultCssFileWithPath == null) return;
            if (projInfo.DefaultXhtmlFileWithPath.Trim().Length == 0 || projInfo.DefaultCssFileWithPath.Trim().Length == 0) return;

            var cssTree = new CssTree();
            Dictionary<string, Dictionary<string, string>> cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);

            var afterBeforeProcess = new AfterBeforeProcessEpub();
            afterBeforeProcess.RemoveAfterBefore(projInfo, cssClass, cssTree.SpecificityClass, cssTree.CssClassOrder);
            PseudoClass = afterBeforeProcess._psuedoClassName;

            if (projInfo.IsReversalExist && projInfo.ProjectInputType.ToLower() == "dictionary")
            {
                cssClass = cssTree.CreateCssProperty(projInfo.DefaultRevCssFileWithPath, true);
                string originalDefaultXhtmlFileName = projInfo.DefaultXhtmlFileWithPath;
                projInfo.DefaultXhtmlFileWithPath = Common.PathCombine(Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath), "FlexRev.xhtml");
                RemovePseudoBefore(cssTree);
                var afterBeforeProcessReversal = new AfterBeforeProcessEpub();
                afterBeforeProcessReversal.RemoveAfterBefore(projInfo, cssClass, cssTree.SpecificityClass, cssTree.CssClassOrder);
                Common.StreamReplaceInFile(projInfo.DefaultXhtmlFileWithPath, "&nbsp;", Common.NonBreakingSpace);
                projInfo.DefaultXhtmlFileWithPath = originalDefaultXhtmlFileName;
            }
        }
예제 #32
0
 /// <summary>
 /// Remove After & Before in Css file
 /// </summary>
 private static void RemovePseudoBefore(CssTree cssTree)
 {
     if (cssTree.SpecificityClass.ContainsKey("subentry"))
     {
         ArrayList aa = cssTree.SpecificityClass["subentry"];
         foreach (ClassInfo myvar in aa)
         {
             if (myvar.Pseudo.ToLower() == "before")
                 myvar.Content = "";
         }
     }
 }
예제 #33
0
 protected void LoadCss(PublicationInformation projInfo)
 {
     var cssTree = new CssTree();
     CssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
 }
예제 #34
0
        public bool Export(PublicationInformation projInfo)
        {
            bool success;
            bool isUnixOS = Common.UnixVersionCheck();
            try
            {
                var regPrinceKey = RegPrinceKey;
                if (regPrinceKey != null || isUnixOS)
                {
                    var curdir = Environment.CurrentDirectory;
                    projInfo.OutputExtension = "pdf";
                    PreExportProcess preProcessor = new PreExportProcess(projInfo);
                    if (isUnixOS)
                    {
                        projInfo.DefaultXhtmlFileWithPath =
                            Common.RemoveDTDForLinuxProcess(projInfo.DefaultXhtmlFileWithPath,"pdfconvert");
                    }
                    Environment.CurrentDirectory = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath);
                    preProcessor.GetTempFolderPath();
                    preProcessor.ImagePreprocess(false);
                    preProcessor.ReplaceSlashToREVERSE_SOLIDUS();
                    if (projInfo.SwapHeadword)
                        preProcessor.SwapHeadWordAndReversalForm();
                    preProcessor.MovePictureAsLastChild(preProcessor.ProcessedXhtml);
                    preProcessor.SetNonBreakInVerseNumber(preProcessor.ProcessedXhtml);
                    preProcessor.ReplaceDoubleSlashToLineBreak(preProcessor.ProcessedXhtml);
                    preProcessor.MoveCallerToPrevText(preProcessor.ProcessedXhtml);
                    string tempFolder = Path.GetDirectoryName(preProcessor.ProcessedXhtml);
                    string tempFolderName = Path.GetFileName(tempFolder);
                    var mc = new MergeCss { OutputLocation = tempFolderName };
                    string mergedCSS = mc.Make(projInfo.DefaultCssFileWithPath, "Temp1.css");
                    preProcessor.ReplaceStringInCss(mergedCSS);
                    preProcessor.InsertPropertyInCSS(mergedCSS);
                    preProcessor.RemoveDeclaration(mergedCSS, ".pictureRight > .picture");
                    preProcessor.RemoveDeclaration(mergedCSS, "div.pictureLeft > img.picture");
                    mergedCSS = preProcessor.RemoveTextIndent(mergedCSS);

                    if (isUnixOS)
                    {
                        Common.StreamReplaceInFile(mergedCSS, "Scheherazade Graphite Alpha", "Scheherazade");
                    }

                    Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>();
                    CssTree cssTree = new CssTree();
                    cssTree.OutputType = Common.OutputType.PDF;
                    cssClass = cssTree.CreateCssProperty(mergedCSS, true);
                    if (cssClass.ContainsKey("@page") && cssClass["@page"].ContainsKey("-ps-hide-versenumber-one"))
                    {
                        string value = cssClass["@page"]["-ps-hide-versenumber-one"];
                        if (value.ToLower() == "true")
                        {
                            preProcessor.RemoveVerseNumberOne(preProcessor.ProcessedXhtml, mergedCSS);
                        }
                    }
                    if (cssClass.ContainsKey("@page:left-top-left") && cssClass["@page:left-top-left"].ContainsKey("-ps-referenceformat"))
                    {
                        string value = cssClass["@page:left-top-left"]["-ps-referenceformat"];
                        if (value.ToLower().Contains("gen 1"))
                        {
                            ReplaceBookNametoBookCode(preProcessor.ProcessedXhtml);
                        }
                    }

                    string xhtmlFileName = Path.GetFileNameWithoutExtension(projInfo.DefaultXhtmlFileWithPath);
                    string defaultCSS = Path.GetFileName(mergedCSS);
                    Common.SetDefaultCSS(preProcessor.ProcessedXhtml, defaultCSS);
                    _processedXhtml = preProcessor.ProcessedXhtml;
                    if (!ExportPrince(projInfo, xhtmlFileName, isUnixOS, regPrinceKey, defaultCSS)) 
                        return false;

                    Environment.CurrentDirectory = curdir;
                    if (!projInfo.DefaultXhtmlFileWithPath.ToLower().Contains("local"))
                    {
                        //Copyright information added in PDF files
                        #pragma warning disable 168
                        string pdfFileName = Common.InsertCopyrightInPdf(Common.PathCombine(Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath), xhtmlFileName + ".pdf"), "Prince XML", projInfo.ProjectInputType);
                        #pragma warning restore 168
                    }
                    else
                    {
                        string pdfFileName = xhtmlFileName + ".pdf";
                        pdfFileName = Common.PathCombine(Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath), pdfFileName);
                        
                        if (!Common.Testing && File.Exists(pdfFileName))
                        {
                            // ReSharper disable RedundantAssignment
                            success = true;
                            // ReSharper restore RedundantAssignment
                            Process.Start(pdfFileName);
                        }
                    }
                    success = true;
                }
                else
                {
                    success = false;
                    if (Common.Testing)
                    {
                        success = true;
                    }
                }
            }
            catch (Exception)
            {
                success = false;
            }
            return success;
        }