-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSplashReader.cs
More file actions
40 lines (32 loc) · 1.02 KB
/
SplashReader.cs
File metadata and controls
40 lines (32 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.IO;
namespace BrickGameEmulator
{
public class SplashReader
{
public BGField[] Read(string filename)
{
List<BGField> frames = new List<BGField>();
string[] lines = File.ReadAllLines(Environment.CurrentDirectory + @"/" + filename);
int framesCount = lines.Length / 20;
for (int i = 0; i < framesCount; i++)
{
int[][] array = new int[10][];
for (int j = 0; j < 10; j++)
{
array[j] = new int[20];
}
for (int j = i * 20; j < (i + 1) * 20; j++)
{
for (int k = 0; k < 10; k++)
{
array[k][j % 20] = int.Parse(lines[j][k].ToString());
}
}
frames.Add(new BGField(array));
}
return frames.ToArray();
}
}
}