/// <summary>
        /// Constructor
        /// </summary>
        public AvailableNetworkGroupPack(
            InterfaceInfo interfaceInfo,
            NetworkIdentifier ssid,
            BssType bssType,
            int signalQuality,
            bool isSecurityEnabled,
            string profileName,
            AuthenticationAlgorithm authenticationAlgorithm,
            CipherAlgorithm cipherAlgorithm,
            IEnumerable <BssNetworkPack> bssNetworks) : base(
                interfaceInfo: interfaceInfo,
                ssid: ssid,
                bssType: bssType,
                signalQuality: signalQuality,
                isSecurityEnabled: isSecurityEnabled,
                profileName: profileName,
                authenticationAlgorithm: authenticationAlgorithm,
                cipherAlgorithm: cipherAlgorithm)
        {
            this.BssNetworks = Array.AsReadOnly(bssNetworks?.OrderByDescending(x => x.LinkQuality).ToArray() ?? new BssNetworkPack[0]);
            if (!this.BssNetworks.Any())
            {
                return;
            }

            var highestLinkQualityNetwork = this.BssNetworks.First();

            LinkQuality = highestLinkQualityNetwork.LinkQuality;
            Frequency   = highestLinkQualityNetwork.Frequency;
            Band        = highestLinkQualityNetwork.Band;
            Channel     = highestLinkQualityNetwork.Channel;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ProfilePack(
     string name,
     InterfaceInfo interfaceInfo,
     ProfileType profileType,
     string profileXml,
     NetworkIdentifier ssid,
     BssType bssType,
     string authentication,
     string encryption,
     int signalQuality,
     int position,
     bool isAutomatic,
     bool isConnected)
 {
     this.Name           = name;
     this.Interface      = interfaceInfo;
     this.ProfileType    = profileType;
     this.ProfileXml     = profileXml;
     this.Ssid           = ssid;
     this.BssType        = bssType;
     this.Authentication = authentication;
     this.Encryption     = encryption;
     this.SignalQuality  = signalQuality;
     this.Position       = position;
     this.IsAutomatic    = isAutomatic;
     this.IsConnected    = isConnected;
 }
        /// <summary>
        /// Constructor
        /// </summary>
        public AvailableNetworkGroupPack(
            InterfaceInfo interfaceInfo,
            NetworkIdentifier ssid,
            BssType bssType,
            int signalQuality,
            bool isSecurityEnabled,
            string profileName,
            IEnumerable <BssNetworkPack> bssNetworks) : base(
                interfaceInfo: interfaceInfo,
                ssid: ssid,
                bssType: bssType,
                signalQuality: signalQuality,
                isSecurityEnabled: isSecurityEnabled,
                profileName: profileName)
        {
            this._bssNetworks = bssNetworks.OrderByDescending(x => x.LinkQuality).ToArray();

            var highestLinkQualityNetwork = _bssNetworks.FirstOrDefault();

            if (highestLinkQualityNetwork != null)
            {
                LinkQuality = highestLinkQualityNetwork.LinkQuality;
                Frequency   = highestLinkQualityNetwork.Frequency;
                Band        = highestLinkQualityNetwork.Band;
                Channel     = highestLinkQualityNetwork.Channel;
            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public AvailableNetworkGroupPack(
            InterfaceConnectionInfo interfaceInfo,
            NetworkIdentifier ssid,
            BssType bssType,
            int signalQuality,
            bool isSecurityEnabled,
            string profileName,
            bool isNetworkConnectable,
            string wlanNotConnectableReason,
            AuthenticationMethod authenticationMethod,
            EncryptionType encryptionType,
            IEnumerable <BssNetworkPack> bssNetworks) : base(
                interfaceInfo: interfaceInfo,
                ssid: ssid,
                bssType: bssType,
                signalQuality: signalQuality,
                isSecurityEnabled: isSecurityEnabled,
                profileName: profileName,
                isNetworkConnectable: isNetworkConnectable,
                wlanNotConnectableReason: wlanNotConnectableReason,
                authenticationMethod: authenticationMethod,
                encryptionType: encryptionType)
        {
            this._bssNetworks = bssNetworks.OrderByDescending(x => x.LinkQuality).ToArray();

            var highestLinkQualityNetwork = _bssNetworks.FirstOrDefault();

            if (highestLinkQualityNetwork != null)
            {
                LinkQuality = highestLinkQualityNetwork.LinkQuality;
                Frequency   = highestLinkQualityNetwork.Frequency;
                Band        = highestLinkQualityNetwork.Band;
                Channel     = highestLinkQualityNetwork.Channel;
            }
        }
Exemplo n.º 5
0
        private ProfileDocument(XDocument root)
        {
            if (root is null)
            {
                return;
            }

            this.Root = root;

            Name = Root.Elements().First().Elements(XName.Get("name", Namespace)).FirstOrDefault()?.Value;

            var ssidElement    = Root.Descendants(XName.Get("SSID", Namespace)).FirstOrDefault();
            var ssidHexString  = ssidElement?.Descendants(XName.Get("hex", Namespace)).FirstOrDefault()?.Value;
            var ssidHexBytes   = HexadecimalStringConverter.ToBytes(ssidHexString);
            var ssidNameString = ssidElement?.Descendants(XName.Get("name", Namespace)).FirstOrDefault()?.Value;

            Ssid = new NetworkIdentifier(ssidHexBytes, ssidNameString);

            var connectionTypeString = Root.Descendants(XName.Get("connectionType", Namespace)).FirstOrDefault()?.Value;

            if (!BssTypeConverter.TryParse(connectionTypeString, out BssType bssType))
            {
                return;
            }
            this.BssType = bssType;

            AuthenticationString = Root.Descendants(XName.Get("authentication", Namespace)).FirstOrDefault()?.Value;
            if (!AuthenticationMethodConverter.TryParse(AuthenticationString, out AuthenticationMethod authentication))
            {
                return;
            }
            this.Authentication = authentication;

            EncryptionString = Root.Descendants(XName.Get("encryption", Namespace)).FirstOrDefault()?.Value;
            if (!EncryptionTypeConverter.TryParse(EncryptionString, out EncryptionType encryption))
            {
                return;
            }
            this.Encryption = encryption;

            //Debug.WriteLine("SSID: {0}, BssType: {1}, Authentication: {2}, Encryption: {3}",
            //	Ssid,
            //	BssType,
            //	Authentication,
            //	Encryption);

            _connectionModeElement = Root.Descendants(XName.Get("connectionMode", Namespace)).FirstOrDefault();
            if (_connectionModeElement is null)
            {
                return;
            }

            _autoSwitchElement = Root.Descendants(XName.Get("autoSwitch", Namespace)).FirstOrDefault();

            IsValid = true;
        }
 /// <summary>
 /// Constructor
 /// </summary>
 public AvailableNetworkPack(
     InterfaceInfo interfaceInfo,
     NetworkIdentifier ssid,
     BssType bssType,
     int signalQuality,
     bool isSecurityEnabled,
     string profileName)
 {
     this.Interface         = interfaceInfo;
     this.Ssid              = ssid;
     this.BssType           = bssType;
     this.SignalQuality     = signalQuality;
     this.IsSecurityEnabled = isSecurityEnabled;
     this.ProfileName       = profileName;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public AvailableNetworkPack(
     InterfaceInfo interfaceInfo,
     NetworkIdentifier ssid,
     BssType bssType,
     int signalQuality,
     bool isSecurityEnabled,
     string profileName,
     AuthenticationAlgorithm authenticationAlgorithm,
     CipherAlgorithm cipherAlgorithm)
 {
     this.Interface               = interfaceInfo;
     this.Ssid                    = ssid;
     this.BssType                 = bssType;
     this.SignalQuality           = signalQuality;
     this.IsSecurityEnabled       = isSecurityEnabled;
     this.ProfileName             = profileName;
     this.AuthenticationAlgorithm = authenticationAlgorithm;
     this.CipherAlgorithm         = cipherAlgorithm;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Constructor
 /// </summary>
 public BssNetworkPack(
     InterfaceInfo interfaceInfo,
     NetworkIdentifier ssid,
     BssType bssType,
     NetworkIdentifier bssid,
     int signalStrength,
     int linkQuality,
     int frequency,
     int channel)
 {
     this.Interface      = interfaceInfo;
     this.Ssid           = ssid;
     this.BssType        = bssType;
     this.Bssid          = bssid;
     this.SignalStrength = signalStrength;
     this.LinkQuality    = linkQuality;
     this.Frequency      = frequency;
     this.Channel        = channel;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public AvailableNetworkPack(
     InterfaceConnectionInfo interfaceInfo,
     NetworkIdentifier ssid,
     BssType bssType,
     int signalQuality,
     bool isSecurityEnabled,
     string profileName,
     bool isNetworkConnectable,
     string wlanNotConnectableReason,
     AuthenticationMethod authenticationMethod,
     EncryptionType encryptionType)
 {
     this.Interface                = interfaceInfo;
     this.Ssid                     = ssid;
     this.BssType                  = bssType;
     this.SignalQuality            = signalQuality;
     this.IsSecurityEnabled        = isSecurityEnabled;
     this.ProfileName              = profileName;
     this.NetworkConnectable       = isNetworkConnectable;
     this.WlanNotConnectableReason = wlanNotConnectableReason;
     this.Authentication           = authenticationMethod;
     this.Encryption               = encryptionType;
 }