Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        protected void ReportReults(PublicationInformation projInfo)
        {
            var output = new DictionaryForMIDsStreamWriter(projInfo);
            var msg    = LocalizationManager.GetString("ExportDictionaryForMIDs.ReportResults.Message", "Dictionary for Mid output successfully created in {0}. Display output files?", "");
            var result = !Common.Testing ? MessageBox.Show(string.Format(msg, output.Directory), "Results", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) :
                         DialogResult.No;

            if (result == DialogResult.Yes)
            {
                DisplayOutput(projInfo);
            }
        }
Exemplo n.º 4
0
        private static void DisplayOutput(PublicationInformation projInfo)
        {
            var        output = new DictionaryForMIDsStreamWriter(projInfo);
            const bool noWait = false;

            if (_isUnixOS)
            {
                SubProcess.Run("", "nautilus", Common.HandleSpaceinLinuxPath(output.Directory), noWait);
            }
            else
            {
                SubProcess.Run(output.Directory, "explorer.exe", output.Directory, noWait);
            }
        }
Exemplo n.º 5
0
        protected void CreateSubmission(PublicationInformation projInfo)
        {
            var output = new DictionaryForMIDsStreamWriter(projInfo);
            var folder = Directory.GetDirectories(output.Directory, "DfM_*");

            if (folder.Length == 0)
            {
                return;                 // Output was not created!
            }
            var        folderName         = Path.GetFileName(folder[0]);
            var        date               = DateTime.Now.ToString("y.M.d");
            var        folderParts        = folderName.Split('_');
            var        submissionName     = string.Format("DictionaryForMIDs_{0}_{1}_{2}.zip", date, folderParts[1], folderParts[2]);
            var        submissionFullName = Common.PathCombine(output.Directory, submissionName);
            var        zip     = new FastZip();
            const bool recurse = true;

            zip.CreateZip(submissionFullName, folder[0], recurse, ".*");
        }
Exemplo n.º 6
0
 private static void DisplayOutput(PublicationInformation projInfo)
 {
     var output = new DictionaryForMIDsStreamWriter(projInfo);
     const bool noWait = false;
     if (_isUnixOS)
     {
         SubProcess.Run("", "nautilus", Common.HandleSpaceinLinuxPath(output.Directory), noWait);
     }
     else
     {
         SubProcess.Run(output.Directory, "explorer.exe", output.Directory, noWait);
     }
 }
Exemplo n.º 7
0
 protected void ReportReults(PublicationInformation projInfo)
 {
     var output = new DictionaryForMIDsStreamWriter(projInfo);
     var msg = LocalizationManager.GetString("ExportDictionaryForMIDs.ReportResults.Message", "Dictionary for Mid output successfully created in {0}. Display output files?", "");
     var result = !Common.Testing ? MessageBox.Show(string.Format(msg, output.Directory), "Results", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) :
         DialogResult.No;
     if (result == DialogResult.Yes)
     {
         DisplayOutput(projInfo);
     }
 }
Exemplo n.º 8
0
 protected void CreateSubmission(PublicationInformation projInfo)
 {
     var output = new DictionaryForMIDsStreamWriter(projInfo);
     var folder = Directory.GetDirectories(output.Directory, "DfM_*");
     if (folder.Length == 0)
         return;                 // Output was not created!
     var folderName = Path.GetFileName(folder[0]);
     var date = DateTime.Now.ToString("y.M.d");
     var folderParts = folderName.Split('_');
     var submissionName = string.Format("DictionaryForMIDs_{0}_{1}_{2}.zip", date, folderParts[1], folderParts[2]);
     var submissionFullName = Common.PathCombine(output.Directory, submissionName);
     var zip = new FastZip();
     const bool recurse = true;
     zip.CreateZip(submissionFullName, folder[0], recurse, ".*");
 }
Exemplo n.º 9
0
 protected void CreateDictionaryForMIDs(PublicationInformation projInfo)
 {
     var output = new DictionaryForMIDsStreamWriter(projInfo);
     Debug.Assert(output.Directory != null);
     var processFullPath = Common.PathCombine(output.Directory, "go.bat");
     var DictionaryForMIDsPath = Common.FromRegistry("Dic4Mid");
     var creatorPath = Common.PathCombine(DictionaryForMIDsPath, "DfM-Creator");
     FolderTree.Copy(creatorPath, output.Directory);
     const string redirectOutputFileName = LogName;
     SubProcess.RedirectOutput = redirectOutputFileName;
     if (_isUnixOS)
     {
         SubProcess.RunCommand(output.Directory, "wineconsole", processFullPath, true);
     }
     else
     {
         SubProcess.Run(output.Directory, processFullPath, ".", true);
     }
 }
Exemplo n.º 10
0
 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::*";
     foreach (XmlNode sense in input.SelectNodes(sensePath))
     {
         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();
 }