File Exists


Node Information
Checks the specified file, if it exists TRUE will be returned, else FALSE will be returned.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Path IN String ONE FALSE FALSE
Exists OUT Boolean MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.IO.File
{
    [IsNode("File Exists")]
    public class FileExists : Node
    {
        Port path = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "Path");
        Port exists = new Port(PortType.OUT, typeof(bool), AcceptsLinks.MULTIPLE, "Exists");
        public string FilePath
        {
            set { path.Value = value.ToString(); }
            get { return GetRuntimeValue(path); }
        }
        public FileExists()
        {
            this.Name = "File Exists";
            this.NodeType = KGraph.NodeType.Function;
            this.ReturnType = typeof(bool);
            exists.Value = "false";
            AddPort(path);
            AddPort(exists);
            Information = "Checks the specified file, if it exists TRUE will be returned, else FALSE will be returned.";
        }
        public override string Code()
        {
            string filepath = string.Empty;
            if (path.IsConnected) { filepath = GetValue(path); }
            else { filepath = "@" + q + FilePath + q; }
            string code = "return System.IO.File.Exists(" + filepath + ");";
            return code;
        }
    }
}