コード例 #1
0
        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)));
        }
コード例 #2
0
        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.");
        }
コード例 #3
0
        /// <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));
        }
コード例 #4
0
        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.");
        }