Ejemplo n.º 1
0
        private Form1PageStrings GetPage(XmlReader r)
        {
            Form1PageStrings ps = new Form1PageStrings();

            int count = r.AttributeCount;

            for (int i = 0; i < count; i++)
            {
                r.MoveToAttribute(i);
                switch (r.Name)
                {
                case "width":
                    ps.Width = r.Value;
                    break;

                case "height":
                    ps.Height = r.Value;
                    break;

                case "marginTopPage1":
                    ps.MarginTopPage1 = r.Value;
                    break;

                case "marginTopOther":
                    ps.MarginTopOther = r.Value;
                    break;

                case "marginRight":
                    ps.MarginRight = r.Value;
                    break;

                case "marginBottom":
                    ps.MarginBottom = r.Value;
                    break;

                case "marginLeft":
                    ps.MarginLeft = r.Value;
                    break;
                }
            }

            return(ps);
        }
Ejemplo n.º 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
            }
        }