mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Added CommandId to commands
This commit is contained in:
parent
e4d7ea9fd8
commit
a3961ffb69
@ -76,17 +76,23 @@ public void broken_executor_should_throw_the_exception()
|
||||
|
||||
public class CommandA : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
public CommandA(int id = 0)
|
||||
// ReSharper restore UnusedParameter.Local
|
||||
{
|
||||
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandB : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
|
||||
public CommandB()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -34,31 +34,9 @@ public static string CalculateCrc(string input)
|
||||
return String.Format("{0:x8}", mCrc);
|
||||
}
|
||||
|
||||
public static string GenerateUserId()
|
||||
public static string GenerateCommandId()
|
||||
{
|
||||
return GenerateId("u");
|
||||
}
|
||||
|
||||
public static string GenerateAppId()
|
||||
{
|
||||
return GenerateId("a");
|
||||
}
|
||||
|
||||
public static string GenerateApiToken()
|
||||
{
|
||||
return Guid.NewGuid().ToString().Replace("-", "");
|
||||
}
|
||||
|
||||
public static string GenerateSecurityToken(int length)
|
||||
{
|
||||
var byteSize = (length / 4) * 3;
|
||||
|
||||
var linkBytes = new byte[byteSize];
|
||||
var rngCrypto = new RNGCryptoServiceProvider();
|
||||
rngCrypto.GetBytes(linkBytes);
|
||||
var base64String = Convert.ToBase64String(linkBytes);
|
||||
|
||||
return base64String;
|
||||
return GenerateId("c");
|
||||
}
|
||||
|
||||
private static string GenerateId(string prefix)
|
||||
|
@ -1,6 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace NzbDrone.Common.Messaging
|
||||
{
|
||||
public interface ICommand : IMessage
|
||||
{
|
||||
String CommandId { get; }
|
||||
}
|
||||
}
|
@ -1,13 +1,15 @@
|
||||
namespace NzbDrone.Common.Messaging
|
||||
using System;
|
||||
|
||||
namespace NzbDrone.Common.Messaging
|
||||
{
|
||||
public class TestCommand : ICommand
|
||||
{
|
||||
public int Duration { get; set; }
|
||||
public String CommandId { get; set; }
|
||||
|
||||
public TestCommand()
|
||||
{
|
||||
Duration = 4000;
|
||||
}
|
||||
|
||||
public int Duration { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -1,8 +1,16 @@
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.DataAugmentation.Scene
|
||||
{
|
||||
public class UpdateSceneMappingCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
|
||||
public UpdateSceneMappingCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,17 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.IndexerSearch
|
||||
{
|
||||
public class EpisodeSearchCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public int EpisodeId { get; set; }
|
||||
|
||||
public EpisodeSearchCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,18 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.IndexerSearch
|
||||
{
|
||||
public class SeasonSearchCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public int SeriesId { get; set; }
|
||||
public int SeasonNumber { get; set; }
|
||||
|
||||
public SeasonSearchCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,17 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.IndexerSearch
|
||||
{
|
||||
public class SeriesSearchCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public int SeriesId { get; set; }
|
||||
|
||||
public SeriesSearchCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,16 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public class RssSyncCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
|
||||
public RssSyncCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,16 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Instrumentation.Commands
|
||||
{
|
||||
public class ClearLogCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
|
||||
public ClearLogCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,16 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Instrumentation.Commands
|
||||
{
|
||||
public class DeleteLogFilesCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
|
||||
public DeleteLogFilesCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,16 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Instrumentation.Commands
|
||||
{
|
||||
public class TrimLogCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
|
||||
public TrimLogCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,22 @@
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.Commands
|
||||
{
|
||||
public class CleanMediaFileDb : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public int SeriesId { get; private set; }
|
||||
|
||||
public CleanMediaFileDb()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
|
||||
public CleanMediaFileDb(int seriesId)
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
SeriesId = seriesId;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.Commands
|
||||
{
|
||||
public class CleanUpRecycleBinCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
|
||||
public CleanUpRecycleBinCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,16 @@
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.Commands
|
||||
{
|
||||
public class DownloadedEpisodesScanCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
|
||||
public DownloadedEpisodesScanCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.Commands
|
||||
@ -7,8 +9,16 @@ public class RenameSeasonCommand : ICommand
|
||||
public int SeriesId { get; private set; }
|
||||
public int SeasonNumber { get; private set; }
|
||||
|
||||
public String CommandId { get; set; }
|
||||
|
||||
public RenameSeasonCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
|
||||
public RenameSeasonCommand(int seriesId, int seasonNumber)
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
SeriesId = seriesId;
|
||||
SeasonNumber = seasonNumber;
|
||||
}
|
||||
|
@ -1,13 +1,22 @@
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.Commands
|
||||
{
|
||||
public class RenameSeriesCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public int SeriesId { get; private set; }
|
||||
|
||||
public RenameSeriesCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
|
||||
public RenameSeriesCommand(int seriesId)
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
SeriesId = seriesId;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Email
|
||||
{
|
||||
public class TestEmailCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public string Server { get; set; }
|
||||
public int Port { get; set; }
|
||||
public bool Ssl { get; set; }
|
||||
@ -11,5 +14,10 @@ public class TestEmailCommand : ICommand
|
||||
public string Password { get; set; }
|
||||
public string From { get; set; }
|
||||
public string To { get; set; }
|
||||
|
||||
public TestEmailCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,19 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Growl
|
||||
{
|
||||
public class TestGrowlCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public string Host { get; set; }
|
||||
public int Port { get; set; }
|
||||
public string Password { get; set; }
|
||||
|
||||
public TestGrowlCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,20 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Plex
|
||||
{
|
||||
public class TestPlexClientCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public string Host { get; set; }
|
||||
public int Port { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
|
||||
public TestPlexClientCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,18 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Plex
|
||||
{
|
||||
public class TestPlexServerCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public string Host { get; set; }
|
||||
public int Port { get; set; }
|
||||
|
||||
public TestPlexServerCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,18 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Prowl
|
||||
{
|
||||
public class TestProwlCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public string ApiKey { get; set; }
|
||||
public int Priority { get; set; }
|
||||
|
||||
public TestProwlCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,18 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Pushover
|
||||
{
|
||||
public class TestPushoverCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public string UserKey { get; set; }
|
||||
public int Priority { get; set; }
|
||||
|
||||
public TestPushoverCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,21 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Xbmc
|
||||
{
|
||||
public class TestXbmcCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public string Host { get; set; }
|
||||
public int Port { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public int DisplayTime { get; set; }
|
||||
|
||||
public TestXbmcCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,18 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Providers
|
||||
{
|
||||
public class UpdateXemMappingsCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public int? SeriesId { get; private set; }
|
||||
|
||||
public UpdateXemMappingsCommand(int? seriesId)
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
|
||||
SeriesId = seriesId;
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,23 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Tv.Commands
|
||||
{
|
||||
public class RefreshSeriesCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
public int? SeriesId { get; private set; }
|
||||
|
||||
public RefreshSeriesCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
|
||||
public RefreshSeriesCommand(int? seriesId)
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
|
||||
SeriesId = seriesId;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using System;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Update.Commands
|
||||
{
|
||||
public class ApplicationUpdateCommand : ICommand
|
||||
{
|
||||
public String CommandId { get; set; }
|
||||
|
||||
public ApplicationUpdateCommand()
|
||||
{
|
||||
CommandId = HashUtil.GenerateCommandId();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user