Directory File Count


Node Information
Gets file count of the specified directory.
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
Count OUT Int64 MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.IO.Directory
{
    [IsNode("Directory File Count")]
    public class DirectoryFileCount : Node
    {
        Port path = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "Path");
        Port count = new Port(PortType.OUT, typeof(long), AcceptsLinks.MULTIPLE, "Count");
        public string FilePath
        {
            set { path.Value = value.ToString(); }
            get { return GetRuntimeValue(path); }
        }
        public DirectoryFileCount()
        {
            this.Dependency = DependencyLibraries.IOOPERATIONS;
            this.Name = "Directory File Count";
            this.NodeType = KGraph.NodeType.Function;
            this.ReturnType = typeof(long);
            count.Value = "false";
            AddPort(path);
            AddPort(count);
            Information = "Gets file count of the specified directory.";
        }
        public override string Code()
        {
            string filepath = string.Empty;
            if (path.IsConnected) { filepath = "(" + GetValue(path) + ").ToString()"; }
            else { filepath = "@" + q + FilePath + q; }
            string code = "return new IOOperations().DirectoryFileCount(" + filepath + ");";
            return code;
        }
    }
}