public AsciimationDataGenerator(string frames)
{
Input = frames;
string[] lines = frames.Split(new string[] { "\\n" }, StringSplitOptions.None);
List<Frame> result = new List<Frame>();
int frameNumber = 0;
for (int i = 1; i < lines.Length - 1; i += FrameHeight + 1)
{
string[] frameLines = new string[FrameHeight];
string[] reducedLines = new string[FrameHeight];
for (int j = i; j < i + FrameHeight; j++)
{
var linej = lines[j].Replace("\\\\", "\\").Replace("\\'", "'");
frameLines[j - i] = linej.PadRight(FrameWidth, ' ').Substring(0, FrameWidth);
reducedLines[j - i] = linej.Length >= FrameWidth ? linej.Substring(0, FrameWidth) : linej + '\n';
}
var line = string.Join("", frameLines);
var tmp1 = string.Join(Environment.NewLine, frameLines);
var reducedLine = string.Join("", reducedLines);
result.Add(new Frame
{
RepeatCount = int.Parse(lines[i - 1]),
Lines = frameLines,
ReducedLines = reducedLines,
Line = line,
ReducedLine = reducedLine,
Bytes = line.Select(c => (byte)c).ToArray(),
ReducedBytes = reducedLine.Select(c => (byte)c).ToArray()
});
frameNumber++;
}
Frames = result.ToArray();
}