Exemple #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();
        }
Exemple #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);
        }
        //protected override bool IsInputKey(Keys keyData)
        //{
        //    // Make sure we get arrow keys
        //    switch(keyData)
        //    {
        //        case Keys.Up:
        //        case Keys.Left:
        //        case Keys.Down:
        //        case Keys.Right:
        //            return true;
        //    }

        //    // The rest can be determined by the base class
        //    return base.IsInputKey(keyData);
        //}

        //protected override void OnKeyUp(KeyEventArgs e)
        //{
        //    base.OnKeyDown(e);

        //    //MessageBox.Show("raw key:" + e.KeyCode.ToString(), "debug");
        //    //MessageBox.Show("Keys.KeyCode:" + Keys.KeyCode.ToString(), "debug");
        //    //MessageBox.Show("e.KeyCode:" + e.KeyCode.ToString(), "debug");

        //    switch(Keys.KeyCode & e.KeyCode)
        //    {
        //        case Keys.Up:
        //            if(iScrnRow > 0)
        //                iScrnRow--;
        //            break;

        //        case Keys.Down:
        //            if(iScrnRow < 28)
        //                iScrnRow++;
        //            break;

        //        case Keys.Left:
        //            if(iScrnCol > 0)
        //                iScrnCol--;
        //            break;

        //        case Keys.Right:
        //            if(iScrnCol < 39)
        //                iScrnCol++;
        //            break;
        //    }

        //    NewDrawTextPreview();
        //    pictureBox1.Image = screenImage;
        //}

        public TextScreenEditorForm()
        {
            InitializeComponent();

            m_ui16DataLength   = 0;
            m_ui16StartAddress = 0;

            scrnCol = 0;
            scrnRow = 0;

            cScrnPaper = 0;
            cScrnInk   = 7;

            bScrnUpdated = false;

            // Load the standard character set
            BuildCharSet();

            labelSelectedPaperColour.BackColor = Color.Black;
            labelSelectedPaperColour.Tag       = 0;

            labelSelectedInkColour.BackColor = Color.White;
            labelSelectedInkColour.Tag       = 7;

            radioButtonSingle.Checked = true;
            radioButtonSteady.Checked = true;

            screenImage = new Bitmap(pictureBoxEditor.Width, pictureBoxEditor.Height);

            fileInfo = new OricFileInfo();
            oricDisk = new OricDisk();
            oricTape = new OricTape();

            loadedProgram = new OricProgram();

            bShowGrid          = true;
            bShowAttrIndicator = true;

            m_bFlash = true;

            _ZoomFactor = 2;

            radioButtonColourMode.Checked = true;
            editMode = EditingMode.COLOUR_MODE;
        }