// Token: 0x06000BF0 RID: 3056 RVA: 0x00031590 File Offset: 0x0002F790 internal void ExecuteDownload(DownloadApp downloadApp) { if (this.downloadQueue.Count > 0) { UpdateRequestAsset updateRequestAsset = this.downloadQueue.Dequeue(); if (this.CacheSatisfiesRequest(updateRequestAsset, this.extensionUpdates)) { GetUpdates.Tracer.TraceDebug <string>(0L, "GetUpdates.ExecuteDownload: Asset {0} satisfied from cache; getting next asset to download", updateRequestAsset.MarketplaceAssetID); this.ExecuteDownload(downloadApp); return; } GetUpdates.Tracer.TraceDebug <string>(0L, "GetUpdates.ExecuteDownload: Downloading {0}", updateRequestAsset.MarketplaceAssetID); this.currentDownloadAppId = updateRequestAsset.ExtensionID; downloadApp.Execute(updateRequestAsset, this.queryContext.DeploymentId, new BaseAsyncCommand.GetLoggedMailboxIdentifierCallback(this.GetLoggedMailboxIdentifier), new DownloadApp.SuccessCallback(this.DownloadAppSuccessCallback), new BaseAsyncCommand.FailureCallback(this.DownloadAppFailureCallback)); return; } else { GetUpdates.Tracer.TraceDebug(0L, "GetUpdates.ExecuteDownload: Downloads complete."); if (this.extensionUpdates.Count > 0) { this.InstallExtensionUpdates(this.extensionUpdates, this.queryContext); return; } this.ExecuteNextUpdateQuery(); return; } }
// Token: 0x06000BF2 RID: 3058 RVA: 0x00031700 File Offset: 0x0002F900 private void DownloadAppSuccessCallback(ExtensionData extensionData, Uri downloadAppUri) { GetUpdates.Tracer.TraceDebug <string>(0L, "GetUpdates.DownloadAppSuccessCallback called for asset {0}", extensionData.MarketplaceAssetID); UpdateRequestAsset updateRequestAsset = null; if (this.IsValidUpdate(extensionData, downloadAppUri, out updateRequestAsset)) { this.extensionsCache.Add(extensionData, updateRequestAsset.State); this.extensionUpdates.Add(extensionData); } this.ExecuteDownload(this.downloadApp); }
// Token: 0x06000BEB RID: 3051 RVA: 0x00030E40 File Offset: 0x0002F040 internal Queue <UpdateRequestAsset> BuildDownloadQueue(List <AppStateResponseAsset> appStateResponses, Uri appStateUri, List <ExtensionData> updates) { Queue <UpdateRequestAsset> queue = new Queue <UpdateRequestAsset>(appStateResponses.Count); foreach (AppStateResponseAsset appStateResponseAsset in appStateResponses) { UpdateRequestAsset updateRequestAsset = null; if (!this.updateRequestAssets.TryGetValue(appStateResponseAsset.MarketplaceAssetID, out updateRequestAsset)) { GetUpdates.Tracer.TraceError <string, string>(0L, "GetUpdates.GetAppStateSuccessCallback: Asset returned in AppState response will not be downloaded. Asset ID does not match any value requested. Response Asset ID: {0} Response Extension ID: {1}", appStateResponseAsset.MarketplaceAssetID, appStateResponseAsset.ExtensionID); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_InvalidAssetIDReturnedByAppState, appStateResponseAsset.MarketplaceAssetID, new object[] { "ProcessUpdates", this.GetLoggedMailboxIdentifier(), appStateResponseAsset.MarketplaceAssetID, appStateUri }); } else if (!this.CacheSatisfiesRequest(updateRequestAsset, updates)) { if (appStateResponseAsset.ExtensionID != updateRequestAsset.ExtensionID) { GetUpdates.Tracer.TraceError <string, string, string>(0L, "GetUpdates.GetAppStateSuccessCallback: Asset returned in AppState response will not be downloaded. Extension ID does not match expected value. Asset ID: {0} Response: {1} Expected: {2}", appStateResponseAsset.MarketplaceAssetID, appStateResponseAsset.ExtensionID, updateRequestAsset.ExtensionID); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_MismatchedExtensionIDReturnedByAppState, appStateResponseAsset.MarketplaceAssetID, new object[] { "ProcessUpdates", this.GetLoggedMailboxIdentifier(), appStateResponseAsset.MarketplaceAssetID, appStateUri, updateRequestAsset.ExtensionID, appStateResponseAsset.ExtensionID }); } else if (appStateResponseAsset.State != null && appStateResponseAsset.Version != null && (appStateResponseAsset.Version == updateRequestAsset.Version || !GetUpdates.IsValidUpdateState(appStateResponseAsset.State))) { this.extensionsCache.Update(appStateResponseAsset); } else if (GetUpdates.IsValidUpdateState(appStateResponseAsset.State) && appStateResponseAsset.Version != null && appStateResponseAsset.Version > updateRequestAsset.Version) { GetUpdates.Tracer.TraceDebug <string>(0L, "GetUpdates.GetAppStateSuccessCallback: Add asset {0} to download queue", appStateResponseAsset.MarketplaceAssetID); updateRequestAsset.State = appStateResponseAsset.State.Value; queue.Enqueue(updateRequestAsset); } else { GetUpdates.Tracer.TraceDebug <string, OmexConstants.AppState?, Version>(0L, "GetUpdates.GetAppStateSuccessCallback: Asset returned in AppState response will not be downloaded. Asset ID: {0} State: {1} Version: {2}", appStateResponseAsset.MarketplaceAssetID, appStateResponseAsset.State, appStateResponseAsset.Version); } } } return(queue); }
// Token: 0x06000BF4 RID: 3060 RVA: 0x00031770 File Offset: 0x0002F970 internal bool IsValidUpdate(ExtensionData extensionData, Uri downloadAppUri, out UpdateRequestAsset requestAsset) { bool flag = false; bool flag2 = false; UpdateRequestAsset updateRequestAsset = null; if (!this.updateRequestAssets.TryGetValue(extensionData.MarketplaceAssetID, out updateRequestAsset)) { GetUpdates.Tracer.TraceError <string, string>(0L, "GetUpdates.IsValidUpdate: Asset returned in AppState response will not be downloaded. Asset ID does not match any value requested. Response Asset ID: {0} Response Extension ID: {1}", extensionData.MarketplaceAssetID, extensionData.ExtensionId); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_InvalidAssetIDReturnedInDownload, extensionData.MarketplaceAssetID, new object[] { "ProcessUpdates", this.GetLoggedMailboxIdentifier(), extensionData.MarketplaceAssetID, downloadAppUri }); } else if (extensionData.ExtensionId != updateRequestAsset.ExtensionID) { GetUpdates.Tracer.TraceError <string, string, string>(0L, "GetUpdates.IsValidUpdate: Asset returned in download response will not be installed. Extension ID does not match expected value. Asset ID: {0} Response: {1} Expected: {2}", extensionData.MarketplaceAssetID, extensionData.ExtensionId, updateRequestAsset.ExtensionID); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_MismatchedExtensionIDReturnedInDownload, extensionData.MarketplaceAssetID, new object[] { "ProcessUpdates", this.GetLoggedMailboxIdentifier(), extensionData.MarketplaceAssetID, downloadAppUri, updateRequestAsset.ExtensionID, extensionData.ExtensionId }); } else if (extensionData.Version == null || extensionData.Version <= updateRequestAsset.Version) { GetUpdates.Tracer.TraceError <string, string, Version>(0L, "GetUpdates.IsValidUpdate: Asset returned in download response will not be installed. Version is not newer. Asset ID: {0} Response: {1} Request: {2}", extensionData.MarketplaceAssetID, extensionData.VersionAsString, updateRequestAsset.Version); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_OldVersionReturnedInDownload, extensionData.MarketplaceAssetID, new object[] { "ProcessUpdates", this.GetLoggedMailboxIdentifier(), extensionData.MarketplaceAssetID, downloadAppUri, updateRequestAsset.Version, extensionData.VersionAsString }); } else if (ExtensionData.CompareCapabilities(extensionData.RequestedCapabilities.Value, updateRequestAsset.RequestedCapabilities) > 0) { GetUpdates.Tracer.TraceError <string, RequestedCapabilities?, RequestedCapabilities>(0L, "GetUpdates.IsValidUpdate: Asset update requires more capabilities than installed asset. Asset ID: {0} Update: {1} Installed: {2}", extensionData.MarketplaceAssetID, extensionData.RequestedCapabilities, updateRequestAsset.RequestedCapabilities); flag2 = true; ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_MoreCapabilitiesReturnedInDownload, extensionData.MarketplaceAssetID, new object[] { "ProcessUpdates", this.GetLoggedMailboxIdentifier(), extensionData.MarketplaceAssetID, downloadAppUri, updateRequestAsset.RequestedCapabilities, extensionData.RequestedCapabilities.Value }); } else if (!InstalledExtensionTable.ValidateAndRemoveManifestSignature(extensionData.Manifest, extensionData.ExtensionId, false)) { GetUpdates.Tracer.TraceError <string>(0L, "GetUpdates.IsValidUpdate: Asset doesn't have valid Signature. Asset ID: {0}.", extensionData.MarketplaceAssetID); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_InvalidAssetSignatureReturnedInDownload, extensionData.MarketplaceAssetID, new object[] { "ProcessUpdates", this.GetLoggedMailboxIdentifier(), extensionData.MarketplaceAssetID, downloadAppUri }); } else if (!ExtensionData.ValidateManifestSize((long)extensionData.Manifest.OuterXml.Length, false)) { GetUpdates.Tracer.TraceError <string>(0L, "GetUpdates.IsValidUpdate: Asset exceeds the allowed maximum size. Asset ID: {0}.", extensionData.MarketplaceAssetID); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_ManifestExceedsAllowedSize, extensionData.MarketplaceAssetID, new object[] { "ProcessUpdates", this.GetLoggedMailboxIdentifier(), extensionData.Manifest.OuterXml.Length, 256 }); } else { flag = true; } if (!flag) { string value = "1.0"; if (flag2) { value = "1.1"; } this.appStatuses[extensionData.ExtensionId] = value; } requestAsset = (flag ? updateRequestAsset : null); return(flag); }
// Token: 0x06000BED RID: 3053 RVA: 0x00031178 File Offset: 0x0002F378 internal bool CacheSatisfiesRequest(UpdateRequestAsset requestAsset, List <ExtensionData> updates) { bool result = false; ExtensionsCacheEntry extensionsCacheEntry = null; if (this.extensionsCache.TryGetEntry(requestAsset.MarketplaceAssetID, out extensionsCacheEntry) && requestAsset.Version <= extensionsCacheEntry.Version && extensionsCacheEntry.Manifest != null) { if (requestAsset.ExtensionID != extensionsCacheEntry.ExtensionID) { GetUpdates.Tracer.TraceError <string, string, string>(0L, "GetUpdates.CacheSatisfiesRequest: Asset {0} extension ID {1} does not match the cache entry {2}", requestAsset.MarketplaceAssetID, requestAsset.ExtensionID, extensionsCacheEntry.ExtensionID); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_MismatchedCacheMailboxExtensionId, requestAsset.MarketplaceAssetID, new object[] { "ProcessUpdates", this.GetLoggedMailboxIdentifier(), requestAsset.MarketplaceAssetID, requestAsset.ExtensionID, extensionsCacheEntry.ExtensionID }); result = true; } else if (requestAsset.Version == extensionsCacheEntry.Version) { GetUpdates.Tracer.TraceDebug <string>(0L, "GetUpdates.CacheSatisfiesRequest: Asset {0} version matches the cache entry", requestAsset.MarketplaceAssetID); result = true; } else if (requestAsset.Version < extensionsCacheEntry.Version && extensionsCacheEntry.Manifest != null) { if (ExtensionData.CompareCapabilities(extensionsCacheEntry.RequestedCapabilities.Value, requestAsset.RequestedCapabilities) > 0) { GetUpdates.Tracer.TraceDebug <string, RequestedCapabilities, RequestedCapabilities>(0L, "GetUpdates.CacheSatisfiesRequest: Asset cache entry requires more capabilities than installed asset. Asset ID: {0} Update: {1} Installed: {2}", requestAsset.MarketplaceAssetID, extensionsCacheEntry.RequestedCapabilities.Value, requestAsset.RequestedCapabilities); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_MoreCapabilitiesSkipUpdate, requestAsset.MarketplaceAssetID, new object[] { "ProcessUpdates", this.GetLoggedMailboxIdentifier(), requestAsset.MarketplaceAssetID, requestAsset.RequestedCapabilities, extensionsCacheEntry.RequestedCapabilities.Value }); result = true; } else if (!GetUpdates.IsValidUpdateState(new OmexConstants.AppState?(extensionsCacheEntry.State))) { GetUpdates.Tracer.TraceDebug <string, OmexConstants.AppState>(0L, "GetUpdates.CacheSatisfiesRequest: Asset {0} cache entry AppState {1} is not valid for updates", requestAsset.MarketplaceAssetID, extensionsCacheEntry.State); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_InvalidStateSkipUpdate, requestAsset.MarketplaceAssetID, new object[] { "ProcessUpdates", this.GetLoggedMailboxIdentifier(), requestAsset.MarketplaceAssetID, extensionsCacheEntry.State }); result = true; } else { GetUpdates.Tracer.TraceDebug <string>(0L, "GetUpdates.CacheSatisfiesRequest: Asset {0} will be updated from the cache", requestAsset.MarketplaceAssetID); ExtensionData updatedExtension = null; Exception ex = InstalledExtensionTable.RunClientExtensionAction(delegate { updatedExtension = ExtensionData.ParseOsfManifest(extensionsCacheEntry.Manifest, extensionsCacheEntry.Manifest.Length, requestAsset.MarketplaceAssetID, requestAsset.MarketplaceContentMarket, ExtensionType.MarketPlace, requestAsset.Scope, requestAsset.Enabled, requestAsset.DisableReason, string.Empty, requestAsset.Etoken); }); if (ex == null) { updates.Add(updatedExtension); result = true; } else { GetUpdates.Tracer.TraceError <string, Exception>(0L, "GetUpdates.CacheSatisfiesRequest: Parse of manifest failed for extension {0}. Exception: {1}", requestAsset.MarketplaceAssetID, ex); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_CachedManifestParseFailed, requestAsset.MarketplaceAssetID, new object[] { "ProcessUpdates", requestAsset.MarketplaceAssetID, ExtensionDiagnostics.GetLoggedExceptionString(ex) }); } } } } return(result); }
internal void SubmitUpdateQuery(ICollection <ExtensionData> extensions, UpdateQueryContext queryContext) { if (extensions == null) { throw new ArgumentNullException("extensions"); } if (extensions.Count == 0) { throw new ArgumentException("extensions must contain one or more extensions"); } if (this.SkipSubmitUpdateQueryForTest) { this.SubmitCount = 0; } Dictionary <string, UpdateRequestAsset> dictionary = new Dictionary <string, UpdateRequestAsset>(extensions.Count); foreach (ExtensionData extensionData in extensions) { if (extensionData.Version == null) { ExtensionsCache.Tracer.TraceDebug <string>(0L, "ExtensionsCache.SubmitUpdateQuery: Extension {0} not added to query list because version is invalid", extensionData.MarketplaceAssetID); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_InvalidVersionSubmitUpdateQuery, extensionData.MarketplaceAssetID, new object[] { "ProcessUpdates", ExtensionDiagnostics.GetLoggedMailboxIdentifier(queryContext.ExchangePrincipal), extensionData.MarketplaceAssetID }); } else { if (extensionData.Scope == null) { throw new ArgumentNullException("extensionData.Scope"); } if (extensionData.RequestedCapabilities == null) { throw new ArgumentNullException("extensionData.RequestedCapabilities"); } ExtensionsCacheEntry extensionsCacheEntry = null; if (this.extensionsDictionary.TryGetValue(extensionData.MarketplaceAssetID, out extensionsCacheEntry) && !InstalledExtensionTable.IsUpdateCheckTimeExpired(extensionsCacheEntry.LastUpdateCheckTime) && extensionsCacheEntry.Version == extensionData.Version) { ExtensionsCache.Tracer.TraceDebug <string>(0L, "ExtensionsCache.SubmitUpdateQuery: Extension {0} not added to query list because version matches recent cache entry", extensionData.MarketplaceAssetID); } else { UpdateRequestAsset updateRequestAsset = null; if (dictionary.TryGetValue(extensionData.MarketplaceAssetID, out updateRequestAsset)) { ExtensionsCache.Tracer.TraceDebug <string, string, string>(0L, "ExtensionsCache.SubmitUpdateQuery: Extension {0} not added to query list because asset with same MarketplaceAssetID is already in list. ExtensionIds with same asset id: {1} {2}", extensionData.MarketplaceAssetID, extensionData.ExtensionId, updateRequestAsset.ExtensionID); } else { dictionary.Add(extensionData.MarketplaceAssetID, new UpdateRequestAsset { MarketplaceContentMarket = extensionData.MarketplaceContentMarket, ExtensionID = extensionData.ExtensionId, MarketplaceAssetID = extensionData.MarketplaceAssetID, RequestedCapabilities = extensionData.RequestedCapabilities.Value, Version = extensionData.Version, DisableReason = extensionData.DisableReason, Enabled = extensionData.Enabled, Scope = extensionData.Scope.Value, Etoken = extensionData.Etoken }); } } } } if (dictionary.Count == 0) { ExtensionsCache.Tracer.TraceDebug(0L, "ExtensionsCache.SubmitUpdateQuery: UpdateRequestAssets count is 0. Updates query will not be started."); return; } queryContext.UpdateRequestAssets = dictionary; queryContext.DeploymentId = ExtensionDataHelper.GetDeploymentId(queryContext.Domain); this.QueueQueryItem(queryContext); }