Exemplo n.º 1
0
        /// <inheritdoc />
        public IInstallerFileBundleProvider Create(IInstallerFileBundleProviderConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            switch (configuration.ProviderType)
            {
            case "Disk": return(new DiskInstallerFileBundleProvider(configuration));

            case "GitHub": return(new GitHubInstallerFileBundleProvider(configuration));

            default: throw new NotSupportedException($"Provider type {configuration.ProviderType} is not supported.");
            }
        }
Exemplo n.º 2
0
        public DiskInstallerFileBundleProvider(IInstallerFileBundleProviderConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (configuration.ProviderType != ProviderType)
            {
                throw new ArgumentException($"Invalid provider type (expected \"{ProviderType}\", got \"{configuration.ProviderType}\"", nameof(configuration));
            }

            if (configuration.Parameters.TryGetValue(nameof(Path), out var path))
            {
                Path = path;
            }
        }
Exemplo n.º 3
0
        public GitHubInstallerFileBundleProvider(IInstallerFileBundleProviderConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (configuration.ProviderType != ProviderType)
            {
                throw new ArgumentException($"Invalid provider type (expected \"{ProviderType}\", got \"{configuration.ProviderType}\"", nameof(configuration));
            }

            if (configuration.Parameters.TryGetValue(nameof(Repository), out var repository))
            {
                Repository = repository;
            }
        }