/// <summary> /// Creates a new node /// </summary> /// <param name="name">the name of the node</param> /// <param name="parent">The parent node</param> protected Node(string name, Node parent = null) { Name = name; Parent = parent; if (parent != null && !string.IsNullOrEmpty(parent.Tag)) Tag = parent.Tag + '.' + name; else Tag = name; }
/// <summary> /// Creates a new node /// </summary> /// <param name="client">the client the node belongs to</param> /// <param name="name">the name of the node</param> /// <param name="parent">The parent node</param> protected Node(IClient<Node> client, string name, Node parent = null) { Client = client; Name = name; Parent = parent; if (parent != null && !string.IsNullOrEmpty(parent.Tag)) Tag = parent.Tag + '.' + name; else Tag = name; }
/// <summary> /// Instantiates a UaNode class /// </summary> /// <param name="name">the name of the node</param> /// <param name="nodeId">The UA Id of the node</param> /// <param name="parent">The parent node</param> internal UaNode(string name, string nodeId, Node parent = null) : base(name, parent) { NodeId = nodeId; }
/// <summary> /// Instantiates a UaNode class /// </summary> /// <param name="client">the client the node belongs to</param> /// <param name="name">the name of the node</param> /// <param name="nodeId">The UA Id of the node</param> /// <param name="parent">The parent node</param> internal UaNode(IClient<UaNode> client, string name, string nodeId, Node parent = null) : base(client, name, parent) { NodeId = nodeId; }
/// <summary> /// Instantiates a DaNode class /// </summary> /// <param name="name">the name of the node</param> /// <param name="tag"></param> /// <param name="parent">The parent node</param> public DaNode(string name, string tag, Node parent = null) : base(name, parent) { Tag = tag; }
/// <summary> /// Instantiates a DaNode class /// </summary> /// <param name="client">the client the node belongs to</param> /// <param name="name">the name of the node</param> /// <param name="tag"></param> /// <param name="parent">The parent node</param> public DaNode(IClient<Node> client, string name, string tag, Node parent = null) : base(client, name, parent) { Tag = tag; }
private void Cd(IList<string> args) { if (!args.Any()) throw new BadCommandException(); _currentNode = _client.FindNode(GenerateRelativeTag(args[0])); }
public Repl(IClient<Node> client) { _client = client; _currentNode = client.RootNode; }
private void RunCommand(Command command) { switch (command.Cmd) { case SupportedCommands.Help: ShowHelp(); break; case SupportedCommands.Read: Read(command.Args); break; case SupportedCommands.Write: Write(command.Args); break; case SupportedCommands.Ls: ShowSubnodes(); break; case SupportedCommands.Root: _currentNode = _client.RootNode; break; case SupportedCommands.Up: _currentNode = _currentNode.Parent ?? _client.RootNode; break; case SupportedCommands.Monitor: Monitor(command.Args); break; case SupportedCommands.Cd: Cd(command.Args); break; default: throw new BadCommandException(); } }