MarketResxManager.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. using System.Collections;
  7. using Muchinfo.PC.Common.Bosn;
  8. namespace Muchinfo.MTPClient.Resources
  9. {
  10. public class MarketResxManager
  11. {
  12. private const string _fileName = "MarketResx.dll";
  13. public static CommonResx MarketResx { get; set; }
  14. public static string MarketDesc(string constKey)
  15. {
  16. if (MarketResx != null && MarketResx.ResourceHashtable != null &&
  17. MarketResx.ResourceHashtable.ContainsKey(constKey))
  18. {
  19. return MarketResx.ResourceHashtable[constKey] as string;
  20. }
  21. else
  22. {
  23. return Client_Resource.ResourceManager.GetString(constKey);
  24. }
  25. }
  26. #region 数据存在UserData目录
  27. public static void InitMarketResx(string filePath)
  28. {
  29. MarketResx = GetMarketResx(filePath);
  30. }
  31. /// <summary>
  32. /// Saves the market RESX.
  33. /// </summary>
  34. /// <param name="hastableResx">The hastable RESX.</param>
  35. /// <param name="ver">The ver.</param>
  36. /// <param name="filePath">The file path.</param>
  37. public static void SaveMarketResx(Hashtable hastableResx, ulong ver, string filePath)
  38. {
  39. string path = Path.Combine(filePath, _fileName);
  40. ResxManagerHelper.SaveData(hastableResx, ver, path);
  41. }
  42. /// <summary>
  43. /// Gets the market RESX.
  44. /// </summary>
  45. /// <param name="filePath">The file path.</param>
  46. /// <returns>CommonResx.</returns>
  47. private static CommonResx GetMarketResx(string filePath)
  48. {
  49. string path = Path.Combine(filePath, _fileName);
  50. return ResxManagerHelper.GetData(path);
  51. }
  52. #endregion
  53. }
  54. }