예제 #1
0
        private static void CreateTap(BasicProgram program)
        {
            int programSize = program.Length - 2;

            const string Filename = "taptest";
            var          header   = new List <byte>();

            header.Add(0);                                              // flag
            header.Add(0);                                              // type
            header.AddRange(Encoding.ASCII.GetBytes(Filename.PadRight(10)));
            header.Add((byte)(programSize & 0xff));                     // data size
            header.Add((byte)((programSize >> 8) & 0xff));              // data size
            header.Add(10);                                             // autostart number
            header.Add(0);                                              // autostart number
            header.Add((byte)(programSize & 0xff));                     // variables
            header.Add((byte)((programSize >> 8) & 0xff));              // variables
            header.Add(BasicProgram.CalcChecksum(header));

            using (var tapFile = new BinaryWriter(File.Open("poke.tap", FileMode.Create)))
            {
                tapFile.Write((byte)19);
                tapFile.Write((byte)0);
                tapFile.Write(header.ToArray());

                tapFile.Write((byte)(program.Length & 0xff));
                tapFile.Write((byte)((program.Length >> 8) & 0xff));
                tapFile.Write(program.program.ToArray());
            }
        }
 public override string ToString()
 {
     return(string.Format("---{0}    {1} {2} Passed, {3} Failed, {4} Skipped   {5}", Status, Filename.PadRight(40), TestsPassed.ToString().PadLeft(3), TestsFailed.ToString().PadLeft(3), TestsSkipped.ToString().PadLeft(3), Result));
 }