public async Task StartRobotCodeAsync(string robotName, bool debug, Project robotProject) { //TODO: Make debug work. Forcing debug to false for now so code always runs properly. debug = false; if (SettingsProvider.TeamSettingsPage.Netconsole) { await StartNetConsoleAsync().ConfigureAwait(false); } string deployedCmd; string deployedCmdFrame; if (debug) { deployedCmd = string.Format(DeployProperties.RobotCommandDebug, robotName); deployedCmdFrame = DeployProperties.RobotCommandDebugFileName; } else { deployedCmd = string.Format(DeployProperties.RobotCommand, robotName); deployedCmdFrame = DeployProperties.RobotCommandFileName; } string args = await GetCommandLineArgumentsAsync(robotProject).ConfigureAwait(false); //Kill the currently running robot program await m_roboRioConnection.RunCommandAsync(DeployProperties.KillOnlyCommand, ConnectionUser.LvUser).ConfigureAwait(false); //Combining all other commands, since they should be safe running together. List <string> commands = new List <string>(); //Write the robotCommand file commands.Add($"echo {deployedCmd} {args} > {DeployProperties.CommandDir}/{deployedCmdFrame}"); if (debug) { //If debug write the debug flag. commands.AddRange(DeployProperties.DebugFlagCommand); } //Add all commands to restart commands.AddRange(DeployProperties.DeployKillCommand); //run all commands await m_roboRioConnection.RunCommandsAsync(commands.ToArray(), ConnectionUser.LvUser).ConfigureAwait(false); //Run sync so files are written to disk. await m_roboRioConnection.RunCommandAsync("sync", ConnectionUser.LvUser).ConfigureAwait(false); }