47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
namespace Trigger.Tasks.Plugins
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// <para>Logs all events from command line</para>
|
|||
|
/// </summary>
|
|||
|
class LogCommandLineEvents : TaskPlugin
|
|||
|
{
|
|||
|
#region Properties
|
|||
|
internal Main Main;
|
|||
|
internal Log Log;
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Methods
|
|||
|
public override bool Init(Main Main)
|
|||
|
{
|
|||
|
return Init(Main, new System.Diagnostics.Stopwatch());
|
|||
|
}
|
|||
|
public override bool Init(Main Main, System.Diagnostics.Stopwatch swInit)
|
|||
|
{
|
|||
|
this.Main = Main;
|
|||
|
this.Log = Main.Log;
|
|||
|
|
|||
|
Main.CommandLineTrigger += new Events.EventPlugin.EventValue<int>(Main_CommandLineTrigger);
|
|||
|
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
public override void Dispose()
|
|||
|
{
|
|||
|
Main.CommandLineTrigger -= new Events.EventPlugin.EventValue<int>(Main_CommandLineTrigger);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Event handlers
|
|||
|
private void Main_CommandLineTrigger(object sender, Events.EventArgsValue<int> e)
|
|||
|
{
|
|||
|
this.Log.LogLineDate("Trigger from command line: 0x" + e.Value.ToString("X4"), Trigger.Log.Type.CommandLineEvent);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|