Пример #1
0
 public Contents()
 {
     Common.ProgBase = Common.GetPSApplicationPath();
     // EDB - for testing only
     _realClass = new ExportThroughPathway();
     ((ExportThroughPathway)_realClass).InputType = "Dictionary";
 }
Пример #2
0
        public Contents()
        {
            //Common.SupportFolder = "PathwaySupport";
			Common.ProgBase = Common.GetPSApplicationPath();
            // EDB - for testing only
            _realClass = new ExportThroughPathway();
            ((ExportThroughPathway)_realClass).InputType = "Dictionary";
        }
Пример #3
0
        /// <summary>
        /// Have the utility do what it does.
        /// </summary>
        public void Process()
        {
            const string MainXhtml = "main.xhtml";
            const string RevXhtml  = "FlexRev.xhtml";
            const string SketchXml = "sketch.xml";

            IExportContents sf = DynamicLoader.CreateObject("CssDialog.dll", "SIL.PublishingSolution.Contents") as IExportContents;

            Debug.Assert(sf != null);
            FdoCache cache = (FdoCache)exportDialog.Mediator.PropertyTable.GetValue("cache");

            sf.DatabaseName   = cache.DatabaseName;
            sf.ExportReversal = sf.ReversalExists = ContentsExists("lexicon", "reversalToolEditComplete", "ReversalIndexXHTML");
            sf.GrammarExists  = false;

            DialogResult result = sf.ShowDialog();

            if (result == DialogResult.Cancel)
            {
                return;
            }

            string outPath = Path.Combine(sf.OutputLocationPath, sf.DictionaryName);

            if (sf.ExistingDirectoryInput)
            {
                string inputPath = sf.ExistingDirectoryLocationPath;
                if (inputPath != outPath)
                {
                    string dirFilter = string.Empty;
                    if (sf.OutputLocationPath == inputPath)
                    {
                        dirFilter = sf.DictionaryName;
                    }
                    try
                    {
                        if (!MyFolders.Copy(inputPath, outPath, dirFilter))
                        {
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        return;
                    }
                }
            }

            if (!MyFolders.CreateDirectory(outPath))
            {
                return;
            }

            string mainFullName = Path.Combine(outPath, MainXhtml);
            string revFullXhtml = Path.Combine(outPath, RevXhtml);
            string gramFullName = Path.Combine(outPath, SketchXml);

            if (!sf.ExportMain)
            {
                mainFullName = "";
            }
            if (!sf.ExportReversal)
            {
                revFullXhtml = "";
            }

            switch (result)
            {
            // No = Skip export of data from Flex but still prepare exported output (ODT, PDF or whatever)
            case DialogResult.No:
                break;

            case DialogResult.Yes:
                if (!DeFlexExports(ExpCss, mainFullName, revFullXhtml, gramFullName))
                {
                    return;
                }
                break;
            }

            IExporter exporter = DynamicLoader.CreateObject("PsExport.dll", "SIL.PublishingSolution.PsExport") as IExporter;

            Debug.Assert(exporter != null);
            exporter.DataType    = "Dictionary";
            exporter.ProgressBar = exportDialog.ProgressBar;
            exporter.Export(mainFullName != "" ? mainFullName : revFullXhtml);

            Reporting();
        }