public int Compare(TLUser x, TLUser y) { if (_epoch) { var epoch = LastSeenConverter.GetIndex(y).CompareTo(LastSeenConverter.GetIndex(x)); if (epoch == 0) { var fullName = x.FullName.CompareTo(y.FullName); if (fullName == 0) { return(y.Id.CompareTo(x.Id)); } return(fullName); } return(epoch); } else { var fullName = x.FullName.CompareTo(y.FullName); if (fullName == 0) { return(y.Id.CompareTo(x.Id)); } return(fullName); } }
public int Compare(User x, User y) { if (_epoch) { var epoch = LastSeenConverter.GetIndex(y).CompareTo(LastSeenConverter.GetIndex(x)); if (epoch == 0) { var nameX = x.FirstName.Length > 0 ? x.FirstName : x.LastName; var nameY = y.FirstName.Length > 0 ? y.FirstName : y.LastName; var fullName = nameX.CompareTo(nameY); if (fullName == 0) { return(y.Id.CompareTo(x.Id)); } return(fullName); } return(epoch); } else { if (x.Type is UserTypeDeleted) { return(1); } var nameX = x.FirstName.Length > 0 ? x.FirstName : x.LastName; var nameY = y.FirstName.Length > 0 ? y.FirstName : y.LastName; var fullName = nameX.CompareTo(nameY); if (fullName == 0) { return(y.Id.CompareTo(x.Id)); } return(fullName); } }
public int Compare(TLChannelParticipantBase x, TLChannelParticipantBase y) { var xUser = x.User; var yUser = y.User; if (xUser == null || yUser == null) { return(-1); } if (_epoch) { var epoch = LastSeenConverter.GetIndex(yUser).CompareTo(LastSeenConverter.GetIndex(xUser)); if (epoch == 0) { var fullName = xUser.FullName.CompareTo(yUser.FullName); if (fullName == 0) { return(yUser.Id.CompareTo(xUser.Id)); } return(fullName); } return(epoch); } else { var fullName = xUser.FullName.CompareTo(yUser.FullName); if (fullName == 0) { return(yUser.Id.CompareTo(xUser.Id)); } return(fullName); } }