Esempio n. 1
0
        public static void FromMeasure(ref TabSiteMeasureAttribute ret, XmlNode measureNode)
        {
            var attributes = XMLUtil.GetNode(measureNode, "attributes");

            if (attributes != null)
            {
                var i = XMLUtil.GetNodeValue(attributes, "divisions").ToInt();
                if (i.IsNull() == false)
                {
                    ret.Divisions = i;
                }

                //num strings (ex: 6)
                i = XMLUtil.GetNodeValue(attributes, "staff-details/staff-lines").ToInt();
                if (i.IsNull() == false)
                {
                    ret.StaffLines = i;
                }

                //string tuning (ex: E)
                var n = XMLUtil.GetNode(attributes, "staff-details/staff-tuning");
                if (n != null)
                {
                    ret.StaffLineTuning = XMLUtil.GetNodeList(n, "tuning-step").Select(x => XMLUtil.GetNodeValue(x)).ToArray();
                }

                //beats per bar (ex: 6)
                var b = XMLUtil.GetNodeValue(attributes, "time/beats").ToInt();
                if (b.IsNull() == false)
                {
                    ret.Beats = b;
                }

                //4 = quarter note
                b = XMLUtil.GetNodeValue(attributes, "time/beat-type").ToInt();
                if (b.IsNull() == false)
                {
                    ret.BeatType = b;
                }
            }
        }
        public static void FromMeasure(ref TabSiteMeasureAttribute ret, XmlNode measureNode)
        {
            var attributes = XMLUtil.GetNode(measureNode, "attributes");
            if (attributes != null)
            {
                var i = XMLUtil.GetNodeValue(attributes, "divisions").ToInt();
                if (i.IsNull() == false)
                {
                    ret.Divisions = i;
                }

                //num strings (ex: 6)
                i = XMLUtil.GetNodeValue(attributes, "staff-details/staff-lines").ToInt();
                if (i.IsNull() == false)
                {
                    ret.StaffLines = i;
                }

                //string tuning (ex: E)
                var n = XMLUtil.GetNode(attributes, "staff-details/staff-tuning");
                if (n != null)
                {
                    ret.StaffLineTuning = XMLUtil.GetNodeList(n, "tuning-step").Select(x => XMLUtil.GetNodeValue(x)).ToArray();
                }

                //beats per bar (ex: 6)
                var b = XMLUtil.GetNodeValue(attributes, "time/beats").ToInt();
                if (b.IsNull() == false) { ret.Beats = b; }

                //4 = quarter note
                b = XMLUtil.GetNodeValue(attributes, "time/beat-type").ToInt();
                if (b.IsNull() == false)
                {
                    ret.BeatType = b;
                }
            }
        }