private void QueueExctractionWorkerThread(object state)
        {
            object[]       args           = state as object[];
            string         installPath    = (string)args[0];
            string         sourceCulture  = (string)args[1];
            string         targetCulture  = (string)args[2] ?? ResourceTool.DEFAULT_CULTURE;
            ExtractionMode mode           = (ExtractionMode)args[3];
            string         exportFilePath = (string)args[4];
            string         languageDbPath = (string)args[5];

            try
            {
                this.DisableForm();

                ITranslator translator;
                switch (mode)
                {
                case ExtractionMode.DatabaseTranslation:
                    translator = new LegacyLanguageDbTranslator();
                    ((LegacyLanguageDbTranslator)translator).ReadDatabase(languageDbPath);
                    break;

                case ExtractionMode.Double:
                    translator = new ExpandedStringTranslator();
                    break;

                case ExtractionMode.Reverse:
                    translator = new ReverseStringTranslator();
                    break;

                case ExtractionMode.WebTranslation:
                    translator = new WebServiceTranslator();
                    break;

                default:
                    translator = new NormalizedStringTranslator();
                    break;
                }
                ResourceTool.ExportLanguage(installPath, sourceCulture, targetCulture, translator, exportFilePath, new AppendLogCallback(this.AppendToLog));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Export Failed", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                this.EnableForm();
            }
        }
Пример #2
0
        private void QueueExctractionWorkerThread(object state)
        {
            object[]       args           = state as object[];
            string         installPath    = (string)args[0];
            string         sourceCulture  = (string)args[1];
            string         targetCulture  = (string)args[2] ?? ResourceTool.DEFAULT_CULTURE;
            ExtractionMode mode           = (ExtractionMode)args[3];
            string         exportFilePath = (string)args[4];
            string         languageDbPath = (string)args[5];

            try
            {
                ITranslator translator;
                switch (mode)
                {
                case ExtractionMode.DatabaseTranslation:
                    translator = new LegacyLanguageDbTranslator();
                    ((LegacyLanguageDbTranslator)translator).ReadDatabase(languageDbPath);
                    break;

                case ExtractionMode.Double:
                    translator = new ExpandedStringTranslator();
                    break;

                case ExtractionMode.Reverse:
                    translator = new ReverseStringTranslator();
                    break;

                case ExtractionMode.WebTranslation:
                    translator = new WebServiceTranslator();
                    break;

                default:
                    translator = new NormalizedStringTranslator();
                    break;
                }
                ResourceTool.ExportLanguage(installPath, sourceCulture, targetCulture, translator, exportFilePath, new AppendLogCallback(this.AppendToLog));
                AppendToLog(string.Empty);
                MsgBox.ShowInformation(SharedStrings.LANGUAGE_READY);
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex);
            }
        }