/// <summary> /// Finds a URL from MSDN documentation. /// </summary> /// <param name="assetId">The asset id in the form "T:System.String"</param> /// <returns>A URL to MSDN or null if no URL was found</returns> public string FindUrl(string assetId) { // Only look for T:System. if (assetId.Length < 3 || !assetId.Substring(2).StartsWith("System.") || IsDisabled) { return(null); } string contentId; if (!_mapAssetIdToContentId.TryGetValue(assetId, out contentId)) { try { Logger.Message("Get MSDN URL for id [{0}]", assetId); var request = new getContentRequest { contentIdentifier = "AssetId:" + HttpUtility.UrlEncode(assetId), locale = Locale }; var appId = new appId() { value = AppId }; var response = msdnClient.GetContent(appId, request); contentId = response.contentId; } catch (EndpointNotFoundException endpointNotFound) { Logger.Warning("Unable to connect to MTPS service. MSDN resolver disabled : {0}", endpointNotFound.Message); IsDisabled = true; } catch (Exception ex) { Logger.Warning("Error while getting MSDN URL [{0}] : {1}", assetId, ex.Message); } _mapAssetIdToContentId[assetId] = contentId; SaveCacheToDisk(); } if (string.IsNullOrEmpty(contentId)) { return(null); } return(string.Format(MsdnUrlFormat, Locale, contentId)); }
/// <summary> /// Creates a new MTPS member model repository. /// </summary> /// <param name="rootAssetId">The root asset ID for the .NET framework.</param> /// <param name="version">The desired documentation version.</param> /// <param name="locale">The desired documentation locale.</param> /// <param name="serviceUrl">The MTPS service URL.</param> public MsdnCodeDocMemberRepository(string rootAssetId = null, string version = null, string locale = null, string serviceUrl = null) { RootAssetId = String.IsNullOrEmpty(rootAssetId) ? DefaultRootAssetId : rootAssetId; Version = String.IsNullOrEmpty(version) ? DefaultVersion : version; Locale = String.IsNullOrEmpty(locale) ? DefaultLocale : locale; ServiceUrl = String.IsNullOrEmpty(serviceUrl) ? DefaultServiceUrl : serviceUrl; _appId = new appId(); _clientGenerator = new Lazy<ContentServicePortTypeClient>( () => new ContentServicePortTypeClient( new BasicHttpBinding{ MaxReceivedMessageSize = 1024 * 1024 }, new EndpointAddress(ServiceUrl) ), true ); }
=> Invoke(token => DoBatchGetUserInfo(token, openIds, lang), appId, secret);
=> Invoke(token => DoGetUsers(token, nextOpenId), appId, secret);
=> Invoke(token => DoGetTagsByUser(token, openId), appId, secret);
=> Invoke(token => DoGetUsersWithTag(token, tagId, nextOpenId), appId, secret);
=> Invoke(token => DoGetTags(token), appId, secret);
=> Invoke(token => DoCreateTag(token, name), appId, secret);
VirtualRoot.RaiseEvent(new SpeedDatasMqEvent(appId, clientIdIps, ea.GetTimestamp()));
/// <summary> /// Finds an URL from MSDN documentation. /// </summary> /// <param name="assetId">The asset id in the form "T:System.String"</param> /// <returns>An url to MSDN or null if no url was found</returns> public string FindUrl(string assetId) { // Only look for T:System. if (assetId.Length < 3 || !assetId.Substring(2).StartsWith("System.") || IsDisabled) return null; string contentId; if (!_mapAssetIdToContentId.TryGetValue(assetId, out contentId)) { try { Logger.Message("Get MSDN URL for id [{0}]", assetId); var request = new getContentRequest { contentIdentifier = "AssetId:" + HttpUtility.UrlEncode(assetId), locale = Locale }; var appId = new appId() { value = AppId }; var response = msdnClient.GetContent(appId, request); contentId = response.contentId; } catch (EndpointNotFoundException endpointNotFound) { Logger.Warning("Unable to connect to MTPS service. Msnd resolver disabled : {0}", endpointNotFound.Message); IsDisabled = true; } catch (Exception ex) { Logger.Warning("Error while getting msdn url [{0}] : {1}", assetId, ex.Message); } _mapAssetIdToContentId[assetId] = contentId; SaveCacheToDisk(); } if (string.IsNullOrEmpty(contentId)) return null; return string.Format(MsdnUrlFormat, Locale, contentId); }
private getContentResponse CachedGetContentRequest(appId appId, getContentRequest request) { var requestKey = CreateGetContentRequestKey(request); var rawResult = Cache[requestKey] as getContentResponse; if (rawResult == null) { rawResult = Client.GetContent(appId, request); if (rawResult != null) Cache[requestKey] = rawResult; } return rawResult; }
=> Invoke(token => DoGetIndustry(token), appId, secret);
=> Invoke(token => DoGetAllPrivateTemplate(token), appId, secret);
=> Invoke(token => DoAddTemplate(token, templateIdShort), appId, secret);
=> Invoke(token => DoSend(token, input), appId, secret);