| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- 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<CommonResx>(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<CommonResx>(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);
- }
- /// <summary>
- /// Saves the market RESX.
- /// </summary>
- /// <param name="hastableResx">The hastable RESX.</param>
- /// <param name="ver">The ver.</param>
- /// <param name="filePath">The file path.</param>
- public static void SaveConfigParamResx(Hashtable hastableResx, ulong ver, string filePath)
- {
- string path = Path.Combine(filePath, _fileName);
- ResxManagerHelper.SaveData(hastableResx, ver, path);
- }
- /// <summary>
- /// Gets the market RESX.
- /// </summary>
- /// <param name="filePath">The file path.</param>
- /// <returns>CommonResx.</returns>
- private static CommonResx GetConfigParamResx(string filePath)
- {
- string path = Path.Combine(filePath, _fileName);
- return ResxManagerHelper.GetData(path);
- }
- #endregion
- }
- }
|