Exemplo n.º 1
0
        // Token: 0x06000BF7 RID: 3063 RVA: 0x00031E60 File Offset: 0x00030060
        private void WriteAppStatuesToMailbox()
        {
            if (this.appStatuses.Count == 0)
            {
                return;
            }
            GetUpdates.Tracer.TraceDebug <int>(0L, "GetUpdates.ConfigAppStatus: Config app status for {0} extensions.", this.appStatuses.Count);
            Exception ex = InstalledExtensionTable.RunClientExtensionAction(delegate
            {
                using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(this.queryContext.ExchangePrincipal, this.queryContext.CultureInfo, this.queryContext.ClientInfoString))
                {
                    using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(this.queryContext.Domain, this.queryContext.IsUserScope, this.queryContext.OrgEmptyMasterTableCache, mailboxSession))
                    {
                        foreach (KeyValuePair <string, string> keyValuePair in this.appStatuses)
                        {
                            installedExtensionTable.ConfigureAppStatus(keyValuePair.Key, keyValuePair.Value);
                        }
                        installedExtensionTable.SaveXML();
                    }
                }
            });

            if (ex != null)
            {
                GetUpdates.Tracer.TraceError <Exception>(0L, "GetUpdates.ConfigAppStatus: Config app status failed. Exception: {0}", ex);
                ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_FailedToConfigAppStatus, null, new object[]
                {
                    "ProcessUpdates",
                    ExtensionDiagnostics.GetLoggedMailboxIdentifier(this.queryContext.ExchangePrincipal),
                    ExtensionDiagnostics.GetLoggedExceptionString(ex)
                });
            }
        }
Exemplo n.º 2
0
        internal static void RunAction(Action action)
        {
            Exception ex = InstalledExtensionTable.RunClientExtensionAction(action);

            if (ex != null)
            {
                throw (ex is LocalizedException) ? ex : new OwaExtensionOperationException(new LocalizedString(ex.Message), ex);
            }
        }
Exemplo n.º 3
0
        // Token: 0x06000BF5 RID: 3061 RVA: 0x00031C20 File Offset: 0x0002FE20
        internal void InstallExtensionUpdates(List <ExtensionData> updates, UpdateQueryContext queryContext)
        {
            GetUpdates.Tracer.TraceDebug <int>(0L, "GetUpdates.InstallExtensionUpdates: Installing {0} extensions.", updates.Count);
            ExtensionData currentExtensionData = null;
            Exception     ex = InstalledExtensionTable.RunClientExtensionAction(delegate
            {
                using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(queryContext.ExchangePrincipal, queryContext.CultureInfo, queryContext.ClientInfoString))
                {
                    using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(queryContext.Domain, queryContext.IsUserScope, queryContext.OrgEmptyMasterTableCache, mailboxSession))
                    {
                        foreach (ExtensionData currentExtensionData in updates)
                        {
                            currentExtensionData = currentExtensionData;
                            GetUpdates.Tracer.TraceDebug <string>(0L, "GetUpdates.InstallExtensionUpdates: Installing asset {0}", currentExtensionData.MarketplaceAssetID);
                            installedExtensionTable.AddExtension(currentExtensionData, true);
                            currentExtensionData = null;
                        }
                        installedExtensionTable.SaveXML();
                    }
                }
            });
            string text = (currentExtensionData == null) ? string.Empty : currentExtensionData.MarketplaceAssetID;

            if (ex != null)
            {
                GetUpdates.Tracer.TraceError <string, Exception>(0L, "GetUpdates.InstallExtensionUpdates: Installation failed for extension {0}. Exception: {1}", text, ex);
                ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_ExtensionUpdateFailed, null, new object[]
                {
                    "UpdateExtension",
                    ExtensionDiagnostics.GetLoggedMailboxIdentifier(queryContext.ExchangePrincipal),
                    text,
                    ExtensionDiagnostics.GetLoggedExceptionString(ex)
                });
            }
            else
            {
                ExtensionDiagnostics.LogToDatacenterOnly(ApplicationLogicEventLogConstants.Tuple_ExtensionUpdateSuccess, null, new object[]
                {
                    "UpdateExtension",
                    ExtensionDiagnostics.GetLoggedMailboxIdentifier(queryContext.ExchangePrincipal),
                    text
                });
            }
            this.ExecuteNextUpdateQuery();
        }
Exemplo n.º 4
0
        private void WriteTokensToMailbox()
        {
            if (this.downloadedTokens.Count == 0 && this.appStatuses.Count == 0)
            {
                return;
            }
            GetTokens.Tracer.TraceDebug <int, int>(0L, "GetTokens.WriteTokensToMailbox: Writing renewed tokens for {0} apps, failure error codes for {0} apps.", this.downloadedTokens.Count, this.appStatuses.Count);
            Exception ex = InstalledExtensionTable.RunClientExtensionAction(delegate
            {
                using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(this.queryContext.ExchangePrincipal, this.queryContext.CultureInfo, this.queryContext.ClientInfoString))
                {
                    using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(this.queryContext.Domain, this.queryContext.IsUserScope, this.queryContext.OrgEmptyMasterTableCache, mailboxSession))
                    {
                        foreach (KeyValuePair <string, string> keyValuePair in this.downloadedTokens)
                        {
                            installedExtensionTable.ConfigureEtoken(keyValuePair.Key, keyValuePair.Value, true);
                        }
                        foreach (KeyValuePair <string, string> keyValuePair2 in this.appStatuses)
                        {
                            installedExtensionTable.ConfigureAppStatus(keyValuePair2.Key, keyValuePair2.Value);
                        }
                        installedExtensionTable.SaveXML();
                    }
                }
            });

            if (ex != null)
            {
                GetTokens.Tracer.TraceError <Exception>(0L, "GetTokens.WriteTokensToMailbox: Writing renewed tokens failed. Exception: {0}", ex);
                ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_FailedToWritebackRenewedTokens, null, new object[]
                {
                    "ProcessTokenRenew",
                    ExtensionDiagnostics.GetLoggedMailboxIdentifier(this.queryContext.ExchangePrincipal),
                    ExtensionDiagnostics.GetLoggedExceptionString(ex)
                });
                return;
            }
            ExtensionDiagnostics.LogToDatacenterOnly(ApplicationLogicEventLogConstants.Tuple_ProcessTokenRenewCompleted, null, new object[]
            {
                "ProcessTokenRenew",
                ExtensionDiagnostics.GetLoggedMailboxIdentifier(this.queryContext.ExchangePrincipal)
            });
        }
Exemplo n.º 5
0
        // 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);
        }