/// <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."); } }
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; } }
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; } }