public TmxMallConfDialog(TmxMallOptions options)
        {
            this.Options = options;
            this.InitializeComponent();
            this.tbUserName.Text = this.Options.TmxMallUserName;
            this.tbClientID.Text = this.Options.TmxMallClientID;
            bool flag = !string.IsNullOrEmpty(this.Options.Fuzzy);

            if (flag)
            {
                this.numericUpDownFuzzy.Value = Convert.ToDecimal(this.Options.Fuzzy);
            }
            bool flag2 = !string.IsNullOrEmpty(this.Options.Num);

            if (flag2)
            {
                this.numericUpDownTmNum.Value = Convert.ToDecimal(this.Options.Num);
            }
            bool flag3 = !string.IsNullOrEmpty(this.Options.ProxyIP);

            if (flag3)
            {
                this.textBoxProxyIP.Text = this.Options.ProxyIP;
            }
            bool flag4 = !string.IsNullOrEmpty(this.Options.ProxyPort);

            if (flag4)
            {
                this.textBoxProxyPort.Text = this.Options.ProxyPort;
            }
        }
 public MyTranslationProviderLanguageDirection(TmxMallTranslationProvider provider, LanguagePair languages)
 {
     this._languages         = languages;
     this._provider          = provider;
     this._options           = this._provider.Options;
     this._visitor           = new TmxMallSegmentElementVisitor();
     this._translationClient = new TranslationClient(languages.SourceCulture, languages.TargetCulture, this._options);
 }
 public TranslationClient(CultureInfo sourceLanguage, CultureInfo targetLanguage, TmxMallOptions options)
 {
     this._sourceLanguage = sourceLanguage;
     this._targetLanguage = targetLanguage;
     this._options        = options;
     this._cache          = new Dictionary <string, List <TranslationResult> >();
     this.glsNum[0]       = "【1】";
     this.glsNum[1]       = "【2】";
     this.glsNum[2]       = "【3】";
     this.glsNum[3]       = "【4】";
     this.glsNum[4]       = "【5】";
 }
        public static TmxMallOptions FromCredentialStore(ITranslationProviderCredentialStore credentialStore)
        {
            TranslationProviderCredential credential = credentialStore.GetCredential(TmxMallOptions._uri);
            bool           flag = credential == null;
            TmxMallOptions result;

            if (flag)
            {
                result = new TmxMallOptions();
            }
            else
            {
                string credential2 = credential.Credential;
                bool   flag2       = string.IsNullOrEmpty(credential2);
                if (flag2)
                {
                    result = new TmxMallOptions();
                }
                else
                {
                    string[] array = credential2.Split(new char[]
                    {
                        ':'
                    });
                    TmxMallOptions tmxMallOptions = new TmxMallOptions();
                    bool           flag3          = array.Length == 8;
                    if (flag3)
                    {
                        tmxMallOptions.TmxMallUserName = array[0];
                        tmxMallOptions.TmxMallClientID = array[1];
                        tmxMallOptions.Num             = array[2];
                        tmxMallOptions.Fuzzy           = array[3];
                        tmxMallOptions.GlsNum          = array[4];
                        tmxMallOptions.LastError       = array[5];
                        tmxMallOptions.ProxyIP         = array[6];
                        tmxMallOptions.ProxyPort       = array[7];
                    }
                    result = tmxMallOptions;
                }
            }
            return(result);
        }
        public bool Edit(IWin32Window owner, ITranslationProvider translationProvider, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
        {
            TmxMallTranslationProvider tmxMallTranslationProvider = translationProvider as TmxMallTranslationProvider;
            bool flag = tmxMallTranslationProvider != null;
            bool result;

            if (flag)
            {
                TmxMallOptions    tmxMallOptions    = TmxMallOptions.FromCredentialStore(credentialStore);
                TmxMallConfDialog tmxMallConfDialog = new TmxMallConfDialog(tmxMallOptions);
                bool flag2 = tmxMallConfDialog.ShowDialog() == DialogResult.OK;
                if (flag2)
                {
                    tmxMallTranslationProvider.UpdateOptions(tmxMallOptions);
                    tmxMallOptions.ToCredentialStore(credentialStore);
                    result = true;
                    return(result);
                }
            }
            result = false;
            return(result);
        }
        public ITranslationProvider[] Browse(IWin32Window owner, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
        {
            TmxMallOptions    tmxMallOptions    = TmxMallOptions.FromCredentialStore(credentialStore);
            TmxMallConfDialog tmxMallConfDialog = new TmxMallConfDialog(tmxMallOptions);
            bool flag = tmxMallConfDialog.ShowDialog(owner) == DialogResult.OK;

            ITranslationProvider[] result;
            if (flag)
            {
                TmxMallTranslationProvider tmxMallTranslationProvider = new TmxMallTranslationProvider(tmxMallConfDialog.Options);
                tmxMallTranslationProvider.UpdateOptions(tmxMallOptions);
                tmxMallOptions.ToCredentialStore(credentialStore);
                result = new ITranslationProvider[]
                {
                    tmxMallTranslationProvider
                };
            }
            else
            {
                result = null;
            }
            return(result);
        }
 public void UpdateOptions(TmxMallOptions options)
 {
     this.Options = options;
 }
 public TmxMallTranslationProvider(TmxMallOptions options)
 {
     this.Options = options;
 }