示例#1
0
        internal Mapping(Device device, Format.Mapping rawMapping)
            : this(rawMapping)
        {
            Attach(device);

            if (Id >= 0)
            {
                Format.MidiDefinition rawDefinition = getMidiDefinition(device, Command.MappingType, Id);
                if (rawDefinition != null)
                {
                    MidiBinding = AMidiDefinition.Parse(device.TypeStr, Command.MappingType, rawDefinition);
                }
            }
        }
示例#2
0
        internal Mapping(Device device, Format.Mapping rawMapping)
            : this(rawMapping)
        {
            if (Command == null)    //pestrela: favorites crash
            {
                return;
            }

            Attach(device);

            if (Id >= 0)
            {
                Format.MidiDefinition rawDefinition = getMidiDefinition(device, Command.MappingType, Id);
                if (rawDefinition != null)
                {
                    MidiBinding = AMidiDefinition.Parse(device.TypeStr, Command.MappingType, rawDefinition);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Creates a copy of this mapping.
        /// </summary>
        /// <param name="includeMidiBinding">Optionally include the midi binding.</param>
        /// <returns>Copy of mapping</returns>
        public Mapping Copy(bool includeMidiBinding)
        {
            Format.Mapping rawMappingCopy;
            using (var copyStream = new System.IO.MemoryStream())
            {
                _rawMapping.Write(new Utils.Writer(copyStream));
                copyStream.Seek(0, System.IO.SeekOrigin.Begin);
                rawMappingCopy = new Format.Mapping(copyStream);
            }

            var copy = new Mapping(rawMappingCopy);

            if (includeMidiBinding)
            {
                copy.MidiBinding = MidiBinding;
            }

            return(copy);
        }
示例#4
0
        /// <summary>
        /// Private constructor. Used for copying and as base constructor.
        /// </summary>
        /// <param name="rawMapping"></param>
        private Mapping(Format.Mapping rawMapping)
        {
            _rawMapping = rawMapping;

            bool originalHasValueUI = _rawMapping.Settings.HasValueUI;

            Command = Commands.All.GetCommandProxy(_rawMapping.TraktorControlId, _rawMapping.Type).Create(_rawMapping.Settings);
            if (Command == null)
            {
            }

            if (originalHasValueUI != _rawMapping.Settings.HasValueUI)
            {
                // TODO: Something for the consolidation function
            }

            _conditions = new ConditionTuple(
                (_rawMapping.Settings.ConditionOneId > 0) ? cmdr.TsiLib.Conditions.All.GetConditionProxy(_rawMapping.Settings.ConditionOneId).Create(_rawMapping.Settings, ConditionNumber.One) : null,
                (_rawMapping.Settings.ConditionTwoId > 0) ? cmdr.TsiLib.Conditions.All.GetConditionProxy(_rawMapping.Settings.ConditionTwoId).Create(_rawMapping.Settings, ConditionNumber.Two) : null
                );
        }
示例#5
0
 internal Mapping(CommandProxy command)
 {
     _rawMapping = new Format.Mapping(command.MappingType, command.Description.Id);
     Command     = command.Create(_rawMapping.Settings);
     _conditions = new ConditionTuple();
 }