using Newtonsoft.Json; namespace Nop.Services.Plugins; /// /// Represents base info of plugin descriptor /// public partial class PluginDescriptorBaseInfo : IComparable { /// /// Gets or sets the plugin system name /// [JsonProperty(PropertyName = "SystemName")] public virtual string SystemName { get; set; } /// /// Gets or sets the version /// [JsonProperty(PropertyName = "Version")] public virtual string Version { get; set; } /// /// Compares this instance with a specified PluginDescriptorBaseInfo object /// /// The PluginDescriptorBaseInfo to compare with this instance /// An integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified parameter public int CompareTo(PluginDescriptorBaseInfo other) { return string.Compare(SystemName, other.SystemName, StringComparison.InvariantCultureIgnoreCase); } /// /// Determines whether this instance and another specified PluginDescriptor object have the same SystemName /// /// The PluginDescriptor to compare to this instance /// True if the SystemName of the value parameter is the same as the SystemName of this instance; otherwise, false public override bool Equals(object value) { return SystemName?.Equals((value as PluginDescriptorBaseInfo)?.SystemName) ?? false; } /// /// Returns the hash code for this plugin descriptor /// /// A 32-bit signed integer hash code public override int GetHashCode() { return SystemName.GetHashCode(); } /// /// Gets a copy of base info of plugin descriptor /// [JsonIgnore] public virtual PluginDescriptorBaseInfo GetBaseInfoCopy => new() { SystemName = SystemName, Version = Version }; }