Exemple #1
0
        public SettingsForm(string [] languages, OCRConfiguration config)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            this.config = config;
            InitializeComponent();
            AcceptButton = buttonOK;
            CancelButton = buttonCancel;

            comboBox_languages.Items.Clear();
            int index = 0;

            // Preventing Tracker #3234560, although this should not happen...
            string languageFromConfig = "ENGLISH";

            if (config.Language != null)
            {
                languageFromConfig = config.Language;
            }
            foreach (string availableLanguage in languages)
            {
                string displayLanguage = availableLanguage.Substring(0, 1).ToUpper() + availableLanguage.Substring(1).ToLower();
                comboBox_languages.Items.Add(displayLanguage);
                if (availableLanguage.Equals(languageFromConfig, StringComparison.CurrentCultureIgnoreCase))
                {
                    comboBox_languages.SelectedIndex = index;
                }
                index++;
            }
        }
Exemple #2
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="greenshotHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public virtual bool Initialize(IGreenshotHost greenshotHost, PluginAttribute myAttributes)
        {
            Log.Debug("Initialize called of " + myAttributes.Name);
            _myAttributes = myAttributes;

            var ocrDirectory = Path.GetDirectoryName(myAttributes.DllFile);

            if (ocrDirectory == null)
            {
                return(false);
            }
            _ocrCommand = Path.Combine(ocrDirectory, "greenshotocrcommand.exe");

            if (!HasModi())
            {
                Log.Warn("No MODI found!");
                return(false);
            }
            // Load configuration
            config = IniConfig.GetIniSection <OCRConfiguration>();

            if (config.Language != null)
            {
                config.Language = config.Language.Replace("miLANG_", "").Replace("_", " ");
            }
            return(true);
        }
Exemple #3
0
        public SettingsForm(string [] languages, OCRConfiguration config)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            this.config = config;
            InitializeComponent();
            AcceptButton = buttonOK;
            CancelButton = buttonCancel;
            this.Icon = GreenshotResources.getGreenshotIcon();

            comboBox_languages.Items.Clear();
            int index=0;

            // Preventing Tracker #3234560, although this should not happen...
            string languageFromConfig = "ENGLISH";
            if (config.Language != null) {
                languageFromConfig  = config.Language;
            }
            foreach(string availableLanguage in languages) {
                string displayLanguage = availableLanguage.Substring(0, 1).ToUpper() + availableLanguage.Substring(1).ToLower();
                comboBox_languages.Items.Add(displayLanguage);
                if (availableLanguage.Equals(languageFromConfig, StringComparison.CurrentCultureIgnoreCase)) {
                    comboBox_languages.SelectedIndex = index;
                }
                index++;
            }
        }
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
        /// <param name="pluginAttribute">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public virtual bool Initialize(IGreenshotHost greenshotHost, PluginAttribute myAttributes)
        {
            LOG.Debug("Initialize called of " + myAttributes.Name);
            host = greenshotHost;
            this.myAttributes = myAttributes;

            OCR_COMMAND = Path.Combine(Path.GetDirectoryName(myAttributes.DllFile), "greenshotocrcommand.exe");

            if (!HasMODI())
            {
                LOG.Warn("No MODI found!");
                return(false);
            }
            // Load configuration
            config = IniConfig.GetIniSection <OCRConfiguration>();

            if (config.Language != null)
            {
                config.Language = config.Language.Replace("miLANG_", "").Replace("_", " ");
            }
            return(true);
        }
Exemple #5
0
		/// <summary>
		/// Implementation of the IGreenshotPlugin.Initialize
		/// </summary>
		/// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
		/// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
		/// <param name="pluginAttribute">My own attributes</param>
		/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
		public virtual bool Initialize(IGreenshotHost greenshotHost, PluginAttribute myAttributes) {
			LOG.Debug("Initialize called of " + myAttributes.Name);
			host = greenshotHost;
			this.myAttributes = myAttributes;
			
			OCR_COMMAND = Path.Combine(Path.GetDirectoryName(myAttributes.DllFile), "greenshotocrcommand.exe");

			if (!HasMODI()) {
				LOG.Warn("No MODI found!");
				return false;
			}
			// Load configuration
			config = IniConfig.GetIniSection<OCRConfiguration>();
			
			if (config.Language != null) {
				config.Language = config.Language.Replace("miLANG_","").Replace("_"," ");
			}
			return true;
		}