Compare Files


Node Information
Compares two given files, if they are the same 'Equal' will be fired, else 'NotEqual' will be fired.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Compare IN RUN MULTIPLE FALSE FALSE
File1 IN String ONE FALSE FALSE
File2 IN String ONE FALSE FALSE
File2 IN FileComparisonType ONE FALSE FALSE
Equal OUT RUN MULTIPLE FALSE FALSE
NotEqual OUT RUN MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.IO.File
{
    [IsNode("Compare Files")]
    public class FileCompare : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Compare");
        Port file1 = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "File1");
        Port file2 = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "File2");
        Port comptype = new Port(PortType.IN, typeof(KIO.FileComparisonType), AcceptsLinks.ONE, "File2");
        Port tru = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Equal");
        Port fls = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "NotEqual");
        public FileCompare()
        {
            this.Dependency = DependencyLibraries.IOOPERATIONS;
            this.Name = "Compare Files";
            this.NodeType = KGraph.NodeType.Method;
            AddPort(run);
            AddPort(file1);
            AddPort(file2);
            AddPort(comptype);
            AddPort(tru);
            AddPort(fls);
            Information = "Compares two given files, if they are the same 'Equal' will be fired, else 'NotEqual' will be fired.";
        }
        public override string Code()
        {
            return "if(KIO.KComparer.Compare(" + GetValue(file1) + ", " + GetValue(file2) + ", " + GetValue(comptype) + "))\r\n{\r\n" + GetValue(tru) + "}\r\nelse\r\n{\r\n" + GetValue(fls) + "\r\n}";
        }
    }
}