Exemple #1
0
 protected void LogResponseParsed()
 {
     ExtensionDiagnostics.LogToDatacenterOnly(ApplicationLogicEventLogConstants.Tuple_OmexWebServiceResponseParsed, null, new object[]
     {
         this.scenario,
         this.requestId,
         base.GetLoggedMailboxIdentifier(),
         this.uri
     });
 }
        // 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();
        }
Exemple #3
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)
            });
        }
        public static MemoryStream DownloadDataFromUri(Uri uri, long expectedMaxResponseSize, Func <long, bool, bool> responseValidationCallback, bool isUrlUserInput = true, bool isBposUser = true)
        {
            string text = Guid.NewGuid().ToString();

            if (isBposUser && isUrlUserInput && IPAddressUtil.IsIntranetAddress(uri))
            {
                throw new DownloadPermanentException();
            }
            string text2 = uri.OriginalString;

            if (text2.Contains("?"))
            {
                text2 = text2 + "&corr=" + text;
            }
            else
            {
                text2 = text2 + "?corr=" + text;
            }
            uri = new Uri(text2);
            MemoryStream   result         = null;
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);

            httpWebRequest.AllowAutoRedirect = true;
            httpWebRequest.Timeout           = 30000;
            httpWebRequest.CachePolicy       = SynchronousDownloadData.NoCachePolicy;
            try
            {
                using (HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse())
                {
                    using (Stream responseStream = httpWebResponse.GetResponseStream())
                    {
                        long num = expectedMaxResponseSize + 1L;
                        if (responseStream.CanSeek)
                        {
                            num = Math.Min(num, responseStream.Length);
                        }
                        byte[] array = new byte[num];
                        int    num2  = 0;
                        int    num3;
                        do
                        {
                            num3  = responseStream.Read(array, num2, array.Length - num2);
                            num2 += num3;
                            responseValidationCallback((long)num2, true);
                        }while (num3 > 0);
                        result = new MemoryStream(array, 0, num2);
                    }
                }
            }
            catch (Exception ex)
            {
                ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_DownloadDataFromOfficeMarketPlaceFailed, null, new object[]
                {
                    "DownloadNewApp",
                    text,
                    uri,
                    ExtensionDiagnostics.GetLoggedExceptionString(ex)
                });
                throw ex;
            }
            ExtensionDiagnostics.LogToDatacenterOnly(ApplicationLogicEventLogConstants.Tuple_DownloadDataFromOfficeMarketPlaceSucceeded, null, new object[]
            {
                "DownloadNewApp",
                text,
                uri
            });
            return(result);
        }