2021-05-03 14:54:32 +00:00
|
|
|
using Elsa.ActivityResults;
|
|
|
|
|
using Elsa.Attributes;
|
|
|
|
|
using Elsa.Services;
|
|
|
|
|
using Elsa.Services.Models;
|
2021-09-10 20:40:37 +00:00
|
|
|
using System.ComponentModel.DataAnnotations;
|
2021-05-03 14:54:32 +00:00
|
|
|
|
2021-06-19 08:53:40 +00:00
|
|
|
// ReSharper disable once CheckNamespace
|
2021-05-03 14:54:32 +00:00
|
|
|
namespace Elsa.Activities.File
|
|
|
|
|
{
|
|
|
|
|
[Action(Category = "File",
|
|
|
|
|
Description = "Deletes file at specified location",
|
|
|
|
|
Outcomes = new[] { OutcomeNames.Done })]
|
|
|
|
|
public class DeleteFile : Activity
|
|
|
|
|
{
|
2021-09-10 20:40:37 +00:00
|
|
|
[Required]
|
2021-06-06 10:04:55 +00:00
|
|
|
[ActivityInput(Hint = "Path of the file to delete.")]
|
2021-09-10 20:40:37 +00:00
|
|
|
public string? Path { get; set; }
|
2021-05-03 14:54:32 +00:00
|
|
|
|
|
|
|
|
protected override IActivityExecutionResult OnExecute(ActivityExecutionContext context)
|
|
|
|
|
{
|
|
|
|
|
System.IO.File.Delete(Path);
|
|
|
|
|
return Done();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|