Ejemplo n.º 1
0
        public void DecodeTokenizedBasicToString()
        {
            var basicDecoder = new DragonBasicTokenizer();
            var basicProgram = basicDecoder.Decode(BasicProgramTokens).Split(new char[] {'\n', '\r'}, StringSplitOptions.RemoveEmptyEntries);

            Assert.AreEqual(BasicProgramText.Length, basicProgram.Length);
            for (int i = 0; i < BasicProgramText.Length; i++ )
                Assert.AreEqual(BasicProgramText[i], basicProgram[i]);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Write a DragonDos file to a plain data file in the local file system.
 /// </summary>
 /// <param name="file">DragonDos file.</param>
 /// <param name="localFilename">Local filename.</param>
 private void SaveToPlainFile(DragonDosFile file, string localFilename)
 {
     if (file.FileType == DragonDosFileType.Basic && ascii)
     {
         var basicTokenizer = new DragonBasicTokenizer(DragonBasicDialect.DragonDos);
         var basicText = basicTokenizer.Decode(file.GetData());
         var output = new StreamWriter(new FileStream(localFilename, FileMode.Create), Encoding.ASCII);
         output.Write(basicText);
         output.Close();
     }
     else
     {
         File.WriteAllBytes(localFilename, file.GetData());
     }
 }