Added initial watchdirectory trigger
This commit is contained in:
parent
89af4ef948
commit
804e3d23bb
|
|
@ -0,0 +1,40 @@
|
|||
using Elsa.ActivityResults;
|
||||
using Elsa.Attributes;
|
||||
using Elsa.Services;
|
||||
using Elsa.Services.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Elsa.Activities.File
|
||||
{
|
||||
[Trigger(Category = "File",
|
||||
DisplayName = "Watch Directory",
|
||||
Description = "Watches a directory for file system changes",
|
||||
Outcomes = new[] { OutcomeNames.Done })]
|
||||
public class WatchDirectory : Activity
|
||||
{
|
||||
private ILogger _logger;
|
||||
|
||||
public WatchDirectory(ILogger<WatchDirectory> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public WatcherChangeTypes ChangeType { get; set; }
|
||||
|
||||
public string Directory { get; set; }
|
||||
|
||||
public string FileName { get; set; }
|
||||
|
||||
public async override ValueTask<IActivityExecutionResult> ExecuteAsync(ActivityExecutionContext context)
|
||||
{
|
||||
_logger.LogInformation($"Directory={Directory}");
|
||||
return Done();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue