public static DCSBIOSOutput CreateCopy(DCSBIOSOutput dcsbiosOutput)
        {
            var tmp = new DCSBIOSOutput
            {
                DCSBiosOutputType       = dcsbiosOutput.DCSBiosOutputType,
                ControlId               = dcsbiosOutput.ControlId,
                Address                 = dcsbiosOutput.Address,
                ControlDescription      = dcsbiosOutput.ControlDescription,
                ControlType             = dcsbiosOutput.ControlType,
                DCSBiosOutputComparison = dcsbiosOutput.DCSBiosOutputComparison,
                Mask       = dcsbiosOutput.Mask,
                MaxLength  = dcsbiosOutput.MaxLength,
                MaxValue   = dcsbiosOutput.MaxValue,
                ShiftValue = dcsbiosOutput.ShiftValue
            };

            if (tmp.DCSBiosOutputType == DCSBiosOutputType.IntegerType)
            {
                tmp.SpecifiedValueInt = dcsbiosOutput.SpecifiedValueInt;
            }

            if (tmp.DCSBiosOutputType == DCSBiosOutputType.StringType)
            {
                tmp.SpecifiedValueString = dcsbiosOutput.SpecifiedValueString;
            }

            return(tmp);
        }
 public static DCSBIOSOutput GetDCSBIOSOutput(string controlId)
 {
     lock (LockObject)
     {
         if (Common.IsOperationModeFlagSet(OperationFlag.KeyboardEmulationOnly))
         {
             throw new Exception("DCSBIOSControlLocator.GetDCSBIOSOutput() Should not be called when only key emulator is active");
         }
         try
         {
             var control       = GetControl(controlId);
             var dcsBIOSOutput = new DCSBIOSOutput();
             dcsBIOSOutput.Consume(control);
             return(dcsBIOSOutput);
         }
         catch (InvalidOperationException ioe)
         {
             throw new Exception("Check DCS-BIOS version. Failed to create DCSBIOSOutput based on control " + controlId + " for airframe " + Airframe.GetDescription() + " ( " + Airframe.GetDescription() + ".json)." + Environment.NewLine + ioe.Message);
         }
     }
 }
 public void Copy(DCSBIOSOutput dcsbiosOutput)
 {
     DCSBiosOutputType       = dcsbiosOutput.DCSBiosOutputType;
     ControlId               = dcsbiosOutput.ControlId;
     Address                 = dcsbiosOutput.Address;
     ControlDescription      = dcsbiosOutput.ControlDescription;
     ControlType             = dcsbiosOutput.ControlType;
     DCSBiosOutputComparison = dcsbiosOutput.DCSBiosOutputComparison;
     Mask       = dcsbiosOutput.Mask;
     MaxLength  = dcsbiosOutput.MaxLength;
     MaxValue   = dcsbiosOutput.MaxValue;
     Shiftvalue = dcsbiosOutput.Shiftvalue;
     if (DCSBiosOutputType == DCSBiosOutputType.INTEGER_TYPE)
     {
         SpecifiedValueInt = dcsbiosOutput.SpecifiedValueInt;
     }
     if (DCSBiosOutputType == DCSBiosOutputType.STRING_TYPE)
     {
         SpecifiedValueString = dcsbiosOutput.SpecifiedValueString;
     }
 }
 public static DCSBIOSOutput GetDCSBIOSOutput(string controlId)
 {
     lock (_lockObject)
     {
         if (_airframe == DCSAirframe.NONE)
         {
             return(null);
         }
         try
         {
             var control       = GetControl(controlId);
             var dcsBIOSOutput = new DCSBIOSOutput();
             dcsBIOSOutput.Consume(control);
             return(dcsBIOSOutput);
         }
         catch (InvalidOperationException ioe)
         {
             throw new Exception("Failed to create DCSBIOSOutput based on control " + controlId + " for airframe " + Airframe.GetDescription() + "." + Environment.NewLine + ioe.Message);
         }
     }
 }
        /*
         * private int Evaluate(uint data)
         * {
         *  try
         *  {
         *      var value = GetUIntValue(data);
         *      _expression.Parameters["x"] = value;
         *      var result = _expression.Evaluate();
         *      return Convert.ToInt32(Math.Abs((double) result));
         *  }
         *  catch (Exception ex)
         *  {
         *      Common.LogError(124874, ex, "Evaluate() function");
         *      throw;
         *  }
         * }
         */

        public static DCSBIOSOutput CreateCopy(DCSBIOSOutput dcsbiosOutput)
        {
            var tmp = new DCSBIOSOutput();

            tmp.DCSBiosOutputType       = dcsbiosOutput.DCSBiosOutputType;
            tmp.ControlId               = dcsbiosOutput.ControlId;
            tmp.Address                 = dcsbiosOutput.Address;
            tmp.ControlDescription      = dcsbiosOutput.ControlDescription;
            tmp.ControlType             = dcsbiosOutput.ControlType;
            tmp.DCSBiosOutputComparison = dcsbiosOutput.DCSBiosOutputComparison;
            tmp.Mask       = dcsbiosOutput.Mask;
            tmp.MaxLength  = dcsbiosOutput.MaxLength;
            tmp.MaxValue   = dcsbiosOutput.MaxValue;
            tmp.Shiftvalue = dcsbiosOutput.Shiftvalue;
            if (tmp.DCSBiosOutputType == DCSBiosOutputType.INTEGER_TYPE)
            {
                tmp.SpecifiedValueInt = dcsbiosOutput.SpecifiedValueInt;
            }
            if (tmp.DCSBiosOutputType == DCSBiosOutputType.STRING_TYPE)
            {
                tmp.SpecifiedValueString = dcsbiosOutput.SpecifiedValueString;
            }
            return(tmp);
        }