Ejemplo n.º 1
0
        public async Task <PluginPath> InstallPluginAsync(
            PluginId pluginId,
            TempFile tempFile,
            PluginPackageType packageType,
            CancellationToken cancellationToken)
        {
            var installDirectory = GetInstallDirectory(pluginId);

            _logger.Verbose($"Installing plugin '{pluginId}' into '{installDirectory}'");

            switch (packageType)
            {
            case PluginPackageType.Zip:
            {
                await tempFile.ExtractZipAsync(installDirectory, cancellationToken).ConfigureAwait(false);

                var pluginDll = Path.Combine(installDirectory, $"{pluginId}.dll");
                _logger.Verbose($"Guessing that plugin location is '{pluginDll}'");
                return(new PluginPath(pluginDll));
            }

            default:
                throw new ArgumentOutOfRangeException(nameof(packageType), packageType, null);
            }
        }
Ejemplo n.º 2
0
        public async Task<PluginPath> InstallPluginAsync(
            PluginId pluginId,
            TempFile tempFile,
            PluginPackageType packageType,
            CancellationToken cancellationToken)
        {
            var installDirectory = GetInstallDirectory(pluginId);

            _logger.Verbose($"Installing plugin '{pluginId}' into '{installDirectory}'");

            switch (packageType)
            {
                case PluginPackageType.Zip:
                    {
                        await tempFile.ExtractZipAsync(installDirectory, cancellationToken).ConfigureAwait(false);
                        var pluginDll = Path.Combine(installDirectory, $"{pluginId}.dll");
                        _logger.Verbose($"Guessing that plugin location is '{pluginDll}'");
                        return new PluginPath(pluginDll);
                    }
                default:
                    throw new ArgumentOutOfRangeException(nameof(packageType), packageType, null);
            }
        }
Ejemplo n.º 3
0
 public PluginPackage(String id, String name, Version version, Version target, PluginPackageType type)
 {
     this.Id      = id;
     this.Name    = name;
     this.Version = version;
     this.Target  = target;
     this.Type    = type;
 }