public FSInterface() { int errorCode = 0; isconnected = false; connect = new Fsuipc(); connect.FSUIPC_Initialization(); if(!connect.FSUIPC_Open(0,ref errorCode)) throw new Exception("Can't connect to FSUIPC! Error code = " + errorCode.ToString()); else isconnected = true; reqCount = 0; //init all subclasses Speeds = new Speeds(this); Altitudes = new Altitudes(this); Autopilot = new Autopilot(this); Controls = new FlightControls(this); }
private void reconnect() { connect.FSUIPC_Close(); connect = new Fsuipc(); connect.FSUIPC_Initialization(); int errorCode = 0; if (!connect.FSUIPC_Open(0, ref errorCode)) throw new Exception("Can't connect to FSUIPC! Error code = " + errorCode.ToString()); else isconnected = true; reqCount = 0; }