ResxManagerHelper.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using Muchinfo.PC.Common.Bosn;
  8. namespace Muchinfo.MTPClient.Resources
  9. {
  10. public class ResxManagerHelper
  11. {
  12. /// <summary>
  13. /// Saves the data.
  14. /// </summary>
  15. /// <param name="hastableResx">The hastable RESX.</param>
  16. /// <param name="ver">The ver.</param>
  17. /// <param name="filePath">The file path.</param>
  18. public static void SaveData(Hashtable hastableResx, ulong ver, string filePath)
  19. {
  20. var resx = new CommonResx() { ResourceHashtable = hastableResx, Version = ver };
  21. JsonHelper.SaveData<CommonResx>(filePath, resx, null, true);
  22. }
  23. /// <summary>
  24. /// Gets the data.
  25. /// </summary>
  26. /// <param name="filePath">The file path.</param>
  27. /// <returns>CommonResx.</returns>
  28. public static CommonResx GetData(string filePath)
  29. {
  30. var resx = new CommonResx() { Version = 0 };
  31. if (!File.Exists(filePath))
  32. return resx;
  33. return JsonHelper.LoadData<CommonResx>(filePath).FirstOrDefault();
  34. }
  35. }
  36. }