public static async Task <bool> DeployNativeLibraries(List <Tuple <string, string> > files, string remoteDirectory, string propertiesName) { List <string> fileList = new List <string>(files.Count); MemoryStream memStream = new MemoryStream(); StreamWriter writer = new StreamWriter(memStream); foreach (Tuple <string, string> tuple in files) { fileList.Add(tuple.Item1); await writer.WriteLineAsync($"{tuple.Item1}={tuple.Item2}"); } writer.Flush(); memStream.Position = 0; OutputWriter.Instance.WriteLine("Deploying native files"); bool nativeDeploy = await RoboRIOConnection.DeployFiles(fileList, remoteDirectory, ConnectionUser.Admin); bool md5Deploy = await RoboRIOConnection.DeployFile(memStream, $"{remoteDirectory}/{propertiesName}.properties", ConnectionUser.Admin); await RoboRIOConnection.RunCommand("ldconfig", ConnectionUser.Admin); writer.Dispose(); memStream.Dispose(); return(nativeDeploy && md5Deploy); }
public async Task <bool> CheckMonoInstall() { OutputWriter.Instance.WriteLine("Checking for Mono install"); var retVal = await RoboRIOConnection.RunCommand($"test -e {DeployProperties.RoboRioMonoBin}", ConnectionUser.LvUser); return(retVal.ExitStatus == 0); }
public async Task StartRobotCode(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 StartNetConsole(); } 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 = GetCommandLineArguments(robotProject); //Kill the currently running robot program await RoboRIOConnection.RunCommand(DeployProperties.KillOnlyCommand, ConnectionUser.LvUser); //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 RoboRIOConnection.RunCommands(commands.ToArray(), ConnectionUser.LvUser); //Run sync so files are written to disk. await RoboRIOConnection.RunCommand("sync", ConnectionUser.LvUser); }
public async Task CreateMonoDirectory() { OutputWriter.Instance.WriteLine("Creating Mono Deploy Directory"); await RoboRIOConnection.RunCommand($"mkdir -p {DeployProperties.DeployDir}", ConnectionUser.LvUser); }