public static ReplayData DecodeFrom(BinaryReader reader) { var futures = new List <Future>(); while (true) { var future = Future.DecodeFrom(reader); if (future == null) { break; } futures.Add(future); } var moves = new List <Move>(); while (true) { var move = Move.DecodeFrom(reader); if (move == null) { break; } moves.Add(move); } return(new ReplayData { Futures = futures.ToArray(), Moves = moves.ToArray() }); }