public static T ReadXmlFileWithLocalCache <T>(string filePath) where T : class { if (!File.Exists(filePath)) { return(null); } FileInfo f = new FileInfo(filePath); string key = "ReadXmlFileWithCache_" + f.FullName.ToUpper().GetHashCode().ToString(); return(GetWithLocalCache <T>(key, () => SerializationUtility.LoadFromXml <T>(filePath), filePath)); }
internal static void LoadResouce(string cacheKey, string filePath) { cacheKey = cacheKey.ToUpper(); MessageResource res = SerializationUtility.LoadFromXml <MessageResource>(filePath); lock (s_SyncObj) { if (s_MessageResDictionary.ContainsKey(cacheKey)) { s_MessageResDictionary[cacheKey] = res; } else { s_MessageResDictionary.Add(cacheKey, res); } } }