Read File Lines (List)


Node Information
Reads the specified file, returns an array of strings.
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
Lines OUT List<String> MULTIPLE TRUE FALSE

Source
namespace Korduene.KGraph.Nodes.IO.File
{
    [IsNode("Read File Lines (List)")]
    public class FileReadLines : Node
    {
        Port path = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "Path");
        Port content = new Port(PortType.OUT, typeof(List<string>), AcceptsLinks.MULTIPLE, "Lines");
        public string FilePath
        {
            set { path.Value = value.ToString(); }
            get { return GetRuntimeValue(path); }
        }
        public FileReadLines()
        {
            this.Name = "Read File Lines (List)";
            AddPort(path);
            AddPort(content);
            content.Instructions = "init";
            Information = "Reads the specified file, returns an array of strings.";
        }
        public override void UpdateResults()
        {
            string filepath = string.Empty;
            if (path.IsConnected) { filepath = GetValue(path); }
            else { filepath = "@" + q + FilePath + q; }
            content.Instructions = "System.IO.File.ReadAllLines(" + filepath + ").ToList()";
        }
    }
}