dev: Added argumentoutofrange static methods, no functional change

This commit is contained in:
Kwoth
2024-05-13 14:50:55 +00:00
parent 7b2ce072ee
commit 52438f45e1
24 changed files with 69 additions and 116 deletions

View File

@@ -201,12 +201,9 @@ public sealed partial class MusicQueue : IMusicQueue
public IQueuedTrackInfo? MoveTrack(int from, int to)
{
if (from < 0)
throw new ArgumentOutOfRangeException(nameof(from));
if (to < 0)
throw new ArgumentOutOfRangeException(nameof(to));
if (to == from)
throw new ArgumentException($"{nameof(from)} and {nameof(to)} must be different");
ArgumentOutOfRangeException.ThrowIfNegative(from);
ArgumentOutOfRangeException.ThrowIfNegative(to);
ArgumentOutOfRangeException.ThrowIfEqual(to, from);
lock (_locker)
{

View File

@@ -8,8 +8,7 @@ public static class MusicPlaylistExtensions
{
public static List<MusicPlaylist> GetPlaylistsOnPage(this DbSet<MusicPlaylist> playlists, int num)
{
if (num < 1)
throw new ArgumentOutOfRangeException(nameof(num));
ArgumentOutOfRangeException.ThrowIfLessThan(num, 1);
return playlists.AsQueryable().Skip((num - 1) * 20).Take(20).Include(pl => pl.Songs).ToList();
}