readFromChunk static method

List<Generator> readFromChunk(
  1. BinaryReader reader,
  2. int size
)

Implementation

static List<Generator> readFromChunk(BinaryReader reader, int size)
{
    if (size % 4 != 0)
    {
        throw "The generator list is invalid.";
    }

  // The last one is the terminator.
    int count = (size ~/ 4) - 1;

    List<Generator> generators = [];

    for (var i = 0; i < count; i++)
    {
        generators.add(
          Generator.fromReader(reader)
        );
    }

    // The last one is the terminator.
    Generator.fromReader(reader);

    return generators;
}