private void RemoteCompileMC(SfbClient _net) { string[] sources = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.f90", SearchOption.TopDirectoryOnly); if (sources.Length > 0 && _net.ServerVersionIsAtLeast("0.8") && _net.SupportedFileType(FileType.mccompile)) { string errortext = null; foreach (string source in sources) { WriteToLog(string.Format("uploaded {0}", _net.SendFile(new FileInfo(source)))); } SetStartTime(DateTime.Now); SetStatus(Status.compiling); // Compileer op de gui thread (hoort eigenlijk niet) _net.Run(FileType.mccompile, "mc.f90", this, ref errortext); if (errortext != null) { MessageBox.Show(errortext, "Server error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (sources.Length > 0) { MessageBox.Show("There are source files found with your input file. \r\nHowever, " + SubItems[(int)Display.where].Text + " does not support remote compiling.", "Server error", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void StartRemoteJob() { string error; _checkInputFile = false; _theTabs.SelectedTab = _tabLog; _log.Text = ""; Interlocked.Increment(ref Scheduler.numNetJobsRunning); //_houston.SetStatusBarText(Scheduler.numJobsRunning.ToString()); _job = null; _net = new SfbClient(this); SetSubItem(Display.cpu, "0.0s"); SetSubItem(Display.mem, "0kb"); if ((error = _net.Connect(remotehost, remoteport, filetype)) == null) { string requiredversion = ""; if (filetype == FileType.sfbox && _net.ServerVersionIsAtLeast(requiredversion = "0.5") || (filetype == FileType.mcrenko || filetype == FileType.ctb) && _net.ServerVersionIsAtLeast(requiredversion = "0.7")) { this._houston.AddtoRegistry(remotehost, remoteport); ArrayList news = _net.GetNews(); string shortName = _net.SendInputFile(FullName); if (filetype == FileType.mcrenko) { RemoteCompileMC(_net); } SetStartTime(DateTime.Now); SetStatus(Status.running); RunDelegate run = new RunDelegate(RunAndDownload); AsyncCallback myAsyncCallback = new AsyncCallback(NetHasExited); run.BeginInvoke(_net, shortName, DirectoryName, this, myAsyncCallback, null); PopupMessages(news); } else { SetStatus(Status.aborted); MessageBox.Show("You need at least server version " + requiredversion + " for what you are trying to do.", "Server error", MessageBoxButtons.OK, MessageBoxIcon.Error); Interlocked.Decrement(ref Scheduler.numNetJobsRunning); } } else { SetStatus(Status.aborted); MessageBox.Show("Server connection error:\n\n" + error, "Server error", MessageBoxButtons.OK, MessageBoxIcon.Error); _log.AppendText("\r\nCould not connect: " + error); Interlocked.Decrement(ref Scheduler.numNetJobsRunning); //_houston.SetStatusBarText(Scheduler.numJobsRunning.ToString()); } }