Ejemplo n.º 1
0
        public static async Task <bool> DeployNativeLibrariesAsync(List <Tuple <string, string> > files, string remoteDirectory, string propertiesName, RoboRioConnection rioConn)
        {
            List <string> fileList     = new List <string>(files.Count);
            bool          nativeDeploy = false;

            string tempFile = Path.Combine(Path.GetTempPath(), $"{propertiesName}.properties");

            using (FileStream memStream = new FileStream(tempFile, FileMode.Create))
                using (StreamWriter writer = new StreamWriter(memStream))
                {
                    foreach (Tuple <string, string> tuple in files)
                    {
                        fileList.Add(tuple.Item1);
                        await writer.WriteLineAsync($"{tuple.Item1}={tuple.Item2}").ConfigureAwait(false);
                    }

                    writer.Flush();

                    fileList.Add(tempFile);
                }

            await OutputWriter.Instance.WriteLineAsync("Deploying native files").ConfigureAwait(false);

            nativeDeploy = await rioConn.DeployFiles(fileList, remoteDirectory, ConnectionUser.Admin).ConfigureAwait(false);

            // TODO: Figure out why trying to deploy the raw MemoryStream was Deadlocking
            //md5Deploy = await rioConn.DeployFileAsync(memStream, $"{remoteDirectory}/{propertiesName}32.properties", ConnectionUser.Admin).ConfigureAwait(false);
            await rioConn.RunCommandAsync("ldconfig", ConnectionUser.Admin).ConfigureAwait(false);

            try
            {
                File.Delete(tempFile);
            }
            catch (Exception)
            {
            }

            return(nativeDeploy);
        }
Ejemplo n.º 2
0
        public async Task <bool> DeployRobotFilesAsync(List <string> files)
        {
            await OutputWriter.Instance.WriteLineAsync("Deploying robot files").ConfigureAwait(false);

            return(await m_roboRioConnection.DeployFiles(files, DeployProperties.DeployDir, ConnectionUser.LvUser).ConfigureAwait(false));
        }