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 ConfigParamResxManager { private const string _fileName = "ConfigParameterResx.dll"; public static CommonResx ConfigParamResx { get; set; } public static void SaveConfigParamResx(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 GetConfigParamResx() { 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 ConstDesc(string constKey) { if (ConfigParamResx != null && ConfigParamResx.ResourceHashtable != null && ConfigParamResx.ResourceHashtable.ContainsKey(constKey)) { return ConfigParamResx.ResourceHashtable[constKey] as string; } else { return Client_Resource.ResourceManager.GetString(constKey); } } public static void InitConfigParamResx() { ConfigParamResx = GetConfigParamResx(); } #region 数据存在UserData目录 public static void InitConfigParamResx(string filePath) { ConfigParamResx = GetConfigParamResx(filePath); } /// /// Saves the market RESX. /// /// The hastable RESX. /// The ver. /// The file path. public static void SaveConfigParamResx(Hashtable hastableResx, ulong ver, string filePath) { string path = Path.Combine(filePath, _fileName); ResxManagerHelper.SaveData(hastableResx, ver, path); } /// /// Gets the market RESX. /// /// The file path. /// CommonResx. private static CommonResx GetConfigParamResx(string filePath) { string path = Path.Combine(filePath, _fileName); return ResxManagerHelper.GetData(path); } #endregion } }