Пример #1
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
            }
        }
Пример #2
0
        private Form1NotationStrings GetMNXCommonData(XmlReader r)
        {
            Form1NotationStrings nss = new Form1NotationStrings();

            int count = r.AttributeCount;

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

                case "gapSize":
                    nss.gapSize = r.Value;
                    break;

                case "minGapsBetweenStaves":
                    nss.minGapsBetweenStaves = r.Value;
                    break;

                case "minGapsBetweenSystems":
                    nss.minGapsBetweenSystems = r.Value;
                    break;

                case "systemStartBars":
                    nss.systemStartBars = r.Value;
                    break;

                case "crotchetsPerMinute":
                    nss.crotchetsPerMinute = r.Value;
                    break;
                }
            }

            return(nss);
        }