Пример #1
0
 /// <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;
 }
Пример #2
0
 /// <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;
 }
Пример #3
0
 /// <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;
 }
Пример #4
0
 /// <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;
 }
Пример #5
0
 /// <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;
 }
Пример #6
0
 /// <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;
 }
Пример #7
0
 private void Cd(IList<string> args)
 {
     if (!args.Any())
     throw new BadCommandException();
       _currentNode = _client.FindNode(GenerateRelativeTag(args[0]));
 }
Пример #8
0
 public Repl(IClient<Node> client)
 {
     _client = client;
       _currentNode = client.RootNode;
 }
Пример #9
0
 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();
       }
 }