Advertisement
Guest User

Client Plugin Discord Example Manifest

a guest
Jul 15th, 2021
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. using Intersect.Plugins.Interfaces;
  2. using Intersect.Plugins.Manifests.Types;
  3. using Intersect.Utilities;
  4. using Semver;
  5. using System;
  6. using System.Collections.Generic;
  7.  
  8. namespace Client.Plugins.DiscordButton
  9. {
  10. /// <summary>
  11. /// Defines a plugin manifest in code rather than an embedded manifest.json file.
  12. /// </summary>
  13. public struct DiscordButtonManifest : IManifestHelper, IEquatable<IManifestHelper>, IEquatable<DiscordButtonManifest>
  14. {
  15. // ReSharper disable once AssignNullToNotNullAttribute This will not be null.
  16. /// <inheritdoc />
  17. public string Name => typeof(DiscordButtonManifest).Namespace;
  18.  
  19. // ReSharper disable once AssignNullToNotNullAttribute This will not be null.
  20. /// <inheritdoc />
  21. public string Key => typeof(DiscordButtonManifest).Namespace;
  22.  
  23. /// <inheritdoc />
  24. public SemVersion Version => new SemVersion(1);
  25.  
  26. /// <inheritdoc />
  27. public Authors Authors =>
  28. "Author <author@email.com> (some link to your profile or website)";
  29.  
  30. /// <inheritdoc />
  31. public string Homepage => "Homepage link";
  32.  
  33. public override bool Equals(object obj) => obj is DiscordButtonManifest other && Equals(other) ||
  34. obj is IManifestHelper otherManifestHelper &&
  35. Equals(otherManifestHelper);
  36.  
  37. public override int GetHashCode() => ValueUtils.ComputeHashCode(Name, Key, Version, Authors, Homepage);
  38.  
  39. public static bool operator ==(DiscordButtonManifest left, DiscordButtonManifest right) => left.Equals(right);
  40.  
  41. public static bool operator !=(DiscordButtonManifest left, DiscordButtonManifest right) => !(left == right);
  42.  
  43. public bool Equals(DiscordButtonManifest other) => Equals(other as IManifestHelper);
  44.  
  45. public bool Equals(IManifestHelper other) => other != null &&
  46. string.Equals(Name, other.Name, StringComparison.Ordinal) &&
  47. string.Equals(Key, other.Key, StringComparison.Ordinal) &&
  48. Version.Equals(other.Version) &&
  49. Authors.Equals(other.Authors as IEnumerable<Author>) &&
  50. string.Equals(Homepage, other.Homepage,
  51. StringComparison.OrdinalIgnoreCase);
  52. }
  53.  
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement