Exemple #1
0
        public static void Write(char identificator, string subject, string comment = null, Exception ex = null)
        {
            if (!IntentoTranslationProviderOptionsForm.IsTrace())
            {
                return;
            }

            try
            {
                DateTime      now     = DateTime.UtcNow;
                List <string> content = new List <string>();
                content.Add(string.Format("{0} {1}", now.ToString("yyyy-MM-dd HH:mm:ss.fffff"), subject));
                if (comment != null)
                {
                    content.Add(comment);
                }
                if (ex != null)
                {
                    content.AddRange(LoggingEx(identificator, ex));
                }

                WriteRemoteLog(identificator, string.Join("\n", content.ToArray()));
            }
            catch { }
        }
Exemple #2
0
 public static string Draw(IntentoTranslationProviderOptionsForm form, GlossaryState state)
 {
     if (state == null)
     {
         Glossary_GroupBox_Disable(form.formMT);
         return(null);
     }
     return(state.Draw());
 }
Exemple #3
0
 public static string Draw(IntentoTranslationProviderOptionsForm form, ModelState state)
 {
     if (state == null)
     {
         Model_Group_Enabled(form.formMT, false);
         return(null);
     }
     return(state.Draw());
 }
Exemple #4
0
 public BaseState(BaseState parent, IntentoMTFormOptions options)
 {
     if (parent != null)
     {
         this.parent = parent;
         this.form   = parent.form;
         this.formMT = parent.formMT;
     }
     this.options = options;
 }
Exemple #5
0
 public IntentoFormOptionsAPI(IntentoTranslationProviderOptionsForm form)
 {
     InitializeComponent();
     LocalizeContent();
     parent = form;
     if (form.GetOptions().HideHiddenTextButton)
     {
         checkBoxShowHidden.Visible = false;
     }
 }
Exemple #6
0
        public static string Draw(IntentoTranslationProviderOptionsForm form, SmartRoutingState state)
        {
            if (state == null)
            {
                form.formMT.RoutingTable = new Dictionary <string, string>(defaultRoutingTable);
                form.formMT.comboBoxRouting.SelectedIndex = 0;
                ProviderState.Draw(form, null);
                return(null);
            }

            return(state.Draw());
        }
Exemple #7
0
        public static string Draw(IntentoTranslationProviderOptionsForm form, ProviderState state)
        {
            if (state == null)
            {
                form.formMT.groupBoxProvider.Enabled = false;
                Providers_ComboBox_BackColor_State(form.formMT, false);

                AuthState.Draw(form, null);
                return(null);
            }

            return(state.Draw());
        }
Exemple #8
0
        public static bool IsLogging()
        {
            string env = Environment.GetEnvironmentVariable("intento_plugin_logging");

            if (env != null)
            {
                env = env.ToLower();
                if (env == "1" || env == "true")
                {
                    return(true);
                }
            }
            return(IntentoTranslationProviderOptionsForm.IsTrace());
        }
Exemple #9
0
        public static string Draw(IntentoTranslationProviderOptionsForm form, AuthState state)
        {
            if (state == null)
            {
                Auth_GroupBox_Enabled(form.formMT, false);
                Auth_Control_BackColor_State(form.formMT, false);

                ModelState.Draw(form, null);
                GlossaryState.Draw(form, null);

                return(null);
            }
            return(state.Draw());
        }
Exemple #10
0
        public ApiKeyState(IntentoTranslationProviderOptionsForm _form, IntentoMTFormOptions options) : base(_form, options)
        {
            apiKey = options.ApiKey;

            if (!options.ForbidSaveApikey)
            {
                string apiKey2 = _form.GetValueFromRegistry("ApiKey");
                if (string.IsNullOrEmpty(apiKey) && !string.IsNullOrEmpty(options.AppName))
                {   // read ApiKey from registry
                    apiKey = apiKey2;
                }
                if (!string.IsNullOrEmpty(apiKey2))
                {
                    form.formAdvanced.checkBoxSaveApiKeyInRegistry.Checked = true;
                }
            }
        }
Exemple #11
0
        //[Obsolete("Logging is deprecated, please use Write instead.")]
        public static void Logging(string subject, string comment = null, Exception ex = null)
        {
            if (!IntentoTranslationProviderOptionsForm.IsTrace())
            {
                return;
            }

            try
            {
                DateTime      now     = DateTime.UtcNow;
                List <string> content = new List <string>();
                content.Add("------------------------");
                content.Add(string.Format("{0} {1}", now.ToString("yyyy-MM-dd HH:mm:ss.fffff"), subject));
                if (comment != null)
                {
                    content.Add(comment);
                }
                if (ex != null)
                {
                    content.AddRange(LoggingEx('U', ex));
                }

                string flag = Environment.GetEnvironmentVariable("file_logging");
                if (string.IsNullOrEmpty(flag))
                {
                    Write('U', string.Join("\n", content.ToArray()));
                }
                else
                {
                    string path = Environment.GetEnvironmentVariable("temp");
                    if (string.IsNullOrEmpty(path))
                    {
                        path = Environment.GetEnvironmentVariable("tmp");
                    }
                    if (string.IsNullOrEmpty(path))
                    {
                        return;
                    }
                    string filename = string.Format("{0}\\Intento_Logs_{1}", path, now.ToString("yyyy-MM-dd-HH"));
                    File.AppendAllLines(filename, content);
                }
            }
            catch { }
        }
Exemple #12
0
 public BaseState(IntentoTranslationProviderOptionsForm form, IntentoMTFormOptions options)
 {
     this.form    = form;
     this.formMT  = form.formMT;
     this.options = options;
 }