Beispiel #1
0
        private void translateAndExportVietPhraseOneMeaningFormat(string[] chineseContents, string[] mergedFileNames)
        {
            int    wrapType = (vietPhraseOneMeaningTranslationTypeComboBox.SelectedIndex == 2) ? 11 : vietPhraseOneMeaningTranslationTypeComboBox.SelectedIndex;
            bool   needToRemoveBlankLine = !insertBlankLinesCheckBox.Checked;
            string targetFolder          = targetFolderTextBox.Text;
            bool   outputToWord          = outputTypeComboBox.SelectedIndex == 4;
            int    translationAlgorithm  = translationAlgorithmComboBox.SelectedIndex;
            bool   prioritizedName       = prioritizedNameCheckBox.Checked;

            for (int i = 0; i < chineseContents.Length; i++)
            {
                if (requestCancel)
                {
                    return;
                }
                ThreadPool.QueueUserWorkItem(delegate(object batchIndexObject) {
                    if (requestCancel)
                    {
                        return;
                    }
                    int num = (int)batchIndexObject;
                    VietPhraseExporter.Export(Translator.ChineseToVietPhraseOneMeaningForBatch(chineseContents[num], wrapType, translationAlgorithm, prioritizedName), needToRemoveBlankLine, Path.Combine(targetFolder, mergedFileNames[num] + (outputToWord ? ".doc" : (mergedFileNames[num].EndsWith("txt") ? "" : ".txt"))), outputToWord);
                    processStatus[num]++;
                }, i);
            }
        }
Beispiel #2
0
        private void translateAndExportChineseFormat(string[] chineseContents, string[] mergedFileNames)
        {
            bool   needToRemoveBlankLine = !insertBlankLinesCheckBox.Checked;
            string targetFolder          = targetFolderTextBox.Text;

            for (int i = 0; i < chineseContents.Length; i++)
            {
                if (requestCancel)
                {
                    return;
                }
                ThreadPool.QueueUserWorkItem(delegate(object batchIndexObject) {
                    if (requestCancel)
                    {
                        return;
                    }
                    int num = (int)batchIndexObject;
                    VietPhraseExporter.Export(chineseContents[num], needToRemoveBlankLine, Path.Combine(targetFolder, mergedFileNames[num] + (mergedFileNames[num].EndsWith("txt") ? "" : ".txt")), false);
                    processStatus[num]++;
                }, i);
            }
        }