/// <summary> /// 获取支持语言 /// </summary> /// <returns></returns> public static NameValueCollection GetSupportedLanguages() { HHContext hhContext = HHContext.Current; string cacheKey = CacheKeyManager.ResourceKey; NameValueCollection supportedLanguages = HHCache.Instance.Get(cacheKey) as NameValueCollection; if (supportedLanguages == null) { string filePath = GlobalSettings.MapPath("~/Languages/languages.xml"); FileDependency dp = new FileDependency(filePath); supportedLanguages = new NameValueCollection(); XmlDocument d = new XmlDocument(); d.Load(filePath); foreach (XmlNode n in d.SelectSingleNode("root").ChildNodes) { if (n.NodeType != XmlNodeType.Comment) { supportedLanguages.Add(n.Attributes["key"].Value, n.Attributes["name"].Value); } } HHCache.Instance.Max(cacheKey, supportedLanguages, dp); } return(supportedLanguages); }
private static void SaveContextToStore(HHContext context) { if (context.IsWebRequest) { context.Context.Items[dataKey] = context; } else { currentContext = context; } }
public static void Unload() { currentContext = null; }