// Token: 0x06000B7C RID: 2940 RVA: 0x0002EE44 File Offset: 0x0002D044 internal AppStateResponseAsset(XElement element, BaseAsyncCommand.LogResponseParseFailureEventCallback logParseFailureCallback) { this.MarketplaceAssetID = this.ParseMarketplaceAssetID(element, OmexConstants.OfficeNamespace + "assetid", logParseFailureCallback); if (!string.IsNullOrWhiteSpace(this.MarketplaceAssetID)) { this.ExtensionID = this.ParseExtensionID(element, OmexConstants.OfficeNamespace + "prodid", logParseFailureCallback); this.Version = this.ParseVersion(element, OmexConstants.OfficeNamespace + "ver", logParseFailureCallback); this.State = this.ParseState(element, OmexConstants.OfficeNamespace + "state", logParseFailureCallback); } }
// Token: 0x06000B7D RID: 2941 RVA: 0x0002EED8 File Offset: 0x0002D0D8 private string ParseMarketplaceAssetID(XElement element, XName assetIDKey, BaseAsyncCommand.LogResponseParseFailureEventCallback logParseFailureCallback) { string text = (string)element.Attribute(assetIDKey); if (string.IsNullOrWhiteSpace(text)) { AppStateResponseAsset.Tracer.TraceError <XElement>(0L, "AppStateResponseAsset.ParseMarketplaceAssetID: Marketplace asset id was not returned: {0}", element); logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_AppStateResponseInvalidMarketplaceAssetID, text, element); } return(text); }
// Token: 0x06000B7F RID: 2943 RVA: 0x0002EF7C File Offset: 0x0002D17C private Version ParseVersion(XElement element, XName versionKey, BaseAsyncCommand.LogResponseParseFailureEventCallback logParseFailureCallback) { Version result = null; string versionAsString = (string)element.Attribute(versionKey); if (!ExtensionData.TryParseVersion(versionAsString, out result)) { AppStateResponseAsset.Tracer.TraceError <XElement>(0L, "AppStateResponseAsset.ParseVersion: Unable to parse version for: {0}", element); logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_AppStateResponseInvalidVersion, this.MarketplaceAssetID, element); } return(result); }
// Token: 0x06000B80 RID: 2944 RVA: 0x0002EFC8 File Offset: 0x0002D1C8 private OmexConstants.AppState?ParseState(XElement element, XName stateKey, BaseAsyncCommand.LogResponseParseFailureEventCallback logParseFailureCallback) { OmexConstants.AppState?result = null; string text = (string)element.Attribute(stateKey); int value; if (!string.IsNullOrWhiteSpace(text) && int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out value)) { result = new OmexConstants.AppState?((OmexConstants.AppState)value); } if (result == null) { AppStateResponseAsset.Tracer.TraceError <XElement>(0L, "AppStateResponseAsset.ParseState: Unable to parse state for: {0}", element); logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_AppStateResponseInvalidState, this.MarketplaceAssetID, element); } return(result); }
// 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); }
internal static List <AppStateResponseAsset> CreateAppStateResponseAssets(XDocument responseXDocument, BaseAsyncCommand.LogResponseParseFailureEventCallback logParseFailureCallback) { IEnumerable <AppStateResponseAsset> collection = from assetElement in responseXDocument.Descendants(OmexConstants.OfficeNamespace + "asset") select new AppStateResponseAsset(assetElement, logParseFailureCallback); return(new List <AppStateResponseAsset>(collection)); }
// Token: 0x06000BD6 RID: 3030 RVA: 0x000306B8 File Offset: 0x0002E8B8 internal static List <ConfigResponseUrl> CreateConfigResponseUrls(XDocument responseXDocument, Uri uri, string requestId, BaseAsyncCommand.LogResponseParseFailureEventCallback logParseFailureCallback) { XName nameXName = OmexConstants.OfficeNamespace + "name"; IEnumerable <XElement> source = from xElement in responseXDocument.Descendants(OmexConstants.OfficeNamespace + "token") select xElement; Dictionary <string, XElement> tokenDictionary = null; try { tokenDictionary = source.ToDictionary((XElement t) => t.Attribute(nameXName).Value); } catch (NullReferenceException) { BaseAsyncCommand.Tracer.TraceError <XDocument>(0L, "GetConfig.CreateConfigResponseUrls: Token name attribute missing from response xml: {0}", responseXDocument); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_ConfigResponseTokenNamesMissing, null, new object[] { GetConfig.ScenarioProcessConfig, requestId, uri }); return(null); } IEnumerable <ConfigResponseUrl> collection = from urlElement in responseXDocument.Descendants(OmexConstants.OfficeNamespace + "service") where urlElement.Attribute(nameXName).Value == "AppStateQuery15" || urlElement.Attribute(nameXName).Value == "AppInstallInfoQuery15" || urlElement.Attribute(nameXName).Value == "AppInfoQuery15" select new ConfigResponseUrl(urlElement, tokenDictionary, logParseFailureCallback); List <ConfigResponseUrl> list = null; try { list = new List <ConfigResponseUrl>(collection); } catch (NullReferenceException) { BaseAsyncCommand.Tracer.TraceError <XDocument>(0L, "GetConfig.CreateConfigResponseUrls: Service name attribute is missing from response xml: {0}", responseXDocument); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_ConfigResponseServiceNameMissing, null, new object[] { GetConfig.ScenarioProcessConfig, requestId, uri }); return(null); } if (list.Any((ConfigResponseUrl t) => t.Url == null)) { BaseAsyncCommand.Tracer.TraceError <XDocument>(0L, "GetConfig.CreateConfigResponseUrls: one or more urls is null: {0}", responseXDocument); return(null); } if (list.Count != 3) { BaseAsyncCommand.Tracer.TraceError <XDocument>(0L, "GetConfig.CreateConfigResponseUrls: urls are missing: {0}", responseXDocument); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_ConfigResponseUrlsMissing, null, new object[] { GetConfig.ScenarioProcessConfig, requestId, uri }); return(null); } return(list); }
private static string ParseUrl(XElement element, XName urlKey, Dictionary <string, XElement> tokenDictionary, string serviceName, BaseAsyncCommand.LogResponseParseFailureEventCallback logParseFailureCallback) { XElement xelement = element.Element(urlKey); if (xelement == null || xelement.Value == null) { ConfigResponseUrl.Tracer.TraceError <XElement>(0L, "ConfigResponseUrl.ParseUrl: Unable to parse url for: {0}", element); logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_ConfigResponseUrlParseFailed, serviceName, element); return(null); } string value = xelement.Value; string[] array = value.Split(new char[] { '[', ']' }); if (array.Length == 1) { ConfigResponseUrl.Tracer.TraceDebug <XElement>(0L, "ConfigResponseUrl.ParseUrl: Url contains no tokens: {0}", element); logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_ConfigResponseUrlNoTokens, serviceName, element); return(value); } if (array.Length != 3) { ConfigResponseUrl.Tracer.TraceError <XElement>(0L, "ConfigResponseUrl.ParseUrl: Expected one token in the response element. Unable to parse url for: {0}", element); logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_ConfigResponseUrlTooManyTokens, serviceName, element); return(null); } if (tokenDictionary == null || tokenDictionary.Count == 0) { ConfigResponseUrl.Tracer.TraceError <XElement>(0L, "ConfigResponseUrl.ParseUrl: No tokens in the response. Unable to parse url for: {0}", element); logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_ConfigResponseUrlTokenNotFound, serviceName, element); return(null); } XElement xelement2 = null; if (!tokenDictionary.TryGetValue(array[1], out xelement2)) { ConfigResponseUrl.Tracer.TraceError <XElement>(0L, "ConfigResponseUrl.ParseUrl: Token not found. Unable to parse url for: {0}", element); logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_ConfigResponseUrlTokenNotFound, serviceName, element); return(null); } string value2 = xelement2.Value; string text = array[0] + value2 + array[2]; if (!Uri.IsWellFormedUriString(text, UriKind.Absolute)) { ConfigResponseUrl.Tracer.TraceError <XElement>(0L, "ConfigResponseUrl.ParseUrl: Constructed url is not well formed for: {0}", element); logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_ConfigResponseUrlNotWellFormed, serviceName, element); return(null); } return(text); }
private static string ParseServiceName(XElement element, XName serviceNameKey, BaseAsyncCommand.LogResponseParseFailureEventCallback logParseFailureCallback) { string text = (string)element.Attribute(serviceNameKey); if (string.IsNullOrWhiteSpace(text)) { ConfigResponseUrl.Tracer.TraceError <XElement>(0L, "ConfigResponseUrl.ParseServiceName: Unable to parse serviceName for: {0}", element); logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_ConfigResponseServiceNameParseFailed, null, element); } return(text); }
internal ConfigResponseUrl(XElement element, Dictionary <string, XElement> tokenDictionary, BaseAsyncCommand.LogResponseParseFailureEventCallback logParseFailureCallback) { this.ServiceName = ConfigResponseUrl.ParseServiceName(element, OmexConstants.OfficeNamespace + "name", logParseFailureCallback); if (!string.IsNullOrWhiteSpace(this.ServiceName)) { this.Url = ConfigResponseUrl.ParseUrl(element, OmexConstants.OfficeNamespace + "url", tokenDictionary, this.ServiceName, logParseFailureCallback); } }