public void Start(string hostName, bool isDisposing) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown if (!isStarted) { if (settings == null) { settings = new TelemetryManifestManagerSettings(hostName); } if (remoteControlClient == null) { remoteControlClient = (IRemoteControlClient)(object)new RemoteControlClient(settings.HostId, settings.BaseUrl, settings.RelativePath, (int)DownloadInterval.TotalMinutes, 60, 6); } if (!isDisposing) { CancellationToken token = tokenSource.Token; Func <Task> actionTask = async delegate { if (!token.IsCancellationRequested) { await Check((BehaviorOnStale)0, token).ConfigureAwait(false); if (!token.IsCancellationRequested && CurrentManifest == null) { await Check((BehaviorOnStale)2, token).ConfigureAwait(false); } } }; scheduler.Schedule(actionTask, token); scheduler.ScheduleTimed((Func <Task>)Check); } isStarted = true; } }
/// <summary>Returns 'null' if download is not available and caller should keep polling.</summary> private async Task <XElement> TryDownloadFileAsync(IRemoteControlClient client) { _service.LogInfo("Read file from client"); // "ReturnsNull": Only return a file if we have it locally *and* it's not older than our polling time (1 day). using (var stream = await client.ReadFileAsync(__VsRemoteControlBehaviorOnStale.ReturnsNull).ConfigureAwait(false)) { if (stream == null) { _service.LogInfo("Read file completed. Client returned no data"); return(null); } _service.LogInfo("Read file completed. Client returned data"); _service.LogInfo("Converting data to XElement"); // We're reading in our own XML file, but even so, use conservative settings // just to be on the safe side. First, disallow DTDs entirely (we will never // have one ourself). And also, prevent any external resolution of files when // processing the xml. var settings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null }; using (var reader = XmlReader.Create(stream, settings)) { var result = XElement.Load(reader); _service.LogInfo("Converting data to XElement completed"); return(result); } } }
private async Task <XElement> TryDownloadFileAsync(IRemoteControlClient client, CancellationToken cancellationToken) { await LogInfoAsync("Read file from client", cancellationToken).ConfigureAwait(false); using var stream = await client.ReadFileAsync(BehaviorOnStale.ReturnStale).ConfigureAwait(false); if (stream == null) { await LogInfoAsync("Read file completed. Client returned no data", cancellationToken).ConfigureAwait(false); return(null); } await LogInfoAsync("Read file completed. Client returned data", cancellationToken).ConfigureAwait(false); await LogInfoAsync("Converting data to XElement", cancellationToken).ConfigureAwait(false); // We're reading in our own XML file, but even so, use conservative settings // just to be on the safe side. First, disallow DTDs entirely (we will never // have one ourself). And also, prevent any external resolution of files when // processing the XML. var settings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null }; using var reader = XmlReader.Create(stream, settings); var result = XElement.Load(reader); await LogInfoAsync("Converting data to XElement completed", cancellationToken).ConfigureAwait(false); return(result); }
public TelemetryManifestManager(IRemoteControlClient theRemoteControlClient, ITelemetryManifestManagerSettings theSettings, ITelemetryManifestParser theManifestParser, ITelemetryScheduler theScheduler, TelemetrySession theMainSession) { CodeContract.RequiresArgumentNotNull <ITelemetryManifestParser>(theManifestParser, "theManifestParser"); CodeContract.RequiresArgumentNotNull <ITelemetryScheduler>(theScheduler, "theScheduler"); CodeContract.RequiresArgumentNotNull <TelemetrySession>(theMainSession, "theMainSession"); manifestParser = theManifestParser; scheduler = theScheduler; scheduler.InitializeTimed(ReadInterval); mainSession = theMainSession; remoteControlClient = theRemoteControlClient; settings = theSettings; RemoteControlClient.TelemetryLogger2 = ((Action <string, IDictionary <string, object>, IDictionary <string, object> >) delegate(string eventName, IDictionary <string, object> properties, IDictionary <string, object> piiProperties) { TelemetryEvent telemetryEvent = new TelemetryEvent(eventName); DictionaryExtensions.AddRange <string, object>(telemetryEvent.Properties, properties, true); DictionaryExtensions.AddRange <string, object>(telemetryEvent.Properties, (IDictionary <string, object>)((IEnumerable <KeyValuePair <string, object> >)piiProperties).ToDictionary((Func <KeyValuePair <string, object>, string>)((KeyValuePair <string, object> p) => p.Key), (Func <KeyValuePair <string, object>, object>)((KeyValuePair <string, object> p) => new TelemetryPiiProperty(p.Value))), true); mainSession.PostEvent(telemetryEvent); }); }
public FlightsRemoteFileReader(IRemoteControlClient remoteControlClient) { CodeContract.RequiresArgumentNotNull <IRemoteControlClient>(remoteControlClient, "remoteControlClient"); this.remoteControlClient = remoteControlClient; }
/// <summary>Returns 'null' if download is not available and caller should keep polling.</summary> private async Task<XElement> TryDownloadFileAsync(IRemoteControlClient client) { _service.LogInfo("Read file from client"); // "ReturnsNull": Only return a file if we have it locally *and* it's not older than our polling time (1 day). using (var stream = await client.ReadFileAsync(__VsRemoteControlBehaviorOnStale.ReturnsNull).ConfigureAwait(false)) { if (stream == null) { _service.LogInfo("Read file completed. Client returned no data"); return null; } _service.LogInfo("Read file completed. Client returned data"); _service.LogInfo("Converting data to XElement"); // We're reading in our own XML file, but even so, use conservative settings // just to be on the safe side. First, disallow DTDs entirely (we will never // have one ourself). And also, prevent any external resolution of files when // processing the xml. var settings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null }; using (var reader = XmlReader.Create(stream, settings)) { var result = XElement.Load(reader); _service.LogInfo("Converting data to XElement completed"); return result; } } }
public ClientHotReloadProcessor(IRemoteControlClient rcClient) { _rcClient = rcClient; }
public ClientHotReloadProcessor(IRemoteControlClient rcClient) { _rcClient = rcClient; InitializeMetadataUpdater(); }