Example #1
0
        /// <summary>
        /// Performs initialization
        /// </summary>
        public static void Init()
        {
            var assembly = Assembly.GetExecutingAssembly();

            Log.Debug("Assembly name: " + assembly.FullName);

            Attributions.Add("LOCALIZATION", ACATExtension.Resources.LocalizationAttribution.Replace("\\n", Environment.NewLine));
            Attributions.Add("LANGUAGETRANSLATION", ACATExtension.Resources.CurrentLanguageAttribution.Replace("\\n", Environment.NewLine));
        }
Example #2
0
        /// <summary>
        /// Performs initialization.  Must be called first.
        /// Sets word prediction parameters and initializes Presage.
        /// CultureInfo parameter defines the language.  If word
        /// prediction database is not found for the specified language
        /// English is used as the default.
        /// </summary>
        /// <param name="ci">language for word prediction</param>
        /// <returns>true on success</returns>
        public bool Init(CultureInfo ci)
        {
            bool retVal = false;

            try
            {
                Attributions.Add("PRESAGE",
                                 "Predictive text functionality is powered by Presage, the " +
                                 "intelligent predictive text engine created by Matteo Vescovi. " +
                                 "(http://presage.sourceforge.net/)");

                upgradeFromPreviousVersion(ci);

                deleteConfigFile();

                checkAndRunPresage();

                Log.Debug("Calling initPresage()");

                retVal = initPresage(ci);

                Log.Debug("Returned from initPresage() " + retVal);

                if (!retVal)
                {
                    int numRetries = 2;

                    for (int ii = 0; ii < numRetries; ii++)
                    {
                        Log.Debug("initPresage() returned false.  Will retry");

                        deleteConfigFile();

                        killPresage();

                        checkAndRunPresage();

                        Log.Debug("Calling initPresage() once more");

                        retVal = initPresage(ci);
                        if (retVal)
                        {
                            Log.Debug("initPresage() succeeded!");
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Debug("Error initializing Presage. " + ex);
            }

            return(retVal);
        }
Example #3
0
        /// <summary>
        /// Initialize the vision actuator.  Detect cameras,
        /// let the user select the preferred camera (if reqd),
        /// spawn threads etc.
        /// </summary>
        /// <returns>true on success, false otherwise</returns>
        public override bool Init()
        {
            Attributions.Add("ACAT Vision",
                             "Open Source Computer Vision Library (OpenCV) is licensed under the BSD license");

            if (!Cameras.GetCameraNames().Any())
            {
                MessageBox.Show(R.GetString("NoCamerasFoundACATVisionDisabled"),
                                _title,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);

                OnInitDone();

                return(true);
            }

            _initInProgress = true;

            // load settings from the settings file
            Settings.SettingsFilePath = UserManager.GetFullPath(SettingsFileName);
            VisionActuatorSettings    = Settings.Load();

            VisionSensor.init();

            bool retVal = detectAndSetPreferredCamera();

            if (retVal)
            {
                showCameraStatus(R.GetString("InitializingCamera"));

                _acatVisionThread = new Thread(visionThread)
                {
                    IsBackground = true
                };
                _acatVisionThread.Start();
            }
            else
            {
                _initInProgress = false;
                OnInitDone();
            }

            return(retVal);
        }
Example #4
0
        /// <summary>
        /// Performs initialization.  Must be called first.
        /// Sets word prediction parameters and initializes Presage
        /// </summary>
        /// <returns>true on success</returns>
        public bool Init()
        {
            bool retVal = false;

            try
            {
                Attributions.Add("PRESAGE",
                                 "Predictive text functionality is powered by Presage, the " +
                                 "intelligent predictive text engine created by Matteo Vescovi. " +
                                 "(http://presage.sourceforge.net/)");

                Settings.PreferencesFilePath = UserManager.GetFullPath(SettingsFileName);

                _presageSettings = Settings.Load();

                if (_presageSettings.StartPresageIfNotRunning)
                {
                    checkAndRunPresage();
                }

                retVal = initPresage();
                if (!retVal)
                {
                    // failure mostly means the presage config file has an
                    // incorrect database path.  Delete the config file so
                    // it will regenerate and then we can insert the correct
                    // database path when we init again
                    deletePresageConfigFile();
                    retVal = initPresage();
                }
            }
            catch (Exception ex)
            {
                Log.Debug("Error initializing Presage. " + ex);
            }

            return(retVal);
        }
        /// <summary>
        /// Performs initialization.  Must be called first.
        /// Sets word prediction parameters and initializes Presage
        /// </summary>
        /// <returns>true on success</returns>
        public bool Init()
        {
            bool retVal = false;

            try
            {
                Attributions.Add("PRESAGE",
                                Resources.PresageAttribution);

                Settings.PreferencesFilePath = UserManager.GetFullPath(SettingsFileName);

                _presageSettings = Settings.Load();

                if (_presageSettings.StartPresageIfNotRunning)
                {
                    checkAndRunPresage();
                }

                retVal = initPresage();
                if (!retVal)
                {
                    // failure mostly means the presage config file has an
                    // incorrect database path.  Delete the config file so
                    // it will regenerate and then we can insert the correct
                    // database path when we init again
                    deletePresageConfigFile();
                    retVal = initPresage();
                }
            }
            catch (Exception ex)
            {
                Log.Debug("Error initializing Presage. " + ex);
            }

            return retVal;
        }
Example #6
0
    public Weapon(string name = "่ฃ…ๅ‚™็„กใ—", string id = "nothing"
                  , int value = 0, int hit        = 0)
    {
        this.EquipType = EquipType.weapon;
        Target         = Target.ally;

        this.Name         = name;
        this.ID           = id;
        this.NormalValue  = value;
        this.HitAboidProb = hit;

        foreach (EnemyType e in Enum.GetValues(typeof(EnumHolder.EnemyType)))
        {
            Effectivenesses.Add(e, 0);
        }

        foreach (Status s in Enum.GetValues(typeof(EnumHolder.Status)))
        {
            Statuses.Add(s, 0);
        }

        foreach (Ailment a in Enum.GetValues(typeof(EnumHolder.Ailment)))
        {
            Ailments.Add(a, 0);
        }

        foreach (Attribution a in Enum.GetValues(typeof(EnumHolder.Attribution)))
        {
            Attributions.Add(a, 0);
        }

        foreach (WeaponAbility w in Enum.GetValues(typeof(EnumHolder.WeaponAbility)))
        {
            WeaponAbilities.Add(w, 0);
        }
    }