public AnimationBinary(Stream stream) { Bar barFile = Bar.Read(stream); if (!isValidAnimationBinary(barFile)) { throw new InvalidDataException($"Invalid animation binary."); } foreach (Bar.Entry barEntry in barFile) { switch (barEntry.Type) { case Bar.EntryType.Motion: MotionFile = Motion.Read(barEntry.Stream); MotionIndex = barEntry.Index; MotionName = barEntry.Name; break; case Bar.EntryType.MotionTriggers: if (barEntry.Stream.Length == 0) { break; } MotionTriggerFile = new MotionTrigger(barEntry.Stream); TriggerIndex = barEntry.Index; TriggerName = barEntry.Name; break; default: break; } } }
public static Dictionary <string, List <Place> > Read(Stream stream) => Bar.Read(stream) .Where(x => x.Type == Bar.EntryType.List) .ToDictionary(x => x.Name, x => ReadPlaceEntry(x.Stream).ToList());