/// <summary>
        ///     METHOD FOR DELETING A NODE
        /// </summary>
        /// <param name="name"> PARAMTER NAME IS THE NAME OF THE NODE </param>
        /// <returns> RETURNS THE JSON STRING OF THE FOUND NODE </returnS>
        public void deleteNode(string name)
        {
            var response = findNode(name);

            if (response != null)
            {
                var keys = new List <string>();
                keys.Add("data.data.data.components.uuid");
                var dict = vr.parseDataDict(response, keys);
                var id   = string.Empty;
                dict.TryGetValue(keys.ElementAt(0), out id);

                deleteNodeUUID(id);
            }
        }
Exemple #2
0
        public string createRoutew(List <Dictionary <string, object> > nodes)
        {
            if (nodes == null)
            {
                nodes = new List <Dictionary <string, object> >();
                // dictionaries with one position and direction
                var dict1 = new Dictionary <string, object>();
                dict1.Add("pos", new List <int> {
                    0, 0, 0
                });
                dict1.Add("dir", new List <int> {
                    10, 0, -10
                });
                var dict2 = new Dictionary <string, object>();
                dict2.Add("pos", new List <int> {
                    100, 0, 0
                });
                dict2.Add("dir", new List <int> {
                    10, 0, 10
                });
                var dict3 = new Dictionary <string, object>();
                dict3.Add("pos", new List <int> {
                    100, 0, 100
                });
                dict3.Add("dir", new List <int> {
                    -10, 0, 10
                });
                var dict4 = new Dictionary <string, object>();
                dict4.Add("pos", new List <int> {
                    0, 0, 100
                });
                dict4.Add("dir", new List <int> {
                    -10, 0, -10
                });
                nodes.Add(dict1);
                nodes.Add(dict2);
                nodes.Add(dict3);
                nodes.Add(dict4);
            }
            dynamic packet =
                new
            {
                id   = "tunnel/send",
                data = new { dest = vr.tunnelID, data = new { id = "route/add", data = new { nodes } } }
            };

            string packetString = JsonConvert.SerializeObject(packet);

            vr.sendData(packetString);

            var response = vr.dataChecker();

            Console.WriteLine("RESONSE ROAD CREATION " + response);
            var keys = new List <string> {
                "data.data.data.uuid"
            };
            var uuidDict = vr.parseDataDict(response, keys);

            routeID = string.Empty;
            uuidDict.TryGetValue(keys.ElementAt(0), out routeID);
            return(routeID);
        }