Beispiel #1
0
        public frmMediaScan(string devicePath, DeviceInfo deviceInfo, ScsiInfo scsiInfo = null)
        {
            XamlReader.Load(this);

            this.devicePath = devicePath;
            btnStop.Visible = false;

            lineChart.AbsoluteMargins = true;
            lineChart.MarginX         = 5;
            lineChart.MarginY         = 5;
            lineChart.DrawAxes        = true;
            lineChart.AxesColor       = Colors.Black;
            lineChart.ColorX          = Colors.Gray;
            lineChart.ColorY          = Colors.Gray;
            lineChart.BackgroundColor = Color.FromRgb(0x2974c1);
            lineChart.LineColor       = Colors.Yellow;
        }
        public frmDump(string devicePath, DeviceInfo deviceInfo, ScsiInfo scsiInfo = null)
        {
            MediaType mediaType;

            XamlReader.Load(this);

            // Defaults
            chkStopOnError.Checked      = false;
            chkForce.Checked            = false;
            chkPersistent.Checked       = true;
            chkResume.Checked           = true;
            chkTrack1Pregap.Checked     = false;
            chkSidecar.Checked          = true;
            chkTrim.Checked             = true;
            chkExistingMetadata.Checked = false;
            stpRetries.Value            = 5;
            stpSkipped.Value            = 512;

            if (scsiInfo != null)
            {
                mediaType = scsiInfo.MediaType;
            }
            else
            {
                switch (deviceInfo.Type)
                {
                case DeviceType.SecureDigital:
                    mediaType = MediaType.SecureDigital;
                    break;

                case DeviceType.MMC:
                    mediaType = MediaType.MMC;
                    break;

                default:
                    if (deviceInfo.IsPcmcia)
                    {
                        mediaType = MediaType.PCCardTypeII;
                    }
                    else if (deviceInfo.IsCompactFlash)
                    {
                        mediaType = MediaType.CompactFlash;
                    }
                    else
                    {
                        mediaType = MediaType.GENERIC_HDD;
                    }
                    break;
                }
            }

            ObservableCollection <IWritableImage> lstPlugins = new ObservableCollection <IWritableImage>();
            PluginBase plugins = GetPluginBase.Instance;

            foreach (IWritableImage plugin in
                     plugins.WritableImages.Values.Where(p => p.SupportedMediaTypes.Contains(mediaType)))
            {
                lstPlugins.Add(plugin);
            }
            cmbFormat.ItemTextBinding = Binding.Property((IWritableImage p) => p.Name);
            cmbFormat.ItemKeyBinding  = Binding.Property((IWritableImage p) => p.Id.ToString());
            cmbFormat.DataStore       = lstPlugins;

            List <CommonEncodingInfo> encodings = Encoding
                                                  .GetEncodings().Select(info => new CommonEncodingInfo
            {
                Name        = info.Name,
                DisplayName =
                    info.GetEncoding().EncodingName
            }).ToList();

            encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings()
                               .Select(info => new CommonEncodingInfo
            {
                Name = info.Name, DisplayName = info.DisplayName
            }));

            ObservableCollection <CommonEncodingInfo> lstEncodings = new ObservableCollection <CommonEncodingInfo>();

            foreach (CommonEncodingInfo info in encodings.OrderBy(t => t.DisplayName))
            {
                lstEncodings.Add(info);
            }
            cmbEncoding.ItemTextBinding = Binding.Property((CommonEncodingInfo p) => p.DisplayName);
            cmbEncoding.ItemKeyBinding  = Binding.Property((CommonEncodingInfo p) => p.Name);
            cmbEncoding.DataStore       = lstEncodings;

            switch (mediaType)
            {
            case MediaType.CD:
            case MediaType.CDDA:
            case MediaType.CDG:
            case MediaType.CDEG:
            case MediaType.CDI:
            case MediaType.CDROM:
            case MediaType.CDROMXA:
            case MediaType.CDPLUS:
            case MediaType.CDMO:
            case MediaType.CDR:
            case MediaType.CDRW:
            case MediaType.CDMRW:
            case MediaType.VCD:
            case MediaType.SVCD:
            case MediaType.PCD:
            case MediaType.DDCD:
            case MediaType.DDCDR:
            case MediaType.DDCDRW:
            case MediaType.DTSCD:
            case MediaType.CDMIDI:
            case MediaType.CDV:
            case MediaType.CDIREADY:
            case MediaType.FMTOWNS:
            case MediaType.PS1CD:
            case MediaType.PS2CD:
            case MediaType.MEGACD:
            case MediaType.SATURNCD:
            case MediaType.GDROM:
            case MediaType.GDR:
            case MediaType.MilCD:
            case MediaType.SuperCDROM2:
            case MediaType.JaguarCD:
            case MediaType.ThreeDO:
            case MediaType.PCFX:
            case MediaType.NeoGeoCD:
            case MediaType.CDTV:
            case MediaType.CD32:
            case MediaType.Playdia:
            case MediaType.Pippin:
            case MediaType.VideoNow:
            case MediaType.VideoNowColor:
            case MediaType.VideoNowXp:
                chkTrack1Pregap.Visible = true;
                break;

            default:
                chkTrack1Pregap.Visible = false;
                break;
            }

            this.devicePath = devicePath;
        }
Beispiel #3
0
        public pnlDeviceInfo(DeviceInfo devInfo)
        {
            XamlReader.Load(this);

            this.devInfo = devInfo;

            txtType.Text         = devInfo.Type.ToString();
            txtManufacturer.Text = devInfo.Manufacturer;
            txtModel.Text        = devInfo.Model;
            txtRevision.Text     = devInfo.Revision;
            txtSerial.Text       = devInfo.Serial;
            txtScsiType.Text     = devInfo.ScsiType.ToString();
            chkRemovable.Checked = devInfo.IsRemovable;
            chkUsb.Checked       = devInfo.IsUsb;

            if (devInfo.IsUsb)
            {
                tabUsb.Visible = true;
                btnSaveUsbDescriptors.Enabled = devInfo.UsbDescriptors != null;
                txtUsbVendorId.Text           = $"{devInfo.UsbVendorId:X4}";
                txtUsbProductId.Text          = $"{devInfo.UsbProductId:X4}";
                txtUsbManufacturer.Text       = devInfo.UsbManufacturerString;
                txtUsbProduct.Text            = devInfo.UsbProductString;
                txtUsbSerial.Text             = devInfo.UsbSerialString;
            }

            if (devInfo.IsFireWire)
            {
                tabFirewire.Visible          = true;
                txtFirewireVendorId.Text     = $"{devInfo.FireWireVendor:X4}";
                txtFirewireModelId.Text      = $"{devInfo.FireWireModel:X4}";
                txtFirewireManufacturer.Text = devInfo.FireWireVendorName;
                txtFirewireModel.Text        = devInfo.FireWireModelName;
                txtFirewireGuid.Text         = $"{devInfo.FireWireGuid:X16}";
            }

            if (devInfo.IsPcmcia)
            {
                tabPcmciaInfo tabPcmciaInfo = new tabPcmciaInfo();
                tabPcmciaInfo.LoadData(devInfo.Cis);
                tabInfos.Pages.Add(tabPcmciaInfo);
            }

            if (devInfo.AtaIdentify != null || devInfo.AtapiIdentify != null)
            {
                tabAtaInfo tabAtaInfo = new tabAtaInfo();
                tabAtaInfo.LoadData(devInfo.AtaIdentify, devInfo.AtapiIdentify, devInfo.AtaMcptError);

                tabInfos.Pages.Add(tabAtaInfo);
            }

            if (devInfo.ScsiInquiryData != null)
            {
                tabScsiInfo tabScsiInfo = new tabScsiInfo();
                tabScsiInfo.LoadData(devInfo.ScsiInquiryData, devInfo.ScsiInquiry, devInfo.ScsiEvpdPages,
                                     devInfo.ScsiMode, devInfo.ScsiType, devInfo.ScsiModeSense6,
                                     devInfo.ScsiModeSense10, devInfo.MmcConfiguration);

                tabInfos.Pages.Add(tabScsiInfo);

                if (devInfo.PlextorFeatures != null)
                {
                    tabPlextor.Visible = true;
                    if (devInfo.PlextorFeatures.Eeprom != null)
                    {
                        stkPlextorEeprom.Visible   = true;
                        txtPlextorDiscs.Text       = $"{devInfo.PlextorFeatures.Discs}";
                        txtPlextorCdReadTime.Text  = TimeSpan.FromSeconds(devInfo.PlextorFeatures.CdReadTime).ToString();
                        txtPlextorCdWriteTime.Text =
                            TimeSpan.FromSeconds(devInfo.PlextorFeatures.CdWriteTime).ToString();
                        if (devInfo.PlextorFeatures.IsDvd)
                        {
                            stkPlextorDvdTimes.Visible = true;
                            txtPlextorDvdReadTime.Text =
                                TimeSpan.FromSeconds(devInfo.PlextorFeatures.DvdReadTime).ToString();
                            txtPlextorDvdWriteTime.Text =
                                TimeSpan.FromSeconds(devInfo.PlextorFeatures.DvdWriteTime).ToString();
                        }
                    }

                    chkPlextorPoweRec.Checked = devInfo.PlextorFeatures.PoweRec;

                    if (devInfo.PlextorFeatures.PoweRec)
                    {
                        chkPlextorPoweRecEnabled.Visible = true;
                        chkPlextorPoweRecEnabled.Checked = devInfo.PlextorFeatures.PoweRecEnabled;

                        if (devInfo.PlextorFeatures.PoweRecEnabled)
                        {
                            stkPlextorPoweRecEnabled.Visible = true;

                            if (devInfo.PlextorFeatures.PoweRecRecommendedSpeed > 0)
                            {
                                stkPlextorPoweRecRecommended.Visible = true;
                                txtPlextorPoweRecRecommended.Text    =
                                    $"{devInfo.PlextorFeatures.PoweRecRecommendedSpeed} Kb/sec.";
                            }

                            if (devInfo.PlextorFeatures.PoweRecSelected > 0)
                            {
                                stkPlextorPoweRecSelected.Visible = true;
                                txtPlextorPoweRecSelected.Text    =
                                    $"{devInfo.PlextorFeatures.PoweRecSelected} Kb/sec.";
                            }

                            if (devInfo.PlextorFeatures.PoweRecMax > 0)
                            {
                                stkPlextorPoweRecMax.Visible = true;
                                txtPlextorPoweRecMax.Text    = $"{devInfo.PlextorFeatures.PoweRecMax} Kb/sec.";
                            }

                            if (devInfo.PlextorFeatures.PoweRecLast > 0)
                            {
                                stkPlextorPoweRecLast.Visible = true;
                                txtPlextorPoweRecLast.Text    = $"{devInfo.PlextorFeatures.PoweRecLast} Kb/sec.";
                            }
                        }
                    }

                    chkPlextorSilentMode.Checked = devInfo.PlextorFeatures.SilentMode;

                    if (devInfo.PlextorFeatures.SilentMode)
                    {
                        chkPlextorSilentModeEnabled.Visible = true;
                        chkPlextorSilentModeEnabled.Checked = devInfo.PlextorFeatures.SilentModeEnabled;

                        if (devInfo.PlextorFeatures.SilentModeEnabled)
                        {
                            lblPlextorSilentModeAccessTime.Text = devInfo.PlextorFeatures.AccessTimeLimit == 2
                                                                      ? "\tAccess time is slow"
                                                                      : "\tAccess time is fast";

                            txtPlextorSilentModeCdReadSpeedLimit.Text =
                                devInfo.PlextorFeatures.CdReadSpeedLimit > 0
                                    ? $"{devInfo.PlextorFeatures.CdReadSpeedLimit}x"
                                    : "unlimited";

                            txtPlextorSilentModeCdWriteSpeedLimit.Text =
                                devInfo.PlextorFeatures.CdWriteSpeedLimit > 0
                                    ? $"{devInfo.PlextorFeatures.CdReadSpeedLimit}x"
                                    : "unlimited";

                            if (devInfo.PlextorFeatures.IsDvd)
                            {
                                stkPlextorSilentModeDvdReadSpeedLimit.Visible = true;
                                txtPlextorSilentModeDvdReadSpeedLimit.Text    =
                                    devInfo.PlextorFeatures.DvdReadSpeedLimit > 0
                                        ? $"{devInfo.PlextorFeatures.DvdReadSpeedLimit}x"
                                        : "unlimited";
                            }
                        }
                    }

                    chkPlextorGigaRec.Checked   = devInfo.PlextorFeatures.GigaRec;
                    chkPlextorSecuRec.Checked   = devInfo.PlextorFeatures.SecuRec;
                    chkPlextorSpeedRead.Checked = devInfo.PlextorFeatures.SpeedRead;

                    if (devInfo.PlextorFeatures.SpeedRead)
                    {
                        chkPlextorSpeedEnabled.Visible = true;
                        chkPlextorSpeedEnabled.Checked = devInfo.PlextorFeatures.SpeedReadEnabled;
                    }

                    chkPlextorHiding.Checked = devInfo.PlextorFeatures.Hiding;
                    if (devInfo.PlextorFeatures.Hiding)
                    {
                        stkPlextorHiding.Visible           = true;
                        chkPlextorHidesRecordables.Checked = devInfo.PlextorFeatures.HidesRecordables;
                        chkPlextorHidesSessions.Checked    = devInfo.PlextorFeatures.HidesSessions;
                    }

                    chkPlextorVariRec.Checked = devInfo.PlextorFeatures.VariRec;

                    if (devInfo.PlextorFeatures.IsDvd)
                    {
                        stkPlextorDvd.Visible              = true;
                        chkPlextorVariRecDvd.Checked       = devInfo.PlextorFeatures.VariRecDvd;
                        chkPlextorBitSetting.Checked       = devInfo.PlextorFeatures.BitSetting;
                        chkPlextorBitSettingDl.Checked     = devInfo.PlextorFeatures.BitSettingDl;
                        chkPlextorDvdPlusWriteTest.Checked = devInfo.PlextorFeatures.DvdPlusWriteTest;
                    }
                }

                if (devInfo.ScsiInquiry?.KreonPresent == true)
                {
                    tabKreon.Visible = true;
                    chkKreonChallengeResponse.Checked    = devInfo.KreonFeatures.HasFlag(KreonFeatures.ChallengeResponse);
                    chkKreonDecryptSs.Checked            = devInfo.KreonFeatures.HasFlag(KreonFeatures.DecryptSs);
                    chkKreonXtremeUnlock.Checked         = devInfo.KreonFeatures.HasFlag(KreonFeatures.XtremeUnlock);
                    chkKreonWxripperUnlock.Checked       = devInfo.KreonFeatures.HasFlag(KreonFeatures.WxripperUnlock);
                    chkKreonChallengeResponse360.Checked =
                        devInfo.KreonFeatures.HasFlag(KreonFeatures.ChallengeResponse360);
                    chkKreonDecryptSs360.Checked      = devInfo.KreonFeatures.HasFlag(KreonFeatures.DecryptSs360);
                    chkKreonXtremeUnlock360.Checked   = devInfo.KreonFeatures.HasFlag(KreonFeatures.XtremeUnlock360);
                    chkKreonWxripperUnlock360.Checked = devInfo.KreonFeatures.HasFlag(KreonFeatures.WxripperUnlock360);
                    chkKreonLock.Checked          = devInfo.KreonFeatures.HasFlag(KreonFeatures.Lock);
                    chkKreonErrorSkipping.Checked = devInfo.KreonFeatures.HasFlag(KreonFeatures.ErrorSkipping);
                }

                if (devInfo.BlockLimits != null)
                {
                    BlockLimits.BlockLimitsData?blockLimits = BlockLimits.Decode(devInfo.BlockLimits);

                    if (blockLimits.HasValue)
                    {
                        tabSsc.Visible = true;
                        if (blockLimits.Value.minBlockLen == blockLimits.Value.maxBlockLen)
                        {
                            lblMinBlockSize.Visible = true;
                            lblMinBlockSize.Text    =
                                $"Device's block size is fixed at {blockLimits.Value.minBlockLen} bytes";
                        }
                        else
                        {
                            lblMinBlockSize.Visible = true;
                            lblMaxBlockSize.Visible = true;

                            lblMaxBlockSize.Text = blockLimits.Value.maxBlockLen > 0
                                                       ? $"Device's maximum block size is {blockLimits.Value.maxBlockLen} bytes"
                                                       : "Device does not specify a maximum block size";
                            lblMinBlockSize.Text =
                                $"Device's minimum block size is {blockLimits.Value.minBlockLen} bytes";

                            if (blockLimits.Value.granularity > 0)
                            {
                                lblBlockSizeGranularity.Visible = true;
                                lblBlockSizeGranularity.Text    =
                                    $"Device's needs a block size granularity of 2^{blockLimits.Value.granularity} ({Math.Pow(2, blockLimits.Value.granularity)}) bytes";
                            }
                        }
                    }
                }

                if (devInfo.DensitySupport != null)
                {
                    if (devInfo.DensitySupportHeader.HasValue)
                    {
                        stkDensities.Visible = true;
                        txtDensities.Text    = DensitySupport.PrettifyDensity(devInfo.DensitySupportHeader);
                    }
                }

                if (devInfo.MediumDensitySupport != null)
                {
                    if (devInfo.MediaTypeSupportHeader.HasValue)
                    {
                        stkMediaTypes.Visible = true;
                        txtMediumTypes.Text   = DensitySupport.PrettifyMediumType(devInfo.MediaTypeSupportHeader);
                    }

                    txtMediumDensity.Visible = true;
                    txtMediumDensity.Text    = DensitySupport.PrettifyMediumType(devInfo.MediumDensitySupport);
                }
            }

            tabSdMmcInfo tabSdMmcInfo = new tabSdMmcInfo();

            tabSdMmcInfo.LoadData(devInfo.Type, devInfo.CID, devInfo.CSD, devInfo.OCR, devInfo.ExtendedCSD,
                                  devInfo.SCR);

            tabInfos.Pages.Add(tabSdMmcInfo);
        }