public static KeyIniItemShortcutType FromInt(int value) { value = value % 256; var type = Enum.IsDefined(typeof(TypeEnum), value) ? (TypeEnum)value : TypeEnum.Unknown; if (type == TypeEnum.Unknown && value < 255 & value > 142) { type = TypeEnum.Midi; } var r = new KeyIniItemShortcutType { Type = type }; if (type == TypeEnum.Midi) { r.MidiChannel = (byte)(value & 0x0f); r.MidiCommand = (byte)(value >> 4); } return(r); }
public void Deserialize(string str) { var parts = str.SplitWithStringDelimiter(' ', '\"'); ShortcutType = KeyIniItemShortcutType.FromInt(int.Parse(parts[0])); Shortcut = int.Parse(parts[1]); Id = parts[2]; Validity = (SectionValidityEnum)int.Parse(parts[3]); }