Delete File


Node Information
Deletes the specified file.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Delete IN RUN MULTIPLE FALSE FALSE
Path IN String ONE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.IO.File
{
    [IsNode("Delete File")]
    public class FileDelete : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE,  "Delete");
        Port path = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "Path");
        public string FilePath
        {
            set { path.Value = value.ToString(); }
            get { return GetRuntimeValue(path); }
        }
        public FileDelete()
        {
            this.Name = "Delete File";
            this.NodeType = KGraph.NodeType.Method;
            AddPort(run);
            AddPort(path);
            Information = "Deletes the specified file.";
        }
        public override string Code()
        {
            string filepath = string.Empty;
            if (path.IsConnected) { filepath = GetValue(path); }
            else { filepath = "@" + q + FilePath + q; }
            string code = "System.IO.File.Delete(" + filepath + ");";
            return code;
        }
    }
}