/// <summary> /// Removes device with specified Mac from saved devices. /// </summary> public static void RemoveDevice(Network.PhysicalAddressSerializable mac) { Network.Device device = GetDevice(mac); if (device != null) { Properties.Settings.Default.Devices.Remove(device); Properties.Settings.Default.Save(); } }
public static void CycleDeviceReceiveMode(Network.PhysicalAddressSerializable mac) { Network.Device device = GetDevice(mac); if (device != null) { device.CycleReceiveMode(); Properties.Settings.Default.Save(); } }
/// <summary> /// Sets a password for encryption for device. If password is null, will remove password. /// </summary> /// <param name="mac"></param> /// <param name="password"></param> public static void SetDeviceEncryptionPassword(Network.PhysicalAddressSerializable mac, SecureString password) { Network.Device device = GetDevice(mac); if (device != null) { if (password == null) { device.RemoveEncryptionPassword(); } else { device.SetEncryptionPassword(password); } Properties.Settings.Default.Save(); } }
/// <summary> /// Adds new device into list or updates info on already existing device. /// </summary> public static void AddUpdateDevice(Network.PhysicalAddressSerializable mac, string name, IPAddress ip, Network.DeviceType?type = null) { Network.Device device = GetDevice(mac); if (device != null) { if (device.TryUpdateInfo(name, ip)) { Properties.Settings.Default.Save(); } } else { device = new Network.Device(name, ip, mac, type ?? Network.DeviceType.Unknown); Properties.Settings.Default.Devices.Add(device); Properties.Settings.Default.Save(); device.NotifyPropertyChanged(); } }