Example #1
0
        private static InnerContextNode TryReadInnerContextNode(XmlNode Node)
        {
            InnerContextNode Result = new InnerContextNode();

            Result.Name = new List <string>();
            foreach (XmlAttribute attr in Node.Attributes)
            {
                if (attr.Name == "Type")
                {
                    Result.Type = attr.InnerText;
                }
            }
            foreach (XmlNode subNode in Node.ChildNodes)
            {
                if (subNode.Name == "string")
                {
                    Result.Name.Add(subNode.InnerText);
                }
                else
                {
                    Result.SubNodes.Add(TryReadInnerContextNode(subNode));
                }
            }
            return(Result);
        }
Example #2
0
        private List <InnerContextNode> GetInnerContext(List <PointOfInterest> Points)
        {
            if (Points == null || Points.Count == 0)
            {
                return(null);
            }
            List <InnerContextNode> Result = new List <InnerContextNode>();

            foreach (PointOfInterest Point in Points)
            {
                InnerContextNode node = new InnerContextNode();
                if (Point.Context != null && Point.Context.Count != 0)
                {
                    node.Name = Point.Context[0].Name;
                    node.Type = Point.Context[0].Type;
                }
                if (Point.Items != null && Point.Items.Count != 0)
                {
                    //Вариант
                    //node.SubNodes = GetInnerContext(Point.Items);  //сохранение в виде дерева
                    Result.AddRange(GetInnerContext(Point.Items));  //сохранение в виде списка
                }
                Result.Add(node);
            }
            return(Result);
        }
Example #3
0
        private static InnerContextNode TryReadInnerContextNode(XmlNode Node, dynamic Lexer)
        {
            InnerContextNode Result = new InnerContextNode();

            Result.Name = new List <string>();
            Result.Type = Node.Attributes["Type"]?.InnerText;
            Result.Name = TokenizeString(Node.InnerText, Lexer);
            return(Result);
        }
Example #4
0
        private static XmlNode BuildInnerContextNode(InnerContextNode IN, XmlDocument Doc)
        {
            XmlElement   icNode     = Doc.CreateElement("i");
            XmlAttribute icNodeType = Doc.CreateAttribute("Type");

            icNodeType.InnerText = IN.Type;
            icNode.Attributes.Append(icNodeType);
            icNode.InnerText = string.Join(" ", IN.Name);
            return(icNode);
        }
Example #5
0
        private static List <InnerContextNode> TryReadInnerContext(XmlNode Node)
        {
            List <InnerContextNode> Result = new List <InnerContextNode>();

            foreach (XmlNode subNode in Node.ChildNodes)
            {
                List <string>    name     = new List <string>();
                XmlNode          NameNode = TryFindNode(subNode, "Name");
                InnerContextNode IC       = new InnerContextNode();
                IC.Name = TryReadListOfStrings(NameNode);
                IC.Type = TryFindValue(Node, "Type");
                Result.Add(IC);
            }
            return(Result);
        }