Exemple #1
0
        public static async Task <NodeDef> GetNodeDefs(this IIntrospectable obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            var xmlStr = await obj.Introspect();

            var ser = new XmlSerializer(typeof(NodeDef), new XmlRootAttribute("node"));

            using (var stream = new System.IO.StringReader(xmlStr))
            {
                return((NodeDef)ser.Deserialize(stream));
            }
        }
Exemple #2
0
        public static async Task <(InterfaceObjDef[] Interfaces, string[] Nodes, string NodePath)> GetObjectDefs(this IIntrospectable obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            var xmlStr = await obj.Introspect();

            var ser = new XmlSerializer(typeof(NodeDef), new XmlRootAttribute("node"));

            using (var stream = new System.IO.StringReader(xmlStr))
            {
                var nodeDef    = (NodeDef)ser.Deserialize(stream);
                var interfaces = nodeDef.GetInterfaceDefs();
                return(interfaces, nodeDef.Nodes.Select(n => n.Name).ToArray(), nodeDef.Name);
            }
        }