Esempio n. 1
0
        public static IBArchive Parse(XDocument xDoc)
        {
            IBArchive ibArchive = new IBArchive();

            foreach (XAttribute attr in xDoc.Root.Attributes())
            {
                if (attr.Name == "type")
                    ibArchive.Type = attr.Value;
                if (attr.Name == "version")
                    ibArchive.Version = attr.Value;
            }

            var elements = xDoc.XPathSelectElements(@"/archive/data/*");
            foreach (var element in elements)
            {
                var key = element.Attributes().Where(attr => attr.Name == "key").FirstOrDefault();
                if (key != null && element.Attribute("key").Value.StartsWith("IBDocument."))
                {
                    //IBDocument.Parse(ibArchive.Data, element);
                }
            }

            //if (xmlReader.Name == "archive")
            //{
            //    while (xmlReader.MoveToNextAttribute())
            //    {
            //        if (xmlReader.Name == "type")
            //            ibArchive.Type = xmlReader.Value;
            //        else if (xmlReader.Name == "version")
            //            ibArchive.Version = xmlReader.Value;
            //    }
            //}

            return ibArchive;
        }
Esempio n. 2
0
        public IBArchive Deserialize()
        {
            IBArchive ibArchive = new IBArchive();

            var reader = new StringReader(_nibPath);
            XDocument xDoc = XDocument.Load(_nibPath);
            if (xDoc.Root.Name == "archive")
            {
                ibArchive = IBArchive.Parse(xDoc);

            }

            return ibArchive;
        }