LocalizedStringData.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System.IO;
  2. using System.Xml.Serialization;
  3. namespace MediaBrowser.Controller.Localization
  4. {
  5. /// <summary>
  6. /// Class LocalizedStringData
  7. /// </summary>
  8. public class LocalizedStringData
  9. {
  10. /// <summary>
  11. /// The this version
  12. /// </summary>
  13. [XmlIgnore]
  14. public string ThisVersion = "1.0000";
  15. /// <summary>
  16. /// The prefix
  17. /// </summary>
  18. [XmlIgnore]
  19. public string Prefix = "";
  20. /// <summary>
  21. /// The file name
  22. /// </summary>
  23. public string FileName; //this is public so it will serialize and we know where to save ourselves
  24. /// <summary>
  25. /// The version
  26. /// </summary>
  27. public string Version = ""; //this will get saved so we can check it against us for changes
  28. /// <summary>
  29. /// Saves this instance.
  30. /// </summary>
  31. public void Save()
  32. {
  33. Save(FileName);
  34. }
  35. /// <summary>
  36. /// Saves the specified file.
  37. /// </summary>
  38. /// <param name="file">The file.</param>
  39. public void Save(string file)
  40. {
  41. var xs = new XmlSerializer(GetType());
  42. using (var fs = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))
  43. {
  44. xs.Serialize(fs, this);
  45. }
  46. }
  47. }
  48. }