2013-08-28 06:51:42 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
2013-08-29 04:43:26 +00:00
|
|
|
|
namespace NzbDrone.Common.Messaging.Tracking
|
2013-08-28 06:51:42 +00:00
|
|
|
|
{
|
2013-08-29 04:43:26 +00:00
|
|
|
|
public class TrackedCommand
|
2013-08-28 06:51:42 +00:00
|
|
|
|
{
|
2013-08-31 03:08:19 +00:00
|
|
|
|
public String Id { get; private set; }
|
|
|
|
|
public String Name { get; private set; }
|
2013-08-28 15:05:41 +00:00
|
|
|
|
public String Type { get; private set; }
|
|
|
|
|
public ICommand Command { get; private set; }
|
2013-08-28 06:51:42 +00:00
|
|
|
|
public CommandState State { get; set; }
|
2013-08-29 04:43:26 +00:00
|
|
|
|
public DateTime StateChangeTime { get; set; }
|
|
|
|
|
public TimeSpan Runtime { get; set; }
|
|
|
|
|
public Exception Exception { get; set; }
|
2013-08-31 06:19:19 +00:00
|
|
|
|
|
|
|
|
|
public TrackedCommand()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-29 04:43:26 +00:00
|
|
|
|
public TrackedCommand(ICommand command, CommandState state)
|
2013-08-28 06:51:42 +00:00
|
|
|
|
{
|
2013-08-31 03:08:19 +00:00
|
|
|
|
Id = command.CommandId;
|
|
|
|
|
Name = command.GetType().Name;
|
2013-08-28 06:51:42 +00:00
|
|
|
|
Type = command.GetType().FullName;
|
|
|
|
|
Command = command;
|
|
|
|
|
State = state;
|
2013-08-29 04:43:26 +00:00
|
|
|
|
StateChangeTime = DateTime.UtcNow;
|
2013-08-28 06:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum CommandState
|
|
|
|
|
{
|
|
|
|
|
Running = 0,
|
|
|
|
|
Completed = 1,
|
|
|
|
|
Failed = 2
|
|
|
|
|
}
|
|
|
|
|
}
|