using FileFlows.Plugin; using FileFlows.Plugin.Attributes; namespace FileFlows.BasicNodes.FileProperties; /// /// Flow element that sets a file property /// public class SetFileProperty : Node { /// public override int Inputs => 1; /// public override int Outputs => 1; /// public override FlowElementType Type => FlowElementType.Process; /// public override string Icon => "fas fa-file-signature"; /// public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/set-file-property"; /// /// Gets or sets the property name /// [TextVariable(1)] public string Property { get; set; } /// /// Gets or sets the property value /// [TextVariable(2)] public string Value { get; set; } /// public override int Execute(NodeParameters args) { string property = args.ReplaceVariables(this.Property ?? string.Empty, stripMissing: true); if (string.IsNullOrEmpty(property)) return args.Fail("No property set"); string value = args.ReplaceVariables(this.Value ?? string.Empty, stripMissing: true)?.EmptyAsNull(); args.SetProperty(property, value); return 1; } }