Beispiel #1
0
        private static MidiMappingRecord LoadMappingRecordFromXElement(XElement mappingElement)
        {
            MidiMappingRecord mappingRecord = new MidiMappingRecord
            {
                Trigger = MidiInputTrigger.Parse(mappingElement.Attribute(Xml_TriggerInputSequenceAttr).Value),
                Action  = CreateActionByName(mappingElement.Attribute(Xml_ActionAttr).Value),
            };

            var paramAttributes = mappingElement
                                  .Attributes()
                                  .Where(attr => attr.Name.LocalName.StartsWith(Xml_ParamAttrPrefix));

            foreach (var param in paramAttributes)
            {
                string paramUnprefixedName = param.Name.LocalName.Substring(Xml_ParamAttrPrefix.Length);
                mappingRecord.Action.Parameters[paramUnprefixedName] = DecodeActionParameter(param.Value);
            }
            return(mappingRecord);
        }