GIT: perform LF normalization

This commit is contained in:
Gary Sharp
2013-02-28 17:15:46 +11:00
parent 989f08a24d
commit 7d9be5620d
729 changed files with 300734 additions and 300712 deletions
+351 -351
View File
@@ -1,351 +1,351 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Quartz;
using System.Web.Script.Serialization;
namespace Disco.Services.Tasks
{
public class ScheduledTaskStatus
{
#region Backing Fields
private string _sessionId;
private string _triggerKey;
private string _taskName;
private Type _taskType;
private bool _isSilent;
private byte _progress;
private string _currentProcess;
private string _currentDescription;
private Exception _taskException;
private bool _cancelInitiallySupported;
private bool _cancelSupported;
private bool _isCanceling;
private DateTime? _startedTimestamp;
private DateTime? _nextScheduledTimestamp;
private DateTime? _finishedTimestamp;
private string _finishedMessage;
private string _finishedUrl;
private int _statusVersion = 0;
#endregion
#region Properties
public string SessionId { get { return this._sessionId; } }
public string TriggerKey { get { return this._triggerKey; } }
public string TaskName { get { return this._taskName; } }
public Type TaskType { get { return this._taskType; } }
public bool IsSilent { get { return this._isSilent; } }
public byte Progress { get { return this._progress; } }
public string CurrentProcess { get { return this._currentProcess; } }
public string CurrentDescription { get { return this._currentDescription; } }
public Exception TaskException { get { return this._taskException; } }
public bool CancelSupported { get { return this._cancelSupported; } }
public bool IsCanceling { get { return this._isCanceling; } }
public DateTime? StartedTimestamp { get { return this._startedTimestamp; } }
public DateTime? FinishedTimestamp { get { return this._finishedTimestamp; } }
public DateTime? NextScheduledTimestamp { get { return this._nextScheduledTimestamp; } }
public string FinishedMessage { get { return this._finishedMessage; } }
public string FinishedUrl { get { return this._finishedUrl; } }
public int StatusVersion { get { return this._statusVersion; } }
public bool IsRunning
{
get
{
return _startedTimestamp.HasValue && !_finishedTimestamp.HasValue;
}
}
#endregion
#region Events
public delegate void UpdatedEvent(ScheduledTaskStatus sender, string[] ChangedProperties);
public delegate void CancelingEvent(ScheduledTaskStatus sender);
public event UpdatedEvent Updated;
public event CancelingEvent Canceling;
#endregion
public ScheduledTaskStatus(ScheduledTask Task, string SessionId, string TriggerKey, string FinishedUrl = null)
{
this._taskName = Task.TaskName;
this._taskType = Task.GetType();
this._sessionId = SessionId;
this._triggerKey = TriggerKey;
this._cancelInitiallySupported = Task.CancelInitiallySupported;
this._cancelSupported = this._cancelInitiallySupported;
this._finishedUrl = FinishedUrl;
this._currentProcess = "Scheduled";
this._currentDescription = "Scheduled Task for Execution";
this._progress = 0;
}
#region Progress Actions
public void UpdateStatus(byte Progress)
{
this._progress = Progress;
UpdateTriggered(new string[] { "Progress" });
}
public void UpdateStatus(double Progress)
{
UpdateStatus((byte)Progress);
}
public void UpdateStatus(string CurrentDescription)
{
this._currentDescription = CurrentDescription;
UpdateTriggered(new string[] { "CurrentDescription" });
}
public void UpdateStatus(byte Progress, string CurrentDescription)
{
this._progress = Progress;
this._currentDescription = CurrentDescription;
UpdateTriggered(new string[] { "Progress", "CurrentDescription" });
}
public void UpdateStatus(double Progress, string CurrentDescription)
{
UpdateStatus((byte)Progress, CurrentDescription);
}
public void UpdateStatus(byte Progress, string CurrentProcess, string CurrentDescription)
{
this._progress = Progress;
this._currentProcess = CurrentProcess;
this._currentDescription = CurrentDescription;
UpdateTriggered(new string[] { "Progress", "CurrentProcess", "CurrentDescription" });
}
public void UpdateStatus(double Progress, string CurrentProcess, string CurrentDescription)
{
UpdateStatus((byte)Progress, CurrentProcess, CurrentDescription);
}
#endregion
#region State Actions
public bool Canceled()
{
if (!this._isCanceling)
{
if (_cancelSupported)
{ // Cancelling
this._isCanceling = true;
UpdateTriggered(new string[] { "IsCancelling" });
if (this.Canceling != null)
Canceling(this);
return true;
}
else
{ // Cancelling not supported
return false;
}
}
else
{ // Already Cancelling
return true;
}
}
public void SetCancelSupported(bool CancelSupported)
{
if (this._cancelSupported != CancelSupported)
{
this._cancelSupported = CancelSupported;
UpdateTriggered(new string[] { "CancelSupported" });
}
}
public void SetTaskException(Exception TaskException)
{
if (this._taskException != TaskException)
{
this._taskException = TaskException;
UpdateTriggered(new string[] { "TaskException" });
}
}
public void SetIsSilent(bool IsSilent)
{
if (this._isSilent != IsSilent)
this._isSilent = IsSilent;
}
public void SetFinishedUrl(string FinishedUrl)
{
if (this._finishedUrl != FinishedUrl)
{
this._finishedUrl = FinishedUrl;
UpdateTriggered(new string[] { "FinishedUrl" });
}
}
public void SetFinishedMessage(string FinishedMessage)
{
if (this._finishedMessage != FinishedMessage)
{
this._finishedMessage = FinishedMessage;
UpdateTriggered(new string[] { "FinishedMessage" });
}
}
public void SetNextScheduledTimestamp(DateTime? NextScheduledTimestamp)
{
if (this._nextScheduledTimestamp != NextScheduledTimestamp)
{
this._nextScheduledTimestamp = NextScheduledTimestamp;
UpdateTriggered(new string[] { "NextScheduledTimestamp" });
}
}
public void Started()
{
List<string> changedProperties = new List<string>() { "IsRunning", "StartedTimestamp" };
this._startedTimestamp = DateTime.Now;
if (this._nextScheduledTimestamp != null)
{
this._nextScheduledTimestamp = null;
changedProperties.Add("NextScheduledTimestamp");
}
if (this._finishedTimestamp != null)
{
this._finishedTimestamp = null;
changedProperties.Add("FinishedTimestamp");
}
if (this._progress != 0)
{
this._progress = 0;
changedProperties.Add("Progress");
}
if (this._currentProcess != "Starting")
{
this._currentProcess = "Starting";
changedProperties.Add("CurrentProcess");
}
if (this._currentDescription != "Initializing Task for Execution")
{
this._currentDescription = "Initializing Task for Execution";
changedProperties.Add("CurrentDescription");
}
if (this._taskException != null)
{
this._taskException = null;
changedProperties.Add("TaskException");
}
if (this._cancelSupported != this._cancelInitiallySupported)
{
this._cancelSupported = this._cancelInitiallySupported;
changedProperties.Add("CancelSupported");
}
{
this._isCanceling = false;
changedProperties.Add("IsCanceling");
}
if (this._isCanceling)
{
this._isCanceling = false;
changedProperties.Add("IsCanceling");
}
UpdateTriggered(changedProperties.ToArray());
}
public void Finished()
{
Finished(this._finishedMessage, this._finishedUrl);
}
public void Finished(string FinishedMessage, string FinishedUrl)
{
List<string> changedProperties = new List<string>() { "IsRunning", "FinishedTimestamp" };
this._finishedTimestamp = DateTime.Now;
if (FinishedMessage != this._finishedMessage)
{
this._finishedMessage = FinishedMessage;
changedProperties.Add("FinishedMessage");
}
if (FinishedUrl != this._finishedUrl)
{
this._finishedUrl = FinishedUrl;
changedProperties.Add("FinishedUrl");
}
if (this._isCanceling)
{
this._isCanceling = false;
changedProperties.Add("IsCanceling");
}
UpdateTriggered(changedProperties.ToArray());
}
public void Reset(DateTime? NextScheduledTimestamp)
{
List<string> changedProperties = new List<string>();
if (this._nextScheduledTimestamp != NextScheduledTimestamp)
{
this._nextScheduledTimestamp = NextScheduledTimestamp;
changedProperties.Add("NextScheduledTimestamp");
}
if (this._startedTimestamp != null)
{
this._startedTimestamp = null;
changedProperties.Add("StartedTimestamp");
}
if (this._finishedTimestamp != null)
{
this._finishedTimestamp = null;
changedProperties.Add("FinishedTimestamp");
}
if (this._finishedMessage != null)
{
this._finishedMessage = null;
changedProperties.Add("FinishedMessage");
}
if (this._finishedUrl != null)
{
this._finishedUrl = null;
changedProperties.Add("FinishedUrl");
}
if (this._progress != 0)
{
this._progress = 0;
changedProperties.Add("Progress");
}
if (this._currentProcess != "Scheduled")
{
this._currentProcess = "Scheduled";
changedProperties.Add("CurrentProcess");
}
if (this._currentDescription != "Scheduled Task for Execution")
{
this._currentDescription = "Scheduled Task for Execution";
changedProperties.Add("CurrentDescription");
}
if (this._isCanceling)
{
this._isCanceling = false;
changedProperties.Add("IsCanceling");
}
UpdateTriggered(changedProperties.ToArray());
}
#endregion
private void UpdateTriggered(string[] ChangedProperties)
{
this._statusVersion++;
if (Updated != null)
Updated(this, ChangedProperties);
if (!_isSilent)
ScheduledTasksLiveStatusService.Broadcast(ScheduledTaskStatusLive.FromScheduledTaskStatus(this, ChangedProperties));
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Quartz;
using System.Web.Script.Serialization;
namespace Disco.Services.Tasks
{
public class ScheduledTaskStatus
{
#region Backing Fields
private string _sessionId;
private string _triggerKey;
private string _taskName;
private Type _taskType;
private bool _isSilent;
private byte _progress;
private string _currentProcess;
private string _currentDescription;
private Exception _taskException;
private bool _cancelInitiallySupported;
private bool _cancelSupported;
private bool _isCanceling;
private DateTime? _startedTimestamp;
private DateTime? _nextScheduledTimestamp;
private DateTime? _finishedTimestamp;
private string _finishedMessage;
private string _finishedUrl;
private int _statusVersion = 0;
#endregion
#region Properties
public string SessionId { get { return this._sessionId; } }
public string TriggerKey { get { return this._triggerKey; } }
public string TaskName { get { return this._taskName; } }
public Type TaskType { get { return this._taskType; } }
public bool IsSilent { get { return this._isSilent; } }
public byte Progress { get { return this._progress; } }
public string CurrentProcess { get { return this._currentProcess; } }
public string CurrentDescription { get { return this._currentDescription; } }
public Exception TaskException { get { return this._taskException; } }
public bool CancelSupported { get { return this._cancelSupported; } }
public bool IsCanceling { get { return this._isCanceling; } }
public DateTime? StartedTimestamp { get { return this._startedTimestamp; } }
public DateTime? FinishedTimestamp { get { return this._finishedTimestamp; } }
public DateTime? NextScheduledTimestamp { get { return this._nextScheduledTimestamp; } }
public string FinishedMessage { get { return this._finishedMessage; } }
public string FinishedUrl { get { return this._finishedUrl; } }
public int StatusVersion { get { return this._statusVersion; } }
public bool IsRunning
{
get
{
return _startedTimestamp.HasValue && !_finishedTimestamp.HasValue;
}
}
#endregion
#region Events
public delegate void UpdatedEvent(ScheduledTaskStatus sender, string[] ChangedProperties);
public delegate void CancelingEvent(ScheduledTaskStatus sender);
public event UpdatedEvent Updated;
public event CancelingEvent Canceling;
#endregion
public ScheduledTaskStatus(ScheduledTask Task, string SessionId, string TriggerKey, string FinishedUrl = null)
{
this._taskName = Task.TaskName;
this._taskType = Task.GetType();
this._sessionId = SessionId;
this._triggerKey = TriggerKey;
this._cancelInitiallySupported = Task.CancelInitiallySupported;
this._cancelSupported = this._cancelInitiallySupported;
this._finishedUrl = FinishedUrl;
this._currentProcess = "Scheduled";
this._currentDescription = "Scheduled Task for Execution";
this._progress = 0;
}
#region Progress Actions
public void UpdateStatus(byte Progress)
{
this._progress = Progress;
UpdateTriggered(new string[] { "Progress" });
}
public void UpdateStatus(double Progress)
{
UpdateStatus((byte)Progress);
}
public void UpdateStatus(string CurrentDescription)
{
this._currentDescription = CurrentDescription;
UpdateTriggered(new string[] { "CurrentDescription" });
}
public void UpdateStatus(byte Progress, string CurrentDescription)
{
this._progress = Progress;
this._currentDescription = CurrentDescription;
UpdateTriggered(new string[] { "Progress", "CurrentDescription" });
}
public void UpdateStatus(double Progress, string CurrentDescription)
{
UpdateStatus((byte)Progress, CurrentDescription);
}
public void UpdateStatus(byte Progress, string CurrentProcess, string CurrentDescription)
{
this._progress = Progress;
this._currentProcess = CurrentProcess;
this._currentDescription = CurrentDescription;
UpdateTriggered(new string[] { "Progress", "CurrentProcess", "CurrentDescription" });
}
public void UpdateStatus(double Progress, string CurrentProcess, string CurrentDescription)
{
UpdateStatus((byte)Progress, CurrentProcess, CurrentDescription);
}
#endregion
#region State Actions
public bool Canceled()
{
if (!this._isCanceling)
{
if (_cancelSupported)
{ // Cancelling
this._isCanceling = true;
UpdateTriggered(new string[] { "IsCancelling" });
if (this.Canceling != null)
Canceling(this);
return true;
}
else
{ // Cancelling not supported
return false;
}
}
else
{ // Already Cancelling
return true;
}
}
public void SetCancelSupported(bool CancelSupported)
{
if (this._cancelSupported != CancelSupported)
{
this._cancelSupported = CancelSupported;
UpdateTriggered(new string[] { "CancelSupported" });
}
}
public void SetTaskException(Exception TaskException)
{
if (this._taskException != TaskException)
{
this._taskException = TaskException;
UpdateTriggered(new string[] { "TaskException" });
}
}
public void SetIsSilent(bool IsSilent)
{
if (this._isSilent != IsSilent)
this._isSilent = IsSilent;
}
public void SetFinishedUrl(string FinishedUrl)
{
if (this._finishedUrl != FinishedUrl)
{
this._finishedUrl = FinishedUrl;
UpdateTriggered(new string[] { "FinishedUrl" });
}
}
public void SetFinishedMessage(string FinishedMessage)
{
if (this._finishedMessage != FinishedMessage)
{
this._finishedMessage = FinishedMessage;
UpdateTriggered(new string[] { "FinishedMessage" });
}
}
public void SetNextScheduledTimestamp(DateTime? NextScheduledTimestamp)
{
if (this._nextScheduledTimestamp != NextScheduledTimestamp)
{
this._nextScheduledTimestamp = NextScheduledTimestamp;
UpdateTriggered(new string[] { "NextScheduledTimestamp" });
}
}
public void Started()
{
List<string> changedProperties = new List<string>() { "IsRunning", "StartedTimestamp" };
this._startedTimestamp = DateTime.Now;
if (this._nextScheduledTimestamp != null)
{
this._nextScheduledTimestamp = null;
changedProperties.Add("NextScheduledTimestamp");
}
if (this._finishedTimestamp != null)
{
this._finishedTimestamp = null;
changedProperties.Add("FinishedTimestamp");
}
if (this._progress != 0)
{
this._progress = 0;
changedProperties.Add("Progress");
}
if (this._currentProcess != "Starting")
{
this._currentProcess = "Starting";
changedProperties.Add("CurrentProcess");
}
if (this._currentDescription != "Initializing Task for Execution")
{
this._currentDescription = "Initializing Task for Execution";
changedProperties.Add("CurrentDescription");
}
if (this._taskException != null)
{
this._taskException = null;
changedProperties.Add("TaskException");
}
if (this._cancelSupported != this._cancelInitiallySupported)
{
this._cancelSupported = this._cancelInitiallySupported;
changedProperties.Add("CancelSupported");
}
{
this._isCanceling = false;
changedProperties.Add("IsCanceling");
}
if (this._isCanceling)
{
this._isCanceling = false;
changedProperties.Add("IsCanceling");
}
UpdateTriggered(changedProperties.ToArray());
}
public void Finished()
{
Finished(this._finishedMessage, this._finishedUrl);
}
public void Finished(string FinishedMessage, string FinishedUrl)
{
List<string> changedProperties = new List<string>() { "IsRunning", "FinishedTimestamp" };
this._finishedTimestamp = DateTime.Now;
if (FinishedMessage != this._finishedMessage)
{
this._finishedMessage = FinishedMessage;
changedProperties.Add("FinishedMessage");
}
if (FinishedUrl != this._finishedUrl)
{
this._finishedUrl = FinishedUrl;
changedProperties.Add("FinishedUrl");
}
if (this._isCanceling)
{
this._isCanceling = false;
changedProperties.Add("IsCanceling");
}
UpdateTriggered(changedProperties.ToArray());
}
public void Reset(DateTime? NextScheduledTimestamp)
{
List<string> changedProperties = new List<string>();
if (this._nextScheduledTimestamp != NextScheduledTimestamp)
{
this._nextScheduledTimestamp = NextScheduledTimestamp;
changedProperties.Add("NextScheduledTimestamp");
}
if (this._startedTimestamp != null)
{
this._startedTimestamp = null;
changedProperties.Add("StartedTimestamp");
}
if (this._finishedTimestamp != null)
{
this._finishedTimestamp = null;
changedProperties.Add("FinishedTimestamp");
}
if (this._finishedMessage != null)
{
this._finishedMessage = null;
changedProperties.Add("FinishedMessage");
}
if (this._finishedUrl != null)
{
this._finishedUrl = null;
changedProperties.Add("FinishedUrl");
}
if (this._progress != 0)
{
this._progress = 0;
changedProperties.Add("Progress");
}
if (this._currentProcess != "Scheduled")
{
this._currentProcess = "Scheduled";
changedProperties.Add("CurrentProcess");
}
if (this._currentDescription != "Scheduled Task for Execution")
{
this._currentDescription = "Scheduled Task for Execution";
changedProperties.Add("CurrentDescription");
}
if (this._isCanceling)
{
this._isCanceling = false;
changedProperties.Add("IsCanceling");
}
UpdateTriggered(changedProperties.ToArray());
}
#endregion
private void UpdateTriggered(string[] ChangedProperties)
{
this._statusVersion++;
if (Updated != null)
Updated(this, ChangedProperties);
if (!_isSilent)
ScheduledTasksLiveStatusService.Broadcast(ScheduledTaskStatusLive.FromScheduledTaskStatus(this, ChangedProperties));
}
}
}
+56 -56
View File
@@ -1,56 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Disco.Services.Tasks
{
public class ScheduledTaskStatusLive
{
public string TaskName { get; set; }
public string SessionId { get; set; }
public byte Progress { get; set; }
public string CurrentProcess { get; set; }
public string CurrentDescription { get; set; }
public string TaskExceptionMessage { get; set; }
public bool CancelSupported { get; set; }
public bool IsCancelling { get; set; }
public bool IsRunning { get; set; }
public DateTime? StartedTimestamp { get; set; }
public DateTime? FinishedTimestamp { get; set; }
public DateTime? NextScheduledTimestamp { get; set; }
public string FinishedMessage { get; set; }
public string FinishedUrl { get; set; }
public int StatusVersion { get; set; }
public string[] ChangedProperties { get; set; }
public static ScheduledTaskStatusLive FromScheduledTaskStatus(ScheduledTaskStatus Status, string[] ChangedProperties)
{
return new ScheduledTaskStatusLive()
{
TaskName = Status.TaskName,
SessionId = Status.SessionId,
Progress = Status.Progress,
CurrentProcess = Status.CurrentProcess,
CurrentDescription = Status.CurrentDescription,
CancelSupported = Status.CancelSupported,
TaskExceptionMessage = (Status.TaskException == null ? null : Status.TaskException.Message),
IsCancelling = Status.IsCanceling,
IsRunning = Status.IsRunning,
StartedTimestamp = Status.StartedTimestamp,
FinishedTimestamp = Status.FinishedTimestamp,
NextScheduledTimestamp = Status.NextScheduledTimestamp,
FinishedMessage = Status.FinishedMessage,
FinishedUrl = Status.FinishedUrl,
StatusVersion = Status.StatusVersion,
ChangedProperties = ChangedProperties
};
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Disco.Services.Tasks
{
public class ScheduledTaskStatusLive
{
public string TaskName { get; set; }
public string SessionId { get; set; }
public byte Progress { get; set; }
public string CurrentProcess { get; set; }
public string CurrentDescription { get; set; }
public string TaskExceptionMessage { get; set; }
public bool CancelSupported { get; set; }
public bool IsCancelling { get; set; }
public bool IsRunning { get; set; }
public DateTime? StartedTimestamp { get; set; }
public DateTime? FinishedTimestamp { get; set; }
public DateTime? NextScheduledTimestamp { get; set; }
public string FinishedMessage { get; set; }
public string FinishedUrl { get; set; }
public int StatusVersion { get; set; }
public string[] ChangedProperties { get; set; }
public static ScheduledTaskStatusLive FromScheduledTaskStatus(ScheduledTaskStatus Status, string[] ChangedProperties)
{
return new ScheduledTaskStatusLive()
{
TaskName = Status.TaskName,
SessionId = Status.SessionId,
Progress = Status.Progress,
CurrentProcess = Status.CurrentProcess,
CurrentDescription = Status.CurrentDescription,
CancelSupported = Status.CancelSupported,
TaskExceptionMessage = (Status.TaskException == null ? null : Status.TaskException.Message),
IsCancelling = Status.IsCanceling,
IsRunning = Status.IsRunning,
StartedTimestamp = Status.StartedTimestamp,
FinishedTimestamp = Status.FinishedTimestamp,
NextScheduledTimestamp = Status.NextScheduledTimestamp,
FinishedMessage = Status.FinishedMessage,
FinishedUrl = Status.FinishedUrl,
StatusVersion = Status.StatusVersion,
ChangedProperties = ChangedProperties
};
}
}
}
@@ -1,56 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SignalR;
using SignalR.Hosting.AspNet;
using SignalR.Infrastructure;
namespace Disco.Services.Tasks
{
public class ScheduledTasksLiveStatusService : PersistentConnection
{
protected override System.Threading.Tasks.Task OnReceivedAsync(IRequest request, string connectionId, string data)
{
// Add to Group
if (!string.IsNullOrWhiteSpace(data) && data.StartsWith("/addToGroups:") && data.Length > 13)
{
var groups = data.Substring(13).Split(',');
foreach (var g in groups)
{
this.Groups.Add(connectionId, g);
}
}
return base.OnReceivedAsync(request, connectionId, data);
}
internal static void Broadcast(ScheduledTaskStatusLive SessionStatus)
{
//var message = Models.LogLiveEvent.Create(logModule, eventType, Timestamp, Arguments);
var connectionManager = GlobalHost.ConnectionManager; //AspNetHost.DependencyResolver.Resolve<IConnectionManager>();
var connectionContext = connectionManager.GetConnectionContext<ScheduledTasksLiveStatusService>();
connectionContext.Groups.Send(_GroupNameAll, SessionStatus);
connectionContext.Groups.Send(SessionStatus.SessionId, SessionStatus);
}
private const string _GroupNameAll = "__All";
//private static string _QualifiedSessionName = typeof(ScheduledTasksLiveStatusService).FullName + ".";
//private static string _QualifiedSessionNameAll = _QualifiedSessionName + "__All";
//private static string LiveStatusGroup(string SessionId)
//{
// return string.Concat(_QualifiedSessionName, SessionId);
//}
public static string LiveStatusAll
{
get
{
//return _QualifiedTypeNameAll;
return _GroupNameAll;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SignalR;
using SignalR.Hosting.AspNet;
using SignalR.Infrastructure;
namespace Disco.Services.Tasks
{
public class ScheduledTasksLiveStatusService : PersistentConnection
{
protected override System.Threading.Tasks.Task OnReceivedAsync(IRequest request, string connectionId, string data)
{
// Add to Group
if (!string.IsNullOrWhiteSpace(data) && data.StartsWith("/addToGroups:") && data.Length > 13)
{
var groups = data.Substring(13).Split(',');
foreach (var g in groups)
{
this.Groups.Add(connectionId, g);
}
}
return base.OnReceivedAsync(request, connectionId, data);
}
internal static void Broadcast(ScheduledTaskStatusLive SessionStatus)
{
//var message = Models.LogLiveEvent.Create(logModule, eventType, Timestamp, Arguments);
var connectionManager = GlobalHost.ConnectionManager; //AspNetHost.DependencyResolver.Resolve<IConnectionManager>();
var connectionContext = connectionManager.GetConnectionContext<ScheduledTasksLiveStatusService>();
connectionContext.Groups.Send(_GroupNameAll, SessionStatus);
connectionContext.Groups.Send(SessionStatus.SessionId, SessionStatus);
}
private const string _GroupNameAll = "__All";
//private static string _QualifiedSessionName = typeof(ScheduledTasksLiveStatusService).FullName + ".";
//private static string _QualifiedSessionNameAll = _QualifiedSessionName + "__All";
//private static string LiveStatusGroup(string SessionId)
//{
// return string.Concat(_QualifiedSessionName, SessionId);
//}
public static string LiveStatusAll
{
get
{
//return _QualifiedTypeNameAll;
return _GroupNameAll;
}
}
}
}
+196 -196
View File
@@ -1,196 +1,196 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Disco.Services.Logging;
using Disco.Services.Logging.Models;
namespace Disco.Services.Tasks
{
public class ScheduledTasksLog : LogBase
{
private const int _ModuleId = 20;
public override string ModuleDescription { get { return "Scheduled Tasks"; } }
public override int ModuleId { get { return _ModuleId; } }
public override string ModuleName { get { return "ScheduledTasks"; } }
public enum EventTypeIds
{
InitializingScheduledTasks = 10,
InitializeException = 15,
InitializeExceptionWithInner,
InitializeScheduledTasksException,
InitializeScheduledTasksExceptionWithInner,
ScheduledTasksException = 30,
ScheduledTasksExceptionWithInner,
ScheduledTaskExecuted = 50,
ScheduledTaskFinished = 80,
}
public static ScheduledTasksLog Current
{
get
{
return (ScheduledTasksLog)LogContext.LogModules[_ModuleId];
}
}
private static void Log(EventTypeIds EventTypeId, params object[] Args)
{
Current.Log((int)EventTypeId, Args);
}
public static void LogInitializingScheduledTasks()
{
Current.Log((int)EventTypeIds.InitializingScheduledTasks);
}
public static void LogScheduledTaskExecuted(string TaskName, string SessionId)
{
Current.Log((int)EventTypeIds.ScheduledTaskExecuted, TaskName, SessionId);
}
public static void LogScheduledTaskFinished(string TaskName, string SessionId)
{
Current.Log((int)EventTypeIds.ScheduledTaskFinished, TaskName, SessionId);
}
public static void LogInitializeException(Exception ex)
{
if (ex.InnerException != null)
{
Log(EventTypeIds.InitializeExceptionWithInner, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace);
}
else
{
Log(EventTypeIds.InitializeException, ex.GetType().Name, ex.Message, ex.StackTrace);
}
}
public static void LogInitializeException(Exception ex, Type ScheduledTaskType)
{
if (ex.InnerException != null)
{
Log(EventTypeIds.InitializeScheduledTasksExceptionWithInner, ScheduledTaskType.Name, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace);
}
else
{
Log(EventTypeIds.InitializeScheduledTasksException, ScheduledTaskType.Name, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace);
}
}
public static void LogScheduledTaskException(string ScheduledTaskName, string SessionId, Type ScheduledTaskType, Exception ex)
{
if (ex.InnerException != null)
{
Log(EventTypeIds.ScheduledTasksExceptionWithInner, ScheduledTaskName, SessionId, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace);
}
else
{
Log(EventTypeIds.ScheduledTasksException, ScheduledTaskName, SessionId, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace);
}
}
protected override List<Logging.Models.LogEventType> LoadEventTypes()
{
return new System.Collections.Generic.List<LogEventType>
{
new LogEventType
{
Id = (int)EventTypeIds.InitializingScheduledTasks,
ModuleId = _ModuleId,
Name = "Initializing Scheduled Tasks",
Format = "Starting Scheduled Task discovery and initialization",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeException,
ModuleId = _ModuleId,
Name = "Initialize Exception",
Format = "Exception: {0}: {1}; {2}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeExceptionWithInner,
ModuleId = _ModuleId,
Name = "Initialize Exception with Inner Exception",
Format = "Exception: {0}: {1}; {2}; Inner: {3}: {4}; {5}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeScheduledTasksException,
ModuleId = _ModuleId,
Name = "Initialize Task Exception",
Format = "[{0}] At '{1}'; Exception: {2}: {3}; {4}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeScheduledTasksExceptionWithInner,
ModuleId = _ModuleId,
Name = "Initialize Task Exception with Inner Exception",
Format = "[{0}] At '{1}'; Exception: {2}: {3}; {4}; Inner: {5}: {6}; {7}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.ScheduledTasksException,
ModuleId = _ModuleId,
Name = "Scheduled Task Exception",
Format = "Task Name: {0}; SessionId: {1}; At: '{2}'; Exception: {3}: {4}; {5}",
Severity = (int)LogEventType.Severities.Error,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.ScheduledTasksExceptionWithInner,
ModuleId = _ModuleId,
Name = "Scheduled Task Exception with Inner Exception",
Format = "Task Name: {0}; SessionId: {1}; At: '{2}'; Exception: {3}: {4}; {5}; Inner: {6}: {7}; {8}",
Severity = (int)LogEventType.Severities.Error,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.ScheduledTaskExecuted,
ModuleId = _ModuleId,
Name = "Scheduled Task Started",
Format = "Scheduled Task Started: {0}; Session Id: {1}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.ScheduledTaskFinished,
ModuleId = _ModuleId,
Name = "Scheduled Task Finished",
Format = "Scheduled Task Finished: {0}; Session Id: {1}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
}
};
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Disco.Services.Logging;
using Disco.Services.Logging.Models;
namespace Disco.Services.Tasks
{
public class ScheduledTasksLog : LogBase
{
private const int _ModuleId = 20;
public override string ModuleDescription { get { return "Scheduled Tasks"; } }
public override int ModuleId { get { return _ModuleId; } }
public override string ModuleName { get { return "ScheduledTasks"; } }
public enum EventTypeIds
{
InitializingScheduledTasks = 10,
InitializeException = 15,
InitializeExceptionWithInner,
InitializeScheduledTasksException,
InitializeScheduledTasksExceptionWithInner,
ScheduledTasksException = 30,
ScheduledTasksExceptionWithInner,
ScheduledTaskExecuted = 50,
ScheduledTaskFinished = 80,
}
public static ScheduledTasksLog Current
{
get
{
return (ScheduledTasksLog)LogContext.LogModules[_ModuleId];
}
}
private static void Log(EventTypeIds EventTypeId, params object[] Args)
{
Current.Log((int)EventTypeId, Args);
}
public static void LogInitializingScheduledTasks()
{
Current.Log((int)EventTypeIds.InitializingScheduledTasks);
}
public static void LogScheduledTaskExecuted(string TaskName, string SessionId)
{
Current.Log((int)EventTypeIds.ScheduledTaskExecuted, TaskName, SessionId);
}
public static void LogScheduledTaskFinished(string TaskName, string SessionId)
{
Current.Log((int)EventTypeIds.ScheduledTaskFinished, TaskName, SessionId);
}
public static void LogInitializeException(Exception ex)
{
if (ex.InnerException != null)
{
Log(EventTypeIds.InitializeExceptionWithInner, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace);
}
else
{
Log(EventTypeIds.InitializeException, ex.GetType().Name, ex.Message, ex.StackTrace);
}
}
public static void LogInitializeException(Exception ex, Type ScheduledTaskType)
{
if (ex.InnerException != null)
{
Log(EventTypeIds.InitializeScheduledTasksExceptionWithInner, ScheduledTaskType.Name, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace);
}
else
{
Log(EventTypeIds.InitializeScheduledTasksException, ScheduledTaskType.Name, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace);
}
}
public static void LogScheduledTaskException(string ScheduledTaskName, string SessionId, Type ScheduledTaskType, Exception ex)
{
if (ex.InnerException != null)
{
Log(EventTypeIds.ScheduledTasksExceptionWithInner, ScheduledTaskName, SessionId, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace);
}
else
{
Log(EventTypeIds.ScheduledTasksException, ScheduledTaskName, SessionId, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace);
}
}
protected override List<Logging.Models.LogEventType> LoadEventTypes()
{
return new System.Collections.Generic.List<LogEventType>
{
new LogEventType
{
Id = (int)EventTypeIds.InitializingScheduledTasks,
ModuleId = _ModuleId,
Name = "Initializing Scheduled Tasks",
Format = "Starting Scheduled Task discovery and initialization",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeException,
ModuleId = _ModuleId,
Name = "Initialize Exception",
Format = "Exception: {0}: {1}; {2}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeExceptionWithInner,
ModuleId = _ModuleId,
Name = "Initialize Exception with Inner Exception",
Format = "Exception: {0}: {1}; {2}; Inner: {3}: {4}; {5}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeScheduledTasksException,
ModuleId = _ModuleId,
Name = "Initialize Task Exception",
Format = "[{0}] At '{1}'; Exception: {2}: {3}; {4}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeScheduledTasksExceptionWithInner,
ModuleId = _ModuleId,
Name = "Initialize Task Exception with Inner Exception",
Format = "[{0}] At '{1}'; Exception: {2}: {3}; {4}; Inner: {5}: {6}; {7}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.ScheduledTasksException,
ModuleId = _ModuleId,
Name = "Scheduled Task Exception",
Format = "Task Name: {0}; SessionId: {1}; At: '{2}'; Exception: {3}: {4}; {5}",
Severity = (int)LogEventType.Severities.Error,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.ScheduledTasksExceptionWithInner,
ModuleId = _ModuleId,
Name = "Scheduled Task Exception with Inner Exception",
Format = "Task Name: {0}; SessionId: {1}; At: '{2}'; Exception: {3}: {4}; {5}; Inner: {6}: {7}; {8}",
Severity = (int)LogEventType.Severities.Error,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.ScheduledTaskExecuted,
ModuleId = _ModuleId,
Name = "Scheduled Task Started",
Format = "Scheduled Task Started: {0}; Session Id: {1}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.ScheduledTaskFinished,
ModuleId = _ModuleId,
Name = "Scheduled Task Finished",
Format = "Scheduled Task Finished: {0}; Session Id: {1}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
}
};
}
}
}