Пример #1
0
 public void stophotspot()
 {
     try
     {
         string argument = "/c netsh wlan stop hostednetwork";
         Process.Start(getstartInfo(argument));
     }
     catch (Exception) { permissionDenied pd = new permissionDenied("stopped"); pd.ShowDialog(); }
 }
Пример #2
0
        public void sethotspot(string _ssid, string _password, bool _presitent)
        {
            try
            {
                Properties.Settings.Default.userssID = _ssid;
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }

            if (_password == null || _password == "")
            {
                if (MessageBox.Show("Ich würde ein Passwort empfehlen.\nTrotzdem fortfahren?", "Sicherheitsmeldung?", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                {
                    //do no stuff
                }
                else
                {
                    try
                    {
                        Properties.Settings.Default.userpassword = "";

                        if (_presitent == false)
                        {
                            argument = "/c netsh wlan set hostednetwork mode=allow ssid= " + Properties.Settings.Default.userssID + " key=" + Properties.Settings.Default.userpassword + " keyUsage=temporaray";
                        }
                        else
                        {
                            argument = "/c netsh wlan set hostednetwork mode=allow ssid= " + Properties.Settings.Default.userssID + " key=" + Properties.Settings.Default.userpassword + " keyUsage=persistent";
                        }

                        Process.Start(getstartInfo(argument));
                    }
                    catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                }
            }
            else
            {
                Properties.Settings.Default.userpassword = _password;

                if (_presitent == false)
                {
                    argument = "/c netsh wlan set hostednetwork mode=allow ssid=" + Properties.Settings.Default.userssID + " key=" + Properties.Settings.Default.userpassword + " keyUsage=temporaray";
                }
                else
                {
                    argument = "/c netsh wlan set hostednetwork mode=allow ssid=" + Properties.Settings.Default.userssID + " key=" + Properties.Settings.Default.userpassword + " keyUsage=persistent";
                }

                try
                {
                    Process.Start(getstartInfo(argument));
                }
                catch (Exception) { permissionDenied pd = new permissionDenied("set"); pd.ShowDialog(); }
            }
        }