Пример #1
0
        public Map(int maxTrack, int sectorSize, int sectorsOnTrack, Control parent, Color backColor, ImageStatsTable statsTable)
        {
            StatsTable     = statsTable;
            MaxTrack       = maxTrack;
            SectorSize     = sectorSize;
            SectorsOnTrack = sectorsOnTrack;
            WorkMap        = new MapCell[MaxTrack * SectorsOnTrack];
            oldMap         = new MapCell[MaxTrack * SectorsOnTrack];
            ChartArea      = new ChartArea(parent);
            this.backColor = backColor;
            for (int i = 0; i < oldMap.Length; i++)
            {
                oldMap[i] = (MapCell)0xFFFF;
            }
            ChartArea.Size              = new Size(MaxTrack * CellWidth, SectorsOnTrack * CellHeight + headerHeight);
            ChartArea.MouseDoubleClick += ChartArea_MouseDoubleClick;
            ChartArea.MouseMove        += ChartArea_MouseMove;
            ChartArea.MouseLeave       += ChartArea_MouseLeave;
            ChartArea.MouseDown        += ChartArea_MouseDown;
            ChartArea.MouseUp          += ChartArea_MouseUp;

            TrackL = new Label()
            {
                Parent = parent, Left = 0, Top = 343, Text = "Track:", AutoSize = true
            };
            TrackLV = new Label()
            {
                Parent = parent, Left = 35, Top = 343, Text = "...", AutoSize = true
            };
            SectorL = new Label()
            {
                Parent = parent, Left = 60, Top = 343, Text = "Sector:", AutoSize = true
            };
            SectorLV = new Label()
            {
                Parent = parent, Left = 98, Top = 343, Text = "...", AutoSize = true
            };
            StatusL = new Label()
            {
                Parent = parent, Left = 130, Top = 343, Text = "Status:", AutoSize = true
            };
            StatusLV = new Label()
            {
                Parent = parent, Left = 170, Top = 343, Text = "...", AutoSize = true
            };
            FileL = new Label()
            {
                Parent = parent, Left = 250, Top = 343, Text = "File:", AutoSize = true
            };
            FileLV = new Label()
            {
                Parent = parent, Left = 275, Top = 343, Text = "...", AutoSize = true
            };
            ExtenstionLV = new Label()
            {
                Parent = parent, Left = 340, Top = 343, Text = "...", AutoSize = true
            };
            UnprocessedLC = new Label()
            {
                Parent = parent, Left = 380, Top = 343, Width = 19, Height = 13, BackColor = Color.Wheat
            };
            UnprocessedLCL = new Label()
            {
                Parent = parent, Left = 405, Top = 343, Text = "Unprocessed", AutoSize = true
            };
            GoodLC = new Label()
            {
                Parent = parent, Left = 508, Top = 343, Width = 19, Height = 13, BackColor = Color.Green
            };
            GoodLCL = new Label()
            {
                Parent = parent, Left = 533, Top = 343, Text = "Good", AutoSize = true
            };
            ZeroLC = new Label()
            {
                Parent = parent, Left = 599, Top = 343, Width = 19, Height = 13, BackColor = Color.Gray
            };
            ZeroLCL = new Label()
            {
                Parent = parent, Left = 624, Top = 343, Text = "Zero", AutoSize = true
            };
            CrcErrorLC = new Label()
            {
                Parent = parent, Left = 682, Top = 343, Width = 19, Height = 13, BackColor = Color.FromArgb(175, 0, 0)
            };
            CrcErrorLCL = new Label()
            {
                Parent = parent, Left = 707, Top = 343, Text = "CRC Error", AutoSize = true
            };
            HeaderNotFoundLC = new Label()
            {
                Parent = parent, Left = 778, Top = 343, Width = 19, Height = 13, BackColor = Color.FromArgb(0, 0, 223)
            };
            HeaderNotFoundLCL = new Label()
            {
                Parent = parent, Left = 803, Top = 343, Text = "Header Not Found", AutoSize = true
            };
            ProcessingLC = new Label()
            {
                Parent = parent, Left = 920, Top = 343, Width = 19, Height = 13, BackColor = Color.Black
            };
            ProcessingLCL = new Label()
            {
                Parent = parent, Left = 945, Top = 343, Text = "Reading", AutoSize = true
            };

            contextMenu        = new ContextMenuStrip();
            contextMenuTopItem = new ToolStripMenuItem()
            {
                Enabled = false
            };
            markAsUnprocessed          = new ToolStripMenuItem();
            markSelectionAsUnprocessed = new ToolStripMenuItem();
            markAsGood          = new ToolStripMenuItem();
            markSelectionAsGood = new ToolStripMenuItem();
            contextMenu.SuspendLayout();
            //
            // contextMenuStrip1
            //
            contextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[]
            {
                contextMenuTopItem,
                markAsUnprocessed,
                markSelectionAsUnprocessed,
                markAsGood,
                markSelectionAsGood
            });
            contextMenu.Name    = "contextMenu";
            contextMenu.Size    = new System.Drawing.Size(240, 70);
            contextMenu.Closed += ContextMenu_Closed;
            //
            // markAsUnprocessed
            //
            markAsUnprocessed.Name   = "markAsUnprocessed";
            markAsUnprocessed.Size   = new System.Drawing.Size(239, 22);
            markAsUnprocessed.Text   = "Mark Sector As Unprocessed";
            markAsUnprocessed.Click += MarkAsUnprocessed_Click;
            //
            // markSelectionAsUnprocessed
            //
            markSelectionAsUnprocessed.Name   = "markSelectionAsUnprocessed";
            markSelectionAsUnprocessed.Size   = new System.Drawing.Size(239, 22);
            markSelectionAsUnprocessed.Text   = "Mark Selection As Unprocessed";
            markSelectionAsUnprocessed.Click += MarkSelectionAsUnprocessed_Click;
            //
            // markAsGood
            //
            markAsGood.Name   = "markAsGood";
            markAsGood.Size   = new System.Drawing.Size(239, 22);
            markAsGood.Text   = "Mark Sector As Good";
            markAsGood.Click += MarkAsGood_Click;
            //
            // markSelectionAsGood
            //
            markSelectionAsGood.Name   = "markSelectionAsGood";
            markSelectionAsGood.Size   = new System.Drawing.Size(239, 22);
            markSelectionAsGood.Text   = "Mark Selection As Good";
            markSelectionAsGood.Click += MarkSelectionAsGood_Click;
            //\
            contextMenu.ResumeLayout(false);
        }
Пример #2
0
        public ReaderBase(Control parent, int sectorSize, int sectorsOnTrack, DiskReaderParams dparams)
        {
            Parent         = parent;
            SectorSize     = sectorSize;
            SectorsOnTrack = sectorsOnTrack;
            parent.SuspendLayout();
            Params   = dparams;
            readSide = new GroupBox()
            {
                Parent = parent, Left = 202, Top = 9, Width = 105, Height = 83, Text = "Read Side"
            };
            side0 = new RadioButton()
            {
                Parent = readSide, Left = 6, Top = 19, Text = "Side 0", AutoSize = true
            };
            side1 = new RadioButton()
            {
                Parent = readSide, Left = 6, Top = 39, Text = "Side 1", AutoSize = true
            };
            sideBoth = new RadioButton()
            {
                Parent = readSide, Left = 6, Top = 60, Text = "Both", AutoSize = true, Checked = true
            };
            sectorReadAttemptsL = new Label()
            {
                Parent = parent, Left = 312, Top = 3, Text = "Sector Read Attempts", AutoSize = true
            };
            sectorReadAttempts = new TextBox()
            {
                Parent = parent, Left = 315, Top = 19, Text = "1"
            };
            firstTrackL = new Label()
            {
                Parent = parent, Left = 313, Top = 44, Text = "First Track", AutoSize = true
            };
            lastTrackL = new Label()
            {
                Parent = parent, Left = 375, Top = 44, Text = "Last Track", AutoSize = true
            };
            firstTrack = new TextBox()
            {
                Parent = parent, Left = 315, Top = 61, Width = 56, Text = "0"
            };
            lastTrack = new TextBox()
            {
                Parent = parent, Left = 378, Top = 61, Width = 56, Text = MainForm.MaxTrack.ToString()
            };
            imageGB = new GroupBox()
            {
                Parent = parent, Left = 651, Top = 5, Width = 381, Height = 213, Text = "Образ"
            };
            newImage = new Button()
            {
                Parent = imageGB, Left = 300, Top = 37, Width = 75, Height = 23, Text = "New"
            };
            loadImage = new Button()
            {
                Parent = imageGB, Left = 300, Top = 66, Width = 75, Height = 23, Text = "Load"
            };
            saveImage = new Button()
            {
                Parent = imageGB, Left = 300, Top = 94, Width = 75, Height = 23, Text = "Save"
            };
            showCatalogue = new Button()
            {
                Parent = imageGB, Left = 170, Top = 184, Width = 75, Height = 23, Text = "Catalogue"
            };
            showCatFromTrack = new Button()
            {
                Parent = imageGB, Left = 250, Top = 184, Width = 128, Height = 23, Text = "Catalogue From Track"
            };
            setSize = new Button()
            {
                Parent = imageGB, Left = 10, Top = 184, Width = 75, Height = 23, Text = "Set Size"
            };
            mergeImage = new Button()
            {
                Parent = imageGB, Left = 90, Top = 184, Width = 75, Height = 23, Text = "Merge"
            };
            readForward = new Button()
            {
                Parent = parent, Left = 549, Top = 10, Width = 96, Height = 23, Text = "Read Forward"
            };
            readBackward = new Button()
            {
                Parent = parent, Left = 549, Top = 36, Width = 96, Height = 23, Text = "Read Backward"
            };
            readRandomSectors = new Button()
            {
                Parent = parent, Left = 511, Top = 72, Width = 134, Height = 23, Text = "Read Random Sectors"
            };
            abortButton = new Button()
            {
                Parent = parent, Left = 568, Top = 193, Width = 75, Height = 23, Text = "Abort"
            };
            readCatalogue = new Button()
            {
                Parent = parent, Left = 6, Top = 50, Width = 144, Height = 23, Text = "Read Catalogue"
            };
            dataRateL = new Label()
            {
                Parent = parent, Left = 3, Top = 10, Text = "Data Rate", AutoSize = true
            };
            dataRate = new ComboBox()
            {
                Parent = parent, Left = 6, Top = 26, Width = 121, Height = 21, DropDownStyle = ComboBoxStyle.DropDownList
            };
            upperSidePanel = new GroupBox()
            {
                Parent = parent, Left = 316, Top = 99, Width = 156, Height = 89, Text = "Upper Side Head Parameter"
            };
            upperSide0 = new RadioButton()
            {
                Parent = upperSidePanel, Left = 6, Top = 20, Text = "Head = 0", AutoSize = true
            };
            upperSide1 = new RadioButton()
            {
                Parent = upperSidePanel, Left = 6, Top = 43, Text = "Head = 1", AutoSize = true
            };
            upperSideAutodetect = new RadioButton()
            {
                Parent = upperSidePanel, Left = 6, Top = 66, Text = "Autodetect", AutoSize = true, Checked = true
            };
            readModePanel = new GroupBox()
            {
                Parent = parent, Left = 202, Top = 99, Width = 105, Height = 62, Text = "Read Mode"
            };
            readModeStandard = new RadioButton()
            {
                Parent = readModePanel, Left = 6, Top = 19, Text = "Standard", AutoSize = true, Checked = !Timer.IsHighResolution
            };
            readModeFast = new RadioButton()
            {
                Parent = readModePanel, Left = 6, Top = 39, Text = "Fast", AutoSize = true, Checked = Timer.IsHighResolution, Enabled = Timer.IsHighResolution
            };
            trackLayoutL = new Label()
            {
                Parent = parent, Left = 0, Top = 205, Text = "Sector Layout:", AutoSize = true
            };
            trackLayoutLV = new Label()
            {
                Parent = parent, Left = 75, Top = 205, Text = "...", AutoSize = true
            };
            drivePanel = new GroupBox()
            {
                Parent = parent, Left = 152, Top = 9, Width = 46, Height = 62, Text = "Drive"
            };
            driveA = new RadioButton()
            {
                Parent = drivePanel, Left = 6, Top = 19, Text = "A:", AutoSize = true, Checked = Params.Drive == Drive.A
            };
            driveB = new RadioButton()
            {
                Parent = drivePanel, Left = 6, Top = 39, Text = "B:", AutoSize = true, Checked = Params.Drive == Drive.B
            };
            trackLayoutL.Visible  = MainForm.Dev;
            trackLayoutLV.Visible = MainForm.Dev;
            for (int i = 0; i < DataRateArray.Length; i++)
            {
                dataRate.Items.Add(DataRateArray[i].ToString().Replace("FD_RATE_", ""));
            }
            dataRate.MouseWheel += DataRate_MouseWheel;
            FillControls();
            stats = new ImageStatsTable(imageGB, SystemColors.Window, SystemColors.ControlText);
            stats.SetPosition(6, 16);
            stats.Repaint();
            map = new Map(MainForm.MaxTrack, SectorSize, SectorsOnTrack, parent, Color.White, stats);
            map.SetPosition(0, 227);
            map.ReadBoundsChanged += Map_ReadBoundsChanged;
            map.FirstTrack         = Params.FirstTrack;
            map.LastTrack          = Params.LastTrack;
            map.Repaint();

            sectorReadAttempts.TextChanged  += SectorReadAttempts_TextChanged;
            firstTrack.TextChanged          += SectorReadAttempts_TextChanged;
            lastTrack.TextChanged           += SectorReadAttempts_TextChanged;
            side0.CheckedChanged            += SectorReadAttempts_TextChanged;
            side1.CheckedChanged            += SectorReadAttempts_TextChanged;
            sideBoth.CheckedChanged         += SectorReadAttempts_TextChanged;
            dataRate.SelectedIndexChanged   += SectorReadAttempts_TextChanged;
            upperSide0.CheckedChanged       += SectorReadAttempts_TextChanged;
            upperSide1.CheckedChanged       += SectorReadAttempts_TextChanged;
            readModeStandard.CheckedChanged += SectorReadAttempts_TextChanged;
            readModeFast.CheckedChanged     += SectorReadAttempts_TextChanged;
            driveA.CheckedChanged           += SectorReadAttempts_TextChanged;
            driveB.CheckedChanged           += SectorReadAttempts_TextChanged;
            abortButton.Click += AbortButton;
            setSize.Click     += SetSize;
            parent.ResumeLayout(false);
        }