public NetworkServer(string ipAddress, string macAddress = null) { if (!IPAddress.TryParse(ipAddress, out var parsedIP)) { new ConstructionException($"Invalid IP address: {ipAddress}"); } if (macAddress != null) { if (!MACAddress.TryParse(macAddress, out var parsedMAC)) { new ConstructionException($"Invalid MAC address: {macAddress}"); } MAC = parsedMAC; } else { MAC = new MACAddress(0xdeadbeef); } IP = parsedIP; arpTable = new Dictionary <IPAddress, PhysicalAddress>(); modules = new Dictionary <int, IServerModule>(); modulesNames = new Dictionary <string, int>(); this.Log(LogLevel.Info, "Network server started at IP {0}", IP); }
internal BluetoothAdapter(Android.Bluetooth.BluetoothAdapter adapter) { InternalDevice = adapter; MACAddress.TryParse(InternalDevice.Address, out MACAddress address); Address = address; DeviceProvider = new BluetoothDeviceProvider(this); }
public static Printer Find(string mac_address) { if (!MACAddress.TryParse(mac_address, out PhysicalAddress mac)) { throw new TinySatoArgumentException($"Bad physical address. address: {mac_address}"); } return(Find(mac, SearchWaitTimeout)); }
public static MACAddress ToMACAddress(this HostName address) { bool done = MACAddress.TryParse(address.CanonicalName, out MACAddress result); if (done) { return(result); } else { return(new MACAddress()); } }
public override bool Check(string Value) { MACAddress val; return(MACAddress.TryParse(Value, out val)); }
internal BluetoothDevice(Android.Bluetooth.BluetoothDevice device) { InternalDevice = device; MACAddress.TryParse(InternalDevice.Address, out MACAddress address); Address = address; }