internal override void ImportSettings(string settings)
        {
            if (string.IsNullOrEmpty(settings))
            {
                throw new ArgumentException("Import string empty. (WindowsBinding)");
            }
            if (settings.StartsWith("MultiPanelOSPZ70{"))
            {
                //MultiPanelOSPZ70{ALT}\o/{1KNOB_ENGINE_LEFT}\o/OSCommand{FILE\o/ARGUMENTS\o/NAME}\o/\\?\hid#vid_06a3&pid_0d67#9&231fd360&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
                var parameters = settings.Split(new[] { Constants.SEPARATOR_SYMBOL }, StringSplitOptions.RemoveEmptyEntries);

                //MultiPanelOSPZ70{ALT}
                var param0 = parameters[0].Replace("MultiPanelOSPZ70{", "").Replace("}", "");
                _pz70DialPosition = (PZ70DialPosition)Enum.Parse(typeof(PZ70DialPosition), param0);

                //{1KNOB_ENGINE_LEFT}
                var param1 = parameters[1].Replace("{", "").Replace("}", "");
                //1KNOB_ENGINE_LEFT
                WhenTurnedOn        = param1.Substring(0, 1) == "1";
                param1              = param1.Substring(1);
                _multiPanelPZ70Knob = (MultiPanelPZ70Knobs)Enum.Parse(typeof(MultiPanelPZ70Knobs), param1);

                //OSCommand{FILE\o/ARGUMENTS\o/NAME}
                OSCommandObject = new OSCommand();
                OSCommandObject.ImportString(parameters[2]);
            }
        }
Пример #2
0
        public void AddOrUpdateSequencedKeyBinding(string information, MultiPanelPZ70Knobs multiPanelPZ70Knob, SortedList <int, KeyPressInfo> sortedList, bool whenTurnedOn = true)
        {
            //This must accept lists
            var found = false;

            RemoveMultiPanelKnobFromList(2, multiPanelPZ70Knob, whenTurnedOn);
            foreach (var knobBinding in _knobBindings)
            {
                if (knobBinding.MultiPanelPZ70Knob == multiPanelPZ70Knob && knobBinding.WhenTurnedOn == whenTurnedOn)
                {
                    if (sortedList.Count == 0)
                    {
                        knobBinding.OSKeyPress = null;
                    }
                    else
                    {
                        knobBinding.OSKeyPress   = new OSKeyPress(information, sortedList);
                        knobBinding.WhenTurnedOn = whenTurnedOn;
                    }
                    found = true;
                    break;
                }
            }
            if (!found && sortedList.Count > 0)
            {
                var knobBinding = new KnobBindingPZ70();
                knobBinding.MultiPanelPZ70Knob = multiPanelPZ70Knob;
                knobBinding.OSKeyPress         = new OSKeyPress(information, sortedList);
                knobBinding.WhenTurnedOn       = whenTurnedOn;
                _knobBindings.Add(knobBinding);
            }
            IsDirtyMethod();
        }
Пример #3
0
        internal override void ImportSettings(string settings)
        {
            if (string.IsNullOrEmpty(settings))
            {
                throw new ArgumentException("Import string empty. (KeyBinding)");
            }
            if (settings.StartsWith("MultiPanelKnob{"))
            {
                //MultiPanelKey{ALT}\o/{1KNOB_ENGINE_LEFT}\o/OSKeyPress{[FiftyMilliSec,RCONTROL + RSHIFT + VK_R][FiftyMilliSec,RCONTROL + RSHIFT + VK_W]}\o/\\?\hid#vid_06a3&pid_0d67#9&231fd360&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
                var parameters = settings.Split(new[] { SeparatorChars }, StringSplitOptions.RemoveEmptyEntries);

                //MultiPanelKey{ALT}
                var param0 = parameters[0].Replace("MultiPanelKnob{", "").Replace("}", "");
                _pz70DialPosition = (PZ70DialPosition)Enum.Parse(typeof(PZ70DialPosition), param0);

                //{1KNOB_ENGINE_LEFT}
                var param1 = parameters[1].Replace("{", "").Replace("}", "");
                //1KNOB_ENGINE_LEFT
                WhenTurnedOn        = param1.Substring(0, 1) == "1";
                param1              = param1.Substring(1);
                _multiPanelPZ70Knob = (MultiPanelPZ70Knobs)Enum.Parse(typeof(MultiPanelPZ70Knobs), param1);

                //OSKeyPress{[FiftyMilliSec,RCONTROL + RSHIFT + VK_R][FiftyMilliSec,RCONTROL + RSHIFT + VK_W]}
                OSKeyPress = new OSKeyPress();
                OSKeyPress.ImportString(parameters[2]);
            }
        }
Пример #4
0
 public MultiPanelKnob(int group, int mask, bool isOn, MultiPanelPZ70Knobs multiPanelPZ70Knob)
 {
     Group = group;
     Mask  = mask;
     IsOn  = isOn;
     MultiPanelPZ70Knob = multiPanelPZ70Knob;
 }
Пример #5
0
        private void RemoveMultiPanelKnobFromList(int list, MultiPanelPZ70Knobs multiPanelPZ70Knob, bool whenTurnedOn = true)
        {
            switch (list)
            {
            case 1:
            {
                foreach (var knobBindingPZ70 in _knobBindings)
                {
                    if (knobBindingPZ70.MultiPanelPZ70Knob == multiPanelPZ70Knob && knobBindingPZ70.WhenTurnedOn == whenTurnedOn)
                    {
                        knobBindingPZ70.OSKeyPress = null;
                    }
                    break;
                }
                break;
            }

            case 2:
            {
                foreach (var dcsBiosBinding in _dcsBiosBindings)
                {
                    if (dcsBiosBinding.MultiPanelPZ70Knob == multiPanelPZ70Knob && dcsBiosBinding.WhenTurnedOn == whenTurnedOn)
                    {
                        dcsBiosBinding.DCSBIOSInputs.Clear();
                    }
                    break;
                }
                break;
            }
            }
        }
Пример #6
0
        internal void ImportSettings(string settings)
        {
            if (string.IsNullOrEmpty(settings))
            {
                throw new ArgumentException("Import string empty. (KeyBinding)");
            }
            if (settings.StartsWith("MultiPanelKnob{"))
            {
                //MultiPanelKey{1KNOB_ENGINE_LEFT}\o/OSKeyPress{[FiftyMilliSec,RCONTROL + RSHIFT + VK_R][FiftyMilliSec,RCONTROL + RSHIFT + VK_W]}\o/\\?\hid#vid_06a3&pid_0d67#9&231fd360&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
                var parameters = settings.Split(new[] { SeparatorChars }, StringSplitOptions.RemoveEmptyEntries);

                //MultiPanelKey{1KNOB_ENGINE_LEFT}
                var param0 = parameters[0].Trim().Substring(15);
                //1KNOB_ENGINE_LEFT}
                param0 = param0.Remove(param0.Length - 1, 1);
                //1KNOB_ENGINE_LEFT
                _whenOnTurnedOn     = (param0.Substring(0, 1) == "1");
                param0              = param0.Substring(1);
                _multiPanelPZ70Knob = (MultiPanelPZ70Knobs)Enum.Parse(typeof(MultiPanelPZ70Knobs), param0);

                //OSKeyPress{[FiftyMilliSec,RCONTROL + RSHIFT + VK_R][FiftyMilliSec,RCONTROL + RSHIFT + VK_W]}
                _osKeyPress = new OSKeyPress();
                _osKeyPress.ImportString(parameters[1]);
            }
        }
Пример #7
0
        public void AddOrUpdateDCSBIOSBinding(MultiPanelPZ70Knobs multiPanelPZ70Knob, List <DCSBIOSInput> dcsbiosInputs, string description, bool whenTurnedOn)
        {
            if (dcsbiosInputs.Count == 0)
            {
                RemoveMultiPanelKnobFromList(ControlListPZ70.DCSBIOS, multiPanelPZ70Knob, whenTurnedOn);
                SetIsDirty();
                return;
            }
            //This must accept lists
            var found = false;

            foreach (var dcsBiosBinding in _dcsBiosBindings)
            {
                if (dcsBiosBinding.DialPosition == _pz70DialPosition && dcsBiosBinding.MultiPanelPZ70Knob == multiPanelPZ70Knob && dcsBiosBinding.WhenTurnedOn == whenTurnedOn)
                {
                    dcsBiosBinding.DCSBIOSInputs = dcsbiosInputs;
                    dcsBiosBinding.Description   = description;
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                var dcsBiosBinding = new DCSBIOSActionBindingPZ70();
                dcsBiosBinding.MultiPanelPZ70Knob = multiPanelPZ70Knob;
                dcsBiosBinding.DialPosition       = _pz70DialPosition;
                dcsBiosBinding.DCSBIOSInputs      = dcsbiosInputs;
                dcsBiosBinding.WhenTurnedOn       = whenTurnedOn;
                dcsBiosBinding.Description        = description;
                _dcsBiosBindings.Add(dcsBiosBinding);
            }
            SetIsDirty();
        }
Пример #8
0
        public void AddOrUpdateBIPLinkKnobBinding(MultiPanelPZ70Knobs multiPanelKnob, BIPLinkPZ70 bipLinkPZ70, bool whenTurnedOn)
        {
            if (bipLinkPZ70.BIPLights.Count == 0)
            {
                RemoveMultiPanelKnobFromList(ControlListPZ70.BIPS, multiPanelKnob, whenTurnedOn);
                SetIsDirty();
                return;
            }
            //This must accept lists
            var found = false;

            foreach (var bipLink in _bipLinks)
            {
                if (bipLink.MultiPanelPZ70Knob == multiPanelKnob && bipLink.WhenTurnedOn == whenTurnedOn)
                {
                    bipLink.BIPLights          = bipLinkPZ70.BIPLights;
                    bipLink.Description        = bipLinkPZ70.Description;
                    bipLink.MultiPanelPZ70Knob = multiPanelKnob;
                    found = true;
                    break;
                }
            }
            if (!found && bipLinkPZ70.BIPLights.Count > 0)
            {
                bipLinkPZ70.MultiPanelPZ70Knob = multiPanelKnob;
                bipLinkPZ70.WhenTurnedOn       = whenTurnedOn;
                _bipLinks.Add(bipLinkPZ70);
            }
            SetIsDirty();
        }
Пример #9
0
        public void AddOrUpdateDCSBIOSBinding(MultiPanelPZ70Knobs multiPanelPZ70Knob, List <DCSBIOSInput> dcsbiosInputs, string description, bool whenTurnedOn = true)
        {
            //This must accept lists
            var found = false;

            RemoveMultiPanelKnobFromList(1, multiPanelPZ70Knob, whenTurnedOn);
            foreach (var dcsBiosBinding in _dcsBiosBindings)
            {
                if (dcsBiosBinding.MultiPanelPZ70Knob == multiPanelPZ70Knob && dcsBiosBinding.WhenTurnedOn == whenTurnedOn)
                {
                    dcsBiosBinding.DCSBIOSInputs = dcsbiosInputs;
                    dcsBiosBinding.WhenTurnedOn  = whenTurnedOn;
                    dcsBiosBinding.Description   = description;
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                var dcsBiosBinding = new DCSBIOSBindingPZ70();
                dcsBiosBinding.MultiPanelPZ70Knob = multiPanelPZ70Knob;
                dcsBiosBinding.DCSBIOSInputs      = dcsbiosInputs;
                dcsBiosBinding.WhenTurnedOn       = whenTurnedOn;
                dcsBiosBinding.Description        = description;
                _dcsBiosBindings.Add(dcsBiosBinding);
            }
            IsDirtyMethod();
        }
Пример #10
0
        public void AddOrUpdateSingleKeyBinding(MultiPanelPZ70Knobs multiPanelPZ70Knob, string keys, KeyPressLength keyPressLength, bool whenTurnedOn = true)
        {
            //This must accept lists
            var found = false;

            foreach (var knobBinding in _knobBindings)
            {
                if (knobBinding.MultiPanelPZ70Knob == multiPanelPZ70Knob && knobBinding.WhenTurnedOn == whenTurnedOn)
                {
                    if (string.IsNullOrEmpty(keys))
                    {
                        knobBinding.OSKeyPress = null;
                    }
                    else
                    {
                        knobBinding.OSKeyPress   = new OSKeyPress(keys, keyPressLength);
                        knobBinding.WhenTurnedOn = whenTurnedOn;
                    }
                    found = true;
                }
            }
            if (!found && !string.IsNullOrEmpty(keys))
            {
                var knobBinding = new KnobBindingPZ70();
                knobBinding.MultiPanelPZ70Knob = multiPanelPZ70Knob;
                knobBinding.OSKeyPress         = new OSKeyPress(keys, keyPressLength);
                knobBinding.WhenTurnedOn       = whenTurnedOn;
                _knobBindings.Add(knobBinding);
            }
            Common.DebugP("MultiPanelPZ70 _knobBindings : " + _knobBindings.Count);
            IsDirtyMethod();
        }
        internal override void ImportSettings(string settings)
        {
            if (string.IsNullOrEmpty(settings))
            {
                throw new ArgumentException("Import string empty. (DCSBIOSBindingPZ70)");
            }

            if (settings.StartsWith("MultiPanelDCSBIOSControl{"))
            {
                // MultiPanelDCSBIOSControl{HDG}\\o/{1LCD_WHEEL_DEC|DCS-BIOS}\\o/\\o/DCSBIOSInput{AAP_CDUPWR|SET_STATE|1|0}\\o/\\\\?\\hid#vid_06a3&pid_0d06#9&244b4bcc&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\\o/PanelSettingsVersion=2X"
                var parameters = settings.Split(new[] { SaitekConstants.SEPARATOR_SYMBOL }, StringSplitOptions.RemoveEmptyEntries);

                // MultiPanelDCSBIOSControl{ALT}
                var param0 = parameters[0].Replace("MultiPanelDCSBIOSControl{", string.Empty).Replace("}", string.Empty);
                _pz70DialPosition = (PZ70DialPosition)Enum.Parse(typeof(PZ70DialPosition), param0);

                // {1KNOB_ALT}
                // or
                // {1KNOB_ALT|Landing gear up and blablabla description}
                var param1 = parameters[1].Replace("{", string.Empty).Replace("}", string.Empty);

                // 1KNOB_ALT
                // or
                // 1KNOB_ALT|Landing gear up and blablabla description
                WhenTurnedOn = (param1.Substring(0, 1) == "1");
                if (param1.Contains("|"))
                {
                    // 1KNOB_ALT|Landing gear up and blablabla description
                    param1 = param1.Substring(1);

                    // KNOB_ALT|Landing gear up and blablabla description
                    var stringArray = param1.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                    _multiPanelPZ70Knob = (MultiPanelPZ70Knobs)Enum.Parse(typeof(MultiPanelPZ70Knobs), stringArray[0]);
                    Description         = stringArray[1];
                }
                else
                {
                    param1 = param1.Substring(1);
                    _multiPanelPZ70Knob = (MultiPanelPZ70Knobs)Enum.Parse(typeof(MultiPanelPZ70Knobs), param1);
                }

                // The rest of the array besides last entry are DCSBIOSInput
                // DCSBIOSInput{AAP_EGIPWR|FIXED_STEP|INC}
                DCSBIOSInputs = new List <DCSBIOSInput>();
                for (var i = 0; i < parameters.Length; i++)
                {
                    if (parameters[i].StartsWith("DCSBIOSInput{"))
                    {
                        var dcsbiosInput = new DCSBIOSInput();
                        dcsbiosInput.ImportString(parameters[i]);
                        DCSBIOSInputs.Add(dcsbiosInput);
                    }
                }
            }
        }
Пример #12
0
        public byte GetMaskForButton(MultiPanelPZ70Knobs multiPanelPZ70Knob)
        {
            try
            {
                switch (multiPanelPZ70Knob)
                {
                case MultiPanelPZ70Knobs.AP_BUTTON:
                {
                    return(AP_MASK);
                }

                case MultiPanelPZ70Knobs.HDG_BUTTON:
                {
                    return(HDG_MASK);
                }

                case MultiPanelPZ70Knobs.NAV_BUTTON:
                {
                    return(NAV_MASK);
                }

                case MultiPanelPZ70Knobs.IAS_BUTTON:
                {
                    return(IAS_MASK);
                }

                case MultiPanelPZ70Knobs.ALT_BUTTON:
                {
                    return(ALT_MASK);
                }

                case MultiPanelPZ70Knobs.VS_BUTTON:
                {
                    return(VS_MASK);
                }

                case MultiPanelPZ70Knobs.APR_BUTTON:
                {
                    return(APR_MASK);
                }

                case MultiPanelPZ70Knobs.REV_BUTTON:
                {
                    return(REV_MASK);
                }
                }
                throw new Exception("Multipanel : Failed to find Mask for button " + multiPanelPZ70Knob);
            }
            catch (Exception e)
            {
                Common.LogError(e);
                throw;
            }
        }
Пример #13
0
 public bool FlipButton(PZ70DialPosition pz70DialPosition, MultiPanelPZ70Knobs multiPanelPZ70Knob)
 {
     try
     {
         return(FlipButton(GetMaskForDialPosition(pz70DialPosition), GetMaskForButton(multiPanelPZ70Knob)));
     }
     catch (Exception e)
     {
         Common.LogError(e, "Flipbutton()");
         throw;
     }
 }
Пример #14
0
 public void AddOrUpdateDCSBIOSLcdBinding(MultiPanelPZ70Knobs multiPanelPZ70Knob, PZ70LCDPosition pz70LCDPosition)
 {
     //Removes config
     foreach (var dcsBiosBindingLCD in _dcsBiosLcdBindings)
     {
         if (dcsBiosBindingLCD.MultiPanelPZ70Knob == multiPanelPZ70Knob && dcsBiosBindingLCD.PZ70LCDPosition == pz70LCDPosition)
         {
             dcsBiosBindingLCD.DCSBIOSOutputObject = null;
             break;
         }
     }
     IsDirtyMethod();
 }
Пример #15
0
        internal void ImportSettings(string settings)
        {
            if (string.IsNullOrEmpty(settings))
            {
                throw new ArgumentException("Import string empty. (DCSBIOSBindingPZ70)");
            }
            if (settings.StartsWith("MultiPanelDCSBIOSControl{"))
            {
                //MultiPanelDCSBIOSControl{1KNOB_ALT}\o/DCSBIOSInput{AAP_STEER|SET_STATE|2}\o/\\?\hid#vid_06a3&pid_0d67#9&231fd360&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
                var parameters = settings.Split(new[] { SeparatorChars }, StringSplitOptions.RemoveEmptyEntries);

                //MultiPanelDCSBIOSControl{1KNOB_ALT}
                //or
                //MultiPanelDCSBIOSControl{1KNOB_ALT|Landing gear up and blablabla description}
                var param0 = parameters[0].Substring(parameters[0].IndexOf("{", StringComparison.InvariantCulture) + 1);
                //1KNOB_ALT}
                param0 = param0.Remove(param0.Length - 1, 1);
                //1KNOB_ALT
                //or
                //1KNOB_ALT|Landing gear up and blablabla description
                _whenOnTurnedOn = (param0.Substring(0, 1) == "1");
                if (param0.Contains("|"))
                {
                    //1KNOB_ALT|Landing gear up and blablabla description
                    param0 = param0.Substring(1);
                    //KNOB_ALT|Landing gear up and blablabla description
                    var stringArray = param0.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                    _multiPanelPZ70Knob = (MultiPanelPZ70Knobs)Enum.Parse(typeof(MultiPanelPZ70Knobs), stringArray[0]);
                    _description        = stringArray[1];
                }
                else
                {
                    param0 = param0.Substring(1);
                    _multiPanelPZ70Knob = (MultiPanelPZ70Knobs)Enum.Parse(typeof(MultiPanelPZ70Knobs), param0);
                }
                //The rest of the array besides last entry are DCSBIOSInput
                //DCSBIOSInput{AAP_EGIPWR|FIXED_STEP|INC}
                _dcsbiosInputs = new List <DCSBIOSInput>();
                for (int i = 1; i < parameters.Length - 1; i++)
                {
                    var dcsbiosInput = new DCSBIOSInput();
                    dcsbiosInput.ImportString(parameters[i]);
                    _dcsbiosInputs.Add(dcsbiosInput);
                }
            }
        }
Пример #16
0
        public void ImportString(string str)
        {
            if (string.IsNullOrEmpty(str))
            {
                throw new ArgumentException("Import string empty. (MultiPanelKnob)");
            }
            if (!str.StartsWith("MultiPanelKnob{") || !str.EndsWith("}"))
            {
                throw new ArgumentException("Import string format exception. (MultiPanelKnob) >" + str + "<");
            }
            //MultiPanelKnob{SWITCHKEY_MASTER_ALT}
            var dataString = str.Remove(0, 15);

            //SWITCHKEY_MASTER_ALT}
            dataString = dataString.Remove(dataString.Length - 1, 1);
            //SWITCHKEY_MASTER_ALT
            MultiPanelPZ70Knob = (MultiPanelPZ70Knobs)Enum.Parse(typeof(MultiPanelPZ70Knobs), dataString.Trim());
        }
Пример #17
0
        public void RemoveMultiPanelKnobFromList(ControlListPZ70 controlListPZ70, MultiPanelPZ70Knobs multiPanelPZ70Knob, bool whenTurnedOn)
        {
            var found = false;

            if (controlListPZ70 == ControlListPZ70.ALL || controlListPZ70 == ControlListPZ70.KEYS)
            {
                foreach (var knobBindingPZ70 in _knobBindings)
                {
                    if (knobBindingPZ70.DialPosition == _pz70DialPosition && knobBindingPZ70.MultiPanelPZ70Knob == multiPanelPZ70Knob && knobBindingPZ70.WhenTurnedOn == whenTurnedOn)
                    {
                        knobBindingPZ70.OSKeyPress = null;
                        found = true;
                    }
                }
            }
            if (controlListPZ70 == ControlListPZ70.ALL || controlListPZ70 == ControlListPZ70.DCSBIOS)
            {
                foreach (var dcsBiosBinding in _dcsBiosBindings)
                {
                    if (dcsBiosBinding.DialPosition == _pz70DialPosition && dcsBiosBinding.MultiPanelPZ70Knob == multiPanelPZ70Knob && dcsBiosBinding.WhenTurnedOn == whenTurnedOn)
                    {
                        dcsBiosBinding.DCSBIOSInputs.Clear();
                        found = true;
                    }
                }
            }
            if (controlListPZ70 == ControlListPZ70.ALL || controlListPZ70 == ControlListPZ70.BIPS)
            {
                foreach (var bipLink in _bipLinks)
                {
                    if (bipLink.DialPosition == _pz70DialPosition && bipLink.MultiPanelPZ70Knob == multiPanelPZ70Knob && bipLink.WhenTurnedOn == whenTurnedOn)
                    {
                        bipLink.BIPLights.Clear();
                        found = true;
                    }
                }
            }

            if (found)
            {
                SetIsDirty();
            }
        }
Пример #18
0
        internal void ImportSettings(string settings)
        {
            if (string.IsNullOrEmpty(settings))
            {
                throw new ArgumentException("Import string empty. (DCSBIOSBindingPZ70)");
            }
            if (settings.StartsWith("MultiPanelDCSBIOSControlLCD{") && settings.Contains("DCSBiosOutput{"))
            {
                //MultiPanelDCSBIOSControlLCD{KNOB_ALT|UpperALT}\o/DCSBiosOutput{AAP_EGIPWR|Equals|0}\o/\\?\hid#vid_06a3&pid_0d67#9&231fd360&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
                var parameters = settings.Split(new[] { SeparatorChars }, StringSplitOptions.RemoveEmptyEntries);

                //MultiPanelDCSBIOSControlLCD{KNOB_ALT|UpperALT}
                var param0 = parameters[0].Substring(parameters[0].IndexOf("{", StringComparison.InvariantCulture) + 1);
                //KNOB_ALT|UpperALT}
                param0 = param0.Remove(param0.Length - 1, 1);
                //KNOB_ALT|UpperALT
                var knobAndLcd = param0.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                _multiPanelPZ70Knob = (MultiPanelPZ70Knobs)Enum.Parse(typeof(MultiPanelPZ70Knobs), knobAndLcd[0]);
                _pz70LCDPosition    = (PZ70LCDPosition)Enum.Parse(typeof(PZ70LCDPosition), knobAndLcd[1]);

                //DCSBiosOutput{AAP_EGIPWR|Equals|0}
                _dcsbiosOutput = new DCSBIOSOutput();
                _dcsbiosOutput.ImportString(parameters[1]);
            }
            if (settings.StartsWith("MultiPanelDCSBIOSControlLCD{") && settings.Contains("DCSBiosOutputFormula{"))
            {
                //MultiPanelDCSBIOSFormulaLCD{KNOB_ALT|UpperALT}\o/DCSBiosOutputFormula{(AAP_EGIPWR+1)/2}\o/\\?\hid#vid_06a3&pid_0d67#9&231fd360&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
                var parameters = settings.Split(new[] { SeparatorChars }, StringSplitOptions.RemoveEmptyEntries);

                //MultiPanelDCSBIOSFormulaLCD{KNOB_ALT|UpperALT}
                var param0 = parameters[0].Substring(parameters[0].IndexOf("{", StringComparison.InvariantCulture) + 1);
                //KNOB_ALT|UpperALT}
                param0 = param0.Remove(param0.Length - 1, 1);
                //KNOB_ALT|UpperALT
                var knobAndLcd = param0.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                _multiPanelPZ70Knob = (MultiPanelPZ70Knobs)Enum.Parse(typeof(MultiPanelPZ70Knobs), knobAndLcd[0]);
                _pz70LCDPosition    = (PZ70LCDPosition)Enum.Parse(typeof(PZ70LCDPosition), knobAndLcd[1]);

                //DCSBiosOutputFormula{(AAP_EGIPWR+1)/2}
                _dcsbiosOutputFormula = new DCSBIOSOutputFormula();
                _dcsbiosOutputFormula.ImportString(parameters[1]);
            }
        }
Пример #19
0
 public bool IsOn(PZ70DialPosition pz70DialPosition, MultiPanelPZ70Knobs multiPanelPZ70Knobs)
 {
     try
     {
         var dialMask   = GetMaskForDialPosition(pz70DialPosition);
         var buttonMask = GetMaskForButton(multiPanelPZ70Knobs);
         for (int i = 0; i < _buttonDialPosition.Length; i++)
         {
             if ((_buttonDialPosition[i] & dialMask) != 0)
             {
                 return((_buttonBytes[i] & buttonMask) != 0);
             }
         }
         throw new Exception("Multipanel IsOn : Failed to find Mask for dial position " + pz70DialPosition + " knob " + multiPanelPZ70Knobs);
     }
     catch (Exception e)
     {
         Common.LogError(e, "IsOn()");
         throw;
     }
 }
Пример #20
0
        public void AddOrUpdateSequencedKeyBinding(string information, MultiPanelPZ70Knobs multiPanelPZ70Knob, SortedList <int, KeyPressInfo> sortedList, bool whenTurnedOn)
        {
            if (sortedList.Count == 0)
            {
                RemoveMultiPanelKnobFromList(ControlListPZ70.KEYS, multiPanelPZ70Knob, whenTurnedOn);
                SetIsDirty();
                return;
            }
            //This must accept lists
            var found = false;

            foreach (var knobBinding in _knobBindings)
            {
                if (knobBinding.DialPosition == _pz70DialPosition && knobBinding.MultiPanelPZ70Knob == multiPanelPZ70Knob && knobBinding.WhenTurnedOn == whenTurnedOn)
                {
                    if (sortedList.Count == 0)
                    {
                        knobBinding.OSKeyPress = null;
                    }
                    else
                    {
                        knobBinding.OSKeyPress = new KeyPress(information, sortedList);
                    }
                    found = true;
                    break;
                }
            }
            if (!found && sortedList.Count > 0)
            {
                var knobBinding = new KeyBindingPZ70();
                knobBinding.MultiPanelPZ70Knob = multiPanelPZ70Knob;
                knobBinding.DialPosition       = _pz70DialPosition;
                knobBinding.OSKeyPress         = new KeyPress(information, sortedList);
                knobBinding.WhenTurnedOn       = whenTurnedOn;
                _knobBindings.Add(knobBinding);
            }
            _knobBindings = KeyBindingPZ70.SetNegators(_knobBindings);
            SetIsDirty();
        }
Пример #21
0
        public override void ImportSettings(string settings)
        {
            if (string.IsNullOrEmpty(settings))
            {
                throw new ArgumentException("Import string empty. (BIPLinkPZ70)");
            }

            if (settings.StartsWith("MultipanelBIPLink{"))
            {
                // MultipanelBIPLink{ALT|1KNOB_ENGINE_LEFT}\o/BIPLight{Position_1_4|GREEN|FourSec|f5fe6e63e0c05a20f519d4b9e46fab3e}\o/BIPLight{Position_1_4|GREEN|FourSec|f5fe6e63e0c05a20f519d4b9e46fab3e}\o/Description["Set Engines On"]\o/\\?\hid#vid_06a3&pid_0d67#9&231fd360&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
                // 0 1 2 3
                var parameters = settings.Split(new[] { SaitekConstants.SEPARATOR_SYMBOL }, StringSplitOptions.RemoveEmptyEntries);

                // MultipanelBIPLink{ALT|1KNOB_ENGINE_LEFT}
                var param0 = parameters[0].Replace("MultipanelBIPLink{", string.Empty).Replace("}", string.Empty).Trim();

                // ALT|1KNOB_ENGINE_LEFT
                var tmpArray = param0.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                WhenOnTurnedOn     = tmpArray[1].Substring(0, 1) == "1";
                MultiPanelPZ70Knob = (MultiPanelPZ70Knobs)Enum.Parse(typeof(MultiPanelPZ70Knobs), tmpArray[1].Substring(1));
                DialPosition       = (PZ70DialPosition)Enum.Parse(typeof(PZ70DialPosition), tmpArray[0]);

                for (var i = 0; i < parameters.Length; i++)
                {
                    if (parameters[i].StartsWith("BIPLight"))
                    {
                        var tmpBipLight = new BIPLight();
                        _bipLights.Add(GetNewKeyValue(), tmpBipLight);
                        tmpBipLight.ImportSettings(parameters[i]);
                    }

                    if (parameters[i].StartsWith("Description["))
                    {
                        var tmp = parameters[i].Replace("Description[", string.Empty).Replace("]", string.Empty);
                        _description = tmp;
                    }
                }
            }
        }
Пример #22
0
        public void AddOrUpdateSingleKeyBinding(MultiPanelPZ70Knobs multiPanelPZ70Knob, string keys, KeyPressLength keyPressLength, bool whenTurnedOn)
        {
            if (string.IsNullOrEmpty(keys))
            {
                RemoveMultiPanelKnobFromList(ControlListPZ70.KEYS, multiPanelPZ70Knob, whenTurnedOn);
                SetIsDirty();
                return;
            }
            //This must accept lists
            var found = false;

            foreach (var knobBinding in _knobBindings)
            {
                if (knobBinding.DialPosition == _pz70DialPosition && knobBinding.MultiPanelPZ70Knob == multiPanelPZ70Knob && knobBinding.WhenTurnedOn == whenTurnedOn)
                {
                    if (string.IsNullOrEmpty(keys))
                    {
                        knobBinding.OSKeyPress = null;
                    }
                    else
                    {
                        knobBinding.OSKeyPress = new KeyPress(keys, keyPressLength);
                    }
                    found = true;
                }
            }
            if (!found && !string.IsNullOrEmpty(keys))
            {
                var knobBinding = new KeyBindingPZ70();
                knobBinding.MultiPanelPZ70Knob = multiPanelPZ70Knob;
                knobBinding.DialPosition       = _pz70DialPosition;
                knobBinding.OSKeyPress         = new KeyPress(keys, keyPressLength);
                knobBinding.WhenTurnedOn       = whenTurnedOn;
                _knobBindings.Add(knobBinding);
            }
            _knobBindings = KeyBindingPZ70.SetNegators(_knobBindings);
            SetIsDirty();
        }
Пример #23
0
        public void AddOrUpdateDCSBIOSLcdBinding(MultiPanelPZ70Knobs multiPanelPZ70Knob, DCSBIOSOutputFormula dcsbiosOutputFormula, PZ70LCDPosition pz70LCDPosition)
        {
            var found = false;

            foreach (var dcsBiosBindingLCD in _dcsBiosLcdBindings)
            {
                if (dcsBiosBindingLCD.MultiPanelPZ70Knob == multiPanelPZ70Knob && dcsBiosBindingLCD.PZ70LCDPosition == pz70LCDPosition)
                {
                    dcsBiosBindingLCD.DCSBIOSOutputFormulaObject = dcsbiosOutputFormula;
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                var dcsBiosBindingLCD = new DCSBIOSBindingLCDPZ70();
                dcsBiosBindingLCD.MultiPanelPZ70Knob         = multiPanelPZ70Knob;
                dcsBiosBindingLCD.DCSBIOSOutputFormulaObject = dcsbiosOutputFormula;
                dcsBiosBindingLCD.PZ70LCDPosition            = pz70LCDPosition;
                _dcsBiosLcdBindings.Add(dcsBiosBindingLCD);
            }
            IsDirtyMethod();
        }
Пример #24
0
        public void AddOrUpdateOSCommandBinding(MultiPanelPZ70Knobs multiPanelPZ70Knob, OSCommand osCommand, bool whenTurnedOn)
        {
            //This must accept lists
            var found = false;

            foreach (var osCommandBinding in _osCommandBindings)
            {
                if (osCommandBinding.DialPosition == _pz70DialPosition && osCommandBinding.MultiPanelPZ70Knob == multiPanelPZ70Knob && osCommandBinding.WhenTurnedOn == whenTurnedOn)
                {
                    osCommandBinding.OSCommandObject = osCommand;
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                var osCommandBindingPZ70 = new OSCommandBindingPZ70();
                osCommandBindingPZ70.MultiPanelPZ70Knob = multiPanelPZ70Knob;
                osCommandBindingPZ70.OSCommandObject    = osCommand;
                osCommandBindingPZ70.WhenTurnedOn       = whenTurnedOn;
                _osCommandBindings.Add(osCommandBindingPZ70);
            }
            SetIsDirty();
        }
Пример #25
0
        private void PZ70SwitchChanged(IEnumerable <object> hashSet)
        {
            if (!ForwardKeyPresses)
            {
                return;
            }

            foreach (var o in hashSet)
            {
                var multiPanelKnob = (MultiPanelKnob)o;
                if (multiPanelKnob.IsOn)
                {
                    switch (multiPanelKnob.MultiPanelPZ70Knob)
                    {
                    case MultiPanelPZ70Knobs.KNOB_ALT:
                    {
                        _selectedMode = multiPanelKnob.MultiPanelPZ70Knob;
                        break;
                    }

                    case MultiPanelPZ70Knobs.KNOB_VS:
                    {
                        _selectedMode = multiPanelKnob.MultiPanelPZ70Knob;
                        break;
                    }

                    case MultiPanelPZ70Knobs.KNOB_IAS:
                    {
                        _selectedMode = multiPanelKnob.MultiPanelPZ70Knob;
                        break;
                    }

                    case MultiPanelPZ70Knobs.KNOB_HDG:
                    {
                        _selectedMode = multiPanelKnob.MultiPanelPZ70Knob;
                        break;
                    }

                    case MultiPanelPZ70Knobs.KNOB_CRS:
                    {
                        _selectedMode = multiPanelKnob.MultiPanelPZ70Knob;
                        break;
                    }

                    case MultiPanelPZ70Knobs.AP_BUTTON:
                    {
                        _apButtonLightOn    = !_apButtonLightOn;
                        multiPanelKnob.IsOn = _apButtonLightOn;
                        SetButtonByte();
                        break;
                    }

                    case MultiPanelPZ70Knobs.HDG_BUTTON:
                    {
                        _hdgButtonLightOn   = !_hdgButtonLightOn;
                        multiPanelKnob.IsOn = _hdgButtonLightOn;
                        SetButtonByte();
                        break;
                    }

                    case MultiPanelPZ70Knobs.NAV_BUTTON:
                    {
                        _navButtonLightOn   = !_navButtonLightOn;
                        multiPanelKnob.IsOn = _navButtonLightOn;
                        SetButtonByte();
                        break;
                    }

                    case MultiPanelPZ70Knobs.IAS_BUTTON:
                    {
                        _iasButtonLightOn   = !_iasButtonLightOn;
                        multiPanelKnob.IsOn = _iasButtonLightOn;
                        SetButtonByte();
                        break;
                    }

                    case MultiPanelPZ70Knobs.ALT_BUTTON:
                    {
                        _altButtonLightOn   = !_altButtonLightOn;
                        multiPanelKnob.IsOn = _altButtonLightOn;
                        SetButtonByte();
                        break;
                    }

                    case MultiPanelPZ70Knobs.VS_BUTTON:
                    {
                        _vsButtonLightOn    = !_vsButtonLightOn;
                        multiPanelKnob.IsOn = _vsButtonLightOn;
                        SetButtonByte();
                        break;
                    }

                    case MultiPanelPZ70Knobs.APR_BUTTON:
                    {
                        _aprButtonLightOn   = !_aprButtonLightOn;
                        multiPanelKnob.IsOn = _aprButtonLightOn;
                        SetButtonByte();
                        break;
                    }

                    case MultiPanelPZ70Knobs.REV_BUTTON:
                    {
                        _revButtonLightOn   = !_revButtonLightOn;
                        multiPanelKnob.IsOn = _revButtonLightOn;
                        SetButtonByte();
                        break;
                    }
                    }
                }

                /*
                 * IMPORTANT
                 * ---------
                 * The LCD buttons toggle between on and off. It is the toggle value that defines if the button is OFF, not the fact that the user releases the button.
                 * Therefore the forementioned buttons cannot be used as usual in a loop with knobBinding.WhenTurnedOn
                 * Instead the buttons global bool value must be used!
                 *
                 */
                var found = false;
                foreach (var knobBinding in _knobBindings)
                {
                    if (knobBinding.OSKeyPress != null && knobBinding.MultiPanelPZ70Knob == multiPanelKnob.MultiPanelPZ70Knob && knobBinding.WhenTurnedOn == multiPanelKnob.IsOn)
                    {
                        if (knobBinding.MultiPanelPZ70Knob == MultiPanelPZ70Knobs.LCD_WHEEL_INC || knobBinding.MultiPanelPZ70Knob == MultiPanelPZ70Knobs.LCD_WHEEL_DEC)
                        {
                            if (!SkipCurrentLcdKnobChange())
                            {
                                knobBinding.OSKeyPress.Execute();
                            }
                            found = true;
                        }
                        else
                        {
                            knobBinding.OSKeyPress.Execute();
                            found = true;
                        }
                        break;
                    }
                }
                if (!found)
                {
                    foreach (var dcsBiosBinding in _dcsBiosBindings)
                    {
                        if (dcsBiosBinding.DCSBIOSInputs.Count > 0 && dcsBiosBinding.MultiPanelPZ70Knob == multiPanelKnob.MultiPanelPZ70Knob && dcsBiosBinding.WhenTurnedOn == multiPanelKnob.IsOn)
                        {
                            dcsBiosBinding.SendDCSBIOSCommands();
                            break;
                        }
                    }
                }
            }
        }
Пример #26
0
 public MultiPanelPZ70KnobOnOff(MultiPanelPZ70Knobs multiPanelPZ70Knobs, bool on)
 {
     _multiPanelPZ70Knobs = multiPanelPZ70Knobs;
     _on = @on;
 }
Пример #27
0
 public MultiPanelPZ70KnobOnOff(MultiPanelPZ70Knobs multiPanelPZ70Knobs, bool buttonState)
 {
     _multiPanelPZ70Knob = multiPanelPZ70Knobs;
     _buttonState        = buttonState;
 }
Пример #28
0
 public void SetButtonOn(PZ70DialPosition pz70DialPosition, MultiPanelPZ70Knobs multiPanelPZ70Knob)
 {
     SetButtonOn(GetMaskForDialPosition(pz70DialPosition), GetMaskForButton(multiPanelPZ70Knob));
 }
Пример #29
0
 public void SetButtonOnOrOff(PZ70DialPosition pz70DialPosition, MultiPanelPZ70Knobs multiPanelPZ70Knob, bool on)
 {
     SetButtonOnOrOff(GetMaskForDialPosition(pz70DialPosition), GetMaskForButton(multiPanelPZ70Knob), on);
 }