Ejemplo n.º 1
0
        // Drag and Drop options
        // 1. Tape to Tape
        // 2. Tape to Disk
        // 3. Disk to Disk
        // 4. Disk to Tape

        private void CopyTapeFilesToTape(TreeNode sourceTreeNode, TreeNode destinationTreeNode)
        {
            // Retrieve details of the destination Tape
            TapeInfo destinationTapeInfo = (TapeInfo)destinationTreeNode.Tag;

            OricTape destinationTape = new OricTape();

            destinationTape.TapeName = destinationTapeInfo.FullName;// Path.Combine(destinationTapeInfo.Folder, destinationTapeInfo.Name);

            // Copy a file from a Tape
            if (sourceTreeNode.Tag.GetType() == typeof(OricFileInfo))
            {
                // Retrieve program information from the source node
                OricFileInfo programInfo = (OricFileInfo)sourceTreeNode.Tag;

                // Load the program contents from the source tape
                OricTape    sourceTape  = new OricTape();
                OricProgram oricProgram = sourceTape.Load(Path.Combine(programInfo.Folder, programInfo.ParentName), programInfo.ProgramName, programInfo.ProgramIndex);

                // Copy file to the end of the destination tape
                destinationTape.SaveFile(oricProgram);
            }
            // Copy a whole Tape
            else if (sourceTreeNode.Tag.GetType() == typeof(TapeInfo))
            {
                // Retrieve information about the source Tape
                TapeInfo sourceTapeInfo = (TapeInfo)sourceTreeNode.Tag;

                OricTape sourceTape = new OricTape();
                sourceTape.TapeName = sourceTapeInfo.FullName;// Path.Combine(sourceTapeInfo.Folder, sourceTapeInfo.Name);

                FileInfo fiTapeFile = new FileInfo(sourceTape.TapeName);

                // Retrieve a catalog of all the programs on the source Tape
                OricFileInfo[] tapeCatalog = sourceTape.Catalog(fiTapeFile);

                foreach (OricFileInfo programInfo in tapeCatalog)
                {
                    // Load the program contents from the source tape
                    OricProgram oricProgram = new OricProgram();
                    oricProgram = sourceTape.Load(Path.Combine(programInfo.Folder, programInfo.ParentName), programInfo.ProgramName, programInfo.ProgramIndex);

                    // Copy file to the end of the destination tape
                    destinationTape.SaveFile(oricProgram);
                }
            }

            // Get full pathname of the updated destination Tape
            FileInfo fiTape = new FileInfo(Path.Combine(Path.GetDirectoryName(destinationTapeInfo.FullName), destinationTreeNode.Text));

            // Remove destination Tape from Tree list
            destinationTreeNode.Remove();

            // Add the updated Tape to the Tree list and display the files in the Tape
            TreeNode newTreeNode = mMainForm.AddTapeToTree(fiTape);

            newTreeNode.Expand();
        }
Ejemplo n.º 2
0
        public OricProgram LoadFile()
        {
            OricProgram oricProgram = new OricProgram();

            oricProgram.New();

            if (MediaType == ConstantsAndEnums.MediaType.TapeFile)
            {
                OricTape oricTape = new OricTape();
                oricProgram = oricTape.Load(Path.Combine(Folder, ParentName), ProgramName, ProgramIndex);
            }
            else
            {
                OricDisk oricDisk = new OricDisk();
                oricDisk.LoadDisk(ParentName);

                switch (oricDisk.DOSFormat())
                {
                case OricDisk.DOSFormats.OricDOS:
                {
                    OricDos oricDisc = new OricDos();
                    oricProgram = oricDisc.LoadFile(ParentName, this);
                }
                break;

                case OricDisk.DOSFormats.SedOric:
                {
                    SedOric oricDisc = new SedOric();
                    oricProgram = oricDisc.LoadFile(ParentName, this);
                }
                break;

                case OricDisk.DOSFormats.StratSed:
                {
                    StratSed oricDisc = new StratSed();
                    oricProgram = oricDisc.LoadFile(ParentName, this);
                }
                break;

                case OricDisk.DOSFormats.TDOS:
                {
                    FTDos oricDisc = new FTDos();
                    oricProgram = oricDisc.LoadFile(ParentName, this);
                }
                break;

                default:
                    break;
                }
            }

            return(oricProgram);
        }
Ejemplo n.º 3
0
        private void TextEditorForm_Load(object sender, EventArgs e)
        {
            String strTitleText = Text;

            Text = String.Format("Text Screen Editor - {0}", fileInfo.ProgramName);

            // Initialise program settings
            loadedProgram.New();

            if (mediaType == OricExplorer.MediaType.DiskFile)
            {
                loadedProgram = fileInfo.LoadFile();
            }
            else if (mediaType == OricExplorer.MediaType.TapeFile)
            {
                loadedProgram = oricTape.Load(Path.Combine(tapeInfo.Folder, tapeInfo.Name), fileInfo.ProgramName, fileInfo.ProgramIndex);
            }

            bScrnData = new Byte[loadedProgram.ProgramLength];

            for (int iIndex = 0; iIndex < loadedProgram.ProgramLength; iIndex++)
            {
                bScrnData[iIndex] = loadedProgram.m_programData[iIndex];
            }

            m_ui16StartAddress = loadedProgram.StartAddress;
            m_ui16DisplayBytes = loadedProgram.ProgramLength;

            DrawTextPreview(screenImage);
            pictureBoxEditor.Image = screenImage;

            firstRow = (fileInfo.StartAddress - 0xBBA8) / 40;
            lastRow  = (fileInfo.EndAddress - 0xBBA8) / 40;

            if (FlashTimer == null)
            {
                FlashTimer          = new System.Windows.Forms.Timer();
                FlashTimer.Interval = 700;
                FlashTimer.Start();
                FlashTimer.Tick += new EventHandler(Timer_Tick);
            }

            UpdateStandardImage();

            infoBoxStartAddress.Text = String.Format("${0:X4}", loadedProgram.StartAddress);
            infoBoxEndAddress.Text   = String.Format("${0:X4}", loadedProgram.EndAddress);
            infoBoxLength.Text       = String.Format("{0:N0} bytes ({1:N1} KB)", loadedProgram.ProgramLength, loadedProgram.ProgramLength / 1024);
            infoBoxDimensions.Text   = String.Format("40 columns by {0} rows", lastRow - firstRow);
        }