public override void Redial()
        {
#if !NET_CORE
            AdslCommand adsl = new AdslCommand(Interface, Account, Password);
            adsl.Disconnect();
            while (adsl.Connect() != 0)
            {
                Thread.Sleep(2000);
            }
#else
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                Process process = Process.Start("/sbin/ifdown", "ppp0");
                process.WaitForExit();
                process = Process.Start("/sbin/ifup", "ppp0");
                process.WaitForExit();
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                AdslCommand adsl = new AdslCommand(Interface, Account, Password);
                adsl.Disconnect();
                while (adsl.Connect() != 0)
                {
                    Thread.Sleep(2000);
                }
            }
            else
            {
                throw new RedialException("Unsport this OS.");
            }
#endif
        }
Beispiel #2
0
        private void RedialOnWindows()
        {
            AdslCommand adsl = new AdslCommand(Interface, Account, Password);

            adsl.Disconnect();
            while (adsl.Connect() != 0)
            {
                Thread.Sleep(2000);
            }
        }