BDX2BBP(BDXFormat bdx) { this.bdx = bdx; bbp = new byte[Marshal.SizeOf<BBPFormat>()].ToStruct<BBPFormat>(); DoCommonStuff(); DoChannelStuff(); var instrTypes = bbp.channelInfo.Select(c => c.playType); var hasPiano = instrTypes.Contains(PlayType.Piano); var hasGuitar = instrTypes.Contains(PlayType.Guitar); var hasDrum = instrTypes.Contains(PlayType.Drum); if (hasPiano && hasGuitar) throw new Exception("Not expecting both to exist!!!"); if (hasPiano) { DoPianoStuff(); } else if (hasGuitar) { DoGuitarStuff(); } DoKaraokeStuff(); // DoMetadataStuff() // mainly Author // metadata stuff temporarily here mgr = JbMgrFormat.JbMgrItem.Empty; //mgr.Author = bdx.contributor.ToString(); mgr.Author = "Degausser2.2a"; mgr.Title = bbp.title.ArrayToString(); mgr.TitleSimple = mgr.Title; //mgr.Flags mgr.ID = 0x80000001; mgr.Flags = new JbMgrFormat.JbMgrItem.JbFlags { HasDrum = hasDrum, HasGuitar = hasGuitar, HasPiano = hasPiano, HasLyrics = bdx.hasKaraoke != 0, HasMelody = bdx.mainInstrument != 0xFF, // not sure about this IsValid = true, OnSD = true, Parts = bdx.channelInfo.Count(c => c.instrument != 0) }; }
public static BBPFormat Convert(BDXFormat bdx, out JbMgrFormat.JbMgrItem mgr) { var converted = new BDX2BBP(bdx); mgr = converted.mgr; return converted.bbp; }