예제 #1
0
        /// <summary>
        /// WifiHost参数初始化
        /// </summary>
        /// <param name="ssid"></param>
        /// <param name="password"></param>
        /// <param name="maxClients">最大客户端数</param>
        /// <param name="sharingConnection">共享连接</param>
        public void Init(string ssid, string password, int maxClients, SharingConnection sharingConnection)
        {
            this.ssid              = ssid;
            this.password          = password;
            this.sharingConnection = sharingConnection;
            this.maxClients        = maxClients;
            string error = ValidateFields();

            if (error != string.Empty)
            {
                throw new Exception(error);
            }
        }
예제 #2
0
        public void EnableIcs(Guid publicGuid, Guid privateGuid)
        {
            if (!this.SharingInstalled)
            {
                throw new Exception("Internet Connection Sharing NOT Installed");
            }

            var connections = this.Connections;

            SharingConnection publicConn = (from c in connections
                                            where c.IsMatch(publicGuid)
                                            select c).First();

            SharingConnection privateConn = (from c in connections
                                             where c.IsMatch(privateGuid)
                                             select c).First();

            this.DisableIcsOnAll();

            publicConn.EnableAsPublic();
            privateConn.EnableAsPrivate();
        }