/// <summary> /// Only for testing. Testing "fake" IE Cache or "fake" server response /// </summary> /// <param name="requestor"></param> /// <param name="theRegistryTools"></param> /// <param name="hostId"></param> /// <param name="baseUrl"></param> /// <param name="relativePath"></param> /// <param name="pollingIntervalMins"></param> /// <param name="httpRequestTimeoutSeconds"></param> /// <param name="maxRandomDownloadDelaySeconds"></param> internal RemoteControlClient(IRemoteControlHTTPRequestor requestor, IRegistryTools theRegistryTools, string hostId, string baseUrl, string relativePath, int pollingIntervalMins = 1380, int httpRequestTimeoutSeconds = 60, int maxRandomDownloadDelaySeconds = 0) : this(theRegistryTools, hostId, baseUrl, relativePath, pollingIntervalMins) { this.maxRandomDownloadDelaySeconds = maxRandomDownloadDelaySeconds; this.requestor = requestor; cacheUpdateTimer = new Timer(delegate(object o) { CacheUpdateTimerCallback(o, cancellationToken.Token).SwallowException(); }, null, -1, -1); }
/// <summary> /// Creates the client and starts polling. /// </summary> /// <param name="hostId">HostId of the settings file (used to construct URL to the file: /// [baseUrl]/[hostId]/[relativePath]).</param> /// <param name="baseUrl">Base URL of the service e.g. https://az700632.vo.msecnd.net</param> /// <param name="relativePath">Relative path used to contruct the full URL to the file: /// [baseUrl]/[hostId]/[relativePath]</param> /// <param name="pollingIntervalMins">Optional. Default = 1440 minutes (24 hours). Min allowed = 5 minutes. /// Polling Interval (in minutes) to check the file on the server when the last request to the server /// succeeded.</param> /// <param name="theHttpRequestTimeoutSeconds">Optional. Default = 60 seconds. Maximum allowed = 60 seconds. /// HTTP request timeout used.</param> /// <param name="overrideReadFileTelemetryFrequency">Optional. Allows to set how often to send successful /// ReadFile telemetry, to prevent noise events Default = 1 (meaning post ReadFile telemetry every time). Min /// allowed is 1.</param> public RemoteControlClient(string hostId, string baseUrl, string relativePath, int pollingIntervalMins = 1380, int theHttpRequestTimeoutSeconds = 60, int overrideReadFileTelemetryFrequency = 1) : this(new RegistryTools(), hostId, baseUrl, relativePath, pollingIntervalMins) { if (!Uri.IsLocalFile) { httpRequestTimeoutSeconds = Math.Min(60, theHttpRequestTimeoutSeconds); if (!isDisabled) { requestor = new RemoteControlHTTPRequestor(FullUrl, httpRequestTimeoutSeconds * 1000); cacheUpdateTimer = new Timer(delegate(object o) { CacheUpdateTimerCallback(o, cancellationToken.Token).SwallowException(); }); cacheUpdateTimer.Change(0, -1); } } else { fileReader = new FileReader(FullUrl); } }