Example #1
0
        public void ReadXml(XmlReader reader)
        {
            FormatVersion = reader.GetAttribute("formatVersion");
            FileVersion   = reader.GetAttribute("fileVersion");
            DateTime originalVersion;

            DateTime.TryParseExact(reader.GetAttribute("originalVersion"), "ddd MMM dd HH:mm:ss UTCzzz yyyy",
                                   CultureInfo.InvariantCulture,
                                   DateTimeStyles.None, out originalVersion);
            OriginalVersion = originalVersion;

            bool isEmptyElement = reader.IsEmptyElement;

            reader.ReadStartElement("fox");
            if (isEmptyElement)
            {
                return;
            }

            bool isClassesElementEmpty = reader.IsEmptyElement;

            reader.ReadStartElement("classes");
            if (isClassesElementEmpty == false)
            {
                while (reader.LocalName == "class")
                {
                    FoxClass foxClass = new FoxClass();
                    foxClass.ReadXml(reader);
                    _classes.Add(foxClass);
                }
                reader.ReadEndElement();
            }

            bool isEntitiesElementEmpty = reader.IsEmptyElement;

            reader.ReadStartElement("entities");
            if (isEntitiesElementEmpty == false)
            {
                while (reader.LocalName == "entity")
                {
                    FoxEntity foxEntity = new FoxEntity();
                    foxEntity.ReadXml(reader);
                    _entities.Add(foxEntity);
                }
                reader.ReadEndElement();
            }

            reader.ReadEndElement();
        }
Example #2
0
        public void ReadXml(XmlReader reader)
        {
            FormatVersion = reader.GetAttribute("formatVersion");
            FileVersion = reader.GetAttribute("fileVersion");
            DateTime originalVersion;
            DateTime.TryParseExact(reader.GetAttribute("originalVersion"), "ddd MMM dd HH:mm:ss UTCzzz yyyy",
                CultureInfo.InvariantCulture,
                DateTimeStyles.None, out originalVersion);
            OriginalVersion = originalVersion;

            bool isEmptyElement = reader.IsEmptyElement;
            reader.ReadStartElement("fox");
            if (isEmptyElement) return;

            bool isClassesElementEmpty = reader.IsEmptyElement;
            reader.ReadStartElement("classes");
            if (isClassesElementEmpty == false)
            {
                while (reader.LocalName == "class")
                {
                    FoxClass foxClass = new FoxClass();
                    foxClass.ReadXml(reader);
                    _classes.Add(foxClass);
                }
                reader.ReadEndElement();
            }

            bool isEntitiesElementEmpty = reader.IsEmptyElement;
            reader.ReadStartElement("entities");
            if (isEntitiesElementEmpty == false)
            {
                while (reader.LocalName == "entity")
                {
                    FoxEntity foxEntity = new FoxEntity();
                    foxEntity.ReadXml(reader);
                    _entities.Add(foxEntity);
                }
                reader.ReadEndElement();
            }

            reader.ReadEndElement();
        }