private void ReadNetworkSettingsFromForm() { _networkConfig = new NetworkConfig(); _networkConfig.IsWireless = _selectedDeviceType.IsWirelessCapable; _networkConfig.StaticIPAddress = _networkConfig.ParseAddress(StaticIPAddress.StringValue); _networkConfig.SubnetMask = _networkConfig.ParseAddress(SubnetMask.StringValue); _networkConfig.PrimaryDNS = _networkConfig.ParseAddress(PrimaryDNS.StringValue); _networkConfig.SecondaryDNS = _networkConfig.ParseAddress(SecondaryDNS.StringValue); _networkConfig.DefaultGateway = _networkConfig.ParseAddress(DefaultGateway.StringValue); _networkConfig.NetworkMacAddress = NetworkMacAddress.StringValue.Split(':').Select(x => Convert.ToByte(x, 16)).ToArray(); _networkConfig.EnableDHCP = EnableDHCP.State == NSCellStateValue.On; if (_networkConfig.IsWireless) { _networkConfig.Authentication = (int)Authentication.IndexOfSelectedItem; _networkConfig.Encryption = (int)Encryption.IndexOfSelectedItem; _networkConfig.Radio = (RadioA.State == NSCellStateValue.On ? (int)MFWirelessConfiguration.RadioTypes.a : 0) | (RadioB.State == NSCellStateValue.On ? (int)MFWirelessConfiguration.RadioTypes.b : 0) | (RadioG.State == NSCellStateValue.On ? (int)MFWirelessConfiguration.RadioTypes.g : 0) | (RadioN.State == NSCellStateValue.On ? (int)MFWirelessConfiguration.RadioTypes.n : 0); _networkConfig.Passphrase = Passphrase.StringValue; _networkConfig.EncryptConfig = EncryptConfig.State == NSCellStateValue.On; _networkConfig.NetworkKeyLength = (int)(Math.Pow(2.0, NetworkKey.IndexOfSelectedItem) * 8); _networkConfig.NetworkKey = NetworkValue.StringValue; _networkConfig.ReKeyInternal = ReKeyInternal.StringValue; _networkConfig.SSID = SSID.StringValue; } }