示例#1
0
 public void Stop()
 {
     PromptToken?.Cancel();
     ConsoleToken?.Cancel();
     PromptThread?.Abort();
     console_thread?.Abort();
     FreeConsole();
 }
示例#2
0
        public ConsoleToken DoStartupChecks()
        {
            ConsoleToken Reply = new ConsoleToken();

            Reply.Status = IsUserAdministrator();
            if (Reply.Status == false)
            {
                Reply.Message = "This Application Needs to be run as Administrator.";
                return(Reply);
            }
            //put all the startup stuff here
            //read the configuration file for ethernet address guids and mac pool
            //load the pool list into TheModel and the adapters into the Acontroller objects respectively
            Reply.Status = TheModel.bootup();
            if (Reply.Status == false)
            {
                //this is a new installation. or lost conf file. user intervention required.
                Reply.Message = "this is a new installation. or lost conf file. user intervention required.";
                return(Reply);
            }
            //firewall(windows ICS on the main(the internet) ethernet port)
            //also check to make sure that there are 2 adapters up?
            //also make sure that the windows firewall is turned off for the 2 ethernet ports
            Reply.Status = PrepNetworks();
            if (Reply.Status == false)
            {
                Reply.Message = "Could Not prep the networks.";
                return(Reply);
            }
            Reply.Status = PrepAdapters();
            if (Reply.Status == false)
            {
                Reply.Message = "Could Not prep the Adapters.";
                return(Reply);
            }

            //check to make sure winpcap is installed if that can be done.
            if (!File.Exists(@"C:\Program Files\WinPcap\install.log") &&
                !File.Exists(@"C:\Program Files (x86)\WinPcap\install.log"))
            {
                Reply.Status  = false;
                Reply.Message = "WinPCAP installation not found. Please make sure its installed in default location. Also that it startsup automatically at bootup.";
                return(Reply);
            }
            // check pscp(putty) executable is in this directory also. // I could add it as a resource file.
            if (!File.Exists(TheModel.PathName + @"\pscp.exe"))
            {
                Reply.Status  = false;
                Reply.Message = "Missing pscp.exe in the Application Dir";
                return(Reply);
            }
            // If the reply of this function is false then print the reason in a textarea in the app.

            Reply.Message = " Start Checks Successful.  ";
            Reply.Status  = true;
            return(Reply);
        }