Exemple #1
0
        public string GetAndValidateExtensionId()
        {
            string tagStringValue = ExtensionData.GetTagStringValue(this.xmlDoc, this.GetOweXpath("Id"), this.namespaceManager);
            string text           = ExtensionDataHelper.FormatExtensionId(tagStringValue);
            Guid   guid;

            if (!GuidHelper.TryParseGuid(text, out guid))
            {
                throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonInvalidID));
            }
            return(text);
        }
 // Token: 0x06000B42 RID: 2882 RVA: 0x0002D750 File Offset: 0x0002B950
 public KilledExtensionEntry(string extensionId, string assetId)
 {
     if (string.IsNullOrWhiteSpace(extensionId))
     {
         throw new ArgumentException("The extension id is missing.");
     }
     if (string.IsNullOrWhiteSpace(assetId))
     {
         throw new ArgumentException("The asset id is missing.");
     }
     this.ExtensionId = ExtensionDataHelper.FormatExtensionId(extensionId);
     this.AssetId     = assetId;
 }
Exemple #3
0
 public static bool ReadKillBitXmlContent(XmlReader reader, out int refreshRate)
 {
     refreshRate = -1;
     if (reader.ReadToFollowing("o:assets") && reader.MoveToAttribute("o:rr") && int.TryParse(reader.Value, out refreshRate))
     {
         refreshRate = ((refreshRate > 6) ? refreshRate : 6);
         if (reader.ReadToFollowing("o:asset"))
         {
             KillBitList.Singleton.Clear();
             do
             {
                 string attribute  = reader.GetAttribute("o:assetid");
                 string attribute2 = reader.GetAttribute("o:pid");
                 if (string.IsNullOrWhiteSpace(attribute2))
                 {
                     KillBitHelper.Tracer.TraceError(0L, "The extension id is missing in the killbit entry.");
                     ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_AppIdMissingInKillbitEntry, null, new object[]
                     {
                         "ProcessKillBit"
                     });
                 }
                 else if (string.IsNullOrWhiteSpace(attribute))
                 {
                     KillBitHelper.Tracer.TraceError(0L, "The asset id is missing in the killbit entry.");
                     ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_AssetIdMissingInKillbitEntry, null, new object[]
                     {
                         "ProcessKillBit"
                     });
                 }
                 else
                 {
                     KilledExtensionEntry entry = new KilledExtensionEntry(ExtensionDataHelper.FormatExtensionId(attribute2), attribute);
                     KillBitList.Singleton.Add(entry);
                     ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_EntryAddedToKillbitList, attribute2, new object[]
                     {
                         "ProcessKillBit",
                         attribute2,
                         attribute
                     });
                 }
             }while (reader.ReadToNextSibling("o:asset"));
         }
         return(true);
     }
     KillBitHelper.Tracer.TraceError(0L, "Cannot find KillBit asset tag or refresh rate in the file, will download killbit list again after one hour.");
     ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_KillbitAssetTagRefreshRateNotFound, null, new object[]
     {
         "ProcessKillBit"
     });
     return(false);
 }
 // Token: 0x06000B2A RID: 2858 RVA: 0x0002D1E8 File Offset: 0x0002B3E8
 public bool IsExtensionKilled(string extensionId)
 {
     lock (this.lockObject)
     {
         foreach (KilledExtensionEntry killedExtensionEntry in this.list)
         {
             if (string.Equals(killedExtensionEntry.ExtensionId, ExtensionDataHelper.FormatExtensionId(extensionId), StringComparison.OrdinalIgnoreCase))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
 // Token: 0x06000B28 RID: 2856 RVA: 0x0002D0C0 File Offset: 0x0002B2C0
 public void Remove(string extensionId)
 {
     lock (this.lockObject)
     {
         List <KilledExtensionEntry> list = new List <KilledExtensionEntry>();
         foreach (KilledExtensionEntry killedExtensionEntry in this.list)
         {
             if (string.Equals(killedExtensionEntry.ExtensionId, ExtensionDataHelper.FormatExtensionId(extensionId), StringComparison.OrdinalIgnoreCase))
             {
                 list.Add(killedExtensionEntry);
             }
         }
         foreach (KilledExtensionEntry item in list)
         {
             this.list.Remove(item);
         }
     }
 }
Exemple #6
0
        // Token: 0x06000B7E RID: 2942 RVA: 0x0002EF1C File Offset: 0x0002D11C
        private string ParseExtensionID(XElement element, XName extensionIDKey, BaseAsyncCommand.LogResponseParseFailureEventCallback logParseFailureCallback)
        {
            string text  = null;
            string text2 = (string)element.Attribute(extensionIDKey);

            if (!string.IsNullOrWhiteSpace(text2))
            {
                text = ExtensionDataHelper.FormatExtensionId(text2);
                Guid guid;
                if (!GuidHelper.TryParseGuid(text, out guid))
                {
                    text = null;
                }
            }
            if (text == null)
            {
                AppStateResponseAsset.Tracer.TraceError <XElement>(0L, "AppStateResponseAsset.ParseExtensionID: Extension id is invalid: {0}", element);
                logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_AppStateResponseInvalidExtensionID, this.MarketplaceAssetID, element);
            }
            return(text);
        }
 public static string GetFaiName(string extensionId, string version)
 {
     return("ClientExtension" + '.' + ExtensionDataHelper.FormatExtensionId(extensionId).Replace("-", string.Empty));
 }
        private static Dictionary <string, ExtensionData> ReadDefaultExtensionData(IExchangePrincipal exchangePrincipal)
        {
            Dictionary <string, ExtensionData> dictionary = new Dictionary <string, ExtensionData>();
            string text = ExchangeSetupContext.InstallPath + "ClientAccess\\owa\\" + string.Format("\\prem\\{0}\\ext\\def\\", DefaultExtensionTable.GetInstalledOwaVersion());

            string[] array = null;
            try
            {
                if (!Directory.Exists(text))
                {
                    DefaultExtensionTable.Tracer.TraceError <string>(0L, "Default extension path {0} does not exist", text);
                    ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_DefaultExtensionPathNotExist, null, new object[]
                    {
                        DefaultExtensionTable.scenario
                    });
                    return(dictionary);
                }
                array = Directory.GetDirectories(text);
            }
            catch (Exception ex)
            {
                DefaultExtensionTable.Tracer.TraceError <Exception>(0L, "Failed to access default extension folder. ", ex);
                ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_DefaultExtensionFolderAccessFailed, ex.GetType().ToString(), new object[]
                {
                    DefaultExtensionTable.scenario,
                    ExtensionDiagnostics.GetLoggedExceptionString(ex)
                });
                return(dictionary);
            }
            foreach (string text2 in array)
            {
                try
                {
                    string path = text2 + "\\" + "manifest.xml";
                    if (File.Exists(path))
                    {
                        using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
                        {
                            ExtensionData extensionData = ExtensionData.ParseOsfManifest(fileStream, null, null, ExtensionType.Default, ExtensionInstallScope.Default, true, DisableReasonType.NotDisabled, string.Empty, null);
                            extensionData.ProvidedTo         = ClientExtensionProvidedTo.Everyone;
                            extensionData.IsMandatory        = false;
                            extensionData.IsEnabledByDefault = true;
                            extensionData.InstalledByVersion = ExchangeSetupContext.InstalledVersion;
                            if (exchangePrincipal != null)
                            {
                                Exception arg = null;
                                if (!DefaultExtensionTable.TryUpdateDefaultExtensionPath(exchangePrincipal, "SourceLocation", extensionData, out arg))
                                {
                                    DefaultExtensionTable.Tracer.TraceError <Exception>(0L, "Skip one default extension because entry point path cannot be updated: {0}", arg);
                                    goto IL_22D;
                                }
                                if (!DefaultExtensionTable.TryUpdateDefaultExtensionPath(exchangePrincipal, "IconUrl", extensionData, out arg))
                                {
                                    DefaultExtensionTable.Tracer.TraceError <Exception>(0L, "Skip one default extension because icon path cannot be updated: {0}", arg);
                                    goto IL_22D;
                                }
                                if (!DefaultExtensionTable.TryUpdateDefaultExtensionPath(exchangePrincipal, "HighResolutionIconUrl", extensionData, out arg))
                                {
                                    DefaultExtensionTable.Tracer.TraceError <Exception>(0L, "Skip one default extension because hi-res icon path cannot be updated: {0}", arg);
                                    goto IL_22D;
                                }
                            }
                            dictionary[ExtensionDataHelper.FormatExtensionId(extensionData.ExtensionId)] = extensionData;
                        }
                    }
                }
                catch (Exception ex2)
                {
                    DefaultExtensionTable.Tracer.TraceError <Exception>(0L, "Skip one default extension because of error. {0}", ex2);
                    ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_DefaultExtensionRetrievalFailed, text2, new object[]
                    {
                        DefaultExtensionTable.scenario,
                        text2,
                        ExtensionDiagnostics.GetLoggedExceptionString(ex2)
                    });
                }
                IL_22D :;
            }
            return(dictionary);
        }
Exemple #9
0
        // Token: 0x06000B51 RID: 2897 RVA: 0x0002DA14 File Offset: 0x0002BC14
        internal static Dictionary <string, ExtensionData> GetOrgExtensions(StringList requestedExtensionIds, string domain, bool shouldReturnEnabledOnly, bool isUserScope, string userId, StringList userEnabledExtensionIds, StringList userDisabledExtensionIds, out OrgExtensionTable.RequestData requestData, bool isDebug, out string orgMasterTableRawXml, bool retrieveOnly1_0 = false)
        {
            Dictionary <string, ExtensionData> dictionary       = new Dictionary <string, ExtensionData>(StringComparer.OrdinalIgnoreCase);
            Collection <ClientExtension>       clientExtensions = null;
            string orgRawXml = null;

            OrgExtensionTable.RequestData requestDataSave = new OrgExtensionTable.RequestData();
            requestData = requestDataSave;
            OrgExtensionTable.ExecuteWebServicesAction(delegate
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                ExchangeService exchangeService = OrgExtensionTable.CreateExchangeServiceDelegate(domain, requestDataSave);
                if (exchangeService == null)
                {
                    return;
                }
                if (OrgExtensionTable.GetClientExtensionTimeoutIsAllowed())
                {
                    exchangeService.Timeout = 30000;
                }
                requestDataSave.CreateExchangeServiceTime   = stopwatch.ElapsedMilliseconds;
                GetClientExtensionResponse clientExtension2 = exchangeService.GetClientExtension(requestedExtensionIds, shouldReturnEnabledOnly, isUserScope, userId, userEnabledExtensionIds, userDisabledExtensionIds, isDebug);
                stopwatch.Stop();
                requestDataSave.GetClientExtensionTime = stopwatch.ElapsedMilliseconds - requestDataSave.CreateExchangeServiceTime;
                requestDataSave.ExchangeServiceUri     = exchangeService.Url;
                string text;
                if (exchangeService.HttpResponseHeaders.TryGetValue("request-id", out text))
                {
                    requestDataSave.EwsRequestId = text.Replace("-", string.Empty);
                }
                else
                {
                    requestDataSave.EwsRequestId = "NotFound";
                }
                clientExtensions = clientExtension2.ClientExtensions;
                if (isDebug && !string.IsNullOrWhiteSpace(clientExtension2.RawMasterTableXml))
                {
                    try
                    {
                        byte[] bytes = Convert.FromBase64String(clientExtension2.RawMasterTableXml);
                        orgRawXml    = Encoding.UTF8.GetString(bytes);
                    }
                    catch (FormatException innerException)
                    {
                        throw new OwaExtensionOperationException(innerException);
                    }
                    catch (ArgumentException innerException2)
                    {
                        throw new OwaExtensionOperationException(innerException2);
                    }
                }
            });
            if (clientExtensions != null)
            {
                foreach (ClientExtension clientExtension in clientExtensions)
                {
                    try
                    {
                        ExtensionData extensionData = ExtensionData.CreateFromClientExtension(clientExtension);
                        if (!retrieveOnly1_0 || !(extensionData.SchemaVersion != SchemaConstants.SchemaVersion1_0))
                        {
                            ExtensionData extensionData2;
                            if (!dictionary.TryGetValue(extensionData.ExtensionId, out extensionData2) || !(extensionData.SchemaVersion < extensionData2.SchemaVersion))
                            {
                                dictionary[ExtensionDataHelper.FormatExtensionId(extensionData.ExtensionId)] = extensionData;
                            }
                        }
                    }
                    catch (OwaExtensionOperationException ex)
                    {
                        OrgExtensionTable.Tracer.TraceError <OwaExtensionOperationException>(0L, "skipping an org extension because it cannot be parsed. Exception: {0}", ex);
                        ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_OrgExtensionParsingFailed, null, new object[]
                        {
                            "ProcessOrgExtensions",
                            ExtensionDiagnostics.GetLoggedExceptionString(ex)
                        });
                    }
                }
            }
            orgMasterTableRawXml = orgRawXml;
            return(dictionary);
        }