Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
 private void translateVietPhraseOneMeaning(string chineseContent, int wrapType, int translationAlgorithm, bool prioritizedName, int batchId)
 {
     if (requestCancel)
     {
         return;
     }
     ThreadPool.QueueUserWorkItem(delegate(object param0) {
         if (requestCancel)
         {
             return;
         }
         vietPhraseOneMeaningResult[batchId] = Translator.ChineseToVietPhraseOneMeaningForBatch(chineseContent, wrapType, translationAlgorithm, prioritizedName);
         processStatus[batchId]++;
     });
 }