Skip to content

Commit

Permalink
Fix ValidatedStringWrapper not sorting properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ManlyMarco committed Nov 20, 2024
1 parent 28c61ed commit 7b497d5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/KKManager/ModpackTool/Data/ValidatedStringWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace KKManager.ModpackTool
{
public class ValidatedStringWrapper : INotifyPropertyChanged
public class ValidatedStringWrapper : INotifyPropertyChanged, IComparable<ValidatedStringWrapper>, IComparable, IEquatable<ValidatedStringWrapper>
{
public static implicit operator string(ValidatedStringWrapper w) => w.Value;

Expand Down Expand Up @@ -51,5 +51,9 @@ private void OnPropertyChanged(string propertyName)
public bool VerifyString(string value) => VerifyValue(value);

public override string ToString() => Value ?? "";

public int CompareTo(object obj) => obj is ValidatedStringWrapper other ? CompareTo(other) : 1;
public int CompareTo(ValidatedStringWrapper other) => string.Compare(Value, other.Value, StringComparison.Ordinal);
public bool Equals(ValidatedStringWrapper other) => Value == other?.Value;
}
}

0 comments on commit 7b497d5

Please sign in to comment.