/// <summary>
        ///     Takes the MODE PAGE 2Ah part of a device report and prints it as a list of values to be sequenced by ASP.NET in the
        ///     rendering
        /// </summary>
        /// <param name="mode">MODE PAGE 2Ah part of the report</param>
        /// <param name="mmcOneValue">List to put the values on</param>
        public static void Report(mmcModeType mode, ref List <string> mmcOneValue)
        {
            if (mode.PlaysAudio)
            {
                mmcOneValue.Add("Drive can play audio");
            }
            if (mode.ReadsMode2Form1)
            {
                mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format");
            }
            if (mode.ReadsMode2Form2)
            {
                mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format");
            }
            if (mode.SupportsMultiSession)
            {
                mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD");
            }

            if (mode.CDDACommand)
            {
                mmcOneValue.Add("Drive can read digital audio");
            }
            if (mode.AccurateCDDA)
            {
                mmcOneValue.Add("Drive can continue from streaming loss");
            }
            if (mode.ReadsSubchannel)
            {
                mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels");
            }
            if (mode.ReadsDeinterlavedSubchannel)
            {
                mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels");
            }
            if (mode.ReturnsC2Pointers)
            {
                mmcOneValue.Add("Drive supports C2 pointers");
            }
            if (mode.ReadsUPC)
            {
                mmcOneValue.Add("Drive can read Media Catalogue Number");
            }
            if (mode.ReadsISRC)
            {
                mmcOneValue.Add("Drive can read ISRC");
            }

            switch (mode.LoadingMechanismType)
            {
            case 0:
                mmcOneValue.Add("Drive uses media caddy");
                break;

            case 1:
                mmcOneValue.Add("Drive uses a tray");
                break;

            case 2:
                mmcOneValue.Add("Drive is pop-up");
                break;

            case 4:
                mmcOneValue.Add("Drive is a changer with individually changeable discs");
                break;

            case 5:
                mmcOneValue.Add("Drive is a changer using cartridges");
                break;

            default:
                mmcOneValue.Add($"Drive uses unknown loading mechanism type {mode.LoadingMechanismType}");
                break;
            }

            if (mode.CanLockMedia)
            {
                mmcOneValue.Add("Drive can lock media");
            }
            if (mode.PreventJumperStatus)
            {
                mmcOneValue.Add("Drive power ups locked");
                mmcOneValue.Add(mode.LockStatus
                                    ? "Drive is locked, media cannot be ejected or inserted"
                                    : "Drive is not locked, media can be ejected and inserted");
            }
            else
            {
                mmcOneValue.Add(mode.LockStatus
                                    ? "Drive is locked, media cannot be ejected, but if empty, can be inserted"
                                    : "Drive is not locked, media can be ejected and inserted");
            }

            if (mode.CanEject)
            {
                mmcOneValue.Add("Drive can eject media");
            }

            if (mode.SeparateChannelMute)
            {
                mmcOneValue.Add("Each channel can be muted independently");
            }
            if (mode.SeparateChannelVolume)
            {
                mmcOneValue.Add("Each channel's volume can be controlled independently");
            }

            if (mode.SupportedVolumeLevels > 0)
            {
                mmcOneValue.Add($"Drive supports {mode.SupportedVolumeLevels} volume levels");
            }
            if (mode.BufferSize > 0)
            {
                mmcOneValue.Add($"Drive has {mode.BufferSize} Kbyte of buffer");
            }
            if (mode.MaximumSpeed > 0)
            {
                mmcOneValue.Add($"Drive's maximum reading speed is {mode.MaximumSpeed} Kbyte/sec.");
            }
            if (mode.CurrentSpeed > 0)
            {
                mmcOneValue.Add($"Drive's current reading speed is {mode.CurrentSpeed} Kbyte/sec.");
            }

            if (mode.ReadsCDR)
            {
                mmcOneValue.Add(mode.WritesCDR ? "Drive can read and write CD-R" : "Drive can read CD-R");

                if (mode.ReadsPacketCDR)
                {
                    mmcOneValue.Add("Drive supports reading CD-R packet media");
                }
            }

            if (mode.ReadsCDRW)
            {
                mmcOneValue.Add(mode.WritesCDRW ? "Drive can read and write CD-RW" : "Drive can read CD-RW");
            }

            if (mode.ReadsDVDROM)
            {
                mmcOneValue.Add("Drive can read DVD-ROM");
            }
            if (mode.ReadsDVDR)
            {
                mmcOneValue.Add(mode.WritesDVDR ? "Drive can read and write DVD-R" : "Drive can read DVD-R");
            }
            if (mode.ReadsDVDRAM)
            {
                mmcOneValue.Add(mode.WritesDVDRAM ? "Drive can read and write DVD-RAM" : "Drive can read DVD-RAM");
            }

            if (mode.CompositeAudioVideo)
            {
                mmcOneValue.Add("Drive can deliver a composite audio and video data stream");
            }
            if (mode.DigitalPort1)
            {
                mmcOneValue.Add("Drive supports IEC-958 digital output on port 1");
            }
            if (mode.DigitalPort2)
            {
                mmcOneValue.Add("Drive supports IEC-958 digital output on port 2");
            }

            if (mode.DeterministicSlotChanger)
            {
                mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots");
            }
            if (mode.CurrentWriteSpeedSelected > 0)
            {
                if (mode.RotationControlSelected == 0)
                {
                    mmcOneValue
                    .Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode");
                }
                else if (mode.RotationControlSelected == 1)
                {
                    mmcOneValue
                    .Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode");
                }
            }
            else
            {
                if (mode.MaximumWriteSpeed > 0)
                {
                    mmcOneValue.Add($"Drive's maximum writing speed is {mode.MaximumWriteSpeed} Kbyte/sec.");
                }
                if (mode.CurrentWriteSpeed > 0)
                {
                    mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeed} Kbyte/sec.");
                }
            }

            if (mode.WriteSpeedPerformanceDescriptors != null)
            {
                foreach (Modes.ModePage_2A_WriteDescriptor descriptor in
                         mode.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0))
                {
                    if (descriptor.RotationControl == 0)
                    {
                        mmcOneValue.Add($"Drive supports writing at {descriptor.WriteSpeed} Kbyte/sec. in CLV mode");
                    }
                    else if (descriptor.RotationControl == 1)
                    {
                        mmcOneValue
                        .Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode");
                    }
                }
            }

            if (mode.TestWrite)
            {
                mmcOneValue.Add("Drive supports test writing");
            }

            if (mode.ReadsBarcode)
            {
                mmcOneValue.Add("Drive can read barcode");
            }

            if (mode.ReadsBothSides)
            {
                mmcOneValue.Add("Drive can read both sides of a disc");
            }
            if (mode.LeadInPW)
            {
                mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In");
            }

            if (mode.CSSandCPPMSupported)
            {
                mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM");
            }

            if (mode.BufferUnderRunProtection)
            {
                mmcOneValue.Add("Drive supports buffer under-run free recording");
            }

            mmcOneValue.Sort();
            mmcOneValue.Add("");
        }
Exemple #2
0
        public static Mode2A MapMode2A(mmcModeType oldMode)
        {
            if (oldMode == null)
            {
                return(null);
            }

            Mode2A newMode = new Mode2A
            {
                AccurateCDDA                = oldMode.AccurateCDDA,
                BCK                         = oldMode.BCK,
                BufferUnderRunProtection    = oldMode.BufferUnderRunProtection,
                CanEject                    = oldMode.CanEject,
                CanLockMedia                = oldMode.CanLockMedia,
                CDDACommand                 = oldMode.CDDACommand,
                CompositeAudioVideo         = oldMode.CompositeAudioVideo,
                CSSandCPPMSupported         = oldMode.CSSandCPPMSupported,
                DeterministicSlotChanger    = oldMode.DeterministicSlotChanger,
                DigitalPort1                = oldMode.DigitalPort1,
                DigitalPort2                = oldMode.DigitalPort2,
                LeadInPW                    = oldMode.LeadInPW,
                LoadingMechanismType        = oldMode.LoadingMechanismType,
                LockStatus                  = oldMode.LockStatus,
                LSBF                        = oldMode.LSBF,
                PlaysAudio                  = oldMode.PlaysAudio,
                PreventJumperStatus         = oldMode.PreventJumperStatus,
                RCK                         = oldMode.RCK,
                ReadsBarcode                = oldMode.ReadsBarcode,
                ReadsBothSides              = oldMode.ReadsBothSides,
                ReadsCDR                    = oldMode.ReadsCDR,
                ReadsCDRW                   = oldMode.ReadsCDRW,
                ReadsDeinterlavedSubchannel = oldMode.ReadsDeinterlavedSubchannel,
                ReadsDVDR                   = oldMode.ReadsDVDR,
                ReadsDVDRAM                 = oldMode.ReadsDVDRAM,
                ReadsDVDROM                 = oldMode.ReadsDVDROM,
                ReadsISRC                   = oldMode.ReadsISRC,
                ReadsMode2Form2             = oldMode.ReadsMode2Form2,
                ReadsMode2Form1             = oldMode.ReadsMode2Form1,
                ReadsPacketCDR              = oldMode.ReadsPacketCDR,
                ReadsSubchannel             = oldMode.ReadsSubchannel,
                ReadsUPC                    = oldMode.ReadsUPC,
                ReturnsC2Pointers           = oldMode.ReturnsC2Pointers,
                SeparateChannelMute         = oldMode.SeparateChannelMute,
                SeparateChannelVolume       = oldMode.SeparateChannelVolume,
                SSS                         = oldMode.SSS,
                SupportsMultiSession        = oldMode.SupportsMultiSession,
                TestWrite                   = oldMode.TestWrite,
                WritesCDR                   = oldMode.WritesCDR,
                WritesCDRW                  = oldMode.WritesCDRW,
                WritesDVDR                  = oldMode.WritesDVDR,
                WritesDVDRAM                = oldMode.WritesDVDRAM
            };

            if (oldMode.BufferSizeSpecified)
            {
                newMode.BufferSize = oldMode.BufferSize;
            }
            if (oldMode.CurrentSpeedSpecified)
            {
                newMode.CurrentSpeed = oldMode.CurrentSpeed;
            }
            if (oldMode.CurrentWriteSpeedSpecified)
            {
                newMode.CurrentWriteSpeed = oldMode.CurrentWriteSpeed;
            }
            if (oldMode.CurrentWriteSpeedSelectedSpecified)
            {
                newMode.CurrentWriteSpeedSelected = oldMode.CurrentWriteSpeedSelected;
            }
            if (oldMode.MaximumSpeedSpecified)
            {
                newMode.MaximumSpeed = oldMode.MaximumSpeed;
            }
            if (oldMode.MaximumWriteSpeedSpecified)
            {
                newMode.MaximumWriteSpeed = oldMode.MaximumWriteSpeed;
            }
            if (oldMode.RotationControlSelectedSpecified)
            {
                newMode.RotationControlSelected = oldMode.RotationControlSelected;
            }
            if (oldMode.SupportedVolumeLevelsSpecified)
            {
                newMode.SupportedVolumeLevels = oldMode.SupportedVolumeLevels;
            }

            if (oldMode.WriteSpeedPerformanceDescriptors == null)
            {
                return(newMode);
            }

            newMode.WriteSpeedPerformanceDescriptors =
                new List <WriteDescriptor>(oldMode.WriteSpeedPerformanceDescriptors.Select(t => new WriteDescriptor
            {
                RotationControl = t.RotationControl,
                WriteSpeed      = t.WriteSpeed
            }));

            return(newMode);
        }