Exemple #1
0
 internal static void Setvalue(IMActionItem item, string value)
 {
     if (!string.Equals(item.IMAction[item.ActionItem].ToString(), value, StringComparison.InvariantCulture))
     {
         item.IMAction[item.ActionItem] = (object)value;
     }
     Logger.Debug("GUIDANCE: " + item.IMAction.Type.ToString());
 }
Exemple #2
0
        internal void Setvalue(IMActionItem item, string value)
        {
            string a = item.IMAction[item.ActionItem].ToString().Replace(',', '.');

            if (!string.Equals(a, value, StringComparison.InvariantCulture))
            {
                item.IMAction[item.ActionItem] = (object)value;
            }
            try
            {
                if (string.Equals(item.ActionItem, "Sensitivity", StringComparison.InvariantCulture))
                {
                    double num1 = Convert.ToDouble(item.IMAction["SensitivityRatioY"], (IFormatProvider)CultureInfo.InvariantCulture);
                    double num2 = Convert.ToDouble(a, (IFormatProvider)CultureInfo.InvariantCulture);
                    double num3 = Convert.ToDouble(item.IMAction[item.ActionItem], (IFormatProvider)CultureInfo.InvariantCulture);
                    double num4 = num2 == 0.0 ? num1 : num2 * num1;
                    if (num1 != 0.0)
                    {
                        item.IMAction["SensitivityRatioY"] = num3 == 0.0 || num4 == 0.0 ? (object)num4.ToString((IFormatProvider)CultureInfo.InvariantCulture) : (object)(num4 / num3).ToString((IFormatProvider)CultureInfo.InvariantCulture);
                    }
                }
                else if (string.Equals(item.ActionItem, "SensitivityRatioY", StringComparison.InvariantCulture))
                {
                    double num1 = Convert.ToDouble(value, (IFormatProvider)CultureInfo.InvariantCulture);
                    double num2 = Convert.ToDouble(item.IMAction["Sensitivity"], (IFormatProvider)CultureInfo.InvariantCulture);
                    item.IMAction[item.ActionItem] = num1 == 0.0 ? (object)"0" : (num2 == 0.0 ? (object)num1.ToString((IFormatProvider)CultureInfo.InvariantCulture) : (object)(num1 / num2).ToString((IFormatProvider)CultureInfo.InvariantCulture));
                }
            }
            catch (Exception ex)
            {
                Logger.Info("Unable to correctly set Sensitivity ratio: " + ex?.ToString());
            }
            if (item.ActionItem.StartsWith("Key", StringComparison.InvariantCulture))
            {
                this.Text = this.Text.ToUpper(CultureInfo.InvariantCulture);
            }
            if (item.ActionItem.Contains("Gamepad", StringComparison.InvariantCultureIgnoreCase))
            {
                this.Text = this.Text.ToUpper(CultureInfo.InvariantCulture);
            }
            Logger.Debug("GUIDANCE: " + item.IMAction.Type.ToString());
        }
Exemple #3
0
        private void SetValueHandling(IMActionItem item)
        {
            string str = item.IMAction[item.ActionItem].ToString();

            if (this.PropertyType.Equals(typeof(double)))
            {
                string s = this.Text.Replace(',', '.');
                if (double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, (IFormatProvider)NumberFormatInfo.InvariantInfo, out double _))
                {
                    str = s;
                }
                else if (!string.IsNullOrEmpty(s))
                {
                    this.Text = str;
                }
            }
            else if (this.PropertyType.Equals(typeof(Decimal)))
            {
                if (Decimal.TryParse(this.Text, out Decimal _))
                {
                    str = this.Text;
                }
                else if (!string.IsNullOrEmpty(this.Text))
                {
                    this.Text = str;
                }
            }
            else if (this.PropertyType.Equals(typeof(int)))
            {
                if (int.TryParse(this.Text, out int _))
                {
                    str = this.Text;
                }
                else if (!string.IsNullOrEmpty(this.Text))
                {
                    this.Text = str;
                }
            }
            this.Setvalue(item, str);
        }
Exemple #4
0
        private void SetValueHandling(IMActionItem item)
        {
            string str = item.IMAction[item.ActionItem].ToString();

            if (this.IsLoaded)
            {
                KMManager.CallGamepadHandler(BlueStacksUIUtils.LastActivatedWindow, "true");
            }
            if (this.PropertyType.Equals(typeof(double)))
            {
                if (double.TryParse(this.Text, out double _))
                {
                    str = this.Text;
                }
                else if (!string.IsNullOrEmpty(this.Text))
                {
                    this.Text = str;
                }
            }
            else if (this.PropertyType.Equals(typeof(int)))
            {
                if (int.TryParse(this.Text, out int _))
                {
                    str = this.Text;
                }
                else if (!string.IsNullOrEmpty(this.Text))
                {
                    this.Text = str;
                }
            }
            else
            {
                str = !this.PropertyType.Equals(typeof(bool)) ? this.Tag.ToString() : this.Tag.ToString();
            }
            IMapTextBox.Setvalue(item, str);
        }