using FileFlows.Plugin;
namespace FileFlows.BasicNodes.File;
///
/// Basic Input file, the default input node
///
public class InputFile : Node
{
///
/// Gets the number of outputs
///
public override int Outputs => 1;
///
/// Gets the element type
///
public override FlowElementType Type => FlowElementType.Input;
///
/// Gets the icon
///
public override string Icon => "far fa-file";
///
/// Gets the help URL
///
public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/input-file";
///
/// Executes the node
///
/// the node parameters
/// the output to call next
public override int Execute(NodeParameters args)
{
try
{
if(args.FileService.FileExists(args.WorkingFile).Is(true) == false)
{
args.Logger?.ELog("File not found: " + args.WorkingFile);
return -1;
}
args.Variables["ORIGINAL_CREATE_UTC"] = args.FileService.FileCreationTimeUtc(args.WorkingFile).ValueOrDefault;
args.Variables["ORIGINAL_LAST_WRITE_UTC"] = args.FileService.FileLastWriteTimeUtc(args.WorkingFile).ValueOrDefault;
return 1;
}
catch (Exception ex)
{
args.Logger?.ELog("Failed in InputFile: " + ex.Message + Environment.NewLine + ex.StackTrace);
return -1;
}
}
}