| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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 RiskMsgResxManager
- {
- private const string _fileName = "RiskMsgResx.dll";
- public static CommonResx RiskMsgResx { get; set; }
- public static void SaveRiskMsgResx(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 GetRiskMsgResx()
- {
- 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 RiskMsgDesc(string constKey)
- {
- if (RiskMsgResx != null && RiskMsgResx.ResourceHashtable != null &&
- RiskMsgResx.ResourceHashtable.ContainsKey(constKey))
- {
- return RiskMsgResx.ResourceHashtable[constKey] as string;
- }
- else
- {
- return Client_Resource.ResourceManager.GetString(constKey);
- }
- }
- public static void InitRiskMsgResx()
- {
- RiskMsgResx = GetRiskMsgResx();
- }
- #region 数据存在UserData目录
- public static void InitRiskMsgResx(string filePath)
- {
- RiskMsgResx = GetRiskMsgResx(filePath);
- }
- public static void SaveRiskMsgResx(Hashtable hastableResx, ulong ver, string filePath)
- {
- string path = Path.Combine(filePath, _fileName);
- ResxManagerHelper.SaveData(hastableResx, ver, path);
- }
- private static CommonResx GetRiskMsgResx(string filePath)
- {
- string path = Path.Combine(filePath, _fileName);
- return ResxManagerHelper.GetData(path);
- }
- #endregion
- }
- }
|