Attributes.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. namespace BepInEx
  3. {
  4. [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
  5. public class BepInPlugin : Attribute
  6. {
  7. /// <summary>
  8. /// The unique identifier of the plugin. Should not change between plugin versions.
  9. /// </summary>
  10. public string GUID { get; protected set; }
  11. /// <summary>
  12. /// The user friendly name of the plugin. Is able to be changed between versions.
  13. /// </summary>
  14. public string Name { get; protected set; }
  15. /// <summary>
  16. /// The specfic version of the plugin.
  17. /// </summary>
  18. public Version Version { get; protected set; }
  19. public BepInPlugin(string GUID, string Name, string Version)
  20. {
  21. this.GUID = GUID;
  22. this.Name = Name;
  23. this.Version = new Version(Version);
  24. }
  25. }
  26. [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
  27. public class BepInDependency : Attribute
  28. {
  29. public enum DependencyFlags
  30. {
  31. HardDependency = 1,
  32. SoftDependency = 2
  33. }
  34. public string DependencyGUID { get; protected set; }
  35. public DependencyFlags Flags { get; protected set; }
  36. public BepInDependency(string DependencyGUID, DependencyFlags Flags = DependencyFlags.HardDependency)
  37. {
  38. this.DependencyGUID = DependencyGUID;
  39. this.Flags = Flags;
  40. }
  41. }
  42. }