public SequentialFileViewer()
        {
            InitializeComponent();
            Dock = DockStyle.Fill;

            FileInformation = new Label();
            ProgramInfo     = new OricFileInfo();
            ProgramData     = new OricProgram();
        }
Example #2
0
        public ScreenViewerForm()
        {
            InitializeComponent();

            oricScreenImage = new ScreenImage();

            oricFileInfo = new OricFileInfo();
            oricProgram  = new OricProgram();
        }
Example #3
0
        private void displayImageInfo(OricFileInfo fileinfo)
        {
            switch (imageFormatsToShow)
            {
            case ImageFormatsToDisplay.HIRES_ONLY:
                infoBoxImageFormat.Text = "HIRES Screens only";
                break;

            case ImageFormatsToDisplay.TEXT_ONLY:
                infoBoxImageFormat.Text = "TEXT Screens only";
                break;

            case ImageFormatsToDisplay.BOTH:
                infoBoxImageFormat.Text = "All Screens";
                break;
            }

            infoBoxImageCounter.Text = string.Format("{0} of {1}", imageIndex + 1, imageList.Count());

            infoBoxFilename.Text = fileinfo.ProgramName;

            if (fileinfo.Format == OricProgram.ProgramFormat.HiresScreen)
            {
                infoBoxFormat.Text = "HIRES Screen";
            }
            else if (fileinfo.Format == OricProgram.ProgramFormat.TextScreen)
            {
                infoBoxFormat.Text = "TEXT Screen";
            }
            else if (fileinfo.Format == OricProgram.ProgramFormat.HelpFile)
            {
                infoBoxFormat.Text = "Help Screen";
            }
            else if (fileinfo.Format == OricProgram.ProgramFormat.WindowFile)
            {
                infoBoxFormat.Text = "Window Screen";
            }
            else
            {
                infoBoxFormat.Text = "Unknown";
            }

            infoBoxStartAddress.Text = string.Format("{0} (${0:X4})", fileinfo.StartAddress, fileinfo.StartAddress);
            infoBoxEndAddress.Text   = string.Format("{0} (${0:X4})", fileinfo.EndAddress, fileinfo.EndAddress);

            infoBoxLength.Text = string.Format("{0:N0} bytes ({1:N1} KB)", fileinfo.LengthBytes, (float)fileinfo.LengthBytes / 1024);

            if (fileinfo.Format == OricProgram.ProgramFormat.HiresScreen)
            {
                infoBoxDimensions.Text = string.Format("240 x {0:N0}", (float)(fileinfo.LengthBytes / 40));
            }
            else
            {
                infoBoxDimensions.Text = string.Format("40 x {0:N0}", (float)(fileinfo.LengthBytes / 40));
            }
        }
        public ctlDataFileViewer()
        {
            InitializeComponent();

            this.Dock = DockStyle.Fill;

            FileInformation = new Label();
            ProgramInfo     = new OricFileInfo();
            ProgramData     = new OricProgram();
            ProgramData.New();
        }
Example #5
0
        public frmDataViewer(OricFileInfo fileInfo, OricProgram programData)
        {
            InitializeComponent();

            dataViewerControl             = new ctlDataViewerControl();
            dataViewerControl.ProgramInfo = fileInfo;
            dataViewerControl.ProgramData = programData;
            dataViewerControl.InitialiseView();

            this.Controls.Add(dataViewerControl);
            this.Size = new Size(dataViewerControl.Width + 15, dataViewerControl.Height + 40);

            this.Text = string.Format("Data Viewer - {0} ({1})", fileInfo.ProgramName, Path.GetFileName(fileInfo.ParentName));
        }
Example #6
0
        private void displayImage(int imageIndex)
        {
            OricFileInfo fileInfo    = (OricFileInfo)imageList[imageIndex];
            OricProgram  oricProgram = fileInfo.LoadFile();

            oricScreenImage.m_ui16StartAddress = oricProgram.StartAddress;
            oricScreenImage.m_ui16DataLength   = oricProgram.ProgramLength;
            oricScreenImage.bScrnData          = oricProgram.m_programData;
            oricScreenImage.m_bFlash           = !oricScreenImage.m_bFlash;

            if (oricProgram.Format == OricProgram.ProgramFormat.HiresScreen)
            {
                screenImageFormat = ScreenImage.ScreenImageFormat.IMAGE_FORMAT_HIRES;
            }
            else
            {
                screenImageFormat = ScreenImage.ScreenImageFormat.IMAGE_FORMAT_TEXT;
            }

            oricScreenImage.DrawScreenImage(ScreenImage.ScreenImageSize.IMAGE_SIZE_ENLARGED, screenImageFormat);
            pictureBoxScreenImage.Image = oricScreenImage.screenImageData;

            displayImageInfo(fileInfo);

            if (!slideshowRunning)
            {
                // Display thumbnail of current image
                foreach (Control control in flowLayoutPanelThumbnails.Controls)
                {
                    if (control is Panel)
                    {
                        Panel panel = (Panel)control;
                        panel.BackColor = Color.FromArgb(200, 200, 200);
                    }
                }

                Control[] imagePanel = flowLayoutPanelThumbnails.Controls.Find(string.Format("panel_{0}", imageIndex), true);

                if (imagePanel.Count() == 1)
                {
                    Panel panel = (Panel)imagePanel[0];
                    panel.BackColor = Color.FromArgb(150, 150, 150);
                    panel.Focus();
                }
            }

            enableDisableControls();
        }
Example #7
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            lvwPrograms.SelectedItems[0].Text = txtProgramName.Text;

            OricFileInfo programInfo = (OricFileInfo)lvwPrograms.SelectedItems[0].Tag;

            programInfo.ProgramName  = txtProgramName.Text;
            programInfo.AutoRun      = (chkAutoRun.Checked ? OricProgram.AutoRunFlag.Enabled : OricProgram.AutoRunFlag.Disabled);
            programInfo.StartAddress = (ushort)nudStartAddress.Value;
            programInfo.EndAddress   = (ushort)nudEndAddress.Value;

            txtProgramName.Tag  = txtProgramName.Text;
            chkAutoRun.Tag      = chkAutoRun.Checked;
            nudStartAddress.Tag = nudStartAddress.Value;

            btnUpdate.Enabled = false;
            btnSave.Enabled   = true;
        }
Example #8
0
        private void lvwPrograms_SelectedIndexChanged(object sender, EventArgs e)
        {
            UpdateListsButtonsStatus();

            bool selection = lvwPrograms.SelectedItems.Count > 0;

            foreach (Control control in new Control[] { txtProgramName, chkAutoRun, nudStartAddress, nudEndAddress, lblProgramLength })
            {
                control.Enabled = selection;
            }

            init = true;
            if (selection)
            {
                OricFileInfo programInfo = (OricFileInfo)lvwPrograms.SelectedItems[0].Tag;
                txtProgramName.Text = programInfo.ProgramName;
                (programInfo.Format == OricProgram.ProgramFormat.BasicProgram ? optBasic : optCodeData).Checked = true;
                chkAutoRun.Checked      = (programInfo.AutoRun == OricProgram.AutoRunFlag.Enabled);
                nudStartAddress.Value   = programInfo.StartAddress;
                nudStartAddress.Maximum = 65535 - programInfo.LengthBytes;
                nudEndAddress.Value     = programInfo.EndAddress;
                lblProgramLength.Text   = programInfo.LengthBytes.ToString();
            }
            else
            {
                txtProgramName.Clear();
                optBasic.Checked      = false;
                optCodeData.Checked   = false;
                chkAutoRun.Checked    = false;
                nudStartAddress.Value = 0;
                nudEndAddress.Value   = 0;
                lblProgramLength.Text = string.Empty;
            }
            init = false;

            txtProgramName.Tag  = txtProgramName.Text;
            chkAutoRun.Tag      = chkAutoRun.Checked;
            nudStartAddress.Tag = nudStartAddress.Value;

            btnUpdate.Enabled = false;
        }
Example #9
0
        void BuildFileInformation(OricFileInfo fileInformation)
        {
            StringBuilder fileInfoText = new StringBuilder();

            fileInfoText.AppendFormat("Address : ${0:X4} - ${1:X4}", fileInformation.StartAddress, fileInformation.EndAddress);

            if (fileInformation.Format == OricProgram.ProgramFormat.CodeFile && fileInformation.ExeAddress != 0)
            {
                fileInfoText.AppendFormat(" (Exe ${0:X4})\n", fileInformation.ExeAddress);
            }
            else
            {
                fileInfoText.Append("\n");
            }

            if (fileInformation.LengthBytes >= 1024)
            {
                fileInfoText.AppendFormat("File Size : {0:N0} bytes ({1:N1} KB)", fileInformation.LengthBytes, (float)fileInformation.LengthBytes / 1024);
            }
            else
            {
                fileInfoText.AppendFormat("File Size : {0:N0} bytes", fileInformation.LengthBytes);
            }

            if (fileInformation.MediaType == OricExplorer.MediaType.DiskFile)
            {
                fileInfoText.AppendFormat("\nDisk Usage : {0:N0} sectors", fileInformation.LengthSectors);
                fileInfoText.AppendFormat("\nStatus : {0}", fileInformation.Protection.ToString());
            }

            if (fileInformation.Format == OricProgram.ProgramFormat.BasicProgram || fileInformation.Format == OricProgram.ProgramFormat.CodeFile)
            {
                fileInfoText.AppendFormat("\nAuto Run : {0}", fileInformation.AutoRun.ToString());
            }

            labelDetails.Text = fileInfoText.ToString();
        }
Example #10
0
        private void lvDirectory_MouseClick(object sender, MouseEventArgs e)
        {
            int iSelectedCount = lvDirectory.SelectedItems.Count;

            if (iSelectedCount > 0)
            {
                ListViewItem lvSelected = lvDirectory.SelectedItems[0];

                int iIndex = Convert.ToInt16(lvSelected.Tag);

                selectedIndex = Convert.ToByte(iIndex);
                selectedIndex++;

                OricFileInfo programInfo = (OricFileInfo)diskDirectory[iIndex];

                byte bTrack  = programInfo.FirstTrack;
                byte bSector = programInfo.FirstSector;

                if ((bTrack & 0x80) == 0x80)
                {
                    // Track is on Side 1
                    if (tabSides.SelectedIndex != 1)
                    {
                        tabSides.SelectedIndex = 1;
                    }
                }
                else
                {
                    // Track is on Side 0
                    if (tabSides.SelectedIndex != 0)
                    {
                        tabSides.SelectedIndex = 0;
                    }
                }

                // Redraw the Sector maps
                DrawSectorMap(0);
                pbSectorMapSide0.Image = imageSectorMap0;

                // Only redraw Side 2 if double sided disk
                if (diskInfo.Sides == 2)
                {
                    DrawSectorMap(1);
                    pbSectorMapSide1.Image = imageSectorMap1;
                }

                int iMapIndex = 0;

                if ((bTrack & 0x80) == 0x80)
                {
                    bTrack    = (byte)(bTrack & 0x7F);
                    iMapIndex = ((bTrack + diskInfo.TracksPerSide) * diskInfo.SectorsPerTrack) + bSector;
                }
                else
                {
                    iMapIndex = (bTrack * diskInfo.SectorsPerTrack) + bSector;
                }

                currentTrack  = bTrack;
                currentSector = bSector;
                UpdateDisplay();
            }
        }
Example #11
0
        public void DisplayProgramInformation(OricFileInfo fileInformation)
        {
            flowLayoutPanelInfo.Controls.Clear();

            if (fileInformation.MediaType == ConstantsAndEnums.MediaType.DiskFile || fileInformation.MediaType == ConstantsAndEnums.MediaType.TapeFile)
            {
                AddDetails("Program Name", fileInformation.ProgramName);
                AddDetails("Program Format", string.Format("{0}", fileInformation.FormatToString()));
                AddDetails("Memory Location", string.Format("${0:X4} to ${1:X4}\n({2} to {3})",
                                                            fileInformation.StartAddress, fileInformation.EndAddress, fileInformation.StartAddress, fileInformation.EndAddress));

                if (fileInformation.LengthBytes >= 1024)
                {
                    AddDetails("Program Size", string.Format("{0:N0} bytes\n({1:N1} KB)",
                                                             fileInformation.LengthBytes, (float)fileInformation.LengthBytes / 1024));
                }
                else
                {
                    AddDetails("Program Size", string.Format("{0:N0} bytes", fileInformation.LengthBytes));
                }

                if (fileInformation.Format == OricProgram.ProgramFormat.BasicProgram || fileInformation.Format == OricProgram.ProgramFormat.CodeFile)
                {
                    AddDetails("Auto Run", fileInformation.AutoRun.ToString());
                }


                if (fileInformation.Format == OricProgram.ProgramFormat.CodeFile && fileInformation.ExeAddress != 0)
                {
                    AddDetails("Executable Address", string.Format("${0:X4}\n({1})", fileInformation.ExeAddress, fileInformation.ExeAddress));
                }

                switch (fileInformation.Format)
                {
                case OricProgram.ProgramFormat.CharacterSet:
                    AddDetails("No. of Characters", (fileInformation.LengthBytes / 8).ToString());
                    break;

                case OricProgram.ProgramFormat.DirectAccessFile:
                    AddDetails("No. of Records", fileInformation.NoOfRecords.ToString());
                    AddDetails("Record Length", fileInformation.RecordLength.ToString());
                    break;

                case OricProgram.ProgramFormat.HelpFile:
                    AddDetails("Dimensions", string.Format("40 x {0}", fileInformation.LengthBytes / 40));
                    break;

                case OricProgram.ProgramFormat.HiresScreen:
                    AddDetails("Dimensions", string.Format("240 x {0}", fileInformation.LengthBytes / 40));
                    break;

                case OricProgram.ProgramFormat.TextScreen:
                    AddDetails("Dimensions", string.Format("40 x {0}", fileInformation.LengthBytes / 40));
                    break;

                case OricProgram.ProgramFormat.CodeFile:
                    break;

                case OricProgram.ProgramFormat.BasicProgram:
                    break;

                case OricProgram.ProgramFormat.SequentialFile:
                    // FileInformation.Text = string.Format("{0} Records", listViewRecords.Items.Count);
                    break;

                case OricProgram.ProgramFormat.WindowFile:
                    AddDetails("Dimensions", string.Format("40 x {0}", fileInformation.LengthBytes / 40));
                    break;

                default:
                    break;
                }

                if (fileInformation.MediaType == ConstantsAndEnums.MediaType.DiskFile)
                {
                    AddDetails("Disk Usage", string.Format("{0:N0} sectors", fileInformation.LengthSectors));

                    AddDetails("Security Status", fileInformation.Protection.ToString());
                }
            }
            else if (fileInformation.MediaType == ConstantsAndEnums.MediaType.ROMFile)
            {
                AddDetails("Name", Path.GetFileName(fileInformation.Name));
                AddDetails("Format", "Oric ROM File");

                AddDetails("Memory Location", string.Format("${0:X4} to ${1:X4}\n({2} to {3})",
                                                            fileInformation.StartAddress, fileInformation.EndAddress, fileInformation.StartAddress, fileInformation.EndAddress));

                if (fileInformation.LengthBytes >= 1024)
                {
                    AddDetails("ROM Size", string.Format("{0:N0} bytes\n({1:N1} KB)",
                                                         fileInformation.LengthBytes, (float)fileInformation.LengthBytes / 1024));
                }
                else
                {
                    AddDetails("ROM Size", string.Format("{0:N0} bytes", fileInformation.LengthBytes));
                }
            }
        }
Example #12
0
        public void DisplayProgramInformation(OricFileInfo oricFileInfo)
        {
            flpInfo.Controls.Clear();

            if (oricFileInfo.MediaType.In(MediaType.DiskFile, MediaType.TapeFile))
            {
                AddDetails("Program Name", oricFileInfo.ProgramName);
                AddDetails("Program Format", string.Format("{0}", oricFileInfo.FormatToString()));
                AddDetails("Memory Location", string.Format("${0:X4} to ${1:X4}\n({0} to {1})", oricFileInfo.StartAddress, oricFileInfo.EndAddress));

                if (oricFileInfo.LengthBytes >= 1024)
                {
                    AddDetails("Program Size", string.Format("{0:N0} bytes\n({1:N1} KB)", oricFileInfo.LengthBytes, (float)oricFileInfo.LengthBytes / 1024));
                }
                else
                {
                    AddDetails("Program Size", string.Format("{0:N0} bytes", oricFileInfo.LengthBytes));
                }

                if (oricFileInfo.Format.In(OricProgram.ProgramFormat.BasicProgram, OricProgram.ProgramFormat.BinaryFile))
                {
                    AddDetails("Auto Run", oricFileInfo.AutoRun.ToString());
                }


                if (oricFileInfo.Format == OricProgram.ProgramFormat.BinaryFile && oricFileInfo.ExeAddress != 0)
                {
                    AddDetails("Executable Address", string.Format("${0:X4}\n({0})", oricFileInfo.ExeAddress));
                }

                switch (oricFileInfo.Format)
                {
                case OricProgram.ProgramFormat.CharacterSet:
                    AddDetails("No. of Characters", (oricFileInfo.LengthBytes / 8).ToString());
                    break;

                case OricProgram.ProgramFormat.DirectAccessFile:
                    AddDetails("No. of Records", oricFileInfo.NoOfRecords.ToString());
                    AddDetails("Record Length", oricFileInfo.RecordLength.ToString());
                    break;

                case OricProgram.ProgramFormat.HelpFile:
                    AddDetails("Dimensions", string.Format("40 x {0}", oricFileInfo.LengthBytes / 40));
                    break;

                case OricProgram.ProgramFormat.HiresScreen:
                    AddDetails("Dimensions", string.Format("240 x {0}", oricFileInfo.LengthBytes / 40));
                    break;

                case OricProgram.ProgramFormat.TextScreen:
                    AddDetails("Dimensions", string.Format("40 x {0}", oricFileInfo.LengthBytes / 40));
                    break;

                case OricProgram.ProgramFormat.BinaryFile:
                    break;

                case OricProgram.ProgramFormat.BasicProgram:
                    break;

                case OricProgram.ProgramFormat.SequentialFile:
                    // FileInformation.Text = string.Format("{0} Records", listViewRecords.Items.Count);
                    break;

                case OricProgram.ProgramFormat.WindowFile:
                    AddDetails("Dimensions", string.Format("40 x {0}", oricFileInfo.LengthBytes / 40));
                    break;

                default:
                    break;
                }

                if (oricFileInfo.MediaType == MediaType.DiskFile)
                {
                    AddDetails("Disk Usage", string.Format("{0:N0} sectors", oricFileInfo.LengthSectors));

                    AddDetails("Security Status", oricFileInfo.Protection.ToString());
                }
            }
            else if (oricFileInfo.MediaType == MediaType.ROMFile)
            {
                AddDetails("Name", Path.GetFileName(oricFileInfo.Name));
                AddDetails("Format", "Oric ROM File");

                AddDetails("Memory Location", string.Format("${0:X4} to ${1:X4}\n({0} to {1})", oricFileInfo.StartAddress, oricFileInfo.EndAddress));

                if (oricFileInfo.LengthBytes >= 1024)
                {
                    AddDetails("ROM Size", string.Format("{0:N0} bytes\n({1:N1} KB)",
                                                         oricFileInfo.LengthBytes, (float)oricFileInfo.LengthBytes / 1024));
                }
                else
                {
                    AddDetails("ROM Size", string.Format("{0:N0} bytes", oricFileInfo.LengthBytes));
                }
            }
            else if (oricFileInfo.MediaType == MediaType.UnknownMedia)
            {
                AddDetails("Name", Path.GetFileName(oricFileInfo.Name));
                AddDetails("Format", oricFileInfo.Format.ToString());

                ushort ushStartAddress = oricFileInfo.StartAddress;
                ushort ushLength       = oricFileInfo.LengthBytes;

                if (oricFileInfo.Format == OricProgram.ProgramFormat.OrixProgram)
                {
                    ushStartAddress += OtherFileInfo.ORIX_HEADER_LENGTH;
                    AddDetails($"Memory Location", string.Format("${0:X4} to ${1:X4}\n({0} to {1})", ushStartAddress, ushStartAddress + ushLength - 1));
                }

                if (oricFileInfo.LengthBytes >= 1024)
                {
                    AddDetails($"Length", $"{ushLength:N0}\n({(float)ushLength / 1024:N1} KB)");
                }
                else
                {
                    AddDetails($"Length", $"{ushLength:N0} bytes");
                }
            }
        }
Example #13
0
        private void DisplayProgramsSectorList(int iSelectedIndex)
        {
            OricFileInfo programInfo = diskDirectory[iSelectedIndex];

            listViewSectorList.BeginUpdate();
            listViewSectorList.Items.Clear();

            OricDos oricDosDisk = new OricDos();

            oricDosDisk.LoadDisk(programInfo.ParentName);

            UInt16 fileSide = 0x00;

            UInt16 fileTrack2 = 0x00;
            UInt16 fileTrack  = programInfo.FirstTrack;
            UInt16 fileSector = programInfo.FirstSector;

            UInt16 nextTrack  = 0x00;
            UInt16 nextSector = 0x00;

            while (fileSector != 0)
            {
                ListViewItem lvItem = new ListViewItem();
                lvItem.Text = String.Format("{0}", listViewSectorList.Items.Count + 1);

                if ((fileTrack & 0x80) == 0x80)
                {
                    fileTrack2 = (UInt16)(fileTrack & 0x7F);
                    fileSide   = 1;
                }
                else
                {
                    fileTrack2 = fileTrack;
                    fileSide   = 0;
                }

                if (checkBoxDisplayAsHex.Checked)
                {
                    lvItem.SubItems.Add(String.Format("{0:X2}", fileSide));
                    lvItem.SubItems.Add(String.Format("{0:X2}", fileTrack2));
                    lvItem.SubItems.Add(String.Format("{0:X2}", fileSector));
                }
                else
                {
                    lvItem.SubItems.Add(String.Format("{0:D2}", fileSide));
                    lvItem.SubItems.Add(String.Format("{0:D2}", fileTrack2));
                    lvItem.SubItems.Add(String.Format("{0:D2}", fileSector));
                }

                if (listViewSectorList.Items.Count % 2 == 0)
                {
                    lvItem.BackColor = Color.White;
                }
                else
                {
                    lvItem.BackColor = Color.WhiteSmoke;
                }

                listViewSectorList.Items.Add(lvItem);

                // Read next sector
                oricDosDisk.ReadSector(fileTrack, fileSector, ref nextTrack, ref nextSector);

                fileTrack  = nextTrack;
                fileSector = nextSector;
            }

            // Adjust column widths to fit their contents
            AdjustListViewColumnHeaderWidths(listViewSectorList);

            listViewSectorList.EndUpdate();
        }