Example #1
0
        // download a log file from a Tizen device, change LF to CR LF, and remove the file from the target
        protected void DownloadAndDeleteOnTargetLogFile(string sourceLogPathName, string destinationLogFileName)
        {
            if (!String.IsNullOrEmpty(SessionDirectory))
            {
                string tempFileName = Path.GetTempFileName();
                try
                {
                    if (DownloadFile(sourceLogPathName, tempFileName))
                    {
                        string errorString;
                        FileHelper.CopyToWindowsText(tempFileName, Path.Combine(SessionDirectory, destinationLogFileName));
                        bool successResult;

                        if (_isSecureProtocol)
                        {
                            string profilerName = _profilerNameFromLogPattern.Match(sourceLogPathName).Groups[1].Value;
                            successResult = SDBLib.RunSdbShellSecureCommand(_selectedDevice, $"vs_profiler_log_remove {profilerName}", null, out errorString);
                        }
                        else
                        {
                            successResult = SDBLib.RunSdbShellCommand(_selectedDevice, $"rm -f {sourceLogPathName}", null, out errorString);
                        }
                        if (!successResult)
                        {
                            WriteToOutput(Tizen.VisualStudio.Utilities.StringHelper.CombineMessages(
                                              "Cannot execute command.", errorString));
                        }
                    }
                }
                finally
                {
                    try { File.Delete(tempFileName); } catch { }
                }
            }
        }
        private bool InstallPackage(string tarPath, out string errorMessage)
        {
            string sdkToolPath = sdbCapability.GetValueByKey("sdk_toolpath");
            string errorString;

            SDBLib.RunSdbShellCommand(null, $"rm -rf {sdkToolPath}/{pkgName}", null, out errorString); // remove old files (if any)
            return(DeployHelper.ExtractTarGzip(null, tarPath, sdkToolPath, out errorMessage));
        }