private ControllerMapping PopulateMapping(DataRow dr) { ControllerMapping mapping = new ControllerMapping(); mapping.MidiControlId = (int)dr["MidiControlId"]; mapping.MidiControlName = (string)dr["MidiControlName"]; mapping.MidiControlType = FixUp.FixControlType(((int)dr["MidiControlType"])); mapping.MinValue = (int)dr["MinValue"]; mapping.MaxValue = (int)dr["MaxValue"]; mapping.CatCmdId = (CatCmd)dr["CatCmdId"]; mapping.CatCmd = CatCmdDb.Get(mapping.CatCmdId); mapping.MidiOutCmdDown = ConvertFromDBVal <string>(dr["MidiOutCmdDown"]); mapping.MidiOutCmdUp = ConvertFromDBVal <string>(dr["MidiOutCmdUp"]); mapping.MidiOutCmdSetValue = ConvertFromDBVal <string>(dr["MidiOutCmdSetValue"]); return(mapping); }
private int GetDeviceMappings(MappedCommand mappedCmd, DataTable controllerDT) { int NumAdded = 0; foreach (DataRow dr in controllerDT.Rows) { if ((int)(dr["CatCmdId"]) == mappedCmd.CmdId) { MappedCommand mc = new MappedCommand(mappedCmd); mc.Controller = controllerDT.TableName; mc.ControlName = (string)dr["MidiControlName"]; mc.ControlType = FixUp.FixControlType(((int)dr["MidiControlType"])); mc.Remove = "Unmap"; this.Add(mc); NumAdded++; } } return(NumAdded); }