public static List <HelpCenterItem> GetHelpCenter(string module, string helpLinkBlock) { var url = CommonLinkUtility.GetHelpLink(); if (string.IsNullOrEmpty(url)) { return(new List <HelpCenterItem>()); } url += "gettingstarted/" + module; var storageData = HelpCenterStorage.GetHelpCenter(); if (storageData == null) { return(new List <HelpCenterItem>()); } HelpCenterData helpCenterData = null; if (storageData.ContainsKey(url)) { helpCenterData = storageData[url]; } if (helpCenterData != null && String.CompareOrdinal(helpCenterData.ResetCacheKey, ClientSettings.ResetCacheKey) != 0) { helpCenterData = null; } if (helpCenterData == null) { var html = SendRequest(url); var data = ParseHelpCenterHtml(html, helpLinkBlock); helpCenterData = new HelpCenterData(); if (data.Any()) { helpCenterData.ListItems = data; helpCenterData.ResetCacheKey = ClientSettings.ResetCacheKey; storageData[url] = helpCenterData; HelpCenterStorage.UpdateHelpCenter(storageData); } } return(helpCenterData.ListItems ?? new List <HelpCenterItem>()); }
public static List<HelpCenterItem> GetHelpCenter(string module, string helpLinkBlock) { var url = CommonLinkUtility.GetHelpLink(true) + "gettingstarted/" + module; HelpCenterData helpCenterData = null; var storageData = HelpCenterStorage.GetHelpCenter() ?? new Dictionary<string, HelpCenterData>(); if (storageData.ContainsKey(url)) { helpCenterData = storageData[url]; } if (helpCenterData != null && String.CompareOrdinal(helpCenterData.ResetCacheKey, ClientSettings.ResetCacheKey) != 0) { helpCenterData = null; } if (helpCenterData == null) { var html = SendRequest(url); var data = ParseHelpCenterHtml(html, helpLinkBlock); helpCenterData = new HelpCenterData(); if (data.Any()) { helpCenterData.ListItems = data; helpCenterData.ResetCacheKey = ClientSettings.ResetCacheKey; storageData.Remove(url); storageData.Add(url, helpCenterData); HelpCenterStorage.UpdateHelpCenter(storageData); } } return helpCenterData.ListItems ?? new List<HelpCenterItem>(); }