public PackageUpdater(IPlugInContext context, IAutoUpdateServiceHttpClient httpClient) : base(context) { int minuteInterval = Utility.ParseInteger(_config[ConfigConstants.INTERVAL], 60); //Default to 60 minutes if (minuteInterval < 1) { minuteInterval = 1; //Set minimum to 1 minutes } this.Interval = TimeSpan.FromMinutes(minuteInterval); this.httpClient = httpClient; this.PackageVersion = Utility.ResolveVariables(_config[PACKAGE_VERSION], Utility.ResolveVariable); (this.credential, this.region) = AWSUtilities.GetAWSCredentialsRegion(context); this.productKey = _config[PRODUCT_KEY]; this.ring = _config[RING]; if (this.PackageVersion.Contains("execute-api")) // check if using AutoUpdate service { if (this.credential == null || this.region == null || string.IsNullOrWhiteSpace(this.productKey) || string.IsNullOrWhiteSpace(this.ring)) { _logger.LogError("AccessKey, SecretKey, Region, ProductKey and Ring can't be empty."); throw new Exception("AccessKey, SecretKey, Region, ProductKey and Ring can't be empty."); } } if (!int.TryParse(_config[ConfigConstants.DOWNLOAD_NETWORK_PRIORITY], out _downloadNetworkPriority)) { _downloadNetworkPriority = ConfigConstants.DEFAULT_NETWORK_PRIORITY; } }
public PackageUpdater(IPlugInContext context, IAutoUpdateServiceHttpClient httpClient, IPackageInstaller packageInstaller) : base(context) { int minuteInterval = Utility.ParseInteger(_config[ConfigConstants.INTERVAL], 60); //Default to 60 minutes if (minuteInterval < 1) { minuteInterval = 1; //Set minimum to 1 minutes } Interval = TimeSpan.FromMinutes(minuteInterval); this.httpClient = httpClient; this.packageInstaller = packageInstaller; PackageVersion = Utility.ResolveVariables(_config[PACKAGE_VERSION], Utility.ResolveVariable); (credential, region) = AWSUtilities.GetAWSCredentialsRegion(context); productKey = _config[PRODUCT_KEY]; deploymentStage = _config[DEPLOYMENT_STAGE]; if (PackageVersion.Contains("execute-api")) // check if using AutoUpdate service { if (credential == null || string.IsNullOrWhiteSpace(productKey) || string.IsNullOrWhiteSpace(deploymentStage)) { _logger.LogError("credential, productKey and deploymentStage can't be empty."); throw new Exception("credential, productKey and deploymentStage can't be empty."); } } if (!int.TryParse(_config[ConfigConstants.DOWNLOAD_NETWORK_PRIORITY], out _downloadNetworkPriority)) { _downloadNetworkPriority = ConfigConstants.DEFAULT_NETWORK_PRIORITY; } }
public AutoUpdateServiceClient(IAutoUpdateServiceHttpClient httpClient) { this.httpClient = httpClient; }