Пример #1
0
        private void ReadTagBlock(XmlReader reader, string name, uint offset, bool visible, IPluginVisitor visitor,
                                  uint pluginLine, string tooltip)
        {
            uint entrySize = 0;

            if (reader.MoveToAttribute("entrySize") || reader.MoveToAttribute("size") || reader.MoveToAttribute("elementSize"))
            {
                if (!string.IsNullOrWhiteSpace(reader.Value))
                {
                    entrySize = ParseUInt(reader.Value);
                }
            }

            int align = 4;

            if (reader.MoveToAttribute("align"))
            {
                align = ParseInt(reader.Value);
            }
            bool sort = false;

            if (reader.MoveToAttribute("sort"))
            {
                sort = ParseBool(reader.Value);
            }

            if (visitor.EnterTagBlock(name, offset, visible, entrySize, align, sort, pluginLine, tooltip))
            {
                reader.MoveToElement();
                XmlReader subtree = reader.ReadSubtree();

                subtree.ReadStartElement();
                ReadElements(subtree, false, visitor);
                visitor.LeaveTagBlock();
            }
        }
Пример #2
0
        private static void ReadTagBlock(XmlReader reader, string name, uint offset, bool visible, IPluginVisitor visitor,
                                         uint pluginLine, string tooltip)
        {
            if (!reader.MoveToAttribute("elementSize") && !reader.MoveToAttribute("entrySize"))
            {
                throw new ArgumentException("Tag Blocks must have an elementSize attribute." + PositionInfo(reader));
            }

            uint elementSize = ParseUInt(reader.Value);
            int  align       = 4;

            if (reader.MoveToAttribute("align"))
            {
                align = ParseInt(reader.Value);
            }
            bool sort = false;

            if (reader.MoveToAttribute("sort"))
            {
                sort = ParseBool(reader.Value);
            }

            if (visitor.EnterTagBlock(name, offset, visible, elementSize, align, sort, pluginLine, tooltip))
            {
                reader.MoveToElement();
                XmlReader subtree = reader.ReadSubtree();

                subtree.ReadStartElement();
                ReadElements(subtree, false, visitor);
                visitor.LeaveTagBlock();
            }
            else
            {
                reader.Skip();
            }
        }