예제 #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 { }
                }
            }
        }