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);
        }
Beispiel #2
0
        public async Task CreateMonoDirectoryAsync()
        {
            await OutputWriter.Instance.WriteLineAsync("Creating Mono Deploy Directory").ConfigureAwait(false);

            await m_roboRioConnection.RunCommandAsync($"mkdir -p {DeployProperties.DeployDir}", ConnectionUser.LvUser).ConfigureAwait(false);
        }