private void ConnectToNetworkExecute(object parameter) { string password = ""; var passwordContainer = parameter as IHavePassword; var secureString = passwordContainer.Password; if (wifi.GetAccessPoints().Find(item => item.Name == SelectedNetwork.Name).IsSecure) { password = ConvertToUnsecureString(secureString); } ConnectionControl.ConnectNetwork(wifi, SelectedNetwork.Name, password); if (wifi.ConnectionStatus == WifiStatus.Connected) { if (wifi.GetAccessPoints().Find(item => item.IsConnected).Name == SelectedNetwork.Name) { ConnectionControl.DeleteMemory(); if (ConnectionControl.ConnectBluegiga(Client, wifi)) { MessageBox.Show("Połączono."); ConnectionStatus = "Połączono"; } else { MessageBox.Show("Brak połączenia."); ConnectionStatus = "Brak połączenia."; } } } WifiSearch(wifi); }
void CheckRecievedObject(object obj) { if (obj is ChatMessage) { server.RecieveMessage((ChatMessage)obj); } else if (obj is ConnectionControl) { ConnectionControl connection = (ConnectionControl)obj; server.RecieveMessage(null, connection.Status.ToString() + " status"); if (connection.Status == ConnectionStatus.LogIn) { UserName = connection.UserName; server.AddUserToList(connection.UserName); server.RecieveMessage(null, connection.Status.ToString() + " status"); } else if (connection.Status == ConnectionStatus.LogOut) { server.RemoveUserFromList(connection.UserName); } } else if (obj is null) { server.RecieveMessage(null, "Recieved null object"); } else { server.RecieveMessage(null, "Recieved unknown"); } }
public void ProduceEnd(Exception ex) { if (ex != null) { if (_responseStarted) { // We can no longer respond with a 500, so we simply close the connection. ConnectionControl.End(ProduceEndType.SocketDisconnect); return; } else { StatusCode = 500; ReasonPhrase = null; // If OnStarting hasn't been triggered yet, we don't want to trigger it now that // the app func has failed. https://github.com/aspnet/KestrelHttpServer/issues/43 _onStarting = null; ResetResponseHeaders(); _responseHeaders.HeaderContentLength = "0"; } } ProduceStart(immediate: true, appCompleted: true); // _autoChunk should be checked after we are sure ProduceStart() has been called // since ProduceStart() may set _autoChunk to true. if (_autoChunk) { WriteChunkedResponseSuffix(); } ConnectionControl.End(_keepAlive ? ProduceEndType.ConnectionKeepAlive : ProduceEndType.SocketShutdownSend); }
private async Task ProduceEnd() { if (_applicationException != null) { if (_responseStarted) { // We can no longer respond with a 500, so we simply close the connection. _requestProcessingStopping = true; return; } else { StatusCode = 500; ReasonPhrase = null; ResetResponseHeaders(); _responseHeaders.HeaderContentLength = "0"; } } await ProduceStart(immediate : true, appCompleted : true); // _autoChunk should be checked after we are sure ProduceStart() has been called // since ProduceStart() may set _autoChunk to true. if (_autoChunk) { WriteChunkedResponseSuffix(); } if (_keepAlive) { ConnectionControl.End(ProduceEndType.ConnectionKeepAlive); } }
private void ApplyConnectionFilter() { lock (_stateLock) { if (_connectionState == ConnectionState.CreatingFrame) { _connectionState = ConnectionState.Open; if (_filterContext.Connection != _libuvStream) { _filteredStreamAdapter = new FilteredStreamAdapter(ConnectionId, _filterContext.Connection, Memory, Log, ThreadPool); SocketInput = _filteredStreamAdapter.SocketInput; SocketOutput = _filteredStreamAdapter.SocketOutput; _readInputContinuation = _filteredStreamAdapter.ReadInputAsync(); } else { SocketInput = _rawSocketInput; SocketOutput = _rawSocketOutput; } PrepareRequest = _filterContext.PrepareRequest; _frame = CreateFrame(); _frame.Start(); } else { ConnectionControl.End(ProduceEndType.SocketDisconnect); } } }
public Control() { InputManager = new InputManager(); GraphicsManager = new GraphicsDeviceManager(this); SubControls = new Dictionary <GameMode, SubControlInterface>(); ConnectionControl = new ConnectionControl(this); OptionControl = new GameOptionsControl(this); RegistrationControl = new PlayerRegistrationControl(this); StatusControl = new MatchmakingStatusControl(this); GameControl = new GameControl(this); FinishControl = new FinishControl(this); SubControls.Add(GameMode.Connect, ConnectionControl); SubControls.Add(GameMode.Options, OptionControl); SubControls.Add(GameMode.Registration, RegistrationControl); SubControls.Add(GameMode.Status, StatusControl); SubControls.Add(GameMode.Game, GameControl); SubControls.Add(GameMode.Finish, FinishControl); ActiveControl = GetSubControl(GameMode.Connect); m_networkDied = false; }
public void HandleConnectionControl(ConnectionControl control) { string reconnectStr = control.ReconnectTo; if (reconnectStr != null) { reconnectStr = reconnectStr.Trim(); if (reconnectStr.Length > 0) { try { Uri uri = new Uri(reconnectStr); if (IsReconnectSupported) { Reconnect(uri); Tracer.Info("Reconnected to: " + uri.OriginalString); } } catch (Exception e) { Tracer.ErrorFormat("Failed to handle ConnectionControl reconnect to {0}: {1}", reconnectStr, e); } } } ProcessNewTransports(control.RebalanceConnection, control.ConnectedBrokers); }
void Start() { scene = SceneManager.GetActiveScene(); GameObject[] i = GameObject.FindGameObjectsWithTag("Input Supply"); inputs = new List <GameObject>(i); GameObject[] o = GameObject.FindGameObjectsWithTag("Target"); outputs = new List <GameObject>(o); List <ConnectionControl> inputVals = new List <ConnectionControl>(); List <ConnectionControl> outputVals = new List <ConnectionControl>(); logicLabStartIdx = SceneManager.GetSceneByName("Logic Lab 0").buildIndex; gates = GameObject.FindGameObjectsWithTag("Logic Gate"); foreach (GameObject input in inputs) { inputVals.Add(input.transform.Find("Output Node").GetComponent <ConnectionControl>()); } foreach (GameObject output in outputs) { outputVals.Add(output.transform.Find("Input Node").GetComponent <ConnectionControl>()); } currentScene = SceneManager.GetActiveScene().buildIndex; A = inputVals[0]; B = inputVals[1]; Cin = inputVals[2]; S = outputVals[0]; Co = outputVals[1]; if (currentScene == 6) { StartCoroutine("Help"); } }
protected void RestoreTransport(ITransport t) { Tracer.Info("Restoring previous transport connection."); t.Start(); //send information to the broker - informing it we are an ft client ConnectionControl cc = new ConnectionControl(); cc.FaultTolerant = true; t.Oneway(cc); stateTracker.DoRestore(t); Tracer.Info("Sending queued commands..."); Dictionary <int, Command> tmpMap = null; lock (((ICollection)requestMap).SyncRoot) { tmpMap = new Dictionary <int, Command>(requestMap); } foreach (Command command in tmpMap.Values) { t.Oneway(command); } }
/// <summary> /// Immediate kill the connection and poison the request and response streams. /// </summary> public void Abort() { if (Interlocked.CompareExchange(ref _requestAborted, 1, 0) == 0) { _requestProcessingStopping = true; _frameStreams?.RequestBody.Abort(); _frameStreams?.ResponseBody.Abort(); try { ConnectionControl.End(ProduceEndType.SocketDisconnect); } catch (Exception ex) { Log.LogError(0, ex, "Abort"); } try { RequestAbortedSource.Cancel(); } catch (Exception ex) { Log.LogError(0, ex, "Abort"); } _abortedCts = null; } }
private async Task WriteAutoChunkSuffixAwaited() { await WriteChunkedResponseSuffix(); if (_keepAlive) { ConnectionControl.End(ProduceEndType.ConnectionKeepAlive); } }
public void UpdateConnectedClients() { ConnectionControl cc = new ConnectionControl(); foreach (ServerClient sc in ConnectedClients) { cc.ListOfUsers.Add(sc.UserName); } SendMessage(cc); //form.ChangeTimer(); }
// // Write a object instance to data output stream // public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut) { ConnectionControl info = (ConnectionControl)o; base.LooseMarshal(wireFormat, o, dataOut); dataOut.Write(info.Close); dataOut.Write(info.Exit); dataOut.Write(info.FaultTolerant); dataOut.Write(info.Resume); dataOut.Write(info.Suspend); }
public void Disconnect() { if (Network != null) { Network.SessionDied -= NetworkDeathHandler; Network.Disconnect(); ConnectionControl.SetStatus("Disconnected."); } CleanUpNetwork(); }
// // Un-marshal an object instance from the data input stream // public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs) { base.TightUnmarshal(wireFormat, o, dataIn, bs); ConnectionControl info = (ConnectionControl)o; info.Close = bs.ReadBoolean(); info.Exit = bs.ReadBoolean(); info.FaultTolerant = bs.ReadBoolean(); info.Resume = bs.ReadBoolean(); info.Suspend = bs.ReadBoolean(); }
// // Write a object instance to data output stream // public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs) { base.TightMarshal2(wireFormat, o, dataOut, bs); ConnectionControl info = (ConnectionControl)o; bs.ReadBoolean(); bs.ReadBoolean(); bs.ReadBoolean(); bs.ReadBoolean(); bs.ReadBoolean(); }
public void UpdateLastConnected() { if (ConnectedClients.Count != 0) { ConnectionControl cc = new ConnectionControl(); foreach (ServerClient sc in ConnectedClients) { cc.ListOfUsers.Add(sc.UserName); } ConnectedClients[ConnectedClients.Count - 1].SendMessageToClient(cc); } }
public void ProduceEnd(Exception ex) { ProduceStart(); if (!_keepAlive) { ConnectionControl.End(ProduceEndType.SocketShutdownSend); } //NOTE: must finish reading request body ConnectionControl.End(_keepAlive ? ProduceEndType.ConnectionKeepAlive : ProduceEndType.SocketDisconnect); }
// // Un-marshal an object instance from the data input stream // public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn) { base.LooseUnmarshal(wireFormat, o, dataIn); ConnectionControl info = (ConnectionControl)o; info.Close = dataIn.ReadBoolean(); info.Exit = dataIn.ReadBoolean(); info.FaultTolerant = dataIn.ReadBoolean(); info.Resume = dataIn.ReadBoolean(); info.Suspend = dataIn.ReadBoolean(); }
public void Start() { Log.ConnectionStart(ConnectionId); // Start socket prior to applying the ConnectionFilter _socket.ReadStart(_allocCallback, _readCallback, this); if (ServerOptions.ConnectionFilter == null) { _frame.Start(); } else { _libuvStream = new LibuvStream(SocketInput, SocketOutput); _filterContext = new ConnectionFilterContext { Connection = _libuvStream, Address = ServerAddress }; try { ServerOptions.ConnectionFilter.OnConnectionAsync(_filterContext).ContinueWith((task, state) => { var connection = (Connection)state; if (task.IsFaulted) { connection.Log.LogError(0, task.Exception, "ConnectionFilter.OnConnection"); connection.ConnectionControl.End(ProduceEndType.SocketDisconnect); } else if (task.IsCanceled) { connection.Log.LogError("ConnectionFilter.OnConnection Canceled"); connection.ConnectionControl.End(ProduceEndType.SocketDisconnect); } else { connection.ApplyConnectionFilter(); } }, this); } catch (Exception ex) { Log.LogError(0, ex, "ConnectionFilter.OnConnection"); ConnectionControl.End(ProduceEndType.SocketDisconnect); } } }
private void WriteSuffix() { // _autoChunk should be checked after we are sure ProduceStart() has been called // since ProduceStart() may set _autoChunk to true. if (_autoChunk) { WriteChunkedResponseSuffix(); } if (_keepAlive) { ConnectionControl.End(ProduceEndType.ConnectionKeepAlive); } }
// // Write the booleans that this object uses to a BooleanStream // public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) { ConnectionControl info = (ConnectionControl)o; int rc = base.TightMarshal1(wireFormat, o, bs); bs.WriteBoolean(info.Close); bs.WriteBoolean(info.Exit); bs.WriteBoolean(info.FaultTolerant); bs.WriteBoolean(info.Resume); bs.WriteBoolean(info.Suspend); return(rc + 0); }
// Called on Libuv thread public void Tick(long timestamp) { if (timestamp > PlatformApis.VolatileRead(ref _timeoutTimestamp)) { ConnectionControl.CancelTimeout(); if (_timeoutAction == TimeoutAction.SendTimeoutResponse) { _frame.SetBadRequestState(RequestRejectionReason.RequestTimeout); } StopAsync(); } Interlocked.Exchange(ref _lastTimestamp, timestamp); }
protected override void OnStart(string[] args) { try { _controller = new ConnectionControl(); ThreadStart threadStart = new ThreadStart(_controller.DoWork); // start worker thread _workerThread = new Thread(threadStart); _workerThread.Start(); } catch (Exception exception) { throw new Exception("Abort", exception); } }
private Task WriteSuffix() { // _autoChunk should be checked after we are sure ProduceStart() has been called // since ProduceStart() may set _autoChunk to true. if (_autoChunk) { return(WriteAutoChunkSuffixAwaited()); } if (_keepAlive) { ConnectionControl.End(ProduceEndType.ConnectionKeepAlive); } return(TaskUtilities.CompletedTask); }
// // Un-marshal an object instance from the data input stream // public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn) { base.LooseUnmarshal(wireFormat, o, dataIn); ConnectionControl info = (ConnectionControl)o; info.Close = dataIn.ReadBoolean(); info.Exit = dataIn.ReadBoolean(); info.FaultTolerant = dataIn.ReadBoolean(); info.Resume = dataIn.ReadBoolean(); info.Suspend = dataIn.ReadBoolean(); info.ConnectedBrokers = LooseUnmarshalString(dataIn); info.ReconnectTo = LooseUnmarshalString(dataIn); info.RebalanceConnection = dataIn.ReadBoolean(); info.Token = ReadBytes(dataIn, dataIn.ReadBoolean()); }
// // Un-marshal an object instance from the data input stream // public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs) { base.TightUnmarshal(wireFormat, o, dataIn, bs); ConnectionControl info = (ConnectionControl)o; info.Close = bs.ReadBoolean(); info.Exit = bs.ReadBoolean(); info.FaultTolerant = bs.ReadBoolean(); info.Resume = bs.ReadBoolean(); info.Suspend = bs.ReadBoolean(); info.ConnectedBrokers = TightUnmarshalString(dataIn, bs); info.ReconnectTo = TightUnmarshalString(dataIn, bs); info.RebalanceConnection = bs.ReadBoolean(); info.Token = ReadBytes(dataIn, bs.ReadBoolean()); }
public void Start() { Log.ConnectionStart(_connectionId); // Start socket prior to applying the ConnectionFilter _socket.ReadStart(_allocCallback, _readCallback, this); // Don't initialize _frame until SocketInput and SocketOutput are set to their final values. if (ConnectionFilter == null) { SocketInput = _rawSocketInput; SocketOutput = _rawSocketOutput; _frame = new Frame(this); _frame.Start(); } else { var libuvStream = new LibuvStream(_rawSocketInput, _rawSocketOutput); _filterContext = new ConnectionFilterContext { Connection = libuvStream, Address = ServerAddress }; ConnectionFilter.OnConnection(_filterContext).ContinueWith((task, state) => { var connection = (Connection)state; if (task.IsFaulted) { connection.Log.LogError("ConnectionFilter.OnConnection", task.Exception); ConnectionControl.End(ProduceEndType.SocketDisconnect); } else if (task.IsCanceled) { connection.Log.LogError("ConnectionFilter.OnConnection Canceled"); ConnectionControl.End(ProduceEndType.SocketDisconnect); } else { connection.ApplyConnectionFilter(); } }, this); } }
public WiimoteMainForm() { InitializeComponent(); pbTrackingLayout.Image = new Bitmap(pbTrackingLayout.Width, pbTrackingLayout.Height); TrackingLayout = Graphics.FromImage(pbTrackingLayout.Image); TrackingLayout.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; CalibrationForm.CalibrationCancelled += new EventHandler(CalibrationForm_Cancelled); controller = new Controller(Screen.PrimaryScreen); cbCursorControl.Checked = controller.CursorEnabled; if (controller.CursorEnabled) { UpdateTrackingUtilization(controller.SourceLayout); } controller.CalibrationStateChanged += controller_CalibrationStateChanged; controller.StatusInfoChanged += controller_StatusInfoChanged; ConnectionControl.StateChanged += new EventHandler <EventArgs <ConnectionController.ConnectState> >(ConnectionControl_StateChanged); if (!ConnectionManager.IsStackCompatible()) { ConnectionControl.Visible = false; try { controller.Enable(); } catch (Exception e) { MessageBox.Show(e.Message); } } else { try { controller.Enable(); } catch (Exception) { ConnectionControl.Connect(); } } }
// // Write the booleans that this object uses to a BooleanStream // public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) { ConnectionControl info = (ConnectionControl)o; int rc = base.TightMarshal1(wireFormat, o, bs); bs.WriteBoolean(info.Close); bs.WriteBoolean(info.Exit); bs.WriteBoolean(info.FaultTolerant); bs.WriteBoolean(info.Resume); bs.WriteBoolean(info.Suspend); rc += TightMarshalString1(info.ConnectedBrokers, bs); rc += TightMarshalString1(info.ReconnectTo, bs); bs.WriteBoolean(info.RebalanceConnection); bs.WriteBoolean(info.Token != null); rc += info.Token == null ? 0 : info.Token.Length + 4; return(rc + 0); }
public MainV2() { log.Info("Mainv2 ctor"); Form splash = Program.Splash; string strVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); strVersion = "mav " + MAVLink.MAVLINK_WIRE_PROTOCOL_VERSION; splash.Text = "Mission Planner " + Application.ProductVersion + " " + strVersion; splash.Refresh(); Application.DoEvents(); instance = this; InitializeComponent(); MenuFlightPlanner.Image = new Bitmap(MissionPlanner.Properties.Resources.flightplanner); MyView = new MainSwitcher(this); View = MyView; _connectionControl = toolStripConnectionControl.ConnectionControl; _connectionControl.CMB_baudrate.TextChanged += this.CMB_baudrate_TextChanged; _connectionControl.CMB_baudrate.SelectedIndexChanged += this.CMB_baudrate_SelectedIndexChanged; _connectionControl.CMB_serialport.SelectedIndexChanged += this.CMB_serialport_SelectedIndexChanged; _connectionControl.CMB_serialport.Enter += this.CMB_serialport_Enter; _connectionControl.CMB_serialport.Click += this.CMB_serialport_Click; _connectionControl.TOOL_APMFirmware.SelectedIndexChanged += this.TOOL_APMFirmware_SelectedIndexChanged; _connectionControl.ShowLinkStats += (sender, e) => ShowConnectionStatsForm(); srtm.datadirectory = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "srtm"; var t = Type.GetType("Mono.Runtime"); MONO = (t != null); speechEngine = new Speech(); // proxy loader - dll load now instead of on config form load new Transition(new TransitionType_EaseInEaseOut(2000)); //MyRenderer.currentpressed = MenuFlightData; //MainMenu.Renderer = new MyRenderer(); foreach (object obj in Enum.GetValues(typeof(Firmwares))) { _connectionControl.TOOL_APMFirmware.Items.Add(obj); } if (_connectionControl.TOOL_APMFirmware.Items.Count > 0) _connectionControl.TOOL_APMFirmware.SelectedIndex = 0; this.Text = splash.Text; comPort.BaseStream.BaudRate = 115200; // ** Old // CMB_serialport.Items.AddRange(SerialPort.GetPortNames()); // CMB_serialport.Items.Add("TCP"); // CMB_serialport.Items.Add("UDP"); // if (CMB_serialport.Items.Count > 0) // { // CMB_baudrate.SelectedIndex = 7; // CMB_serialport.SelectedIndex = 0; // } // ** new _connectionControl.CMB_serialport.Items.Add("AUTO"); _connectionControl.CMB_serialport.Items.AddRange(SerialPort.GetPortNames()); _connectionControl.CMB_serialport.Items.Add("TCP"); _connectionControl.CMB_serialport.Items.Add("UDP"); if (_connectionControl.CMB_serialport.Items.Count > 0) { _connectionControl.CMB_baudrate.SelectedIndex = 7; _connectionControl.CMB_serialport.SelectedIndex = 0; } // ** Done splash.Refresh(); Application.DoEvents(); // set this before we reset it MainV2.config["NUM_tracklength"] = "200"; // load config xmlconfig(false); if (config.ContainsKey("language") && !string.IsNullOrEmpty((string)config["language"])) changelanguage(CultureInfoEx.GetCultureInfo((string)config["language"])); if (!MONO) // windows only { if (MainV2.config["showconsole"] != null && MainV2.config["showconsole"].ToString() == "True") { } else { int win = NativeMethods.FindWindow("ConsoleWindowClass", null); NativeMethods.ShowWindow(win, NativeMethods.SW_HIDE); // hide window } } ChangeUnits(); if (config["theme"] != null) { ThemeManager.SetTheme((ThemeManager.Themes)Enum.Parse(typeof(ThemeManager.Themes), MainV2.config["theme"].ToString())); if (ThemeManager.CurrentTheme == ThemeManager.Themes.Custom) { try { ThemeManager.BGColor = Color.FromArgb(int.Parse(MainV2.config["theme_bg"].ToString())); ThemeManager.ControlBGColor = Color.FromArgb(int.Parse(MainV2.config["theme_ctlbg"].ToString())); ThemeManager.TextColor = Color.FromArgb(int.Parse(MainV2.config["theme_text"].ToString())); ThemeManager.ButBG = Color.FromArgb(int.Parse(MainV2.config["theme_butbg"].ToString())); ThemeManager.ButBorder = Color.FromArgb(int.Parse(MainV2.config["theme_butbord"].ToString())); } catch { log.Error("Bad Custom theme - reset to standard"); ThemeManager.SetTheme(ThemeManager.Themes.BurntKermit); } } } try { log.Info("Create FD"); FlightData = new GCSViews.FlightData(); log.Info("Create FP"); FlightPlanner = new GCSViews.FlightPlanner(); //Configuration = new GCSViews.ConfigurationView.Setup(); log.Info("Create SIM"); Simulation = new GCSViews.Simulation(); //Firmware = new GCSViews.Firmware(); //Terminal = new GCSViews.Terminal(); // preload log.Info("Create Python"); Python.CreateEngine(); } catch (ArgumentException e) { //http://www.microsoft.com/en-us/download/details.aspx?id=16083 //System.ArgumentException: Font 'Arial' does not support style 'Regular'. log.Fatal(e); CustomMessageBox.Show(e.ToString() + "\n\n Font Issues? Please install this http://www.microsoft.com/en-us/download/details.aspx?id=16083"); //splash.Close(); //this.Close(); Application.Exit(); } catch (Exception e) { log.Fatal(e); CustomMessageBox.Show("A Major error has occured : " + e.ToString()); Application.Exit(); } if (MainV2.config["CHK_GDIPlus"] != null) GCSViews.FlightData.myhud.UseOpenGL = !bool.Parse(MainV2.config["CHK_GDIPlus"].ToString()); try { if (config["MainLocX"] != null && config["MainLocY"] != null) { this.StartPosition = FormStartPosition.Manual; Point startpos = new Point(int.Parse(config["MainLocX"].ToString()), int.Parse(config["MainLocY"].ToString())); this.Location = startpos; } if (config["MainMaximised"] != null) { this.WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), config["MainMaximised"].ToString()); // dont allow minimised start state if (this.WindowState == FormWindowState.Minimized) { this.WindowState = FormWindowState.Normal; this.Location = new Point(100, 100); } } if (config["MainHeight"] != null) this.Height = int.Parse(config["MainHeight"].ToString()); if (config["MainWidth"] != null) this.Width = int.Parse(config["MainWidth"].ToString()); if (config["CMB_rateattitude"] != null) MainV2.comPort.MAV.cs.rateattitude = byte.Parse(config["CMB_rateattitude"].ToString()); if (config["CMB_rateposition"] != null) MainV2.comPort.MAV.cs.rateposition = byte.Parse(config["CMB_rateposition"].ToString()); if (config["CMB_ratestatus"] != null) MainV2.comPort.MAV.cs.ratestatus = byte.Parse(config["CMB_ratestatus"].ToString()); if (config["CMB_raterc"] != null) MainV2.comPort.MAV.cs.raterc = byte.Parse(config["CMB_raterc"].ToString()); if (config["CMB_ratesensors"] != null) MainV2.comPort.MAV.cs.ratesensors = byte.Parse(config["CMB_ratesensors"].ToString()); if (config["speechenable"] != null) MainV2.speechEnable = bool.Parse(config["speechenable"].ToString()); //int fixme; /* MainV2.comPort.MAV.cs.rateattitude = 50; MainV2.comPort.MAV.cs.rateposition = 50; MainV2.comPort.MAV.cs.ratestatus = 50; MainV2.comPort.MAV.cs.raterc = 50; MainV2.comPort.MAV.cs.ratesensors = 50; */ try { if (config["TXT_homelat"] != null) MainV2.comPort.MAV.cs.HomeLocation.Lat = double.Parse(config["TXT_homelat"].ToString()); if (config["TXT_homelng"] != null) MainV2.comPort.MAV.cs.HomeLocation.Lng = double.Parse(config["TXT_homelng"].ToString()); if (config["TXT_homealt"] != null) MainV2.comPort.MAV.cs.HomeLocation.Alt = double.Parse(config["TXT_homealt"].ToString()); } catch { } } catch { } if (MainV2.comPort.MAV.cs.rateattitude == 0) // initilised to 10, configured above from save { CustomMessageBox.Show("NOTE: your attitude rate is 0, the hud will not work\nChange in Configuration > Planner > Telemetry Rates"); } // log dir if (config["logdirectory"] != null) MainV2.LogDir = config["logdirectory"].ToString(); //System.Threading.Thread.Sleep(2000); // make sure new enough .net framework is installed if (!MONO) { Microsoft.Win32.RegistryKey installed_versions = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP"); string[] version_names = installed_versions.GetSubKeyNames(); //version names start with 'v', eg, 'v3.5' which needs to be trimmed off before conversion double Framework = Convert.ToDouble(version_names[version_names.Length - 1].Remove(0, 1), CultureInfo.InvariantCulture); int SP = Convert.ToInt32(installed_versions.OpenSubKey(version_names[version_names.Length - 1]).GetValue("SP", 0)); if (Framework < 3.5) { CustomMessageBox.Show("This program requires .NET Framework 3.5. You currently have " + Framework); } } Application.DoEvents(); Comports.Add(comPort); //int fixmenextrelease; // if (MainV2.getConfig("fixparams") == "") { // Utilities.ParameterMetaDataParser.GetParameterInformation(); // MainV2.config["fixparams"] = 1; } splash.Close(); }