/// <summary> /// Create the header data object from a buffer containing the header data /// </summary> /// <param name="buf">buffer containing the data</param> /// <param name="size">size of the data</param> public HeaderData(IntPtr buf, int size) : base(buf, size) { byte b; MSF = new MinuteSecondFrame(Get8(0), Get8(1), Get8(2)); b = Get8(3); BlockType = (BlockTypeType)((b >> 5) & 0x07); DataType = (DataTypeType)(b & 0x03); }
/// <summary> /// Create a new TOC entry /// </summary> /// <param name="buffer">the memory buffer holding the TOC</param> /// <param name="offset">the offset to the TOC entry of interest</param> /// <param name="size">the overall size of the buffer</param> /// <param name="mode">time versus lba mode</param> public TocEntry(IntPtr buffer, int offset, int size, bool mode) : base(buffer, size) { byte b = Get8(offset + 1) ; Adr = (byte)((b >> 4) & 0x0f) ; Control = (byte)(b & 0x0f) ; Number = Get8(offset + 2) ; if (mode) StartMSF = new MinuteSecondFrame(Get8(offset + 5), Get8(offset + 6), Get8(offset + 7)); else StartSector = Get32(offset + 4) ; }
/// <summary> /// This constructs the ATIP infomation /// </summary> /// <param name="buffer"></param> /// <param name="size"></param> public AtipInfo(IntPtr buffer, int size) : base(buffer, size) { byte b; if (size < 4) { return; } b = Get8(4); IndicativeTargetWritingPower = (byte)((b >> 4) & 0x0f); IsDDCD = GetBit(4, 3); ReferenceSpeed = (byte)(b & 0x07); b = Get8(5); UnrestrictedUse = GetBit(5, 6); b = Get8(6); MediaCDRW = GetBit(6, 6); MediaSubtype = (byte)((b >> 3) & 0x07); A1Valid = GetBit(6, 2); A2Valid = GetBit(6, 1); A3Valid = GetBit(6, 0); StartTimeOfLeadin = new MinuteSecondFrame(Get8(8), Get8(9), Get8(10)); LastPossibleStartOfLeadout = new MinuteSecondFrame(Get8(12), Get8(13), Get8(14)); A1Values = new byte[3]; for (int i = 0; i < 3; i++) { A1Values[i] = Get8(i + 16); } A2Values = new byte[3]; for (int i = 0; i < 3; i++) { A2Values[i] = Get8(i + 20); } A3Values = new byte[3]; for (int i = 0; i < 3; i++) { A3Values[i] = Get8(i + 24); } }
/// <summary> /// Create a new TOC entry /// </summary> /// <param name="buffer">the memory buffer holding the TOC</param> /// <param name="offset">the offset to the TOC entry of interest</param> /// <param name="size">the overall size of the buffer</param> /// <param name="mode">time versus lba mode</param> public TocEntry(IntPtr buffer, int offset, int size, bool mode) : base(buffer, size) { byte b = Get8(offset + 1); Adr = (byte)((b >> 4) & 0x0f); Control = (byte)(b & 0x0f); Number = Get8(offset + 2); if (mode) { StartMSF = new MinuteSecondFrame(Get8(offset + 5), Get8(offset + 6), Get8(offset + 7)); } else { StartSector = Get32(offset + 4); } }
/// <summary> /// Returns true if the two objects are equal /// </summary> /// <param name="o">the object to compare to</param> /// <returns>true if the objects are equal, false otherwise</returns> public override bool Equals(Object o) { if (o == null) { return(false); } if (!(o is MinuteSecondFrame)) { return(false); } MinuteSecondFrame other = (MinuteSecondFrame)o; return(other.Minutes == Minutes && other.Seconds == Seconds && other.Frames == Frames); }
/// <summary> /// The constructor for the DiskInformation class. It parses the information from the /// memory buffer that contains the raw SCSI result. /// </summary> /// <param name="buffer">The buffer containing the raw SCSI result</param> /// <param name="size">The size of the raw SCSI result buffer</param> public DiskInformation(IntPtr buffer, int size) : base(buffer, size) { ushort len = Get16(0); byte b = Get8(2); if ((b & 0x10) != 0) { m_erasable = true; } else { m_erasable = false; } m_session_state = (SessionStateType)((b >> 2) & 0x03); m_disk_status = (DiskStatusType)(b & 0x03); m_first_track = Get8(3); m_session_count = (ushort)(Get8(4) | (Get8(9) << 8)); m_first_track_in_last_session = (ushort)(Get8(5) | (Get8(10) << 8)); m_last_track_in_last_session = (ushort)(Get8(6) | (Get8(11) << 8)); b = Get8(7); if ((b & 0x80) != 0) { m_disk_id_valid = true; m_disk_identification = Get32(12); } else { m_disk_id_valid = false; } if ((b & 0x40) != 0) { m_disk_bar_code_valid = true; m_disk_bar_code = new byte[8]; for (int i = 24; i <= 31; i++) { m_disk_bar_code[i - 24] = Get8(i); } } else { m_disk_bar_code_valid = false; m_disk_bar_code = null; } if ((b & 0x20) != 0) { m_unrestricted_disk_use = true; } else { m_unrestricted_disk_use = false; } if ((b & 0x10) != 0) { m_disk_application_code_valid = true; m_disk_application_code = Get8(32); } else { m_disk_application_code_valid = false; } if ((b & 0x04) != 0) { m_dirty_bit = true; } else { m_dirty_bit = false; } m_background_format_status = (BackgroundFormatStatusType)(b & 0x03); m_last_session_lead_in_start_address = new MinuteSecondFrame(Get8(16) * 60 + Get8(17), Get8(18), Get8(19)); m_last_possible_leadout_start_address = new MinuteSecondFrame(Get8(20) * 60 + Get8(21), Get8(22), Get8(23)); OpcTable = new List <OpcTableEntry>(); if (BufferSize > 33) { byte cnt = Get8(33); int offset = 34; for (byte i = 0; i < cnt && offset < BufferSize; i++) { OpcTableEntry entry = new OpcTableEntry(Buffer, BufferSize, offset); OpcTable.Add(entry); offset += 8; } } }
/// <summary> /// /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <returns></returns> public CommandStatus PlayAudio(MinuteSecondFrame start, MinuteSecondFrame end) { if (m_logger != null) { string args = "NOT IMPLEMENTED"; m_logger.LogMessage(new UserMessage(UserMessage.Category.Debug, 8, "Bwg.Scsi.Device.PlayAudio(" + args + ")")); } return CommandStatus.NotSupported; }
/// <summary> /// Create the header data object from a buffer containing the header data /// </summary> /// <param name="buf">buffer containing the data</param> /// <param name="size">size of the data</param> public HeaderData(IntPtr buf, int size) : base(buf, size) { byte b ; MSF = new MinuteSecondFrame(Get8(0), Get8(1), Get8(2)); b = Get8(3); BlockType = (BlockTypeType)((b >> 5) & 0x07); DataType = (DataTypeType)(b & 0x03); }
/// <summary> /// The constructor for the DiskInformation class. It parses the information from the /// memory buffer that contains the raw SCSI result. /// </summary> /// <param name="buffer">The buffer containing the raw SCSI result</param> /// <param name="size">The size of the raw SCSI result buffer</param> public DiskInformation(IntPtr buffer, int size) : base(buffer, size) { ushort len = Get16(0); byte b = Get8(2); if ((b & 0x10) != 0) m_erasable = true; else m_erasable = false; m_session_state = (SessionStateType)((b >> 2) & 0x03); m_disk_status = (DiskStatusType)(b & 0x03); m_first_track = Get8(3); m_session_count = (ushort)(Get8(4) | (Get8(9) << 8)); m_first_track_in_last_session = (ushort)(Get8(5) | (Get8(10) << 8)); m_last_track_in_last_session = (ushort)(Get8(6) | (Get8(11) << 8)); b = Get8(7); if ((b & 0x80) != 0) { m_disk_id_valid = true; m_disk_identification = Get32(12); } else m_disk_id_valid = false; if ((b & 0x40) != 0) { m_disk_bar_code_valid = true; m_disk_bar_code = new byte[8]; for (int i = 24; i <= 31; i++) m_disk_bar_code[i - 24] = Get8(i); } else { m_disk_bar_code_valid = false; m_disk_bar_code = null; } if ((b & 0x20) != 0) m_unrestricted_disk_use = true; else m_unrestricted_disk_use = false; if ((b & 0x10) != 0) { m_disk_application_code_valid = true; m_disk_application_code = Get8(32); } else m_disk_application_code_valid = false; if ((b & 0x04) != 0) m_dirty_bit = true; else m_dirty_bit = false; m_background_format_status = (BackgroundFormatStatusType)(b & 0x03); m_last_session_lead_in_start_address = new MinuteSecondFrame(Get8(16) * 60 + Get8(17), Get8(18), Get8(19)); m_last_possible_leadout_start_address = new MinuteSecondFrame(Get8(20) * 60 + Get8(21), Get8(22), Get8(23)); OpcTable = new List<OpcTableEntry>(); if (BufferSize > 33) { byte cnt = Get8(33); int offset = 34; for(byte i = 0 ; i < cnt && offset < BufferSize ; i++) { OpcTableEntry entry = new OpcTableEntry(Buffer, BufferSize, offset); OpcTable.Add(entry); offset += 8; } } }
/// <summary> /// This constructs the ATIP infomation /// </summary> /// <param name="buffer"></param> /// <param name="size"></param> public AtipInfo(IntPtr buffer, int size) : base(buffer, size) { byte b; if (size < 4) return; b = Get8(4); IndicativeTargetWritingPower = (byte)((b >> 4) & 0x0f); IsDDCD = GetBit(4, 3); ReferenceSpeed = (byte)(b & 0x07); b = Get8(5); UnrestrictedUse = GetBit(5, 6); b = Get8(6); MediaCDRW = GetBit(6, 6); MediaSubtype = (byte)((b >> 3) & 0x07); A1Valid = GetBit(6, 2); A2Valid = GetBit(6, 1); A3Valid = GetBit(6, 0); StartTimeOfLeadin = new MinuteSecondFrame(Get8(8), Get8(9), Get8(10)); LastPossibleStartOfLeadout = new MinuteSecondFrame(Get8(12), Get8(13), Get8(14)); A1Values = new byte[3]; for (int i = 0; i < 3; i++) A1Values[i] = Get8(i + 16); A2Values = new byte[3]; for (int i = 0; i < 3; i++) A2Values[i] = Get8(i + 20); A3Values = new byte[3]; for (int i = 0; i < 3; i++) A3Values[i] = Get8(i + 24); }