mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
dev: Added argumentoutofrange static methods, no functional change
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user