Drive Info


Node Information
Gets the given Drive's Information.
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
Size OUT Int64 MULTIPLE FALSE FALSE
Size OUT String MULTIPLE FALSE FALSE
Freespace OUT Int64 MULTIPLE FALSE FALSE
Format OUT String MULTIPLE FALSE FALSE
Name OUT String MULTIPLE FALSE FALSE
Label OUT String MULTIPLE FALSE FALSE
DriveType OUT DriveType MULTIPLE FALSE FALSE
IsReady OUT Boolean MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.IO.Drive
{
    [IsNode("Drive Info")]
    public class DriveInfo : Node
    {
        Port path = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "Path");
        Port size = new Port(PortType.OUT, typeof(long), AcceptsLinks.MULTIPLE, "Size");
        Port rsize = new Port(PortType.OUT, typeof(string), AcceptsLinks.MULTIPLE, "Size");
        Port freespace = new Port(PortType.OUT, typeof(long), AcceptsLinks.MULTIPLE, "Freespace");
        Port format = new Port(PortType.OUT, typeof(string), AcceptsLinks.MULTIPLE, "Format");
        Port name = new Port(PortType.OUT, typeof(string), AcceptsLinks.MULTIPLE, "Name");
        Port label = new Port(PortType.OUT, typeof(string), AcceptsLinks.MULTIPLE, "Label");
        Port drivetype = new Port(PortType.OUT, typeof(System.IO.DriveType), AcceptsLinks.MULTIPLE, "DriveType");
        Port isready = new Port(PortType.OUT, typeof(bool), AcceptsLinks.MULTIPLE, "IsReady");
        public string DrivePath
        {
            set { path.Value = value.ToString(); }
            get { return GetRuntimeValue(path); }
        }
        public DriveInfo()
        {
            this.Name = "Drive Info";
            size.Value = "0";
            freespace.Value = "0";
            AddPort(path);
            AddPort(size);
            AddPort(rsize);
            AddPort(freespace);
            AddPort(format);
            AddPort(name);
            AddPort(label);
            AddPort(drivetype);
            drivetype.DataType = typeof(System.IO.DriveType);
            AddPort(isready);
            Information = "Gets the given Drive's Information.";
        }
        public override void UpdateResults()
        {
            string filepath = GetValue(path);
            size.Instructions = "new System.IO.DriveInfo((" + filepath + ").ToString()).TotalSize";
            rsize.Instructions = "FileSizeConverter.ConvertSize(new System.IO.DriveInfo((" + filepath + ").ToString()).TotalSize)";
            freespace.Instructions = "new System.IO.DriveInfo((" + filepath + ").ToString()).TotalFreeSpace";
            format.Instructions = "new System.IO.DriveInfo((" + filepath + ").ToString()).DriveFormat";
            name.Instructions = "new System.IO.DriveInfo((" + filepath + ").ToString()).Name";
            label.Instructions = "new System.IO.DriveInfo((" + filepath + ").ToString()).VolumeLabel";
            isready.Instructions = "new System.IO.DriveInfo((" + filepath + ").ToString()).IsReady";
            drivetype.Instructions = "new System.IO.DriveInfo((" + filepath + ").ToString()).DriveType";
        }
    }
}