You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. using System;
  2. using Version = SemVer.Version;
  3. // ReSharper disable CheckNamespace
  4. namespace IPA
  5. {
  6. /// <summary>
  7. /// A class to provide information about a mod on ModSaber.ML
  8. /// </summary>
  9. // ReSharper disable once IdentifierTypo
  10. public class ModsaberModInfo
  11. {
  12. /// <summary>
  13. /// The name the mod uses on ModSaber as an identifier.
  14. /// </summary>
  15. public string InternalName
  16. {
  17. get => _internalName;
  18. set
  19. {
  20. if (_internalName == null)
  21. {
  22. _internalName = value;
  23. }
  24. else
  25. {
  26. throw new Exception("Cannot change name one it has been set!");
  27. }
  28. }
  29. }
  30. private string _internalName;
  31. /// <summary>
  32. /// The version of the currently installed mod. Used to compare to the version on ModSaber. Should be a valid SemVer version.
  33. /// </summary>
  34. public string CurrentVersion
  35. {
  36. get => _currentVersion;
  37. set
  38. {
  39. if (_currentVersion == null)
  40. {
  41. var version = new Version(value); // check for valid version
  42. _currentVersion = value;
  43. SemverVersion = version;
  44. }
  45. else
  46. {
  47. throw new Exception("Cannot change version one it has been set!");
  48. }
  49. }
  50. }
  51. private string _currentVersion;
  52. internal Version SemverVersion;
  53. }
  54. }