using Connected.Interop.Reflection; namespace Connected.Net.Hubs; public enum MessageClientBehavior { Reliable = 1, FireForget = 2 } public sealed class Client : IComparable> { public Client(string connection) { if (string.IsNullOrWhiteSpace(connection)) throw new ArgumentException(null, nameof(connection)); Connection = connection; } public string Connection { get; set; } public int User { get; set; } public TArgs? Arguments { get; set; } public DateTime RetentionDeadline { get; set; } public MessageClientBehavior Behavior { get; set; } = MessageClientBehavior.Reliable; public int CompareTo(Client? other) { if (other is null) return 1; if (User != other.User) return 1; if (Behavior != other.Behavior) return 1; if (Arguments is null && other.Arguments is null) return 0; if (Arguments is null && other.Arguments is not null) return -1; if (Arguments is not null && other.Arguments is null) return 1; if (ObjectComparer.Compare(Arguments, other.Arguments)) return 0; return -1; } }