示例#1
0
 private bool IsValidLocalConnection(string name, string path)
 {
     try {
         var info = _installationService.CreateInfo(name, path);
         return(info.VerifyInstallation());
     } catch (Exception ex) when(!ex.IsCriticalException())
     {
         _log.Write(LogVerbosity.Normal, MessageCategory.Error, ex.Message);
     }
     return(false);
 }
示例#2
0
        private IEnumerable <Interpreter> GetInterpreters()
        {
            if (_options.AutoDetect)
            {
                _logger.LogTrace(Resources.Trace_AutoDetectingR);

                var engines = _installationService.GetCompatibleEngines().AsList();
                if (engines.Any())
                {
                    var interpreterId = 0;
                    foreach (var e in engines)
                    {
                        var detected = new Interpreter(this, Invariant($"{interpreterId++}"), e.Name, e.InstallPath, e.BinPath, e.Version);
                        _logger.LogTrace(Resources.Trace_DetectedR, detected.Version, detected.Path);
                        yield return(detected);
                    }
                }
                else
                {
                    _logger.LogWarning(Resources.Error_NoRInterpreters);
                }
            }

            foreach (var kv in _options.Interpreters)
            {
                string             id      = kv.Key;
                InterpreterOptions options = kv.Value;

                if (!string.IsNullOrEmpty(options.BasePath) && _fs.DirectoryExists(options.BasePath))
                {
                    var interpInfo = _installationService.CreateInfo(string.Empty, options.BasePath);
                    if (interpInfo.VerifyInstallation())
                    {
                        yield return(new Interpreter(this, id, options.Name, interpInfo.InstallPath, interpInfo.BinPath, interpInfo.Version));

                        continue;
                    }
                }

                _logger.LogError(Resources.Error_FailedRInstallationData, options.Name ?? id, options.BasePath);
            }
        }
示例#3
0
        private IEnumerable <Interpreter> GetInterpreters()
        {
            foreach (var kv in _options.Interpreters)
            {
                var id      = kv.Key;
                var options = kv.Value;

                if (!string.IsNullOrEmpty(options.BasePath) && _fs.DirectoryExists(options.BasePath))
                {
                    var interpInfo = _installationService.CreateInfo(string.Empty, options.BasePath);
                    if (interpInfo != null && interpInfo.VerifyInstallation())
                    {
                        yield return(new Interpreter(id, options.Name, interpInfo));

                        continue;
                    }
                }

                _logger.LogError(Resources.Error_FailedRInstallationData, options.Name ?? id, options.BasePath);
            }
        }