Example #1
0
        private Form1MetadataStrings GetMetadata(XmlReader r)
        {
            Form1MetadataStrings m = new Form1MetadataStrings(); // sets all values to "" by default
            int count = r.AttributeCount;

            for (int i = 0; i < count; i++)
            {
                r.MoveToAttribute(i);
                switch (r.Name)
                {
                case "title":
                    m.Title = r.Value;
                    break;

                case "author":
                    m.Author = r.Value;
                    break;

                case "keywords":
                    m.Keywords = r.Value;
                    break;

                case "comment":
                    m.Comment = r.Value;
                    break;
                }
            }

            return(m);
        }
Example #2
0
        public Form1StringData(string form1DataPath)
        {
            _form1DataPath = form1DataPath;
            _fileName      = Path.GetFileNameWithoutExtension(form1DataPath);

            using (XmlReader r = XmlReader.Create(form1DataPath))
            {
                M.ReadToXmlElementTag(r, "form1Data"); // check that this is a form1Data file

                M.ReadToXmlElementTag(r, "page", "notation", "metadata", "options");

                while (r.Name == "page" || r.Name == "notation" || r.Name == "metadata" || r.Name == "options")
                {
                    if (r.NodeType != XmlNodeType.EndElement)
                    {
                        switch (r.Name)
                        {
                        case "page":
                            Page = GetPage(r);
                            break;

                        case "notation":
                            Notation = GetMNXCommonData(r);
                            break;

                        case "metadata":
                            Metadata = GetMetadata(r);
                            break;

                        case "options":
                            Options = GetOptions(r);
                            break;
                        }
                        M.ReadToXmlElementTag(r, "page", "notation", "metadata", "options", "form1Data");
                    }
                }
                M.Assert(r.Name == "form1Data"); // end of form1Data
            }
        }