Directory Exists


Node Information
Checks the specified directory, 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.Directory
{
    [IsNode("Directory Exists")]
    public class DirectoryExists : 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 DirectoryExists()
        {
            this.Name = "Directory Exists";
            this.NodeType = KGraph.NodeType.Function;
            this.ReturnType = typeof(bool);
            exists.Value = "false";
            AddPort(path);
            AddPort(exists);
            Information = "Checks the specified directory, 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.Directory.Exists(" + filepath + ");";
            return code;
        }
    }
}