private void ExtractDCSBIOSOutputsInFormula() { try { var found = false; var controls = DCSBIOSControlLocator.GetControls(); foreach (var dcsbiosControl in controls) { if (_formula.Contains(dcsbiosControl.identifier)) { // Console.WriteLine("Variable " + dcsbiosControl.identifier + " set to 0"); _variables.Add(dcsbiosControl.identifier, 0); var dcsbiosOutput = DCSBIOSControlLocator.GetDCSBIOSOutput(dcsbiosControl.identifier); _dcsbiosOutputs.Add(dcsbiosOutput); DCSBIOSProtocolParser.RegisterAddressToBroadCast(dcsbiosOutput.Address); found = true; } } if (!found) { throw new Exception("Could not find any DCS-BIOS Controls in formula expression."); } //_expression = new Expression(_formula); } catch (Exception ex) { Common.LogError(1955594, ex, "ExtractDCSBIOSOutputsInFormula() function"); throw; } }
public void Consume(DCSBIOSControl dcsbiosControl) { _controlId = dcsbiosControl.identifier; _controlDescription = dcsbiosControl.description; _controlType = dcsbiosControl.physical_variant; try { _address = dcsbiosControl.outputs[0].address; _mask = dcsbiosControl.outputs[0].mask; _maxValue = dcsbiosControl.outputs[0].max_value; _shiftvalue = dcsbiosControl.outputs[0].shift_by; if (dcsbiosControl.outputs[0].type.Equals("string")) { _dcsBiosOutputType = DCSBiosOutputType.STRING_TYPE; } else if (dcsbiosControl.outputs[0].type.Equals("integer")) { _dcsBiosOutputType = DCSBiosOutputType.INTEGER_TYPE; } //TODO Denna borde göras så att förutom _address så är mottagarens unika ID med så slipper alla lyssna eller ..? (prestanda) DCSBIOSProtocolParser.RegisterAddressToBroadCast(_address); } catch (Exception) { throw new Exception("Failed to copy control " + _controlId + ". Control output is missing." + Environment.NewLine); } }
public DCSBIOSString(uint address, int length) { _address = address; for (var i = _address; i < _address + length; i = i + 2) { DCSBIOSProtocolParser.RegisterAddressToBroadCast(i); _receivedAddresses.Add(i); } _length = length; _internalBuffer = new string[_length]; }
public DCSBIOSString(uint address, int length) { _address = address; for (var i = _address; i < _address + length; i = i + 2) { //Common.DebugP("DCSBIOSString Registering()" + address + ", total length = " + _length); DCSBIOSProtocolParser.RegisterAddressToBroadCast(i); _receivedAddresses.Add(i); } _length = length; _internalBuffer = new string[_length]; }