Пример #1
0
 private bool Start(string ssid, string password, IcsConnection connection, int maxClients)
 {
     try
     {
         Stop();
         wlanManager.SetConnectionSettings(ssid, maxClients);
         wlanManager.SetSecondaryKey(password);
         wlanManager.StartHostedNetwork();
         var privateConnectionGuid = wlanManager.HostedNetworkInterfaceGuid;
         icsManager.EnableIcs(connection.Guid, privateConnectionGuid);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #2
0
        public void EnableIcs(Guid publicGuid, Guid privateGuid)
        {
            if (!this.SharingInstalled)
            {
                throw new Exception("Internet Connection Sharing NOT Installed");
            }

            var connections = this.Connections;

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

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

            this.DisableIcsOnAll();

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