Exemplo n.º 1
0
        private async Task <ProcessOutput> InvokeJavaTool(ExternalFileType type, string args)
        {
            string path = await _filesDownloader.GetFileLocation(type); // Downloads the file if it hasn't been already

            ProcessOutput output = await InvokeJava($"-jar \"{path}\" {args}");

            _logger.Verbose($"Standard output: {output.StandardOutput}");
            if (output.ErrorOutput.Length > 0)
            {
                _logger.Verbose($"Error output: {output.ErrorOutput}");
            }

            return(output);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Checks if ADB is on PATH, and downloads it if not
        /// </summary>
        public async Task PrepareAdbPath()
        {
            try
            {
                await ProcessUtil.InvokeAndCaptureOutput(_adbExecutableName, "-version");

                // If the ADB EXE is already on PATH, we can just use that
                _adbPath = _adbExecutableName;
                _logger.Information("Located ADB install on PATH");
            }
            catch (Win32Exception) // Thrown if the file we attempted to execute does not exist (on mac & linux as well, despite saying Win32)
            {
                // Otherwise, we download the tool and make it executable (only necessary on mac & linux)
                _adbPath = await _filesDownloader.GetFileLocation(ExternalFileType.PlatformTools); // Download ADB if it hasn't been already
            }
        }