public async Task <bool> DeleteProfileAsync(ProfileItem profileItem) { if (profileItem == null) { throw new ArgumentNullException(nameof(profileItem)); } return(await Task.Run(() => NativeWifi.DeleteProfile(profileItem.InterfaceId, profileItem.Name))); }
public void DeletProfileTest() { Assert.IsTrue(_interfaceId != null, "No wireless interface is connected."); Assert.IsTrue(NativeWifi.EnumerateProfileNames().Contains(_testProfileName), "The wireless profile for test doesn't exist."); var result = NativeWifi.DeleteProfile(_interfaceId, _testProfileName); Assert.IsTrue(result, "Failed to delete the wireless profile for test."); Assert.IsFalse(NativeWifi.EnumerateProfileNames().Contains(_testProfileName), "The wireless profile for test remains."); }
/// <summary> /// Deletes a specified wireless profile. /// </summary> /// <param name="profileName">Profile name to be deleted</param> /// <returns>True if successfully deleted. False if not.</returns> /// <remarks>Profile name is case-sensitive.</remarks> public static bool DeleteProfile(string profileName) { var targetProfile = NativeWifi.EnumerateProfiles() .Where(x => profileName.Equals(x.Name, StringComparison.Ordinal)) .FirstOrDefault(); if (targetProfile == null) { return(false); } return(NativeWifi.DeleteProfile( interfaceId: targetProfile.Interface.Id, profileName: profileName)); }
public void DeletProfileTest() { var testProfileName = $"TestProfile{DateTime.Today.Year}"; var testSsidString = $"TestSsidString{DateTime.Today.DayOfYear}"; Assert.IsTrue(_interfaceId != null, "No wireless interface is connected."); Assert.IsTrue(NativeWifi.EnumerateProfileNames().Contains(testProfileName), "The wireless profile for test doesn't exist."); var result = NativeWifi.DeleteProfile(_interfaceId, testProfileName); Assert.IsTrue(result, "Failed to delete the wireless profile for test."); Assert.IsFalse(NativeWifi.EnumerateProfileNames().Contains(testProfileName), "The wireless profile for test remains."); }