using System.Linq; using JD.Timeline.Model.Utility; using JD.Serialization; namespace JD.Timeline.Model { public static class DanceTapeExtensions { public static void SetClock(this Tape tape) { if (!tape.Id.EndsWith(FileExtensions.DanceTape)) return; tape.TapeClock = Tape.TapeClock_Enum.TapeClock_ConductorGameplay; } public static void AddTracksForGhostClips(this Tape tape) { if (!tape.Id.EndsWith(FileExtensions.DanceTape)) return; var trackIds = tape.Tracks.Select(x => x.Id); var ghostClipTracks = tape.Clips.Where(x => !trackIds.Contains(x.TrackId)).Select(x => new {TrackId = x.TrackId, Type = x.Type}).Distinct(); foreach (var ghostClip in ghostClipTracks) { if (ghostClip.Type == typeof(MotionClip)) { tape.GetOrCreateTrack("Missing track").Id = ghostClip.TrackId; } if (ghostClip.Type == typeof(PictogramClip)) { tape.GetOrCreateTrack("Missing track").Id = ghostClip.TrackId; } if (ghostClip.Type == typeof(GoldEffectClip)) { tape.GetOrCreateTrack("Missing track").Id = ghostClip.TrackId; } } } } }