private static string GetSectionLabel(TzxDataBlock tzxBlock)
        {
            string sectionLabel = null;

            switch (tzxBlock.Type)
            {
            case TzxDataBlockType.StandardSpeedDataBlock:
                StandardSpeedDataBlock dataBlock = (StandardSpeedDataBlock)tzxBlock;
                sectionLabel = GetSectionLabel(dataBlock.TapeDataBlock);
                break;

            case TzxDataBlockType.TurboSpeedDataBlock:
                dataBlock     = (StandardSpeedDataBlock)tzxBlock;
                sectionLabel  = GetSectionLabel(dataBlock.TapeDataBlock);
                sectionLabel += " [turbo speed]";
                break;

            case TzxDataBlockType.PureDataBlock:
                dataBlock     = (StandardSpeedDataBlock)tzxBlock;
                sectionLabel  = GetSectionLabel(dataBlock.TapeDataBlock);
                sectionLabel += " [no pilot/sync]";
                break;

            case TzxDataBlockType.PureTone:
                sectionLabel = "Pure tone";
                break;

            case TzxDataBlockType.PulseSequence:
                sectionLabel = "Pulse sequence";
                break;

            case TzxDataBlockType.DirectRecording:
                sectionLabel = "Direct recording";
                break;

            case TzxDataBlockType.PauseOrStopTheTape:
                sectionLabel = "Pause";
                break;

            case TzxDataBlockType.GroupStart:
                GroupStart groupStart = (GroupStart)tzxBlock;
                sectionLabel = groupStart.GroupName;
                break;
            }
            return(sectionLabel);
        }
Beispiel #2
0
 private static void ReadGroupStart(BinaryReader fileReader, GroupStart groupStart)
 {
     groupStart.GroupNameLength = fileReader.ReadByte();
     groupStart.GroupName       = Encoding.GetEncoding("ISO-8859-1").GetString(fileReader.ReadBytes(groupStart.GroupNameLength));
 }
Beispiel #3
0
        private static TzxDataBlock ReadTzxDataBlock(BinaryReader fileReader)
        {
            TzxDataBlock resultDataBlock = null;

            byte id = fileReader.ReadByte();

            TzxDataBlockType dataBlockType = TzxDataBlock.GetTZXDataBlockTypeFromID(id);

            switch (dataBlockType)
            {
            // ID 10 - Standard Speed Data Block
            case TzxDataBlockType.StandardSpeedDataBlock:
                resultDataBlock = new StandardSpeedDataBlock();
                ReadStandardSpeedDataBlock(fileReader, (StandardSpeedDataBlock)resultDataBlock);
                break;

            // ID 11 - Turbo Speed Data Block
            case TzxDataBlockType.TurboSpeedDataBlock:
                resultDataBlock = new TurboSpeedDataBlock();
                ReadTurboSpeedDataBlock(fileReader, (TurboSpeedDataBlock)resultDataBlock);
                break;

            // ID 12 - Pure Tone
            case TzxDataBlockType.PureTone:
                resultDataBlock = new PureTone();
                ReadPureTone(fileReader, (PureTone)resultDataBlock);
                break;

            // ID 13 - Pulse sequence
            case TzxDataBlockType.PulseSequence:
                resultDataBlock = new PulseSequence();
                ReadPulseSequence(fileReader, (PulseSequence)resultDataBlock);
                break;

            // ID 14 - Pure Data Block
            case TzxDataBlockType.PureDataBlock:
                resultDataBlock = new PureDataBlock();
                ReadPureDataBlock(fileReader, (PureDataBlock)resultDataBlock);
                break;

            // ID 15 - Direct Recording
            case TzxDataBlockType.DirectRecording:
                resultDataBlock = new DirectRecording();
                ReadDirectRecording(fileReader, (DirectRecording)resultDataBlock);
                break;

            // ID 20 - Pause (silence) or 'Stop the Tape' command
            case TzxDataBlockType.PauseOrStopTheTape:
                resultDataBlock = new PauseOrStopTheTape();
                ReadPauseOrStopTheTape(fileReader, (PauseOrStopTheTape)resultDataBlock);
                break;

            // ID 21 - Group start
            case TzxDataBlockType.GroupStart:
                resultDataBlock = new GroupStart();
                ReadGroupStart(fileReader, (GroupStart)resultDataBlock);
                break;

            // ID 22 - Group end
            case TzxDataBlockType.GroupEnd:
                resultDataBlock = new GroupEnd();
                break;

            // ID 30 - Text description
            case TzxDataBlockType.TextDescription:
                resultDataBlock = new TextDescription();
                ReadTextDescription(fileReader, (TextDescription)resultDataBlock);
                break;

            // ID 32 - Archive info
            case TzxDataBlockType.ArchiveInfo:
                resultDataBlock = new ArchiveInfo();
                ReadArchiveInfo(fileReader, (ArchiveInfo)resultDataBlock);
                break;

            default:
                throw new NotImplementedException("TZX data block ID " + id.ToString("X") + " is not yet implemented");
            }

            return(resultDataBlock);
        }
        private static TzxDataBlock ReadTzxDataBlock(BinaryReader fileReader)
        {
            TzxDataBlock resultDataBlock = null;

            byte id = fileReader.ReadByte();

            TzxDataBlockType dataBlockType = TzxDataBlock.GetTZXDataBlockTypeFromID(id);
            switch (dataBlockType)
            {
                // ID 10 - Standard Speed Data Block
                case TzxDataBlockType.StandardSpeedDataBlock:
                    resultDataBlock = new StandardSpeedDataBlock();
                    ReadStandardSpeedDataBlock(fileReader, (StandardSpeedDataBlock)resultDataBlock);
                    break;
                // ID 11 - Turbo Speed Data Block
                case TzxDataBlockType.TurboSpeedDataBlock:
                    resultDataBlock = new TurboSpeedDataBlock();
                    ReadTurboSpeedDataBlock(fileReader, (TurboSpeedDataBlock)resultDataBlock);
                    break;
                // ID 12 - Pure Tone
                case TzxDataBlockType.PureTone:
                    resultDataBlock = new PureTone();
                    ReadPureTone(fileReader, (PureTone)resultDataBlock);
                    break;
                // ID 13 - Pulse sequence
                case TzxDataBlockType.PulseSequence:
                    resultDataBlock = new PulseSequence();
                    ReadPulseSequence(fileReader, (PulseSequence)resultDataBlock);
                    break;
                // ID 14 - Pure Data Block
                case TzxDataBlockType.PureDataBlock:
                    resultDataBlock = new PureDataBlock();
                    ReadPureDataBlock(fileReader, (PureDataBlock)resultDataBlock);
                    break;
                // ID 15 - Direct Recording
                case TzxDataBlockType.DirectRecording:
                    resultDataBlock = new DirectRecording();
                    ReadDirectRecording(fileReader, (DirectRecording)resultDataBlock);
                    break;
                // ID 20 - Pause (silence) or 'Stop the Tape' command
                case TzxDataBlockType.PauseOrStopTheTape:
                    resultDataBlock = new PauseOrStopTheTape();
                    ReadPauseOrStopTheTape(fileReader, (PauseOrStopTheTape)resultDataBlock);
                    break;
                // ID 21 - Group start
                case TzxDataBlockType.GroupStart:
                    resultDataBlock = new GroupStart();
                    ReadGroupStart(fileReader, (GroupStart)resultDataBlock);
                    break;
                // ID 22 - Group end
                case TzxDataBlockType.GroupEnd:
                    resultDataBlock = new GroupEnd();
                    break;
                // ID 30 - Text description
                case TzxDataBlockType.TextDescription:
                    resultDataBlock = new TextDescription();
                    ReadTextDescription(fileReader, (TextDescription)resultDataBlock);
                    break;
                // ID 32 - Archive info
                case TzxDataBlockType.ArchiveInfo:
                    resultDataBlock = new ArchiveInfo();
                    ReadArchiveInfo(fileReader, (ArchiveInfo)resultDataBlock);
                    break;
                default:
                    throw new NotImplementedException("TZX data block ID "+ id.ToString("X") + " is not yet implemented");
            }

            return resultDataBlock;
        }
 private static void ReadGroupStart(BinaryReader fileReader, GroupStart groupStart)
 {
     groupStart.GroupNameLength = fileReader.ReadByte();
     groupStart.GroupName = Encoding.GetEncoding("ISO-8859-1").GetString(fileReader.ReadBytes(groupStart.GroupNameLength));
 }