示例#1
0
        // Token: 0x06000B6F RID: 2927 RVA: 0x0002EB20 File Offset: 0x0002CD20
        internal void SubmitRenewQuery(ICollection <ExtensionData> extensions, TokenRenewQueryContext queryContext)
        {
            if (extensions == null)
            {
                throw new ArgumentNullException("extensions");
            }
            if (extensions.Count == 0)
            {
                throw new ArgumentException("extensions must contain one or more extensions");
            }
            List <TokenRenewRequestAsset> list = new List <TokenRenewRequestAsset>(extensions.Count);

            foreach (ExtensionData extensionData in extensions)
            {
                list.Add(new TokenRenewRequestAsset
                {
                    MarketplaceContentMarket = extensionData.MarketplaceContentMarket,
                    ExtensionID        = extensionData.ExtensionId,
                    MarketplaceAssetID = extensionData.MarketplaceAssetID,
                    Scope  = extensionData.Scope.Value,
                    Etoken = extensionData.Etoken
                });
            }
            if (list.Count == 0)
            {
                TokenRenewSubmitter.Tracer.TraceDebug(0L, "ExtensionsCache.SubmitRenewQuery: TokenRenewRequestAssets count is 0. Token renew query will not be started.");
                return;
            }
            queryContext.TokenRenewRequestAssets = list;
            queryContext.DeploymentId            = ExtensionDataHelper.GetDeploymentId(queryContext.Domain);
            this.QueueQueryItem(queryContext);
        }
示例#2
0
        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);
        }