Exemple #1
0
    static void RunAndDownload(SfbClient _net, string shortName, string directoryName, JobEntry je)
    {
        je.RunAndDownloadIsActive = true;
        string errortext = null;

        _net.Run(je.filetype, shortName, je, ref errortext);

        if (errortext == "Maximum number of concurrent jobs exceeded.")
        {
            _net.Disconnect();
            je.WriteToLog(errortext.ToLower());
            je.SetStatus(Status.schedulerequest);
        }
        else if (errortext != null)
        {
            _net.Disconnect();
            MessageBoxShow(je._houston, errortext, "Run error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        else
        {
            _net.GetFinalStatus();
            je.SetCpuAndMem();

            _net.Download(je.DirectoryName);
            //je.WriteToLog("downloading finished");
            _net.Disconnect();
            if (je.stat == Status.aborted)
            {
                je.WriteToLog("abort completed");
            }
        }
    }
Exemple #2
0
    public string Connect(string host, int port, FileType ftype)
    {
        lock (this)
        {
            string image;

            io = new ServerIO();
            lock (io)
            {
                if (io.Connect(host, port) && (image = io.ReadLine()) != null)
                {
                    if (image.Substring(0, 1) == "-")
                    {
                        Disconnect();
                        return(image.Substring(5));
                    }
                    else
                    {
                        string[] s = image.Substring(5).Split();
                        pid     = s[0];
                        pincode = s[1];
                    }
                }
                else
                {
                    return("Connection to the primary server failed.\r\n\r\nHost " + host + "\r\nPort " + port.ToString());
                }

                io.WriteLine("VERSION 0.3");
                image = io.ReadLine();
                if (image.Substring(0, 1) == "+")
                {
                    server_version = image.Substring(5);

                    io.WriteLine("HOST");
                    image = io.ReadLine();
                    if (image.Substring(0, 1) == "+")
                    {
                        je.WriteToLog("connected to " + image.Substring(5));
                        je.SubItems[(int)Display.where].Text = image.Substring(5);
                    } // else ignore the error

                    je.WriteToLog("server version " + server_version);
                }
                else
                {
                    Disconnect();
                    return(image.Substring(5));
                }

                io.WriteLine(string.Format("CLIENT {0} {1}", Application.ProductName, Houston.HoustonVersion.ToString()));
                image = io.ReadLine();

                io.WriteLine("USER " + Environment.UserName);
                image = io.ReadLine();

                if (!SupportedFileType(ftype))
                {
                    Disconnect();
                    return("The required program is not installed on this server");
                }
            }

            io2 = new ServerIO();
            if (io2.Connect(host, port) && (image = io2.ReadLine()) != null)
            {
                if (image.Substring(0, 1) == "-")
                {
                    Disconnect();
                    return(image.Substring(5));
                } //else ignore pid/pin
            }
            else
            {
                return("Connection to secondary server failed.\r\n\r\nHost " + host + "\r\nPort " + port.ToString());
            }

            io2.WriteLine("VERSION -0.3");
            image = io2.ReadLine();
            if (image.Substring(0, 1) == "+")
            {
            }
            else
            {
                Disconnect();
                return(image.Substring(5));
            }

            io2.WriteLine("PID " + pid);
            io2.ReadLine();
            io2.WriteLine("PIN " + pincode);
            io2.ReadLine();

            return(null);
        }
    }