using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Collections; using Muchinfo.PC.Common.Bosn; namespace Muchinfo.MTPClient.Resources { public class TradeDateResxManager { private const string _fileName = "TradeDateResx.dll"; public static CommonResx TradeDateResx { get; set; } public static void SaveTradeDateResx(Hashtable hastableResx, ulong ver) { var resx = new CommonResx() { ResourceHashtable = hastableResx, Version = ver }; string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _fileName); JsonHelper.SaveData(path, resx, null, true); } public static CommonResx GetTradeDateResx() { var resx = new CommonResx() { Version = 0 }; string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _fileName); if (!File.Exists(path)) return resx; return JsonHelper.LoadData(path).FirstOrDefault(); } public static string TradeDateDesc(string constKey) { if (TradeDateResx != null && TradeDateResx.ResourceHashtable != null && TradeDateResx.ResourceHashtable.ContainsKey(constKey)) { return TradeDateResx.ResourceHashtable[constKey] as string; } else { return Client_Resource.ResourceManager.GetString(constKey); } } public static void InitTradeDateResx() { TradeDateResx = GetTradeDateResx(); } public static void TradeDateResxSaveRep(Hashtable resxHashtable, ulong ver) { TradeDateResx = new CommonResx() { ResourceHashtable = resxHashtable, Version = ver }; SaveTradeDateResx(resxHashtable, ver); } #region 数据存在UserData目录 public static void InitTradeDateResx(string filePath) { TradeDateResx = GetTradeDateResx(filePath); } public static void SaveTradeDateResx(Hashtable hastableResx, ulong ver, string filePath) { string path = Path.Combine(filePath, _fileName); ResxManagerHelper.SaveData(hastableResx, ver, path); } private static CommonResx GetTradeDateResx(string filePath) { string path = Path.Combine(filePath, _fileName); return ResxManagerHelper.GetData(path); } #endregion } }