private void AwaitSimulation() { while (true) { if (Closing) { return; } if (RichTextBoxGetText(rtbOutput).Contains("Simulation complete.")) { lock (OutputQueue) { OutputQueue.Enqueue($"\n{(char)27}[36mAveraging data...\n{(char)27}[0m", DateTime.Now.ToBinary()); } DataManipulator.AverageData(Parameters); lock (OutputQueue) { OutputQueue.Enqueue($"{(char)27}[36mScaling data...\n{(char)27}[0m", DateTime.Now.ToBinary()); } DataManipulator.ScaleData(Parameters); lock (OutputQueue) { OutputQueue.Enqueue($"{(char)27}[36mGenerating plots...\n{(char)27}[0m", DateTime.Now.ToBinary()); } SourceGenerator.GeneratePlots(Parameters); BS.SendInput("cd build/scratch/out"); Thread.Sleep(50); foreach (var plot in Parameters.Plots) { BS.SendInput($"gnuplot {plot.EscapedName}.gpl"); Thread.Sleep(500); } lock (OutputQueue) { OutputQueue.Enqueue($"{(char)27}[36mMoving files to local directory...\n{(char)27}[0m", DateTime.Now.ToBinary()); Thread.Sleep(50); } foreach (var file in Directory.GetFiles(Path.Combine(Properties.Settings.Default.NS3Dir, "build/scratch/out"))) { File.Copy(file, Path.Combine($"{Parameters.EscapedName}/output", Path.GetFileName(file))); } lock (OutputQueue) { OutputQueue.Enqueue($"\n{(char)27}[36mJob complete.\n{(char)27}[0m", DateTime.Now.ToBinary()); } return; } Thread.Sleep(100); } }
private void runSimulationToolStripMenuItem_Click(object sender, EventArgs e) { SourceGenerator.GenerateSource(Path.Combine(Properties.Settings.Default.NS3Dir, "scratch", $"{NetworkParameters.EscapedName}.cc"), NetworkParameters, Nodes, Links, Streams, Domains); if (Console == null) { Console = new Console(this, NetworkParameters); Console.Show(); } else { Console.LoadParameters(NetworkParameters); Console.BringToFront(); } }