private void ReadTOC(Stream S, TOC T) { ArrayList Entries = new ArrayList(); ArrayList SubTOCs = new ArrayList(); long BaseOffset = S.Position; TOCEntry TE = new TOCEntry(S, BaseOffset); bool ValidEntry = true; while (ValidEntry) { switch (TE.Type) { case EntryType.SubTOC: long Pos = S.Position; S.Seek(BaseOffset + TE.Offset_, SeekOrigin.Begin); TOC SubTOC = new TOC(); SubTOC.Name = TE.Name; this.ReadTOC(S, SubTOC); SubTOCs.Add(SubTOC); S.Seek(Pos, SeekOrigin.Begin); break; case EntryType.PNG: Entries.Add(TE); break; default: ValidEntry = false; break; } TE = new TOCEntry(S, BaseOffset); } T.SubTOCs = (TOC[])SubTOCs.ToArray(typeof(TOC)); T.Entries = (TOCEntry[])Entries.ToArray(typeof(TOCEntry)); }
protected override XElement ExportNewTOC() { List <XElement> list = new List <XElement>(); foreach (Node item in Model.Nodes) { XElement navPoint = ConvertToXElement(item); if (navPoint != null) { list.Add(navPoint); } } IEnumerable <XAttribute> spine = TOC.Attributes(); XElement navMap = null; if (spine.Count() > 0) { navMap = new XElement(ns + "spine", spine, list); } else { //There is no spine elements OpfDocument doc = new OpfDocument(); XAttribute TocRef = new XAttribute("toc", doc.GetNCXid()); navMap = new XElement(ns + "spine", TocRef, list); } OnSave(new ExportTocEventArgs(navMap)); //_NewTOC = navMap; return(navMap); }
private void ReadTOC(Stream S, TOC T) { ArrayList Entries = new ArrayList(); ArrayList SubTOCs = new ArrayList(); long BaseOffset = S.Position; TOCEntry TE = new TOCEntry(S, BaseOffset); bool ValidEntry = true; while (ValidEntry) { switch (TE.Type) { case EntryType.SubTOC: long Pos = S.Position; S.Seek(BaseOffset + TE.Offset_, SeekOrigin.Begin); TOC SubTOC = new TOC(); SubTOC.Name = TE.Name; this.ReadTOC(S, SubTOC); SubTOCs.Add(SubTOC); S.Seek(Pos, SeekOrigin.Begin); break; case EntryType.PNG: Entries.Add(TE); break; default: ValidEntry = false; break; } TE = new TOCEntry(S, BaseOffset); } T.SubTOCs = (TOC[])SubTOCs.ToArray(typeof (TOC)); T.Entries = (TOCEntry[])Entries.ToArray(typeof (TOCEntry)); }
public DataFile(string FilePath) { this.Location_ = FilePath; this.MainTOC_ = new TOC(); this.MainTOC_.Name = Path.GetFileName(FilePath); FileStream F = new FileStream(FilePath, FileMode.Open, FileAccess.Read); this.ReadTOC(F, this.MainTOC_); F.Close(); }
/// <summary> /// Renders a Table of Contents (TOC) in front of the document. /// /// Please set the paragraphs style to "Heading{#}". /// Otherwise, it renders an empty TOC. /// </summary> private void RenderTOC() { TOC tocBuilder = new TOC(); CT_SdtBlock tableOfContents = tocBuilder.Build(); CT_P pHeader = CreateFrontHeader(); newDoc.Document.body.Items.Add(tableOfContents); newDoc.Document.body.Items.Add(pHeader); newDoc.CreateParagraph().CreateRun().AddBreak(BreakType.PAGE); newDoc.EnforceUpdateFields(); }
public bool Open(string filename) { Header = new Header(this); TOC = new TOC(this); _filename = filename; bool encrypted = false; _stream = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite); var br = new BinaryReader(_stream); byte[] headerData = br.ReadBytes(0x14); if (BitConverter.ToUInt32(headerData, 0) != Header.MagicId) { encrypted = true; } if (encrypted) { headerData = DataUtil.Decrypt(headerData); } var headerMS = new MemoryStream(headerData); Header.Read(new BinaryReader(headerMS)); headerMS.Close(); if (Header.Identifier != Header.MagicId || Header.Version != Header.SupportedVersion) { _stream.Close(); return false; } byte[] tocData = br.ReadBytes(Header.TocSize); if (encrypted) { tocData = DataUtil.Decrypt(tocData); } var tocMS = new MemoryStream(tocData); TOC.Read(new BinaryReader(tocMS)); tocMS.Close(); return true; }
internal void packTOC() { int count = TOC.GetLength(0); List <string> tiks = new List <string>(count); List <string> sizes = new List <string>(count); for (int i = 0; i < count; i++) { tiks.Add(TOC[i, 0]); sizes.Add(TOC[i, 1]); } _tiks = tiks.ToArray(); _size = sizes.ToArray(); }
int estsize() { int size = 0; for (int i = 0; i < TOC.GetLength(0); i++) { int s = 0; if (int.TryParse(TOC[i, 1], out s)) { size += s; } } return(size); }
public void OnEvent(object element, object dataset) { if (!(element is IDatasetElement) || !(dataset is IDataset)) { return; } TOC toc = _doc.FocusMap.TOC as TOC; if (toc == null) { return; } ITOCElement tocElement = toc.GetTOCElement(((IDatasetElement)element).Class); if (tocElement == null) { return; } ILayer newLayer = LayerFactory.Create(((IDatasetElement)element).Class); if (newLayer is IFeatureLayer && element is IFeatureLayer) { if (((IFeatureLayer)element).Joins != null) { ((IFeatureLayer)newLayer).Joins = ((IFeatureLayer)element).Joins.Clone() as FeatureLayerJoins; } if (((IFeatureLayer)element).FilterQuery != null) { QueryFilter filter = new QueryFilter(); filter.WhereClause = ((IFeatureLayer)element).FilterQuery.WhereClause; ((IFeatureLayer)newLayer).FilterQuery = filter; } } if (newLayer == null) { return; } _doc.FocusMap.AddLayer(newLayer); if (_doc.Application is IMapApplication) { ((IMapApplication)_doc.Application).RefreshActiveMap(Framework.Carto.DrawPhase.All); } }
protected virtual void Dispose(bool disposing) { if (disposing) { header = null; TOC.Clear(); if (_reader != null) { _reader.Dispose(); } if (_writer != null) { _writer.Dispose(); } } }
protected override void LoadBaseNodes() { if (TOC != null) { Node ChildNode; foreach (var item in TOC.Elements()) { if (item.Name.LocalName == "itemref") { string idRef = item.Attribute("idref").Value; Model.Nodes.Add(new Node(idRef)); ChildNode = Model.Nodes.Last(); ChildNode.IsChecked = true; SaveInfoIntoNode(idRef, ChildNode); } } } }
protected override void LoadBaseNodes() { if (TOC != null) { Node ChildNode; foreach (var item in TOC.Elements(ns + "navPoint")) { if (item.Name.LocalName == "navPoint") { string s = item.Element(ns + "navLabel").Element(ns + "text").Value.Trim(); Model.Nodes.Add(new Node(s)); ChildNode = Model.Nodes.Last(); ChildNode.IsChecked = true; SaveInfoIntoNode(item, ChildNode); LoadChildNode(item, ChildNode); } } } }
protected virtual void Dispose(bool disposing) { if (!disposing) { return; } _header = null; foreach (var entry in TOC.Where(entry => entry.Data != null)) { entry.Data.Dispose(); } TOC.Clear(); if (_reader != null) { _reader.Dispose(); } }
public void Load(IPersistStream stream) { string mapName = (string)stream.Load("map", ""); if (_maps != null) { foreach (IMap map in _maps) { if (map.Name == mapName) { this.Map = (Map)map; break; } } } double?minx = (double?)stream.Load("minx"); if (minx != null) { _envelope = new Envelope( (double)minx, (double)stream.Load("miny", 0.0), (double)stream.Load("maxx", 0.0), (double)stream.Load("maxy", 0.0)); } if (this.Map != null) { TOC objInst = new TOC(this.Map); objInst.Modifier = TOCModifier.Private; _toc = (TOC)stream.Load("ITOC", null, objInst); if (_toc == null) { objInst.Dispose(); } _displayRotation = (double)stream.Load("DisplayRotation", (double)0.0); } }
internal int editTOC(TOC alteredTOC) { rulesencyclopediaDBEntities1 context = new rulesencyclopediaDBEntities1(); TOC toc = null; try { toc = context.TOC.First(a => a.Id == alteredTOC.Id); toc.Text = alteredTOC.Text; toc.Revision = alteredTOC.Revision; toc.Editor = alteredTOC.Editor; context.SaveChanges(); } catch (EntityException ex) { exHandler.exceptionHandlerEntity(ex, "Something went wrong when editing toc"); } finally { context.Dispose(); } return(toc.Id); }
protected virtual void Dispose(bool disposing) { if (disposing) { header = null; foreach (var entry in TOC) { if (entry.Data != null) { entry.Data.Close(); } } TOC.Clear(); if (_reader != null) { _reader.Dispose(); } if (_writer != null) { _writer.Dispose(); } } }
internal int deleteTOC(int ID) { rulesencyclopediaDBEntities1 context = new rulesencyclopediaDBEntities1(); TOC toc = null; try { toc = new TOC { Id = ID }; context.TOC.Attach(toc); context.TOC.Remove(toc); context.SaveChanges(); } catch (EntityException ex) { exHandler.exceptionHandlerEntity(ex, "Something went wrong while deleting the TOC"); } finally { context.Dispose(); } return(toc.Id); }
internal TOCDTO getTOC(int ID) { TOC toc = null; rulesencyclopediaDBEntities1 context = null; try { context = new rulesencyclopediaDBEntities1(); { toc = context.TOC.Single(element => element.Id == ID); } } catch (EntityException ex) { exHandler.exceptionHandlerEntity(ex, "something went wrong when getting toc"); } finally { context.Dispose(); } TOCDTO tocDTO = (TOCDTO)DTOConverter.Converter(new TOCDTO(), toc); return(tocDTO); }
internal int postTOC(TOC toc) { rulesencyclopediaDBEntities1 context = null; TOC result = null; try { context = new rulesencyclopediaDBEntities1(); { //getting back the key for the created user. result = context.TOC.Add(toc); context.SaveChanges(); } } catch (EntityException ex) { exHandler.exceptionHandlerEntity(ex, "Something went wrong when creating new toc"); } finally { context.Dispose(); } return(result.Id); }
public FileEntry(TOC toc) { TOC = toc; }
public CompactDiscInfoViewModel(byte[] toc, byte[] atip, byte[] compactDiscInformation, byte[] session, byte[] rawToc, byte[] pma, byte[] cdTextLeadIn, TOC.CDTOC?decodedToc, ATIP.CDATIP?decodedAtip, Session.CDSessionInfo?decodedSession, FullTOC.CDFullTOC?fullToc, CDTextOnLeadIn.CDText?decodedCdTextLeadIn, DiscInformation.StandardDiscInformation?decodedCompactDiscInformation, string mcn, Dictionary <byte, string> isrcs, Window view) { _tocData = toc; _atipData = atip; _compactDiscInformationData = compactDiscInformation; _sessionData = session; _rawTocData = rawToc; _pmaData = pma; _cdTextLeadInData = cdTextLeadIn; _view = view; IsrcList = new ObservableCollection <IsrcModel>(); SaveCdInformationCommand = ReactiveCommand.Create(ExecuteSaveCdInformationCommand); SaveCdTocCommand = ReactiveCommand.Create(ExecuteSaveCdTocCommand); SaveCdFullTocCommand = ReactiveCommand.Create(ExecuteSaveCdFullTocCommand); SaveCdSessionCommand = ReactiveCommand.Create(ExecuteSaveCdSessionCommand); SaveCdTextCommand = ReactiveCommand.Create(ExecuteSaveCdTextCommand); SaveCdAtipCommand = ReactiveCommand.Create(ExecuteSaveCdAtipCommand); SaveCdPmaCommand = ReactiveCommand.Create(ExecuteSaveCdPmaCommand); if (decodedCompactDiscInformation.HasValue) { CdInformationText = DiscInformation.Prettify000b(decodedCompactDiscInformation); } if (decodedToc.HasValue) { CdTocText = TOC.Prettify(decodedToc); } if (fullToc.HasValue) { CdFullTocText = FullTOC.Prettify(fullToc); } if (decodedSession.HasValue) { CdSessionText = Session.Prettify(decodedSession); } if (decodedCdTextLeadIn.HasValue) { CdTextText = CDTextOnLeadIn.Prettify(decodedCdTextLeadIn); } if (decodedAtip.HasValue) { CdAtipText = ATIP.Prettify(atip); } if (!string.IsNullOrEmpty(mcn)) { McnText = mcn; } if (isrcs != null && isrcs.Count > 0) { foreach (KeyValuePair <byte, string> isrc in isrcs) { IsrcList.Add(new IsrcModel { Track = isrc.Key.ToString(), Isrc = isrc.Value }); } } MiscellaneousVisible = McnText != null || isrcs?.Count > 0 || pma != null; CdPmaVisible = pma != null; }
/// <summary>Reads the TOC, processes it, returns the track list and last sector</summary> /// <param name="dev">Device</param> /// <param name="dumpLog">Dump log</param> /// <param name="force">Force dump enabled</param> /// <param name="lastSector">Last sector number</param> /// <param name="leadOutStarts">Lead-out starts</param> /// <param name="mediaTags">Media tags</param> /// <param name="stoppingErrorMessage">Stopping error message handler</param> /// <param name="toc">Full CD TOC</param> /// <param name="trackFlags">Track flags</param> /// <param name="updateStatus">Update status handler</param> /// <returns>List of tracks</returns> public static Track[] GetCdTracks(Device dev, DumpLog dumpLog, bool force, out long lastSector, Dictionary <int, long> leadOutStarts, Dictionary <MediaTagType, byte[]> mediaTags, ErrorMessageHandler stoppingErrorMessage, out FullTOC.CDFullTOC?toc, Dictionary <byte, byte> trackFlags, UpdateStatusHandler updateStatus) { byte[] cmdBuf; // Data buffer const uint sectorSize = 2352; // Full sector size bool sense; // Sense indicator List <Track> trackList = new List <Track>(); // Tracks in disc byte[] tmpBuf; // Temporary buffer toc = null; lastSector = 0; TrackType leadoutTrackType = TrackType.Audio; // We discarded all discs that falsify a TOC before requesting a real TOC // No TOC, no CD (or an empty one) dumpLog?.WriteLine("Reading full TOC"); updateStatus?.Invoke("Reading full TOC"); sense = dev.ReadRawToc(out cmdBuf, out _, 0, dev.Timeout, out _); if (!sense) { toc = FullTOC.Decode(cmdBuf); if (toc.HasValue) { tmpBuf = new byte[cmdBuf.Length - 2]; Array.Copy(cmdBuf, 2, tmpBuf, 0, cmdBuf.Length - 2); mediaTags?.Add(MediaTagType.CD_FullTOC, tmpBuf); } } updateStatus?.Invoke("Building track map..."); dumpLog?.WriteLine("Building track map..."); if (toc.HasValue) { FullTOC.TrackDataDescriptor[] sortedTracks = toc.Value.TrackDescriptors.OrderBy(track => track.POINT).ToArray(); foreach (FullTOC.TrackDataDescriptor trk in sortedTracks.Where(trk => trk.ADR == 1 || trk.ADR == 4)) { if (trk.POINT >= 0x01 && trk.POINT <= 0x63) { trackList.Add(new Track { TrackSequence = trk.POINT, TrackSession = trk.SessionNumber, TrackType = (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack || (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental ? TrackType.Data : TrackType.Audio, TrackStartSector = (ulong)((trk.PHOUR * 3600 * 75) + (trk.PMIN * 60 * 75) + (trk.PSEC * 75) + trk.PFRAME - 150), TrackBytesPerSector = (int)sectorSize, TrackRawBytesPerSector = (int)sectorSize }); trackFlags?.Add(trk.POINT, trk.CONTROL); } else if (trk.POINT == 0xA2) { int phour, pmin, psec, pframe; if (trk.PFRAME == 0) { pframe = 74; if (trk.PSEC == 0) { psec = 59; if (trk.PMIN == 0) { pmin = 59; phour = trk.PHOUR - 1; } else { pmin = trk.PMIN - 1; phour = trk.PHOUR; } } else { psec = trk.PSEC - 1; pmin = trk.PMIN; phour = trk.PHOUR; } } else { pframe = trk.PFRAME - 1; psec = trk.PSEC; pmin = trk.PMIN; phour = trk.PHOUR; } lastSector = (phour * 3600 * 75) + (pmin * 60 * 75) + (psec * 75) + pframe - 150; leadOutStarts?.Add(trk.SessionNumber, lastSector + 1); } else if (trk.POINT == 0xA0 && trk.ADR == 1) { leadoutTrackType = (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack || (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental ? TrackType.Data : TrackType.Audio; } } } else { updateStatus?.Invoke("Cannot read RAW TOC, requesting processed one..."); dumpLog?.WriteLine("Cannot read RAW TOC, requesting processed one..."); sense = dev.ReadToc(out cmdBuf, out _, false, 0, dev.Timeout, out _); TOC.CDTOC?oldToc = TOC.Decode(cmdBuf); if ((sense || !oldToc.HasValue) && !force) { dumpLog?.WriteLine("Could not read TOC, if you want to continue, use force, and will try from LBA 0 to 360000..."); stoppingErrorMessage?. Invoke("Could not read TOC, if you want to continue, use force, and will try from LBA 0 to 360000..."); return(null); } if (oldToc.HasValue) { foreach (TOC.CDTOCTrackDataDescriptor trk in oldToc.Value.TrackDescriptors. OrderBy(t => t.TrackNumber). Where(trk => trk.ADR == 1 || trk.ADR == 4)) { if (trk.TrackNumber >= 0x01 && trk.TrackNumber <= 0x63) { trackList.Add(new Track { TrackSequence = trk.TrackNumber, TrackSession = 1, TrackType = (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack || (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental ? TrackType.Data : TrackType.Audio, TrackStartSector = trk.TrackStartAddress, TrackBytesPerSector = (int)sectorSize, TrackRawBytesPerSector = (int)sectorSize }); trackFlags?.Add(trk.TrackNumber, trk.CONTROL); } else if (trk.TrackNumber == 0xAA) { leadoutTrackType = (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack || (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental ? TrackType.Data : TrackType.Audio; lastSector = trk.TrackStartAddress - 1; } } } } if (trackList.Count == 0) { updateStatus?.Invoke("No tracks found, adding a single track from 0 to Lead-Out"); dumpLog?.WriteLine("No tracks found, adding a single track from 0 to Lead-Out"); trackList.Add(new Track { TrackSequence = 1, TrackSession = 1, TrackType = leadoutTrackType, TrackStartSector = 0, TrackBytesPerSector = (int)sectorSize, TrackRawBytesPerSector = (int)sectorSize }); trackFlags?.Add(1, (byte)(leadoutTrackType == TrackType.Audio ? 0 : 4)); } if (lastSector != 0) { return(trackList.ToArray()); } sense = dev.ReadCapacity16(out cmdBuf, out _, dev.Timeout, out _); if (!sense) { byte[] temp = new byte[8]; Array.Copy(cmdBuf, 0, temp, 0, 8); Array.Reverse(temp); lastSector = (long)BitConverter.ToUInt64(temp, 0); } else { sense = dev.ReadCapacity(out cmdBuf, out _, dev.Timeout, out _); if (!sense) { lastSector = (cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]; } } if (lastSector > 0) { return(trackList.ToArray()); } if (!force) { stoppingErrorMessage?. Invoke("Could not find Lead-Out, if you want to continue use force option and will continue until 360000 sectors..."); dumpLog?.WriteLine("Could not find Lead-Out, if you want to continue use force option and will continue until 360000 sectors..."); return(null); } updateStatus?. Invoke("WARNING: Could not find Lead-Out start, will try to read up to 360000 sectors, probably will fail before..."); dumpLog?.WriteLine("WARNING: Could not find Lead-Out start, will try to read up to 360000 sectors, probably will fail before..."); lastSector = 360000; return(trackList.ToArray()); }
public ImageInfoViewModel(string imagePath, IFilter filter, IMediaImage imageFormat, Window view) { _imagePath = imagePath; _filter = filter; _imageFormat = imageFormat; _view = view; IAssetLoader assets = AvaloniaLocator.Current.GetService <IAssetLoader>(); MediaTagsList = new ObservableCollection <string>(); SectorTagsList = new ObservableCollection <string>(); Sessions = new ObservableCollection <Session>(); Tracks = new ObservableCollection <Track>(); DumpHardwareList = new ObservableCollection <DumpHardwareModel>(); EntropyCommand = ReactiveCommand.Create(ExecuteEntropyCommand); VerifyCommand = ReactiveCommand.Create(ExecuteVerifyCommand); ChecksumCommand = ReactiveCommand.Create(ExecuteChecksumCommand); ConvertCommand = ReactiveCommand.Create(ExecuteConvertCommand); CreateSidecarCommand = ReactiveCommand.Create(ExecuteCreateSidecarCommand); ViewSectorsCommand = ReactiveCommand.Create(ExecuteViewSectorsCommand); DecodeMediaTagCommand = ReactiveCommand.Create(ExecuteDecodeMediaTagCommand); var genericHddIcon = new Bitmap(assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-harddisk.png"))); var genericOpticalIcon = new Bitmap(assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-optical.png"))); var genericFolderIcon = new Bitmap(assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/inode-directory.png"))); var mediaResource = new Uri($"avares://Aaru.Gui/Assets/Logos/Media/{imageFormat.Info.MediaType}.png"); MediaLogo = assets.Exists(mediaResource) ? new Bitmap(assets.Open(mediaResource)) : imageFormat.Info.XmlMediaType == XmlMediaType.BlockMedia ? genericHddIcon : imageFormat.Info.XmlMediaType == XmlMediaType.OpticalDisc ? genericOpticalIcon : genericFolderIcon; ImagePathText = $"Path: {imagePath}"; FilterText = $"Filter: {filter.Name}"; ImageIdentifiedText = $"Image format identified by {imageFormat.Name} ({imageFormat.Id})."; ImageFormatText = !string.IsNullOrWhiteSpace(imageFormat.Info.Version) ? $"Format: {imageFormat.Format} version {imageFormat.Info.Version}" : $"Format: {imageFormat.Format}"; ImageSizeText = $"Image without headers is {imageFormat.Info.ImageSize} bytes long"; SectorsText = $"Contains a media of {imageFormat.Info.Sectors} sectors with a maximum sector size of {imageFormat.Info.SectorSize} bytes (if all sectors are of the same size this would be {imageFormat.Info.Sectors * imageFormat.Info.SectorSize} bytes)"; MediaTypeText = $"Contains a media of type {imageFormat.Info.MediaType} and XML type {imageFormat.Info.XmlMediaType}"; HasPartitionsText = $"{(imageFormat.Info.HasPartitions ? "Has" : "Doesn't have")} partitions"; HasSessionsText = $"{(imageFormat.Info.HasSessions ? "Has" : "Doesn't have")} sessions"; if (!string.IsNullOrWhiteSpace(imageFormat.Info.Application)) { ApplicationText = !string.IsNullOrWhiteSpace(imageFormat.Info.ApplicationVersion) ? $"Was created with {imageFormat.Info.Application} version {imageFormat.Info.ApplicationVersion}" : $"Was created with {imageFormat.Info.Application}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.Creator)) { CreatorText = $"Created by: {imageFormat.Info.Creator}"; } if (imageFormat.Info.CreationTime != DateTime.MinValue) { CreationTimeText = $"Created on {imageFormat.Info.CreationTime}"; } if (imageFormat.Info.LastModificationTime != DateTime.MinValue) { LastModificationTimeText = $"Last modified on {imageFormat.Info.LastModificationTime}"; } if (imageFormat.Info.MediaSequence != 0 && imageFormat.Info.LastMediaSequence != 0) { MediaSequenceText = $"Media is number {imageFormat.Info.MediaSequence} on a set of {imageFormat.Info.LastMediaSequence} medias"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaTitle)) { MediaTitleText = $"Media title: {imageFormat.Info.MediaTitle}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaManufacturer)) { MediaManufacturerText = $"Media manufacturer: {imageFormat.Info.MediaManufacturer}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaModel)) { MediaModelText = $"Media model: {imageFormat.Info.MediaModel}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaSerialNumber)) { MediaSerialNumberText = $"Media serial number: {imageFormat.Info.MediaSerialNumber}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaBarcode)) { MediaBarcodeText = $"Media barcode: {imageFormat.Info.MediaBarcode}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaPartNumber)) { MediaPartNumberText = $"Media part number: {imageFormat.Info.MediaPartNumber}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveManufacturer)) { DriveManufacturerText = $"Drive manufacturer: {imageFormat.Info.DriveManufacturer}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveModel)) { DriveModelText = $"Drive model: {imageFormat.Info.DriveModel}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveSerialNumber)) { DriveSerialNumberText = $"Drive serial number: {imageFormat.Info.DriveSerialNumber}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveFirmwareRevision)) { DriveFirmwareRevisionText = $"Drive firmware info: {imageFormat.Info.DriveFirmwareRevision}"; } if (imageFormat.Info.Cylinders > 0 && imageFormat.Info.Heads > 0 && imageFormat.Info.SectorsPerTrack > 0 && imageFormat.Info.XmlMediaType != XmlMediaType.OpticalDisc && (!(imageFormat is ITapeImage tapeImage) || !tapeImage.IsTape)) { MediaGeometryText = $"Media geometry: {imageFormat.Info.Cylinders} cylinders, {imageFormat.Info.Heads} heads, {imageFormat.Info.SectorsPerTrack} sectors per track"; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Count > 0) { foreach (MediaTagType tag in imageFormat.Info.ReadableMediaTags.OrderBy(t => t)) { MediaTagsList.Add(tag.ToString()); } } if (imageFormat.Info.ReadableSectorTags != null && imageFormat.Info.ReadableSectorTags.Count > 0) { foreach (SectorTagType tag in imageFormat.Info.ReadableSectorTags.OrderBy(t => t)) { SectorTagsList.Add(tag.ToString()); } } PeripheralDeviceTypes scsiDeviceType = PeripheralDeviceTypes.DirectAccess; byte[] scsiInquiryData = null; Inquiry?scsiInquiry = null; Modes.DecodedMode?scsiMode = null; byte[] scsiModeSense6 = null; byte[] scsiModeSense10 = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_INQUIRY)) { scsiInquiryData = imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY); scsiDeviceType = (PeripheralDeviceTypes)(scsiInquiryData[0] & 0x1F); scsiInquiry = Inquiry.Decode(scsiInquiryData); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_6)) { scsiModeSense6 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_6); scsiMode = Modes.DecodeMode6(scsiModeSense6, scsiDeviceType); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_10)) { scsiModeSense10 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_10); scsiMode = Modes.DecodeMode10(scsiModeSense10, scsiDeviceType); } ScsiInfo = new ScsiInfo { DataContext = new ScsiInfoViewModel(scsiInquiryData, scsiInquiry, null, scsiMode, scsiDeviceType, scsiModeSense6, scsiModeSense10, null, _view) }; byte[] ataIdentify = null; byte[] atapiIdentify = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) { ataIdentify = imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATAPI_IDENTIFY)) { atapiIdentify = imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); } AtaInfo = new AtaInfo { DataContext = new AtaInfoViewModel(ataIdentify, atapiIdentify, null, _view) }; byte[] toc = null; TOC.CDTOC? decodedToc = null; byte[] fullToc = null; FullTOC.CDFullTOC? decodedFullToc = null; byte[] pma = null; byte[] atip = null; ATIP.CDATIP? decodedAtip = null; byte[] cdtext = null; CDTextOnLeadIn.CDText?decodedCdText = null; string mediaCatalogueNumber = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TOC)) { toc = imageFormat.ReadDiskTag(MediaTagType.CD_TOC); if (toc.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(toc, 0)); if (dataLen + 2 != toc.Length) { byte[] tmp = new byte[toc.Length + 2]; Array.Copy(toc, 0, tmp, 2, toc.Length); tmp[0] = (byte)((toc.Length & 0xFF00) >> 8); tmp[1] = (byte)(toc.Length & 0xFF); toc = tmp; } decodedToc = TOC.Decode(toc); } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_FullTOC)) { fullToc = imageFormat.ReadDiskTag(MediaTagType.CD_FullTOC); if (fullToc.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(fullToc, 0)); if (dataLen + 2 != fullToc.Length) { byte[] tmp = new byte[fullToc.Length + 2]; Array.Copy(fullToc, 0, tmp, 2, fullToc.Length); tmp[0] = (byte)((fullToc.Length & 0xFF00) >> 8); tmp[1] = (byte)(fullToc.Length & 0xFF); fullToc = tmp; } decodedFullToc = FullTOC.Decode(fullToc); } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_PMA)) { pma = imageFormat.ReadDiskTag(MediaTagType.CD_PMA); if (pma.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(pma, 0)); if (dataLen + 2 != pma.Length) { byte[] tmp = new byte[pma.Length + 2]; Array.Copy(pma, 0, tmp, 2, pma.Length); tmp[0] = (byte)((pma.Length & 0xFF00) >> 8); tmp[1] = (byte)(pma.Length & 0xFF); pma = tmp; } } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_ATIP)) { atip = imageFormat.ReadDiskTag(MediaTagType.CD_ATIP); uint dataLen = Swapping.Swap(BitConverter.ToUInt32(atip, 0)); if (dataLen + 4 != atip.Length) { byte[] tmp = new byte[atip.Length + 4]; Array.Copy(atip, 0, tmp, 4, atip.Length); tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24); tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16); tmp[2] = (byte)((atip.Length & 0xFF00) >> 8); tmp[3] = (byte)(atip.Length & 0xFF); atip = tmp; } decodedAtip = ATIP.Decode(atip); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TEXT)) { cdtext = imageFormat.ReadDiskTag(MediaTagType.CD_TEXT); uint dataLen = Swapping.Swap(BitConverter.ToUInt32(cdtext, 0)); if (dataLen + 4 != cdtext.Length) { byte[] tmp = new byte[cdtext.Length + 4]; Array.Copy(cdtext, 0, tmp, 4, cdtext.Length); tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24); tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16); tmp[2] = (byte)((cdtext.Length & 0xFF00) >> 8); tmp[3] = (byte)(cdtext.Length & 0xFF); cdtext = tmp; } decodedCdText = CDTextOnLeadIn.Decode(cdtext); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_MCN)) { byte[] mcn = imageFormat.ReadDiskTag(MediaTagType.CD_MCN); mediaCatalogueNumber = Encoding.UTF8.GetString(mcn); } CompactDiscInfo = new CompactDiscInfo { DataContext = new CompactDiscInfoViewModel(toc, atip, null, null, fullToc, pma, cdtext, decodedToc, decodedAtip, null, decodedFullToc, decodedCdText, null, mediaCatalogueNumber, null, _view) }; byte[] dvdPfi = null; byte[] dvdDmi = null; byte[] dvdCmi = null; byte[] hddvdCopyrightInformation = null; byte[] dvdBca = null; PFI.PhysicalFormatInformation?decodedPfi = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_PFI)) { dvdPfi = imageFormat.ReadDiskTag(MediaTagType.DVD_PFI); decodedPfi = PFI.Decode(dvdPfi); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_DMI)) { dvdDmi = imageFormat.ReadDiskTag(MediaTagType.DVD_DMI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_CMI)) { dvdCmi = imageFormat.ReadDiskTag(MediaTagType.DVD_CMI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.HDDVD_CPI)) { hddvdCopyrightInformation = imageFormat.ReadDiskTag(MediaTagType.HDDVD_CPI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_BCA)) { dvdBca = imageFormat.ReadDiskTag(MediaTagType.DVD_BCA); } DvdInfo = new DvdInfo { DataContext = new DvdInfoViewModel(imageFormat.Info.MediaType, dvdPfi, dvdDmi, dvdCmi, hddvdCopyrightInformation, dvdBca, null, decodedPfi, _view) }; byte[] dvdRamDds = null; byte[] dvdRamCartridgeStatus = null; byte[] dvdRamSpareArea = null; byte[] lastBorderOutRmd = null; byte[] dvdPreRecordedInfo = null; byte[] dvdrMediaIdentifier = null; byte[] dvdrPhysicalInformation = null; byte[] hddvdrMediumStatus = null; byte[] dvdrLayerCapacity = null; byte[] dvdrDlMiddleZoneStart = null; byte[] dvdrDlJumpIntervalSize = null; byte[] dvdrDlManualLayerJumpStartLba = null; byte[] dvdPlusAdip = null; byte[] dvdPlusDcb = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_DDS)) { dvdRamDds = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_DDS); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_MediumStatus)) { dvdRamCartridgeStatus = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_MediumStatus); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_SpareArea)) { dvdRamSpareArea = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_SpareArea); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_RMD)) { lastBorderOutRmd = imageFormat.ReadDiskTag(MediaTagType.DVDR_RMD); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_PreRecordedInfo)) { dvdPreRecordedInfo = imageFormat.ReadDiskTag(MediaTagType.DVDR_PreRecordedInfo); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_MediaIdentifier)) { dvdrMediaIdentifier = imageFormat.ReadDiskTag(MediaTagType.DVDR_MediaIdentifier); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_PFI)) { dvdrPhysicalInformation = imageFormat.ReadDiskTag(MediaTagType.DVDR_PFI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.HDDVD_MediumStatus)) { hddvdrMediumStatus = imageFormat.ReadDiskTag(MediaTagType.HDDVD_MediumStatus); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_LayerCapacity)) { dvdrLayerCapacity = imageFormat.ReadDiskTag(MediaTagType.DVDDL_LayerCapacity); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_MiddleZoneAddress)) { dvdrDlMiddleZoneStart = imageFormat.ReadDiskTag(MediaTagType.DVDDL_MiddleZoneAddress); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_JumpIntervalSize)) { dvdrDlJumpIntervalSize = imageFormat.ReadDiskTag(MediaTagType.DVDDL_JumpIntervalSize); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_ManualLayerJumpLBA)) { dvdrDlManualLayerJumpStartLba = imageFormat.ReadDiskTag(MediaTagType.DVDDL_ManualLayerJumpLBA); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_ADIP)) { dvdPlusAdip = imageFormat.ReadDiskTag(MediaTagType.DVD_ADIP); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DCB)) { dvdPlusDcb = imageFormat.ReadDiskTag(MediaTagType.DCB); } DvdWritableInfo = new DvdWritableInfo { DataContext = new DvdWritableInfoViewModel(imageFormat.Info.MediaType, dvdRamDds, dvdRamCartridgeStatus, dvdRamSpareArea, lastBorderOutRmd, dvdPreRecordedInfo, dvdrMediaIdentifier, dvdrPhysicalInformation, hddvdrMediumStatus, null, dvdrLayerCapacity, dvdrDlMiddleZoneStart, dvdrDlJumpIntervalSize, dvdrDlManualLayerJumpStartLba, null, dvdPlusAdip, dvdPlusDcb, _view) }; byte[] blurayBurstCuttingArea = null; byte[] blurayCartridgeStatus = null; byte[] blurayDds = null; byte[] blurayDiscInformation = null; byte[] blurayPowResources = null; byte[] bluraySpareAreaInformation = null; byte[] blurayTrackResources = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_BCA)) { blurayBurstCuttingArea = imageFormat.ReadDiskTag(MediaTagType.BD_BCA); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_CartridgeStatus)) { blurayCartridgeStatus = imageFormat.ReadDiskTag(MediaTagType.BD_CartridgeStatus); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DDS)) { blurayDds = imageFormat.ReadDiskTag(MediaTagType.BD_DDS); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DI)) { blurayDiscInformation = imageFormat.ReadDiskTag(MediaTagType.BD_DI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_POWResourcesInformation)) { blurayPowResources = imageFormat.ReadDiskTag(MediaTagType.MMC_POWResourcesInformation); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_SpareArea)) { bluraySpareAreaInformation = imageFormat.ReadDiskTag(MediaTagType.BD_SpareArea); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_TrackResourcesInformation)) { bluraySpareAreaInformation = imageFormat.ReadDiskTag(MediaTagType.MMC_TrackResourcesInformation); } BlurayInfo = new BlurayInfo { DataContext = new BlurayInfoViewModel(blurayDiscInformation, blurayBurstCuttingArea, blurayDds, blurayCartridgeStatus, bluraySpareAreaInformation, blurayPowResources, blurayTrackResources, null, null, _view) }; byte[] xboxDmi = null; byte[] xboxSecuritySector = null; SS.SecuritySector?decodedXboxSecuritySector = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_DMI)) { xboxDmi = imageFormat.ReadDiskTag(MediaTagType.Xbox_DMI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_SecuritySector)) { xboxSecuritySector = imageFormat.ReadDiskTag(MediaTagType.Xbox_SecuritySector); decodedXboxSecuritySector = SS.Decode(xboxSecuritySector); } XboxInfo = new XboxInfo { DataContext = new XboxInfoViewModel(null, xboxDmi, xboxSecuritySector, decodedXboxSecuritySector, _view) }; byte[] pcmciaCis = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.PCMCIA_CIS)) { pcmciaCis = imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS); } PcmciaInfo = new PcmciaInfo { DataContext = new PcmciaInfoViewModel(pcmciaCis, _view) }; DeviceType deviceType = DeviceType.Unknown; byte[] cid = null; byte[] csd = null; byte[] ocr = null; byte[] extendedCsd = null; byte[] scr = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CID)) { cid = imageFormat.ReadDiskTag(MediaTagType.SD_CID); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CSD)) { csd = imageFormat.ReadDiskTag(MediaTagType.SD_CSD); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_OCR)) { ocr = imageFormat.ReadDiskTag(MediaTagType.SD_OCR); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_SCR)) { scr = imageFormat.ReadDiskTag(MediaTagType.SD_SCR); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CID)) { cid = imageFormat.ReadDiskTag(MediaTagType.MMC_CID); deviceType = DeviceType.MMC; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CSD)) { csd = imageFormat.ReadDiskTag(MediaTagType.MMC_CSD); deviceType = DeviceType.MMC; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_OCR)) { ocr = imageFormat.ReadDiskTag(MediaTagType.MMC_OCR); deviceType = DeviceType.MMC; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_ExtendedCSD)) { extendedCsd = imageFormat.ReadDiskTag(MediaTagType.MMC_ExtendedCSD); deviceType = DeviceType.MMC; } SdMmcInfo = new SdMmcInfo { DataContext = new SdMmcInfoViewModel(deviceType, cid, csd, ocr, extendedCsd, scr) }; if (imageFormat is IOpticalMediaImage opticalMediaImage) { try { if (opticalMediaImage.Sessions != null && opticalMediaImage.Sessions.Count > 0) { foreach (Session session in opticalMediaImage.Sessions) { Sessions.Add(session); } } } catch { // ignored } try { if (opticalMediaImage.Tracks != null && opticalMediaImage.Tracks.Count > 0) { foreach (Track track in opticalMediaImage.Tracks) { Tracks.Add(track); } } } catch { // ignored } } if (imageFormat.DumpHardware is null) { return; } foreach (DumpHardwareType dump in imageFormat.DumpHardware) { foreach (ExtentType extent in dump.Extents) { DumpHardwareList.Add(new DumpHardwareModel { Manufacturer = dump.Manufacturer, Model = dump.Model, Serial = dump.Serial, SoftwareName = dump.Software.Name, SoftwareVersion = dump.Software.Version, OperatingSystem = dump.Software.OperatingSystem, Start = extent.Start, End = extent.End }); } } }
static void DoScsiMediaInfo(string outputPrefix, Device dev) { ScsiInfo scsiInfo = new ScsiInfo(dev); if (!scsiInfo.MediaInserted) { return; } if (scsiInfo.DeviceInfo.ScsiModeSense6 != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_scsi_modesense6.bin", "SCSI MODE SENSE (6)", scsiInfo.DeviceInfo.ScsiModeSense6); } if (scsiInfo.DeviceInfo.ScsiModeSense10 != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_scsi_modesense10.bin", "SCSI MODE SENSE (10)", scsiInfo.DeviceInfo.ScsiModeSense10); } switch (dev.ScsiType) { case PeripheralDeviceTypes.DirectAccess: case PeripheralDeviceTypes.MultiMediaDevice: case PeripheralDeviceTypes.OCRWDevice: case PeripheralDeviceTypes.OpticalDevice: case PeripheralDeviceTypes.SimplifiedDevice: case PeripheralDeviceTypes.WriteOnceDevice: if (scsiInfo.ReadCapacity != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity.bin", "SCSI READ CAPACITY", scsiInfo.ReadCapacity); } if (scsiInfo.ReadCapacity16 != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity16.bin", "SCSI READ CAPACITY(16)", scsiInfo.ReadCapacity16); } if (scsiInfo.Blocks != 0 && scsiInfo.BlockSize != 0) { DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", scsiInfo.Blocks, scsiInfo.BlockSize, scsiInfo.Blocks * scsiInfo.BlockSize); } break; case PeripheralDeviceTypes.SequentialAccess: if (scsiInfo.DensitySupport != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIA)", scsiInfo.DensitySupport); if (scsiInfo.DensitySupportHeader.HasValue) { DicConsole.WriteLine("Densities supported by currently inserted media:"); DicConsole.WriteLine(DensitySupport.PrettifyDensity(scsiInfo.DensitySupportHeader)); } } if (scsiInfo.MediaTypeSupport != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_medium_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", scsiInfo.MediaTypeSupport); if (scsiInfo.MediaTypeSupportHeader.HasValue) { DicConsole.WriteLine("Medium types currently inserted in device:"); DicConsole.WriteLine(DensitySupport.PrettifyMediumType(scsiInfo.MediaTypeSupportHeader)); } DicConsole.WriteLine(DensitySupport.PrettifyMediumType(scsiInfo.MediaTypeSupport)); } break; } if (dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice) { if (scsiInfo.MmcConfiguration != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_getconfiguration_current.bin", "SCSI GET CONFIGURATION", scsiInfo.MmcConfiguration); } if (scsiInfo.RecognizedFormatLayers != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_formatlayers.bin", "SCSI READ DISC STRUCTURE", scsiInfo.RecognizedFormatLayers); } if (scsiInfo.WriteProtectionStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_writeprotection.bin", "SCSI READ DISC STRUCTURE", scsiInfo.WriteProtectionStatus); } if (scsiInfo.DvdPfi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pfi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPfi); if (scsiInfo.DecodedPfi.HasValue) { DicConsole.WriteLine("PFI:\n{0}", PFI.Prettify(scsiInfo.DecodedPfi)); } } if (scsiInfo.DvdDmi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_dmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdDmi); if (DMI.IsXbox(scsiInfo.DvdDmi)) { DicConsole.WriteLine("Xbox DMI:\n{0}", DMI.PrettifyXbox(scsiInfo.DvdDmi)); } else if (DMI.IsXbox360(scsiInfo.DvdDmi)) { DicConsole.WriteLine("Xbox 360 DMI:\n{0}", DMI.PrettifyXbox360(scsiInfo.DvdDmi)); } } if (scsiInfo.DvdCmi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_cmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdCmi); DicConsole.WriteLine("Lead-In CMI:\n{0}", CSS_CPRM.PrettifyLeadInCopyright(scsiInfo.DvdCmi)); } if (scsiInfo.DvdBca != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_bca.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdBca); } if (scsiInfo.DvdAacs != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_aacs.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdAacs); } if (scsiInfo.DvdRamDds != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_dds.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamDds); DicConsole.WriteLine("Disc Definition Structure:\n{0}", DDS.Prettify(scsiInfo.DvdRamDds)); } if (scsiInfo.DvdRamCartridgeStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_status.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamCartridgeStatus); DicConsole.WriteLine("Medium Status:\n{0}", Cartridge.Prettify(scsiInfo.DvdRamCartridgeStatus)); } if (scsiInfo.DvdRamSpareArea != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_spare.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamSpareArea); DicConsole.WriteLine("Spare Area Information:\n{0}", Spare.Prettify(scsiInfo.DvdRamSpareArea)); } if (scsiInfo.LastBorderOutRmd != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", "SCSI READ DISC STRUCTURE", scsiInfo.LastBorderOutRmd); } if (scsiInfo.DvdPreRecordedInfo != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pri.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPreRecordedInfo); } if (scsiInfo.DvdrMediaIdentifier != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_mediaid.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrMediaIdentifier); } if (scsiInfo.DvdrPhysicalInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_pfi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrPhysicalInformation); } if (scsiInfo.DvdPlusAdip != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_adip.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusAdip); } if (scsiInfo.DvdPlusDcb != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_dcb.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusDcb); } if (scsiInfo.HddvdCopyrightInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvd_cmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdCopyrightInformation); } if (scsiInfo.HddvdrMediumStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_status.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrMediumStatus); } if (scsiInfo.HddvdrLastRmd != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrLastRmd); } if (scsiInfo.DvdrLayerCapacity != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_layercap.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrLayerCapacity); } if (scsiInfo.DvdrDlMiddleZoneStart != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_mzs.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlMiddleZoneStart); } if (scsiInfo.DvdrDlJumpIntervalSize != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_jis.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlJumpIntervalSize); } if (scsiInfo.DvdrDlManualLayerJumpStartLba != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_manuallj.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlManualLayerJumpStartLba); } if (scsiInfo.DvdrDlRemapAnchorPoint != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlRemapAnchorPoint); } if (scsiInfo.BlurayDiscInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_di.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDiscInformation); DicConsole.WriteLine("Blu-ray Disc Information:\n{0}", DI.Prettify(scsiInfo.BlurayDiscInformation)); } if (scsiInfo.BlurayPac != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_pac.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayPac); } if (scsiInfo.BlurayBurstCuttingArea != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_bca.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayBurstCuttingArea); DicConsole.WriteLine("Blu-ray Burst Cutting Area:\n{0}", BCA.Prettify(scsiInfo.BlurayBurstCuttingArea)); } if (scsiInfo.BlurayDds != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dds.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDds); DicConsole.WriteLine("Blu-ray Disc Definition Structure:\n{0}", Decoders.Bluray.DDS.Prettify(scsiInfo.BlurayDds)); } if (scsiInfo.BlurayCartridgeStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_cartstatus.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayCartridgeStatus); DicConsole.WriteLine("Blu-ray Cartridge Status:\n{0}", Decoders.Bluray.Cartridge.Prettify(scsiInfo.BlurayCartridgeStatus)); } if (scsiInfo.BluraySpareAreaInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_spare.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BluraySpareAreaInformation); DicConsole.WriteLine("Blu-ray Spare Area Information:\n{0}", Decoders.Bluray.Spare.Prettify(scsiInfo.BluraySpareAreaInformation)); } if (scsiInfo.BlurayRawDfl != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dfl.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayRawDfl); } if (scsiInfo.BlurayTrackResources != null) { DicConsole.WriteLine("Track Resources Information:\n{0}", DiscInformation.Prettify(scsiInfo.BlurayTrackResources)); DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_001b.bin", "SCSI READ DISC INFORMATION", scsiInfo.BlurayTrackResources); } if (scsiInfo.BlurayPowResources != null) { DicConsole.WriteLine("POW Resources Information:\n{0}", DiscInformation.Prettify(scsiInfo.BlurayPowResources)); DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_010b.bin", "SCSI READ DISC INFORMATION", scsiInfo.BlurayPowResources); } if (scsiInfo.Toc != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_toc.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Toc); if (scsiInfo.DecodedToc.HasValue) { DicConsole.WriteLine("TOC:\n{0}", TOC.Prettify(scsiInfo.DecodedToc)); } } if (scsiInfo.Atip != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Atip); if (scsiInfo.DecodedAtip.HasValue) { DicConsole.WriteLine("ATIP:\n{0}", ATIP.Prettify(scsiInfo.DecodedAtip)); } } if (scsiInfo.CompactDiscInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_000b.bin", "SCSI READ DISC INFORMATION", scsiInfo.CompactDiscInformation); if (scsiInfo.DecodedCompactDiscInformation.HasValue) { DicConsole.WriteLine("Standard Disc Information:\n{0}", DiscInformation.Prettify000b(scsiInfo.DecodedCompactDiscInformation)); } } if (scsiInfo.Session != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_session.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Session); if (scsiInfo.DecodedSession.HasValue) { DicConsole.WriteLine("Session information:\n{0}", Session.Prettify(scsiInfo.DecodedSession)); } } if (scsiInfo.RawToc != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_rawtoc.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.RawToc); if (scsiInfo.FullToc.HasValue) { DicConsole.WriteLine("Raw TOC:\n{0}", FullTOC.Prettify(scsiInfo.RawToc)); } } if (scsiInfo.Pma != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_pma.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Pma); DicConsole.WriteLine("PMA:\n{0}", PMA.Prettify(scsiInfo.Pma)); } if (scsiInfo.CdTextLeadIn != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.CdTextLeadIn); if (scsiInfo.DecodedCdTextLeadIn.HasValue) { DicConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", CDTextOnLeadIn.Prettify(scsiInfo.DecodedCdTextLeadIn)); } } if (!string.IsNullOrEmpty(scsiInfo.Mcn)) { DicConsole.WriteLine("MCN: {0}", scsiInfo.Mcn); } if (scsiInfo.Isrcs != null) { foreach (KeyValuePair <byte, string> isrc in scsiInfo.Isrcs) { DicConsole.WriteLine("Track's {0} ISRC: {1}", isrc.Key, isrc.Value); } } if (scsiInfo.XboxSecuritySector != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_xbox_ss.bin", "KREON EXTRACT SS", scsiInfo.XboxSecuritySector); } if (scsiInfo.DecodedXboxSecuritySector.HasValue) { DicConsole.WriteLine("Xbox Security Sector:\n{0}", SS.Prettify(scsiInfo.DecodedXboxSecuritySector)); } if (scsiInfo.XgdInfo != null) { DicConsole.WriteLine("Video layer 0 size: {0} sectors", scsiInfo.XgdInfo.L0Video); DicConsole.WriteLine("Video layer 1 size: {0} sectors", scsiInfo.XgdInfo.L1Video); DicConsole.WriteLine("Middle zone size: {0} sectors", scsiInfo.XgdInfo.MiddleZone); DicConsole.WriteLine("Game data size: {0} sectors", scsiInfo.XgdInfo.GameSize); DicConsole.WriteLine("Total size: {0} sectors", scsiInfo.XgdInfo.TotalSize); DicConsole.WriteLine("Real layer break: {0}", scsiInfo.XgdInfo.LayerBreak); DicConsole.WriteLine(); } } if (scsiInfo.MediaSerialNumber != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_mediaserialnumber.bin", "SCSI READ MEDIA SERIAL NUMBER", scsiInfo.MediaSerialNumber); DicConsole.Write("Media Serial Number: "); for (int i = 4; i < scsiInfo.MediaSerialNumber.Length; i++) { DicConsole.Write("{0:X2}", scsiInfo.MediaSerialNumber[i]); } DicConsole.WriteLine(); } DicConsole.WriteLine("Media identified as {0}", scsiInfo.MediaType); Core.Statistics.AddMedia(scsiInfo.MediaType, true); }
public DirectoryEntry(TOC toc) { TOC = toc; }
public void OnEvent(object element, object dataset) { if (!(element is IDatasetElement) || !(dataset is IDataset)) { return; } TOC toc = _doc.FocusMap.TOC as TOC; if (toc == null) { return; } ITOCElement tocElement = toc.GetTOCElement(((IDatasetElement)element).Class); if (tocElement == null) { return; } ITOCElement parentTocElement = tocElement.ParentGroup; //IDatasetElement e = ((IDataset)dataset)[((IDatasetElement)element).Title]; //if (e == null) return; if (!(element is ILayer)) { return; } FormSplitLayerWithFilter dlg = new FormSplitLayerWithFilter(_doc, element as ILayer); if (dlg.ShowDialog() == DialogResult.OK) { foreach (FormSplitLayerWithFilter.FilterExpessionItem expression in dlg.FilterExpressions) { ILayer newLayer = LayerFactory.Create(((IDatasetElement)element).Class); if (newLayer is IFeatureLayer && element is IFeatureLayer && ((IFeatureLayer)element).Joins != null) { ((IFeatureLayer)newLayer).Joins = ((IFeatureLayer)element).Joins.Clone() as FeatureLayerJoins; } if (newLayer is IFeatureLayer) { QueryFilter filter = new QueryFilter(); filter.WhereClause = expression.Filter; ((IFeatureLayer)newLayer).FilterQuery = filter; _doc.FocusMap.AddLayer(newLayer); tocElement = toc.GetTOCElement(newLayer); tocElement.Name = expression.Text; toc.Add2Group(tocElement, parentTocElement); } } if (_doc.Application is IMapApplication) { ((IMapApplication)_doc.Application).RefreshActiveMap(Framework.Carto.DrawPhase.All); } } }
public pnlScsiInfo(ScsiInfo scsiInfo) { XamlReader.Load(this); this.scsiInfo = scsiInfo; Stream logo = ResourceHandler.GetResourceStream($"DiscImageChef.Gui.Assets.Logos.Media.{scsiInfo.MediaType}.svg"); /* if(logo != null) * { * svgMediaLogo.SvgStream = logo; * svgMediaLogo.Visible = true; * } * else * {*/ logo = ResourceHandler.GetResourceStream($"DiscImageChef.Gui.Assets.Logos.Media.{scsiInfo.MediaType}.png"); if (logo != null) { imgMediaLogo.Image = new Bitmap(logo); imgMediaLogo.Visible = true; } //} switch (this.scsiInfo.MediaType) { case MediaType.HDDVDROM: case MediaType.HDDVDRAM: case MediaType.HDDVDR: case MediaType.HDDVDRW: case MediaType.HDDVDRDL: case MediaType.HDDVDRWDL: tabDvd.Text = "HD DVD"; break; default: tabDvd.Text = "DVD"; break; } switch (this.scsiInfo.MediaType) { case MediaType.DVDR: tabDvdr.Text = "DVD-R"; break; case MediaType.DVDRW: tabDvdr.Text = "DVD-RW"; break; case MediaType.DVDPR: tabDvdr.Text = "DVD+R"; break; case MediaType.DVDPRW: tabDvdr.Text = "DVD+RW"; break; case MediaType.DVDPRWDL: tabDvdr.Text = "DVD+RW DL"; break; case MediaType.DVDRDL: tabDvdr.Text = "DVD-R DL"; break; case MediaType.DVDPRDL: tabDvdr.Text = "DVD+R DL"; break; case MediaType.DVDRAM: tabDvdr.Text = "DVD-RAM"; break; case MediaType.DVDRWDL: tabDvdr.Text = "DVD-RW DL"; break; case MediaType.HDDVDRAM: tabDvdr.Text = "HD DVD-RAM"; break; case MediaType.HDDVDR: tabDvdr.Text = "HD DVD-R"; break; case MediaType.HDDVDRW: tabDvdr.Text = "HD DVD-RW"; break; case MediaType.HDDVDRDL: tabDvdr.Text = "HD DVD-R DL"; break; case MediaType.HDDVDRWDL: tabDvdr.Text = "HD DVD-RW DL"; break; } txtType.Text = scsiInfo.MediaType.ToString(); lblMediaSize.Text = $"Media has {scsiInfo.Blocks} blocks of {scsiInfo.BlockSize} bytes/each. (for a total of {scsiInfo.Blocks * scsiInfo.BlockSize} bytes)"; lblMediaSize.Visible = scsiInfo.Blocks != 0 && scsiInfo.BlockSize != 0; if (scsiInfo.MediaSerialNumber != null) { stkMediaSerial.Visible = true; StringBuilder sbSerial = new StringBuilder(); for (int i = 4; i < scsiInfo.MediaSerialNumber.Length; i++) { sbSerial.AppendFormat("{0:X2}", scsiInfo.MediaSerialNumber[i]); } txtMediaSerial.Text = sbSerial.ToString(); } btnSaveReadMediaSerial.Visible = this.scsiInfo.MediaSerialNumber != null; btnSaveReadCapacity.Visible = this.scsiInfo.ReadCapacity != null; btnSaveReadCapacity16.Visible = this.scsiInfo.ReadCapacity16 != null; btnSaveGetConfiguration.Visible = this.scsiInfo.MmcConfiguration != null; btnSaveRecognizedFormatLayers.Visible = this.scsiInfo.RecognizedFormatLayers != null; btnSaveWriteProtectionStatus.Visible = this.scsiInfo.WriteProtectionStatus != null; tabMmc.Visible = btnSaveGetConfiguration.Visible || btnSaveRecognizedFormatLayers.Visible || btnSaveWriteProtectionStatus.Visible; if (this.scsiInfo.DensitySupportHeader.HasValue) { grpDensitySupport.Visible = true; txtDensitySupport.Text = DensitySupport.PrettifyDensity(scsiInfo.DensitySupportHeader); } if (this.scsiInfo.MediaTypeSupportHeader.HasValue) { grpMediumSupport.Visible = true; txtMediumSupport.Text = DensitySupport.PrettifyMediumType(scsiInfo.MediaTypeSupportHeader); } btnSaveDensitySupport.Visible = scsiInfo.DensitySupport != null; btnSaveMediumSupport.Visible = scsiInfo.MediaTypeSupport != null; tabSsc.Visible = grpDensitySupport.Visible || grpMediumSupport.Visible || btnSaveDensitySupport.Visible || btnSaveMediumSupport.Visible; if (this.scsiInfo.DecodedCompactDiscInformation.HasValue) { tabCdInformation.Visible = true; txtCdInformation.Text = DiscInformation.Prettify000b(scsiInfo.DecodedCompactDiscInformation); btnCdInformation.Visible = scsiInfo.CompactDiscInformation != null; } if (this.scsiInfo.DecodedToc.HasValue) { tabCdToc.Visible = true; txtCdToc.Text = TOC.Prettify(scsiInfo.DecodedToc); btnCdToc.Visible = scsiInfo.Toc != null; } if (this.scsiInfo.FullToc.HasValue) { tabCdFullToc.Visible = true; txtCdFullToc.Text = FullTOC.Prettify(scsiInfo.FullToc); btnCdFullToc.Visible = scsiInfo.RawToc != null; } if (this.scsiInfo.DecodedSession.HasValue) { tabCdSession.Visible = true; txtCdSession.Text = Session.Prettify(scsiInfo.DecodedSession); btnCdSession.Visible = scsiInfo.Session != null; } if (this.scsiInfo.DecodedCdTextLeadIn.HasValue) { tabCdText.Visible = true; txtCdText.Text = CDTextOnLeadIn.Prettify(this.scsiInfo.DecodedCdTextLeadIn); btnCdText.Visible = scsiInfo.CdTextLeadIn != null; } if (this.scsiInfo.DecodedAtip.HasValue) { tabCdAtip.Visible = true; txtCdAtip.Text = ATIP.Prettify(this.scsiInfo.Atip); btnCdAtip.Visible = scsiInfo.Atip != null; } if (!string.IsNullOrEmpty(scsiInfo.Mcn)) { stkMcn.Visible = true; txtMcn.Text = scsiInfo.Mcn; } if (this.scsiInfo.Isrcs != null && this.scsiInfo.Isrcs.Count > 0) { grpIsrcs.Visible = true; TreeGridItemCollection isrcsItems = new TreeGridItemCollection(); grdIsrcs.Columns.Add(new GridColumn { HeaderText = "ISRC", DataCell = new TextBoxCell(0) }); grdIsrcs.Columns.Add(new GridColumn { HeaderText = "Track", DataCell = new TextBoxCell(0) }); grdIsrcs.AllowMultipleSelection = false; grdIsrcs.ShowHeader = true; grdIsrcs.DataStore = isrcsItems; foreach (KeyValuePair <byte, string> isrc in this.scsiInfo.Isrcs) { isrcsItems.Add(new TreeGridItem { Values = new object[] { isrc.Key.ToString(), isrc.Value } }); } } btnCdPma.Visible = this.scsiInfo.Pma != null; tabCdMisc.Visible = stkMcn.Visible || grpIsrcs.Visible || btnCdPma.Visible; tabCd.Visible = tabCdInformation.Visible || tabCdToc.Visible || tabCdFullToc.Visible || tabCdSession.Visible || tabCdText.Visible || tabCdAtip.Visible || stkMcn.Visible || grpIsrcs.Visible || btnCdPma.Visible; if (this.scsiInfo.DecodedPfi.HasValue) { grpDvdPfi.Visible = true; txtDvdPfi.Text = PFI.Prettify(this.scsiInfo.DecodedPfi); } if (this.scsiInfo.DvdCmi != null) { grpDvdCmi.Visible = true; txtDvdCmi.Text = CSS_CPRM.PrettifyLeadInCopyright(this.scsiInfo.DvdCmi); btnSaveDvdCmi.Visible = true; } btnSaveDvdPfi.Visible = this.scsiInfo.DvdPfi != null; btnSaveDvdDmi.Visible = this.scsiInfo.DvdDmi != null; btnSaveDvdCmi.Visible = this.scsiInfo.DvdCmi != null; btnSaveHdDvdCmi.Visible = this.scsiInfo.HddvdCopyrightInformation != null; btnSaveDvdBca.Visible = this.scsiInfo.DvdBca != null; btnSaveDvdAacs.Visible = this.scsiInfo.DvdAacs != null; tabDvd.Visible = grpDvdPfi.Visible || grpDvdCmi.Visible || btnSaveDvdPfi.Visible || btnSaveDvdDmi.Visible || btnSaveDvdCmi.Visible || btnSaveHdDvdCmi.Visible || btnSaveDvdBca.Visible || btnSaveDvdAacs.Visible; if (this.scsiInfo.XgdInfo != null) { stkXboxInformation.Visible = true; txtXboxL0Video.Text = $"{this.scsiInfo.XgdInfo.L0Video} sectors"; txtXboxL1Video.Text = $"{this.scsiInfo.XgdInfo.L1Video} sectors"; txtXboxMiddleZone.Text = $"{this.scsiInfo.XgdInfo.MiddleZone} sectors"; txtXboxGameSize.Text = $"{this.scsiInfo.XgdInfo.GameSize} sectors"; txtXboxTotalSize.Text = $"{this.scsiInfo.XgdInfo.TotalSize} sectors"; txtXboxRealBreak.Text = this.scsiInfo.XgdInfo.LayerBreak.ToString(); } if (this.scsiInfo.DvdDmi != null) { if (DMI.IsXbox(scsiInfo.DvdDmi)) { grpXboxDmi.Visible = true; txtXboxDmi.Text = DMI.PrettifyXbox(scsiInfo.DvdDmi); } else if (DMI.IsXbox360(scsiInfo.DvdDmi)) { grpXboxDmi.Visible = true; txtXboxDmi.Text = DMI.PrettifyXbox360(scsiInfo.DvdDmi); } } if (this.scsiInfo.DecodedXboxSecuritySector.HasValue) { grpXboxSs.Visible = true; txtXboxSs.Text = SS.Prettify(this.scsiInfo.DecodedXboxSecuritySector); } btnSaveXboxSs.Visible = this.scsiInfo.XboxSecuritySector != null; tabXbox.Visible = stkXboxInformation.Visible || grpXboxDmi.Visible || grpXboxSs.Visible || btnSaveXboxSs.Visible; if (this.scsiInfo.DvdRamDds != null) { grpDvdRamDds.Visible = true; btnSaveDvdRamDds.Visible = true; txtDvdRamDds.Text = DDS.Prettify(this.scsiInfo.DvdRamDds); } if (this.scsiInfo.DvdRamCartridgeStatus != null) { grpDvdRamCartridgeStatus.Visible = true; btnSaveDvdRamCartridgeStatus.Visible = true; txtDvdRamCartridgeStatus.Text = Cartridge.Prettify(this.scsiInfo.DvdRamCartridgeStatus); } if (this.scsiInfo.DvdRamSpareArea != null) { grpDvdRamSpareAreaInformation.Visible = true; btnSaveDvdRamSpareAreaInformation.Visible = true; txtDvdRamSpareAreaInformation.Text = Spare.Prettify(this.scsiInfo.DvdRamSpareArea); } btnSaveDvdRamDds.Visible = this.scsiInfo.DvdRamDds != null; btnSaveDvdRamCartridgeStatus.Visible = this.scsiInfo.DvdRamCartridgeStatus != null; btnSaveDvdRamSpareAreaInformation.Visible = this.scsiInfo.DvdRamSpareArea != null; btnSaveLastBorderOutRmd.Visible = this.scsiInfo.LastBorderOutRmd != null; btnSaveDvdPreRecordedInfo.Visible = this.scsiInfo.DvdPreRecordedInfo != null; btnSaveDvdrMediaIdentifier.Visible = this.scsiInfo.DvdrMediaIdentifier != null; btnSaveDvdrPhysicalInformation.Visible = this.scsiInfo.DvdrPhysicalInformation != null; btnSaveHddvdrMediumStatus.Visible = this.scsiInfo.HddvdrMediumStatus != null; btnSaveHddvdrLastRmd.Visible = this.scsiInfo.HddvdrLastRmd != null; btnSaveDvdrLayerCapacity.Visible = this.scsiInfo.DvdrLayerCapacity != null; btnSaveDvdrDlMiddleZoneStart.Visible = this.scsiInfo.DvdrDlMiddleZoneStart != null; btnSaveDvdrDlJumpIntervalSize.Visible = this.scsiInfo.DvdrDlJumpIntervalSize != null; btnSaveDvdrDlManualLayerJumpStartLba.Visible = this.scsiInfo.DvdrDlManualLayerJumpStartLba != null; btnSaveDvdrDlRemapAnchorPoint.Visible = this.scsiInfo.DvdrDlRemapAnchorPoint != null; btnSaveDvdPlusAdip.Visible = this.scsiInfo.DvdPlusAdip != null; btnSaveDvdPlusDcb.Visible = this.scsiInfo.DvdPlusDcb != null; tabDvdr.Visible = grpDvdRamDds.Visible || grpDvdRamCartridgeStatus.Visible || grpDvdRamSpareAreaInformation.Visible || btnSaveDvdRamDds.Visible || btnSaveDvdRamCartridgeStatus.Visible || btnSaveDvdRamSpareAreaInformation.Visible || btnSaveLastBorderOutRmd.Visible || btnSaveDvdPreRecordedInfo.Visible || btnSaveDvdrMediaIdentifier.Visible || btnSaveDvdrPhysicalInformation.Visible || btnSaveHddvdrMediumStatus.Visible || btnSaveHddvdrLastRmd.Visible || btnSaveDvdrLayerCapacity.Visible || btnSaveDvdrDlMiddleZoneStart.Visible || btnSaveDvdrDlJumpIntervalSize.Visible || btnSaveDvdrDlManualLayerJumpStartLba.Visible || btnSaveDvdrDlRemapAnchorPoint.Visible || btnSaveDvdPlusAdip.Visible || btnSaveDvdPlusDcb.Visible; if (this.scsiInfo.BlurayDiscInformation != null) { grpBlurayDiscInformation.Visible = true; btnSaveBlurayDiscInformation.Visible = true; txtBlurayDiscInformation.Text = DI.Prettify(this.scsiInfo.BlurayDiscInformation); } if (this.scsiInfo.BlurayBurstCuttingArea != null) { grpBlurayBurstCuttingArea.Visible = true; btnSaveBlurayBurstCuttingArea.Visible = true; txtBlurayBurstCuttingArea.Text = BCA.Prettify(this.scsiInfo.BlurayBurstCuttingArea); } if (this.scsiInfo.BlurayDds != null) { grpBlurayDds.Visible = true; btnSaveBlurayDds.Visible = true; txtBlurayDds.Text = Decoders.Bluray.DDS.Prettify(this.scsiInfo.BlurayDds); } if (this.scsiInfo.BlurayCartridgeStatus != null) { grpBlurayCartridgeStatus.Visible = true; btnSaveBlurayCartridgeStatus.Visible = true; txtBlurayCartridgeStatus.Text = Decoders.Bluray.Cartridge.Prettify(this.scsiInfo.BlurayCartridgeStatus); } if (this.scsiInfo.BluraySpareAreaInformation != null) { grpBluraySpareAreaInformation.Visible = true; btnSaveBluraySpareAreaInformation.Visible = true; txtBluraySpareAreaInformation.Text = Decoders.Bluray.Spare.Prettify(this.scsiInfo.BluraySpareAreaInformation); } if (this.scsiInfo.BlurayPowResources != null) { grpBlurayPowResources.Visible = true; btnSaveBlurayPowResources.Visible = true; txtBlurayPowResources.Text = DiscInformation.Prettify(this.scsiInfo.BlurayPowResources); } if (this.scsiInfo.BlurayTrackResources != null) { grpBlurayTrackResources.Visible = true; btnSaveBlurayTrackResources.Visible = true; txtBlurayTrackResources.Text = DiscInformation.Prettify(this.scsiInfo.BlurayTrackResources); } btnSaveBlurayRawDfl.Visible = this.scsiInfo.BlurayRawDfl != null; btnSaveBlurayPac.Visible = this.scsiInfo.BlurayPac != null; tabBluray.Visible = grpBlurayDiscInformation.Visible || grpBlurayBurstCuttingArea.Visible || grpBlurayDds.Visible || grpBlurayCartridgeStatus.Visible || grpBluraySpareAreaInformation.Visible || grpBlurayPowResources.Visible || grpBlurayTrackResources.Visible || btnSaveBlurayRawDfl.Visible || btnSaveBlurayPac.Visible; }
internal static void DoDecode(DecodeOptions options) { DicConsole.DebugWriteLine("Decode command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("Decode command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Decode command", "--input={0}", options.InputFile); DicConsole.DebugWriteLine("Decode command", "--start={0}", options.StartSector); DicConsole.DebugWriteLine("Decode command", "--length={0}", options.Length); DicConsole.DebugWriteLine("Decode command", "--disk-tags={0}", options.DiskTags); DicConsole.DebugWriteLine("Decode command", "--sector-tags={0}", options.SectorTags); FiltersList filtersList = new FiltersList(); IFilter inputFilter = filtersList.GetFilter(options.InputFile); if (inputFilter == null) { DicConsole.ErrorWriteLine("Cannot open specified file."); return; } IMediaImage inputFormat = ImageFormat.Detect(inputFilter); if (inputFormat == null) { DicConsole.ErrorWriteLine("Unable to recognize image format, not decoding"); return; } inputFormat.Open(inputFilter); Core.Statistics.AddMediaFormat(inputFormat.Format); Core.Statistics.AddMedia(inputFormat.Info.MediaType, false); Core.Statistics.AddFilter(inputFilter.Name); if (options.DiskTags) { if (inputFormat.Info.ReadableMediaTags.Count == 0) { DicConsole.WriteLine("There are no disk tags in chosen disc image."); } else { foreach (MediaTagType tag in inputFormat.Info.ReadableMediaTags) { switch (tag) { case MediaTagType.SCSI_INQUIRY: { byte[] inquiry = inputFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY); if (inquiry == null) { DicConsole.WriteLine("Error reading SCSI INQUIRY response from disc image"); } else { DicConsole.WriteLine("SCSI INQUIRY command response:"); DicConsole .WriteLine("================================================================================"); DicConsole.WriteLine(Inquiry.Prettify(inquiry)); DicConsole .WriteLine("================================================================================"); } break; } case MediaTagType.ATA_IDENTIFY: { byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY); if (identify == null) { DicConsole.WriteLine("Error reading ATA IDENTIFY DEVICE response from disc image"); } else { DicConsole.WriteLine("ATA IDENTIFY DEVICE command response:"); DicConsole .WriteLine("================================================================================"); DicConsole.WriteLine(Identify.Prettify(identify)); DicConsole .WriteLine("================================================================================"); } break; } case MediaTagType.ATAPI_IDENTIFY: { byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); if (identify == null) { DicConsole .WriteLine("Error reading ATA IDENTIFY PACKET DEVICE response from disc image"); } else { DicConsole.WriteLine("ATA IDENTIFY PACKET DEVICE command response:"); DicConsole .WriteLine("================================================================================"); DicConsole.WriteLine(Identify.Prettify(identify)); DicConsole .WriteLine("================================================================================"); } break; } case MediaTagType.CD_ATIP: { byte[] atip = inputFormat.ReadDiskTag(MediaTagType.CD_ATIP); if (atip == null) { DicConsole.WriteLine("Error reading CD ATIP from disc image"); } else { DicConsole.WriteLine("CD ATIP:"); DicConsole .WriteLine("================================================================================"); DicConsole.WriteLine(ATIP.Prettify(atip)); DicConsole .WriteLine("================================================================================"); } break; } case MediaTagType.CD_FullTOC: { byte[] fulltoc = inputFormat.ReadDiskTag(MediaTagType.CD_FullTOC); if (fulltoc == null) { DicConsole.WriteLine("Error reading CD full TOC from disc image"); } else { DicConsole.WriteLine("CD full TOC:"); DicConsole .WriteLine("================================================================================"); DicConsole.WriteLine(FullTOC.Prettify(fulltoc)); DicConsole .WriteLine("================================================================================"); } break; } case MediaTagType.CD_PMA: { byte[] pma = inputFormat.ReadDiskTag(MediaTagType.CD_PMA); if (pma == null) { DicConsole.WriteLine("Error reading CD PMA from disc image"); } else { DicConsole.WriteLine("CD PMA:"); DicConsole .WriteLine("================================================================================"); DicConsole.WriteLine(PMA.Prettify(pma)); DicConsole .WriteLine("================================================================================"); } break; } case MediaTagType.CD_SessionInfo: { byte[] sessioninfo = inputFormat.ReadDiskTag(MediaTagType.CD_SessionInfo); if (sessioninfo == null) { DicConsole.WriteLine("Error reading CD session information from disc image"); } else { DicConsole.WriteLine("CD session information:"); DicConsole .WriteLine("================================================================================"); DicConsole.WriteLine(Session.Prettify(sessioninfo)); DicConsole .WriteLine("================================================================================"); } break; } case MediaTagType.CD_TEXT: { byte[] cdtext = inputFormat.ReadDiskTag(MediaTagType.CD_TEXT); if (cdtext == null) { DicConsole.WriteLine("Error reading CD-TEXT from disc image"); } else { DicConsole.WriteLine("CD-TEXT:"); DicConsole .WriteLine("================================================================================"); DicConsole.WriteLine(CDTextOnLeadIn.Prettify(cdtext)); DicConsole .WriteLine("================================================================================"); } break; } case MediaTagType.CD_TOC: { byte[] toc = inputFormat.ReadDiskTag(MediaTagType.CD_TOC); if (toc == null) { DicConsole.WriteLine("Error reading CD TOC from disc image"); } else { DicConsole.WriteLine("CD TOC:"); DicConsole .WriteLine("================================================================================"); DicConsole.WriteLine(TOC.Prettify(toc)); DicConsole .WriteLine("================================================================================"); } break; } default: DicConsole.WriteLine("Decoder for disk tag type \"{0}\" not yet implemented, sorry.", tag); break; } } } } if (options.SectorTags) { ulong length; if (options.Length.ToLowerInvariant() == "all") { length = inputFormat.Info.Sectors - 1; } else { if (!ulong.TryParse(options.Length, out length)) { DicConsole.WriteLine("Value \"{0}\" is not a valid number for length.", options.Length); DicConsole.WriteLine("Not decoding sectors tags"); return; } } if (inputFormat.Info.ReadableSectorTags.Count == 0) { DicConsole.WriteLine("There are no sector tags in chosen disc image."); } else { foreach (SectorTagType tag in inputFormat.Info.ReadableSectorTags) { switch (tag) { default: DicConsole.WriteLine("Decoder for disk tag type \"{0}\" not yet implemented, sorry.", tag); break; } } } // TODO: Not implemented } Core.Statistics.AddCommand("decode"); }
public pnlImageInfo(string imagePath, IFilter filter, IMediaImage imageFormat) { this.imagePath = imagePath; this.filter = filter; this.imageFormat = imageFormat; XamlReader.Load(this); Stream logo = ResourceHandler .GetResourceStream($"DiscImageChef.Gui.Assets.Logos.Media.{imageFormat.Info.MediaType}.svg"); /* if(logo != null) * { * svgMediaLogo.SvgStream = logo; * svgMediaLogo.Visible = true; * } * else * {*/ logo = ResourceHandler .GetResourceStream($"DiscImageChef.Gui.Assets.Logos.Media.{imageFormat.Info.MediaType}.png"); if (logo != null) { imgMediaLogo.Image = new Bitmap(logo); imgMediaLogo.Visible = true; } //} lblImagePath.Text = $"Path: {imagePath}"; lblFilter.Text = $"Filter: {filter.Name}"; lblImageFormat.Text = $"Image format identified by {imageFormat.Name} ({imageFormat.Id})."; lblImageFormat.Text = !string.IsNullOrWhiteSpace(imageFormat.Info.Version) ? $"Format: {imageFormat.Format} version {imageFormat.Info.Version}" : $"Format: {imageFormat.Format}"; lblImageSize.Text = $"Image without headers is {imageFormat.Info.ImageSize} bytes long"; lblSectors.Text = $"Contains a media of {imageFormat.Info.Sectors} sectors with a maximum sector size of {imageFormat.Info.SectorSize} bytes (if all sectors are of the same size this would be {imageFormat.Info.Sectors * imageFormat.Info.SectorSize} bytes)"; lblMediaType.Text = $"Contains a media of type {imageFormat.Info.MediaType} and XML type {imageFormat.Info.XmlMediaType}"; lblHasPartitions.Text = $"{(imageFormat.Info.HasPartitions ? "Has" : "Doesn't have")} partitions"; lblHasSessions.Text = $"{(imageFormat.Info.HasSessions ? "Has" : "Doesn't have")} sessions"; if (!string.IsNullOrWhiteSpace(imageFormat.Info.Application)) { lblApplication.Visible = true; lblApplication.Text = !string.IsNullOrWhiteSpace(imageFormat.Info.ApplicationVersion) ? $"Was created with {imageFormat.Info.Application} version {imageFormat.Info.ApplicationVersion}" : $"Was created with {imageFormat.Info.Application}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.Creator)) { lblCreator.Visible = true; lblCreator.Text = $"Created by: {imageFormat.Info.Creator}"; } if (imageFormat.Info.CreationTime != DateTime.MinValue) { lblCreationTime.Visible = true; lblCreationTime.Text = $"Created on {imageFormat.Info.CreationTime}"; } if (imageFormat.Info.LastModificationTime != DateTime.MinValue) { lblLastModificationTime.Visible = true; lblLastModificationTime.Text = $"Last modified on {imageFormat.Info.LastModificationTime}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.Comments)) { grpComments.Visible = true; txtComments.Text = imageFormat.Info.Comments; } if (imageFormat.Info.MediaSequence != 0 && imageFormat.Info.LastMediaSequence != 0) { lblMediaSequence.Visible = true; lblMediaSequence.Text = $"Media is number {imageFormat.Info.MediaSequence} on a set of {imageFormat.Info.LastMediaSequence} medias"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaTitle)) { lblMediaTitle.Visible = true; lblMediaTitle.Text = $"Media title: {imageFormat.Info.MediaTitle}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaManufacturer)) { lblMediaManufacturer.Visible = true; lblMediaManufacturer.Text = $"Media manufacturer: {imageFormat.Info.MediaManufacturer}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaModel)) { lblMediaModel.Visible = true; lblMediaModel.Text = $"Media model: {imageFormat.Info.MediaModel}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaSerialNumber)) { lblMediaSerialNumber.Visible = true; lblMediaSerialNumber.Text = $"Media serial number: {imageFormat.Info.MediaSerialNumber}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaBarcode)) { lblMediaBarcode.Visible = true; lblMediaBarcode.Text = $"Media barcode: {imageFormat.Info.MediaBarcode}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaPartNumber)) { lblMediaPartNumber.Visible = true; lblMediaPartNumber.Text = $"Media part number: {imageFormat.Info.MediaPartNumber}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveManufacturer)) { lblDriveManufacturer.Visible = true; lblDriveManufacturer.Text = $"Drive manufacturer: {imageFormat.Info.DriveManufacturer}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveModel)) { lblDriveModel.Visible = true; lblDriveModel.Text = $"Drive model: {imageFormat.Info.DriveModel}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveSerialNumber)) { lblDriveSerialNumber.Visible = true; lblDriveSerialNumber.Text = $"Drive serial number: {imageFormat.Info.DriveSerialNumber}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveFirmwareRevision)) { lblDriveFirmwareRevision.Visible = true; lblDriveFirmwareRevision.Text = $"Drive firmware info: {imageFormat.Info.DriveFirmwareRevision}"; } if (imageFormat.Info.Cylinders > 0 && imageFormat.Info.Heads > 0 && imageFormat.Info.SectorsPerTrack > 0 && imageFormat.Info.XmlMediaType != XmlMediaType.OpticalDisc && (!(imageFormat is ITapeImage tapeImage) || !tapeImage.IsTape)) { lblMediaGeometry.Visible = true; lblMediaGeometry.Text = $"Media geometry: {imageFormat.Info.Cylinders} cylinders, {imageFormat.Info.Heads} heads, {imageFormat.Info.SectorsPerTrack} sectors per track"; } grpMediaInfo.Visible = lblMediaSequence.Visible || lblMediaTitle.Visible || lblMediaManufacturer.Visible || lblMediaModel.Visible || lblMediaSerialNumber.Visible || lblMediaBarcode.Visible || lblMediaPartNumber.Visible; grpDriveInfo.Visible = lblDriveManufacturer.Visible || lblDriveModel.Visible || lblDriveSerialNumber.Visible || lblDriveFirmwareRevision.Visible || lblMediaGeometry.Visible; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Count > 0) { TreeGridItemCollection mediaTagList = new TreeGridItemCollection(); treeMediaTags.Columns.Add(new GridColumn { HeaderText = "Tag", DataCell = new TextBoxCell(0) }); treeMediaTags.AllowMultipleSelection = false; treeMediaTags.ShowHeader = false; treeMediaTags.DataStore = mediaTagList; foreach (MediaTagType tag in imageFormat.Info.ReadableMediaTags.OrderBy(t => t)) { mediaTagList.Add(new TreeGridItem { Values = new object[] { tag.ToString() } }); } grpMediaTags.Visible = true; } if (imageFormat.Info.ReadableSectorTags != null && imageFormat.Info.ReadableSectorTags.Count > 0) { TreeGridItemCollection sectorTagList = new TreeGridItemCollection(); treeSectorTags.Columns.Add(new GridColumn { HeaderText = "Tag", DataCell = new TextBoxCell(0) }); treeSectorTags.AllowMultipleSelection = false; treeSectorTags.ShowHeader = false; treeSectorTags.DataStore = sectorTagList; foreach (SectorTagType tag in imageFormat.Info.ReadableSectorTags.OrderBy(t => t)) { sectorTagList.Add(new TreeGridItem { Values = new object[] { tag.ToString() } }); } grpSectorTags.Visible = true; } PeripheralDeviceTypes scsiDeviceType = PeripheralDeviceTypes.DirectAccess; byte[] scsiInquiryData = null; Inquiry.SCSIInquiry?scsiInquiry = null; Modes.DecodedMode? scsiMode = null; byte[] scsiModeSense6 = null; byte[] scsiModeSense10 = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_INQUIRY)) { scsiInquiryData = imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY); scsiDeviceType = (PeripheralDeviceTypes)(scsiInquiryData[0] & 0x1F); scsiInquiry = Inquiry.Decode(scsiInquiryData); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_6)) { scsiModeSense6 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_6); scsiMode = Modes.DecodeMode6(scsiModeSense6, scsiDeviceType); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_10)) { scsiModeSense10 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_10); scsiMode = Modes.DecodeMode10(scsiModeSense10, scsiDeviceType); } tabScsiInfo tabScsiInfo = new tabScsiInfo(); tabScsiInfo.LoadData(scsiInquiryData, scsiInquiry, null, scsiMode, scsiDeviceType, scsiModeSense6, scsiModeSense10, null); tabInfos.Pages.Add(tabScsiInfo); byte[] ataIdentify = null; byte[] atapiIdentify = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) { ataIdentify = imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATAPI_IDENTIFY)) { atapiIdentify = imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); } tabAtaInfo tabAtaInfo = new tabAtaInfo(); tabAtaInfo.LoadData(ataIdentify, atapiIdentify, null); tabInfos.Pages.Add(tabAtaInfo); byte[] toc = null; TOC.CDTOC? decodedToc = null; byte[] fullToc = null; FullTOC.CDFullTOC? decodedFullToc = null; byte[] pma = null; byte[] atip = null; ATIP.CDATIP? decodedAtip = null; byte[] cdtext = null; CDTextOnLeadIn.CDText?decodedCdText = null; string mediaCatalogueNumber = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TOC)) { toc = imageFormat.ReadDiskTag(MediaTagType.CD_TOC); if (toc.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(toc, 0)); if (dataLen + 2 != toc.Length) { byte[] tmp = new byte[toc.Length + 2]; Array.Copy(toc, 0, tmp, 2, toc.Length); tmp[0] = (byte)((toc.Length & 0xFF00) >> 8); tmp[1] = (byte)(toc.Length & 0xFF); toc = tmp; } decodedToc = TOC.Decode(toc); } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_FullTOC)) { fullToc = imageFormat.ReadDiskTag(MediaTagType.CD_FullTOC); if (fullToc.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(fullToc, 0)); if (dataLen + 2 != fullToc.Length) { byte[] tmp = new byte[fullToc.Length + 2]; Array.Copy(fullToc, 0, tmp, 2, fullToc.Length); tmp[0] = (byte)((fullToc.Length & 0xFF00) >> 8); tmp[1] = (byte)(fullToc.Length & 0xFF); fullToc = tmp; } decodedFullToc = FullTOC.Decode(fullToc); } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_PMA)) { pma = imageFormat.ReadDiskTag(MediaTagType.CD_PMA); if (pma.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(pma, 0)); if (dataLen + 2 != pma.Length) { byte[] tmp = new byte[pma.Length + 2]; Array.Copy(pma, 0, tmp, 2, pma.Length); tmp[0] = (byte)((pma.Length & 0xFF00) >> 8); tmp[1] = (byte)(pma.Length & 0xFF); pma = tmp; } } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_ATIP)) { atip = imageFormat.ReadDiskTag(MediaTagType.CD_ATIP); uint dataLen = Swapping.Swap(BitConverter.ToUInt32(atip, 0)); if (dataLen + 4 != atip.Length) { byte[] tmp = new byte[atip.Length + 4]; Array.Copy(atip, 0, tmp, 4, atip.Length); tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24); tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16); tmp[2] = (byte)((atip.Length & 0xFF00) >> 8); tmp[3] = (byte)(atip.Length & 0xFF); atip = tmp; } decodedAtip = ATIP.Decode(atip); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TEXT)) { cdtext = imageFormat.ReadDiskTag(MediaTagType.CD_TEXT); uint dataLen = Swapping.Swap(BitConverter.ToUInt32(cdtext, 0)); if (dataLen + 4 != cdtext.Length) { byte[] tmp = new byte[cdtext.Length + 4]; Array.Copy(cdtext, 0, tmp, 4, cdtext.Length); tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24); tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16); tmp[2] = (byte)((cdtext.Length & 0xFF00) >> 8); tmp[3] = (byte)(cdtext.Length & 0xFF); cdtext = tmp; } decodedCdText = CDTextOnLeadIn.Decode(cdtext); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_MCN)) { byte[] mcn = imageFormat.ReadDiskTag(MediaTagType.CD_MCN); mediaCatalogueNumber = Encoding.UTF8.GetString(mcn); } tabCompactDiscInfo tabCompactDiscInfo = new tabCompactDiscInfo(); tabCompactDiscInfo.LoadData(toc, atip, null, null, fullToc, pma, cdtext, decodedToc, decodedAtip, null, decodedFullToc, decodedCdText, null, mediaCatalogueNumber, null); tabInfos.Pages.Add(tabCompactDiscInfo); byte[] dvdPfi = null; byte[] dvdDmi = null; byte[] dvdCmi = null; byte[] hddvdCopyrightInformation = null; byte[] dvdBca = null; PFI.PhysicalFormatInformation?decodedPfi = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_PFI)) { dvdPfi = imageFormat.ReadDiskTag(MediaTagType.DVD_PFI); decodedPfi = PFI.Decode(dvdPfi); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_DMI)) { dvdDmi = imageFormat.ReadDiskTag(MediaTagType.DVD_DMI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_CMI)) { dvdCmi = imageFormat.ReadDiskTag(MediaTagType.DVD_CMI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.HDDVD_CPI)) { hddvdCopyrightInformation = imageFormat.ReadDiskTag(MediaTagType.HDDVD_CPI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_BCA)) { dvdBca = imageFormat.ReadDiskTag(MediaTagType.DVD_BCA); } tabDvdInfo tabDvdInfo = new tabDvdInfo(); tabDvdInfo.LoadData(imageFormat.Info.MediaType, dvdPfi, dvdDmi, dvdCmi, hddvdCopyrightInformation, dvdBca, null, decodedPfi); tabInfos.Pages.Add(tabDvdInfo); byte[] dvdRamDds = null; byte[] dvdRamCartridgeStatus = null; byte[] dvdRamSpareArea = null; byte[] lastBorderOutRmd = null; byte[] dvdPreRecordedInfo = null; byte[] dvdrMediaIdentifier = null; byte[] dvdrPhysicalInformation = null; byte[] hddvdrMediumStatus = null; byte[] dvdrLayerCapacity = null; byte[] dvdrDlMiddleZoneStart = null; byte[] dvdrDlJumpIntervalSize = null; byte[] dvdrDlManualLayerJumpStartLba = null; byte[] dvdPlusAdip = null; byte[] dvdPlusDcb = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_DDS)) { dvdRamDds = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_DDS); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_MediumStatus)) { dvdRamCartridgeStatus = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_MediumStatus); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_SpareArea)) { dvdRamSpareArea = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_SpareArea); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_RMD)) { lastBorderOutRmd = imageFormat.ReadDiskTag(MediaTagType.DVDR_RMD); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_PreRecordedInfo)) { dvdPreRecordedInfo = imageFormat.ReadDiskTag(MediaTagType.DVDR_PreRecordedInfo); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_MediaIdentifier)) { dvdrMediaIdentifier = imageFormat.ReadDiskTag(MediaTagType.DVDR_MediaIdentifier); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_PFI)) { dvdrPhysicalInformation = imageFormat.ReadDiskTag(MediaTagType.DVDR_PFI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.HDDVD_MediumStatus)) { hddvdrMediumStatus = imageFormat.ReadDiskTag(MediaTagType.HDDVD_MediumStatus); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_LayerCapacity)) { dvdrLayerCapacity = imageFormat.ReadDiskTag(MediaTagType.DVDDL_LayerCapacity); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_MiddleZoneAddress)) { dvdrDlMiddleZoneStart = imageFormat.ReadDiskTag(MediaTagType.DVDDL_MiddleZoneAddress); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_JumpIntervalSize)) { dvdrDlJumpIntervalSize = imageFormat.ReadDiskTag(MediaTagType.DVDDL_JumpIntervalSize); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_ManualLayerJumpLBA)) { dvdrDlManualLayerJumpStartLba = imageFormat.ReadDiskTag(MediaTagType.DVDDL_ManualLayerJumpLBA); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_ADIP)) { dvdPlusAdip = imageFormat.ReadDiskTag(MediaTagType.DVD_ADIP); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DCB)) { dvdPlusDcb = imageFormat.ReadDiskTag(MediaTagType.DCB); } tabDvdWritableInfo tabDvdWritableInfo = new tabDvdWritableInfo(); tabDvdWritableInfo.LoadData(imageFormat.Info.MediaType, dvdRamDds, dvdRamCartridgeStatus, dvdRamSpareArea, lastBorderOutRmd, dvdPreRecordedInfo, dvdrMediaIdentifier, dvdrPhysicalInformation, hddvdrMediumStatus, null, dvdrLayerCapacity, dvdrDlMiddleZoneStart, dvdrDlJumpIntervalSize, dvdrDlManualLayerJumpStartLba, null, dvdPlusAdip, dvdPlusDcb); tabInfos.Pages.Add(tabDvdWritableInfo); byte[] blurayBurstCuttingArea = null; byte[] blurayCartridgeStatus = null; byte[] blurayDds = null; byte[] blurayDiscInformation = null; byte[] blurayPowResources = null; byte[] bluraySpareAreaInformation = null; byte[] blurayTrackResources = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_BCA)) { blurayBurstCuttingArea = imageFormat.ReadDiskTag(MediaTagType.BD_BCA); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_CartridgeStatus)) { blurayCartridgeStatus = imageFormat.ReadDiskTag(MediaTagType.BD_CartridgeStatus); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DDS)) { blurayDds = imageFormat.ReadDiskTag(MediaTagType.BD_DDS); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DI)) { blurayDiscInformation = imageFormat.ReadDiskTag(MediaTagType.BD_DI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_POWResourcesInformation)) { blurayPowResources = imageFormat.ReadDiskTag(MediaTagType.MMC_POWResourcesInformation); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_SpareArea)) { bluraySpareAreaInformation = imageFormat.ReadDiskTag(MediaTagType.BD_SpareArea); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_TrackResourcesInformation)) { bluraySpareAreaInformation = imageFormat.ReadDiskTag(MediaTagType.MMC_TrackResourcesInformation); } tabBlurayInfo tabBlurayInfo = new tabBlurayInfo(); tabBlurayInfo.LoadData(blurayDiscInformation, blurayBurstCuttingArea, blurayDds, blurayCartridgeStatus, bluraySpareAreaInformation, blurayPowResources, blurayTrackResources, null, null); tabInfos.Pages.Add(tabBlurayInfo); byte[] xboxDmi = null; byte[] xboxSecuritySector = null; SS.SecuritySector?decodedXboxSecuritySector = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_DMI)) { xboxDmi = imageFormat.ReadDiskTag(MediaTagType.Xbox_DMI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_SecuritySector)) { xboxSecuritySector = imageFormat.ReadDiskTag(MediaTagType.Xbox_SecuritySector); decodedXboxSecuritySector = SS.Decode(xboxSecuritySector); } tabXboxInfo tabXboxInfo = new tabXboxInfo(); tabXboxInfo.LoadData(null, xboxDmi, xboxSecuritySector, decodedXboxSecuritySector); tabInfos.Pages.Add(tabXboxInfo); byte[] pcmciaCis = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.PCMCIA_CIS)) { pcmciaCis = imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS); } tabPcmciaInfo tabPcmciaInfo = new tabPcmciaInfo(); tabPcmciaInfo.LoadData(pcmciaCis); tabInfos.Pages.Add(tabPcmciaInfo); DeviceType deviceType = DeviceType.Unknown; byte[] cid = null; byte[] csd = null; byte[] ocr = null; byte[] extendedCsd = null; byte[] scr = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CID)) { cid = imageFormat.ReadDiskTag(MediaTagType.SD_CID); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CSD)) { csd = imageFormat.ReadDiskTag(MediaTagType.SD_CSD); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_OCR)) { ocr = imageFormat.ReadDiskTag(MediaTagType.SD_OCR); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_SCR)) { scr = imageFormat.ReadDiskTag(MediaTagType.SD_SCR); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CID)) { cid = imageFormat.ReadDiskTag(MediaTagType.MMC_CID); deviceType = DeviceType.MMC; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CSD)) { csd = imageFormat.ReadDiskTag(MediaTagType.MMC_CSD); deviceType = DeviceType.MMC; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_OCR)) { ocr = imageFormat.ReadDiskTag(MediaTagType.MMC_OCR); deviceType = DeviceType.MMC; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_ExtendedCSD)) { extendedCsd = imageFormat.ReadDiskTag(MediaTagType.MMC_ExtendedCSD); deviceType = DeviceType.MMC; } tabSdMmcInfo tabSdMmcInfo = new tabSdMmcInfo(); tabSdMmcInfo.LoadData(deviceType, cid, csd, ocr, extendedCsd, scr); tabInfos.Pages.Add(tabSdMmcInfo); if (imageFormat is IOpticalMediaImage opticalMediaImage) { try { if (opticalMediaImage.Sessions != null && opticalMediaImage.Sessions.Count > 0) { TreeGridItemCollection sessionList = new TreeGridItemCollection(); treeSessions.Columns.Add(new GridColumn { HeaderText = "Session", DataCell = new TextBoxCell(0) }); treeSessions.Columns.Add(new GridColumn { HeaderText = "First track", DataCell = new TextBoxCell(1) }); treeSessions.Columns.Add(new GridColumn { HeaderText = "Last track", DataCell = new TextBoxCell(2) }); treeSessions.Columns.Add(new GridColumn { HeaderText = "Start", DataCell = new TextBoxCell(3) }); treeSessions.Columns.Add(new GridColumn { HeaderText = "End", DataCell = new TextBoxCell(4) }); treeSessions.AllowMultipleSelection = false; treeSessions.ShowHeader = true; treeSessions.DataStore = sessionList; foreach (Session session in opticalMediaImage.Sessions) { sessionList.Add(new TreeGridItem { Values = new object[] { session.SessionSequence, session.StartTrack, session.EndTrack, session.StartSector, session.EndSector } }); } tabSessions.Visible = true; } } catch { // ignored } try { if (opticalMediaImage.Tracks != null && opticalMediaImage.Tracks.Count > 0) { TreeGridItemCollection tracksList = new TreeGridItemCollection(); treeTracks.Columns.Add(new GridColumn { HeaderText = "Track", DataCell = new TextBoxCell(0) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Type", DataCell = new TextBoxCell(1) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Bps", DataCell = new TextBoxCell(2) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Raw bps", DataCell = new TextBoxCell(3) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Subchannel", DataCell = new TextBoxCell(4) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Pregap", DataCell = new TextBoxCell(5) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Start", DataCell = new TextBoxCell(6) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "End", DataCell = new TextBoxCell(7) }); treeTracks.AllowMultipleSelection = false; treeTracks.ShowHeader = true; treeTracks.DataStore = tracksList; foreach (Track track in opticalMediaImage.Tracks) { tracksList.Add(new TreeGridItem { Values = new object[] { track.TrackSequence, track.TrackType, track.TrackBytesPerSector, track.TrackRawBytesPerSector, track.TrackSubchannelType, track.TrackPregap, track.TrackStartSector, track.TrackEndSector } }); } tabTracks.Visible = true; } } catch { // ignored } } if (imageFormat.DumpHardware == null) { return; } TreeGridItemCollection dumpHardwareList = new TreeGridItemCollection(); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Manufacturer", DataCell = new TextBoxCell(0) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Model", DataCell = new TextBoxCell(1) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Serial", DataCell = new TextBoxCell(2) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Software", DataCell = new TextBoxCell(3) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Version", DataCell = new TextBoxCell(4) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Operating system", DataCell = new TextBoxCell(5) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Start", DataCell = new TextBoxCell(6) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "End", DataCell = new TextBoxCell(7) }); treeDumpHardware.AllowMultipleSelection = false; treeDumpHardware.ShowHeader = true; treeDumpHardware.DataStore = dumpHardwareList; foreach (DumpHardwareType dump in imageFormat.DumpHardware) { foreach (ExtentType extent in dump.Extents) { dumpHardwareList.Add(new TreeGridItem { Values = new object[] { dump.Manufacturer, dump.Model, dump.Serial, dump.Software.Name, dump.Software.Version, dump.Software.OperatingSystem, extent.Start, extent.End } }); } } tabDumpHardware.Visible = true; }
/// <summary> /// GenerateTOC /// </summary> public override void GenerateTOC(string stylesSourceFile, bool addDefaultStyles) { TOC.Generate(); Style.CreateTOCStyles(stylesSourceFile, addDefaultStyles); }
public static byte[] CalculateHeaders(List <LGPEntry> files, Func <string, int> headerSortKey, Func <string, uint> dataSortKey, out List <LGPEntryMade> entries) { files = files.OrderBy(e => e.HashCode).ThenBy(e => headerSortKey(e.Name)).ToList(); byte[] hash = new byte[LGPEntry.HashValues * LGPEntry.HashValues * 4]; TOC[] toc = new TOC[files.Count]; var hfiles = files.GroupBy(e => e.HashCode).OrderBy(g => g.Key); List <List <PathEntry> > paths = new List <List <PathEntry> >(); entries = new List <LGPEntryMade>(); int count = 0; //int position = 0; foreach (var group in hfiles) { Bytes.WriteUShort(hash, 4 * group.Key, (ushort)(count + 1)); Bytes.WriteUShort(hash, 4 * group.Key + 2, (ushort)(group.Count())); foreach (var name in group.OfType <LGPEntry>().GroupBy(e => e.TOCName).OrderBy(g => headerSortKey(g.Key))) { bool hasPaths = name.Count() > 1; if (hasPaths) { paths.Add(new List <PathEntry>()); } foreach (var file in name) { toc[count] = new TOC(file.TOCName); toc[count].Type = 14; toc[count].Path = (ushort)(hasPaths ? paths.Count : 0); toc[count].Source = file; //toc[count].Offset = position; //just use file sizes so far, we'll calculate the additional offset due to header later - once the file paths are done //position += 24 + file.MaxSize; if (hasPaths) { paths.Last().Add(new PathEntry() { Index = (ushort)count, Path = file.Path }); } entries.Add(new LGPEntryMade() { Entry = file, TOCIndex = count }); count++; } } } int headerSize = 16 //initial header + (27 * toc.Length) //toc + hash.Length //hashtable + 2 //path count + paths.Select(L => 2 + L.Count * 130).Sum() //path entries - 2 byte count for each list, followed by 130 bytes per entry ; int position = 0; count = 0; foreach (var em in entries.OrderBy(em => dataSortKey(em.Entry.Name)).ThenBy(em => em.Entry.Name)) { em.DataOffset = toc[em.TOCIndex].Offset = position + headerSize; em.DataIndex = count; position += 24 + em.Entry.MaxSize; count++; } byte[] header = new byte[headerSize]; //Initial header Array.Copy(System.Text.Encoding.ASCII.GetBytes("SQUARESOFT"), 0, header, 2, 10); Bytes.WriteInt(header, 12, toc.Length); //Now write TOC int offset = 16; foreach (var entry in toc) { Array.Copy(entry.Name, 0, header, offset, entry.Name.Length); offset += 20; Bytes.WriteInt(header, offset, entry.Offset); offset += 4; header[offset] = entry.Type; offset++; Bytes.WriteUShort(header, offset, entry.Path); offset += 2; } //Now hash table Array.Copy(hash, 0, header, offset, hash.Length); offset += hash.Length; //Now path array... Bytes.WriteUShort(header, offset, (ushort)(paths.Count)); offset += 2; foreach (var pathlist in paths) { Bytes.WriteUShort(header, offset, (ushort)(pathlist.Count)); offset += 2; foreach (var path in pathlist) { byte[] p = System.Text.Encoding.ASCII.GetBytes(path.Path); Array.Copy(p, 0, header, offset, p.Length); offset += 128; Bytes.WriteUShort(header, offset, path.Index); offset += 2; } } return(header); }
internal void LoadData(byte[] toc, byte[] atip, byte[] compactDiscInformation, byte[] session, byte[] rawToc, byte[] pma, byte[] cdTextLeadIn, TOC.CDTOC?decodedToc, ATIP.CDATIP?decodedAtip, Session.CDSessionInfo?decodedSession, FullTOC.CDFullTOC?fullToc, CDTextOnLeadIn.CDText?decodedCdTextLeadIn, DiscInformation.StandardDiscInformation?decodedCompactDiscInformation, string mcn, Dictionary <byte, string> isrcs) { tocData = toc; atipData = atip; compactDiscInformationData = compactDiscInformation; sessionData = session; rawTocData = rawToc; pmaData = pma; cdTextLeadInData = cdTextLeadIn; if (decodedCompactDiscInformation.HasValue) { tabCdInformation.Visible = true; txtCdInformation.Text = DiscInformation.Prettify000b(decodedCompactDiscInformation); btnCdInformation.Visible = compactDiscInformation != null; } if (decodedToc.HasValue) { tabCdToc.Visible = true; txtCdToc.Text = TOC.Prettify(decodedToc); btnCdToc.Visible = toc != null; } if (fullToc.HasValue) { tabCdFullToc.Visible = true; txtCdFullToc.Text = FullTOC.Prettify(fullToc); btnCdFullToc.Visible = rawToc != null; } if (decodedSession.HasValue) { tabCdSession.Visible = true; txtCdSession.Text = Session.Prettify(decodedSession); btnCdSession.Visible = session != null; } if (decodedCdTextLeadIn.HasValue) { tabCdText.Visible = true; txtCdText.Text = CDTextOnLeadIn.Prettify(decodedCdTextLeadIn); btnCdText.Visible = cdTextLeadIn != null; } if (decodedAtip.HasValue) { tabCdAtip.Visible = true; txtCdAtip.Text = ATIP.Prettify(atip); btnCdAtip.Visible = atip != null; } if (!string.IsNullOrEmpty(mcn)) { stkMcn.Visible = true; txtMcn.Text = mcn; } if (isrcs != null && isrcs.Count > 0) { grpIsrcs.Visible = true; TreeGridItemCollection isrcsItems = new TreeGridItemCollection(); grdIsrcs.Columns.Add(new GridColumn { HeaderText = "ISRC", DataCell = new TextBoxCell(0) }); grdIsrcs.Columns.Add(new GridColumn { HeaderText = "Track", DataCell = new TextBoxCell(0) }); grdIsrcs.AllowMultipleSelection = false; grdIsrcs.ShowHeader = true; grdIsrcs.DataStore = isrcsItems; foreach (KeyValuePair <byte, string> isrc in isrcs) { isrcsItems.Add(new TreeGridItem { Values = new object[] { isrc.Key.ToString(), isrc.Value } }); } } btnCdPma.Visible = pma != null; tabCdMisc.Visible = stkMcn.Visible || grpIsrcs.Visible || btnCdPma.Visible; Visible = tabCdInformation.Visible || tabCdToc.Visible || tabCdFullToc.Visible || tabCdSession.Visible || tabCdText.Visible || tabCdAtip.Visible || stkMcn.Visible || grpIsrcs.Visible || btnCdPma.Visible; }
static void DoScsiMediaInfo(bool debug, bool verbose, string outputPrefix, Devices.Device dev) { var scsiInfo = new ScsiInfo(dev); if (!scsiInfo.MediaInserted) { return; } if (scsiInfo.DeviceInfo.ScsiModeSense6 != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_scsi_modesense6.bin", "SCSI MODE SENSE (6)", scsiInfo.DeviceInfo.ScsiModeSense6); } if (scsiInfo.DeviceInfo.ScsiModeSense10 != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_scsi_modesense10.bin", "SCSI MODE SENSE (10)", scsiInfo.DeviceInfo.ScsiModeSense10); } switch (dev.ScsiType) { case PeripheralDeviceTypes.DirectAccess: case PeripheralDeviceTypes.MultiMediaDevice: case PeripheralDeviceTypes.OCRWDevice: case PeripheralDeviceTypes.OpticalDevice: case PeripheralDeviceTypes.SimplifiedDevice: case PeripheralDeviceTypes.WriteOnceDevice: if (scsiInfo.ReadCapacity != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity.bin", "SCSI READ CAPACITY", scsiInfo.ReadCapacity); } if (scsiInfo.ReadCapacity16 != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity16.bin", "SCSI READ CAPACITY(16)", scsiInfo.ReadCapacity16); } if (scsiInfo.Blocks != 0 && scsiInfo.BlockSize != 0) { AaruConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", scsiInfo.Blocks, scsiInfo.BlockSize, scsiInfo.Blocks * scsiInfo.BlockSize); } break; case PeripheralDeviceTypes.SequentialAccess: if (scsiInfo.DensitySupport != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIA)", scsiInfo.DensitySupport); if (scsiInfo.DensitySupportHeader.HasValue) { AaruConsole.WriteLine("Densities supported by currently inserted media:"); AaruConsole.WriteLine(DensitySupport.PrettifyDensity(scsiInfo.DensitySupportHeader)); } } if (scsiInfo.MediaTypeSupport != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_medium_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", scsiInfo.MediaTypeSupport); if (scsiInfo.MediaTypeSupportHeader.HasValue) { AaruConsole.WriteLine("Medium types currently inserted in device:"); AaruConsole.WriteLine(DensitySupport.PrettifyMediumType(scsiInfo.MediaTypeSupportHeader)); } AaruConsole.WriteLine(DensitySupport.PrettifyMediumType(scsiInfo.MediaTypeSupport)); } break; } if (dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice) { if (scsiInfo.MmcConfiguration != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_getconfiguration_current.bin", "SCSI GET CONFIGURATION", scsiInfo.MmcConfiguration); } if (scsiInfo.RecognizedFormatLayers != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_formatlayers.bin", "SCSI READ DISC STRUCTURE", scsiInfo.RecognizedFormatLayers); } if (scsiInfo.WriteProtectionStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_writeprotection.bin", "SCSI READ DISC STRUCTURE", scsiInfo.WriteProtectionStatus); } if (scsiInfo.DvdPfi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pfi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPfi); if (scsiInfo.DecodedPfi.HasValue) { AaruConsole.WriteLine("PFI:\n{0}", PFI.Prettify(scsiInfo.DecodedPfi)); } } if (scsiInfo.DvdDmi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_dmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdDmi); if (DMI.IsXbox(scsiInfo.DvdDmi)) { AaruConsole.WriteLine("Xbox DMI:\n{0}", DMI.PrettifyXbox(scsiInfo.DvdDmi)); } else if (DMI.IsXbox360(scsiInfo.DvdDmi)) { AaruConsole.WriteLine("Xbox 360 DMI:\n{0}", DMI.PrettifyXbox360(scsiInfo.DvdDmi)); } } if (scsiInfo.DvdCmi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_cmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdCmi); AaruConsole.WriteLine("Lead-In CMI:\n{0}", CSS_CPRM.PrettifyLeadInCopyright(scsiInfo.DvdCmi)); } if (scsiInfo.DvdBca != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_bca.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdBca); } if (scsiInfo.DvdAacs != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_aacs.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdAacs); } if (scsiInfo.DvdRamDds != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_dds.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamDds); AaruConsole.WriteLine("Disc Definition Structure:\n{0}", DDS.Prettify(scsiInfo.DvdRamDds)); } if (scsiInfo.DvdRamCartridgeStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_status.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamCartridgeStatus); AaruConsole.WriteLine("Medium Status:\n{0}", Cartridge.Prettify(scsiInfo.DvdRamCartridgeStatus)); } if (scsiInfo.DvdRamSpareArea != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_spare.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamSpareArea); AaruConsole.WriteLine("Spare Area Information:\n{0}", Spare.Prettify(scsiInfo.DvdRamSpareArea)); } if (scsiInfo.LastBorderOutRmd != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", "SCSI READ DISC STRUCTURE", scsiInfo.LastBorderOutRmd); } if (scsiInfo.DvdPreRecordedInfo != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pri.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPreRecordedInfo); } if (scsiInfo.DvdrMediaIdentifier != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_mediaid.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrMediaIdentifier); } if (scsiInfo.DvdrPhysicalInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_pfi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrPhysicalInformation); } if (scsiInfo.DvdPlusAdip != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_adip.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusAdip); } if (scsiInfo.DvdPlusDcb != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_dcb.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusDcb); } if (scsiInfo.HddvdCopyrightInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvd_cmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdCopyrightInformation); } if (scsiInfo.HddvdrMediumStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_status.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrMediumStatus); } if (scsiInfo.HddvdrLastRmd != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrLastRmd); } if (scsiInfo.DvdrLayerCapacity != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_layercap.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrLayerCapacity); } if (scsiInfo.DvdrDlMiddleZoneStart != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_mzs.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlMiddleZoneStart); } if (scsiInfo.DvdrDlJumpIntervalSize != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_jis.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlJumpIntervalSize); } if (scsiInfo.DvdrDlManualLayerJumpStartLba != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_manuallj.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlManualLayerJumpStartLba); } if (scsiInfo.DvdrDlRemapAnchorPoint != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlRemapAnchorPoint); } if (scsiInfo.BlurayDiscInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_di.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDiscInformation); AaruConsole.WriteLine("Blu-ray Disc Information:\n{0}", DI.Prettify(scsiInfo.BlurayDiscInformation)); } if (scsiInfo.BlurayPac != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_pac.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayPac); } if (scsiInfo.BlurayBurstCuttingArea != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_bca.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayBurstCuttingArea); AaruConsole.WriteLine("Blu-ray Burst Cutting Area:\n{0}", BCA.Prettify(scsiInfo.BlurayBurstCuttingArea)); } if (scsiInfo.BlurayDds != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dds.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDds); AaruConsole.WriteLine("Blu-ray Disc Definition Structure:\n{0}", Decoders.Bluray.DDS.Prettify(scsiInfo.BlurayDds)); } if (scsiInfo.BlurayCartridgeStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_cartstatus.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayCartridgeStatus); AaruConsole.WriteLine("Blu-ray Cartridge Status:\n{0}", Decoders.Bluray.Cartridge.Prettify(scsiInfo.BlurayCartridgeStatus)); } if (scsiInfo.BluraySpareAreaInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_spare.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BluraySpareAreaInformation); AaruConsole.WriteLine("Blu-ray Spare Area Information:\n{0}", Decoders.Bluray.Spare.Prettify(scsiInfo.BluraySpareAreaInformation)); } if (scsiInfo.BlurayRawDfl != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dfl.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayRawDfl); } if (scsiInfo.BlurayTrackResources != null) { AaruConsole.WriteLine("Track Resources Information:\n{0}", DiscInformation.Prettify(scsiInfo.BlurayTrackResources)); DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_001b.bin", "SCSI READ DISC INFORMATION", scsiInfo.BlurayTrackResources); } if (scsiInfo.BlurayPowResources != null) { AaruConsole.WriteLine("POW Resources Information:\n{0}", DiscInformation.Prettify(scsiInfo.BlurayPowResources)); DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_010b.bin", "SCSI READ DISC INFORMATION", scsiInfo.BlurayPowResources); } if (scsiInfo.Toc != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_toc.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Toc); if (scsiInfo.DecodedToc.HasValue) { AaruConsole.WriteLine("TOC:\n{0}", TOC.Prettify(scsiInfo.DecodedToc)); } } if (scsiInfo.Atip != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Atip); if (scsiInfo.DecodedAtip.HasValue) { AaruConsole.WriteLine("ATIP:\n{0}", ATIP.Prettify(scsiInfo.DecodedAtip)); } } if (scsiInfo.CompactDiscInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_000b.bin", "SCSI READ DISC INFORMATION", scsiInfo.CompactDiscInformation); if (scsiInfo.DecodedCompactDiscInformation.HasValue) { AaruConsole.WriteLine("Standard Disc Information:\n{0}", DiscInformation.Prettify000b(scsiInfo.DecodedCompactDiscInformation)); } } if (scsiInfo.Session != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_session.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Session); if (scsiInfo.DecodedSession.HasValue) { AaruConsole.WriteLine("Session information:\n{0}", Session.Prettify(scsiInfo.DecodedSession)); } } if (scsiInfo.RawToc != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_rawtoc.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.RawToc); if (scsiInfo.FullToc.HasValue) { AaruConsole.WriteLine("Raw TOC:\n{0}", FullTOC.Prettify(scsiInfo.RawToc)); } } if (scsiInfo.Pma != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_pma.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Pma); AaruConsole.WriteLine("PMA:\n{0}", PMA.Prettify(scsiInfo.Pma)); } if (scsiInfo.CdTextLeadIn != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.CdTextLeadIn); if (scsiInfo.DecodedCdTextLeadIn.HasValue) { AaruConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", CDTextOnLeadIn.Prettify(scsiInfo.DecodedCdTextLeadIn)); } } if (!string.IsNullOrEmpty(scsiInfo.Mcn)) { AaruConsole.WriteLine("MCN: {0}", scsiInfo.Mcn); } if (scsiInfo.Isrcs != null) { foreach (KeyValuePair <byte, string> isrc in scsiInfo.Isrcs) { AaruConsole.WriteLine("Track's {0} ISRC: {1}", isrc.Key, isrc.Value); } } if (scsiInfo.XboxSecuritySector != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_xbox_ss.bin", "KREON EXTRACT SS", scsiInfo.XboxSecuritySector); } if (scsiInfo.DecodedXboxSecuritySector.HasValue) { AaruConsole.WriteLine("Xbox Security Sector:\n{0}", SS.Prettify(scsiInfo.DecodedXboxSecuritySector)); } if (scsiInfo.XgdInfo != null) { AaruConsole.WriteLine("Video layer 0 size: {0} sectors", scsiInfo.XgdInfo.L0Video); AaruConsole.WriteLine("Video layer 1 size: {0} sectors", scsiInfo.XgdInfo.L1Video); AaruConsole.WriteLine("Middle zone size: {0} sectors", scsiInfo.XgdInfo.MiddleZone); AaruConsole.WriteLine("Game data size: {0} sectors", scsiInfo.XgdInfo.GameSize); AaruConsole.WriteLine("Total size: {0} sectors", scsiInfo.XgdInfo.TotalSize); AaruConsole.WriteLine("Real layer break: {0}", scsiInfo.XgdInfo.LayerBreak); AaruConsole.WriteLine(); } } if (scsiInfo.MediaSerialNumber != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_mediaserialnumber.bin", "SCSI READ MEDIA SERIAL NUMBER", scsiInfo.MediaSerialNumber); AaruConsole.Write("Media Serial Number: "); for (int i = 4; i < scsiInfo.MediaSerialNumber.Length; i++) { AaruConsole.Write("{0:X2}", scsiInfo.MediaSerialNumber[i]); } AaruConsole.WriteLine(); } AaruConsole.WriteLine("Media identified as {0}", scsiInfo.MediaType); Statistics.AddMedia(scsiInfo.MediaType, true); if (scsiInfo.Toc != null || scsiInfo.RawToc != null) { uint blockSize = 2352; Track[] tracks = Dump.GetCdTracks(ref blockSize, dev, scsiInfo.MediaType, null, false, out long lastSector, null, null, null, TrackSubchannelType.None, out _, null, null); if (tracks != null) { bool supportsPqSubchannel = Dump.SupportsPqSubchannel(dev, null, null); bool supportsRwSubchannel = Dump.SupportsRwSubchannel(dev, null, null); // Open master database var ctx = AaruContext.Create(Settings.Settings.MasterDbPath); // Search for device in master database Database.Models.Device dbDev = ctx.Devices.FirstOrDefault(d => d.Manufacturer == dev.Manufacturer && d.Model == dev.Model && d.Revision == dev.FirmwareRevision); Dump.SolveTrackPregaps(dev, null, null, tracks, supportsPqSubchannel, supportsRwSubchannel, dbDev, out bool inexactPositioning); for (int t = 1; t < tracks.Length; t++) { tracks[t - 1].TrackEndSector = tracks[t].TrackStartSector - 1; } tracks[tracks.Length - 1].TrackEndSector = (ulong)lastSector; AaruConsole.WriteLine(); AaruConsole.WriteLine("Track calculations:"); if (inexactPositioning) { AaruConsole. WriteLine("WARNING: The drive has returned incorrect Q positioning when calculating pregaps. A best effort has been tried but they may be incorrect."); } foreach (Track track in tracks) { AaruConsole. WriteLine("Track {0} starts at LBA {1}, ends at LBA {2}, has a pregap of {3} sectors and is of type {4}", track.TrackSequence, track.TrackStartSector, track.TrackEndSector, track.TrackPregap, track.TrackType); } AaruConsole.WriteLine(); AaruConsole.WriteLine("Offsets:"); CdOffset cdOffset = null; // Search for read offset in master database cdOffset = ctx.CdOffsets.FirstOrDefault(d => d.Manufacturer == dev.Manufacturer && d.Model == dev.Model); CompactDisc.GetOffset(cdOffset, dbDev, debug, dev, scsiInfo.MediaType, null, tracks, null, out int?driveOffset, out int?combinedOffset, out _); if (combinedOffset is null) { if (driveOffset is null) { AaruConsole.WriteLine("Drive reading offset not found in database."); AaruConsole.WriteLine("Disc offset cannot be calculated."); } else { AaruConsole. WriteLine($"Drive reading offset is {driveOffset} bytes ({driveOffset / 4} samples)."); AaruConsole.WriteLine("Disc write offset is unknown."); } } else { int offsetBytes = combinedOffset.Value; if (driveOffset is null) { AaruConsole.WriteLine("Drive reading offset not found in database."); AaruConsole. WriteLine($"Combined disc and drive offset are {offsetBytes} bytes ({offsetBytes / 4} samples)."); } else { AaruConsole. WriteLine($"Drive reading offset is {driveOffset} bytes ({driveOffset / 4} samples)."); AaruConsole. WriteLine($"Combined offset is {offsetBytes} bytes ({offsetBytes / 4} samples)"); int?discOffset = offsetBytes - driveOffset; AaruConsole.WriteLine($"Disc offset is {discOffset} bytes ({discOffset / 4} samples)"); } } } } dev.Close(); }
public TOCEntry(TOC toc) { TOC = toc; }
public static int Invoke(bool verbose, bool debug, bool diskTags, string imagePath, string length, bool sectorTags, ulong startSector) { MainClass.PrintCopyright(); if (debug) { AaruConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; } if (verbose) { AaruConsole.VerboseWriteLineEvent += System.Console.WriteLine; } Statistics.AddCommand("decode"); AaruConsole.DebugWriteLine("Decode command", "--debug={0}", debug); AaruConsole.DebugWriteLine("Decode command", "--disk-tags={0}", diskTags); AaruConsole.DebugWriteLine("Decode command", "--input={0}", imagePath); AaruConsole.DebugWriteLine("Decode command", "--length={0}", length); AaruConsole.DebugWriteLine("Decode command", "--sector-tags={0}", sectorTags); AaruConsole.DebugWriteLine("Decode command", "--start={0}", startSector); AaruConsole.DebugWriteLine("Decode command", "--verbose={0}", verbose); var filtersList = new FiltersList(); IFilter inputFilter = filtersList.GetFilter(imagePath); if (inputFilter == null) { AaruConsole.ErrorWriteLine("Cannot open specified file."); return((int)ErrorNumber.CannotOpenFile); } IMediaImage inputFormat = ImageFormat.Detect(inputFilter); if (inputFormat == null) { AaruConsole.ErrorWriteLine("Unable to recognize image format, not decoding"); return((int)ErrorNumber.UnrecognizedFormat); } inputFormat.Open(inputFilter); Statistics.AddMediaFormat(inputFormat.Format); Statistics.AddMedia(inputFormat.Info.MediaType, false); Statistics.AddFilter(inputFilter.Name); if (diskTags) { if (inputFormat.Info.ReadableMediaTags.Count == 0) { AaruConsole.WriteLine("There are no disk tags in chosen disc image."); } else { foreach (MediaTagType tag in inputFormat.Info.ReadableMediaTags) { switch (tag) { case MediaTagType.SCSI_INQUIRY: { byte[] inquiry = inputFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY); if (inquiry == null) { AaruConsole.WriteLine("Error reading SCSI INQUIRY response from disc image"); } else { AaruConsole.WriteLine("SCSI INQUIRY command response:"); AaruConsole. WriteLine("================================================================================"); AaruConsole.WriteLine(Inquiry.Prettify(inquiry)); AaruConsole. WriteLine("================================================================================"); } break; } case MediaTagType.ATA_IDENTIFY: { byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY); if (identify == null) { AaruConsole.WriteLine("Error reading ATA IDENTIFY DEVICE response from disc image"); } else { AaruConsole.WriteLine("ATA IDENTIFY DEVICE command response:"); AaruConsole. WriteLine("================================================================================"); AaruConsole.WriteLine(Identify.Prettify(identify)); AaruConsole. WriteLine("================================================================================"); } break; } case MediaTagType.ATAPI_IDENTIFY: { byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); if (identify == null) { AaruConsole. WriteLine("Error reading ATA IDENTIFY PACKET DEVICE response from disc image"); } else { AaruConsole.WriteLine("ATA IDENTIFY PACKET DEVICE command response:"); AaruConsole. WriteLine("================================================================================"); AaruConsole.WriteLine(Identify.Prettify(identify)); AaruConsole. WriteLine("================================================================================"); } break; } case MediaTagType.CD_ATIP: { byte[] atip = inputFormat.ReadDiskTag(MediaTagType.CD_ATIP); if (atip == null) { AaruConsole.WriteLine("Error reading CD ATIP from disc image"); } else { AaruConsole.WriteLine("CD ATIP:"); AaruConsole. WriteLine("================================================================================"); AaruConsole.WriteLine(ATIP.Prettify(atip)); AaruConsole. WriteLine("================================================================================"); } break; } case MediaTagType.CD_FullTOC: { byte[] fullToc = inputFormat.ReadDiskTag(MediaTagType.CD_FullTOC); if (fullToc == null) { AaruConsole.WriteLine("Error reading CD full TOC from disc image"); } else { AaruConsole.WriteLine("CD full TOC:"); AaruConsole. WriteLine("================================================================================"); AaruConsole.WriteLine(FullTOC.Prettify(fullToc)); AaruConsole. WriteLine("================================================================================"); } break; } case MediaTagType.CD_PMA: { byte[] pma = inputFormat.ReadDiskTag(MediaTagType.CD_PMA); if (pma == null) { AaruConsole.WriteLine("Error reading CD PMA from disc image"); } else { AaruConsole.WriteLine("CD PMA:"); AaruConsole. WriteLine("================================================================================"); AaruConsole.WriteLine(PMA.Prettify(pma)); AaruConsole. WriteLine("================================================================================"); } break; } case MediaTagType.CD_SessionInfo: { byte[] sessionInfo = inputFormat.ReadDiskTag(MediaTagType.CD_SessionInfo); if (sessionInfo == null) { AaruConsole.WriteLine("Error reading CD session information from disc image"); } else { AaruConsole.WriteLine("CD session information:"); AaruConsole. WriteLine("================================================================================"); AaruConsole.WriteLine(Session.Prettify(sessionInfo)); AaruConsole. WriteLine("================================================================================"); } break; } case MediaTagType.CD_TEXT: { byte[] cdText = inputFormat.ReadDiskTag(MediaTagType.CD_TEXT); if (cdText == null) { AaruConsole.WriteLine("Error reading CD-TEXT from disc image"); } else { AaruConsole.WriteLine("CD-TEXT:"); AaruConsole. WriteLine("================================================================================"); AaruConsole.WriteLine(CDTextOnLeadIn.Prettify(cdText)); AaruConsole. WriteLine("================================================================================"); } break; } case MediaTagType.CD_TOC: { byte[] toc = inputFormat.ReadDiskTag(MediaTagType.CD_TOC); if (toc == null) { AaruConsole.WriteLine("Error reading CD TOC from disc image"); } else { AaruConsole.WriteLine("CD TOC:"); AaruConsole. WriteLine("================================================================================"); AaruConsole.WriteLine(TOC.Prettify(toc)); AaruConsole. WriteLine("================================================================================"); } break; } default: AaruConsole.WriteLine("Decoder for disk tag type \"{0}\" not yet implemented, sorry.", tag); break; } } } } if (sectorTags) { if (length.ToLowerInvariant() == "all") { } else { if (!ulong.TryParse(length, out ulong _)) { AaruConsole.WriteLine("Value \"{0}\" is not a valid number for length.", length); AaruConsole.WriteLine("Not decoding sectors tags"); return(3); } } if (inputFormat.Info.ReadableSectorTags.Count == 0) { AaruConsole.WriteLine("There are no sector tags in chosen disc image."); } else { foreach (SectorTagType tag in inputFormat.Info.ReadableSectorTags) { switch (tag) { default: AaruConsole.WriteLine("Decoder for disk tag type \"{0}\" not yet implemented, sorry.", tag); break; } } } // TODO: Not implemented } return((int)ErrorNumber.NoError); }
// TODO: More graphically aware decoders void OnCmbTagSelectedIndexChanged(object sender, EventArgs e) { if (!(cmbTag.SelectedValue is MediaTagWithData tagWithData)) { return; } // TODO: Decoders should be able to handle tags with/without length header txtPrintHex.Text = PrintHex.ByteArrayToHexArrayString(tagWithData.Data, HEX_COLUMNS); tabDecoded.Visible = true; switch (tagWithData.Tag) { case MediaTagType.CD_TOC: txtDecoded.Text = TOC.Prettify(tagWithData.Data); break; case MediaTagType.CD_SessionInfo: txtDecoded.Text = Session.Prettify(tagWithData.Data); break; case MediaTagType.CD_FullTOC: txtDecoded.Text = FullTOC.Prettify(tagWithData.Data); break; case MediaTagType.CD_PMA: txtDecoded.Text = PMA.Prettify(tagWithData.Data); break; case MediaTagType.CD_ATIP: txtDecoded.Text = ATIP.Prettify(tagWithData.Data); break; case MediaTagType.CD_TEXT: txtDecoded.Text = CDTextOnLeadIn.Prettify(tagWithData.Data); break; case MediaTagType.CD_MCN: txtDecoded.Text = Encoding.ASCII.GetString(tagWithData.Data); break; case MediaTagType.DVD_PFI: txtDecoded.Text = PFI.Prettify(tagWithData.Data); break; case MediaTagType.DVD_CMI: txtDecoded.Text = CSS_CPRM.PrettifyLeadInCopyright(tagWithData.Data); break; case MediaTagType.DVDRAM_DDS: txtDecoded.Text = DDS.Prettify(tagWithData.Data); break; case MediaTagType.DVDRAM_SpareArea: txtDecoded.Text = Spare.Prettify(tagWithData.Data); break; case MediaTagType.DVDR_PFI: txtDecoded.Text = PFI.Prettify(tagWithData.Data); break; case MediaTagType.HDDVD_MediumStatus: txtDecoded.Text = PFI.Prettify(tagWithData.Data); break; case MediaTagType.BD_DI: txtDecoded.Text = DI.Prettify(tagWithData.Data); break; case MediaTagType.BD_BCA: txtDecoded.Text = BCA.Prettify(tagWithData.Data); break; case MediaTagType.BD_DDS: txtDecoded.Text = Decoders.Bluray.DDS.Prettify(tagWithData.Data); break; case MediaTagType.BD_CartridgeStatus: txtDecoded.Text = Cartridge.Prettify(tagWithData.Data); break; case MediaTagType.BD_SpareArea: txtDecoded.Text = Decoders.Bluray.Spare.Prettify(tagWithData.Data); break; case MediaTagType.MMC_WriteProtection: txtDecoded.Text = WriteProtect.PrettifyWriteProtectionStatus(tagWithData.Data); break; case MediaTagType.MMC_DiscInformation: txtDecoded.Text = DiscInformation.Prettify(tagWithData.Data); break; case MediaTagType.SCSI_INQUIRY: txtDecoded.Text = Inquiry.Prettify(tagWithData.Data); break; case MediaTagType.SCSI_MODEPAGE_2A: txtDecoded.Text = Modes.PrettifyModePage_2A(tagWithData.Data); break; case MediaTagType.ATA_IDENTIFY: case MediaTagType.ATAPI_IDENTIFY: txtDecoded.Text = Identify.Prettify(tagWithData.Data); break; case MediaTagType.Xbox_SecuritySector: txtDecoded.Text = SS.Prettify(tagWithData.Data); break; case MediaTagType.SCSI_MODESENSE_6: txtDecoded.Text = Modes.PrettifyModeHeader6(tagWithData.Data, PeripheralDeviceTypes.DirectAccess); break; case MediaTagType.SCSI_MODESENSE_10: txtDecoded.Text = Modes.PrettifyModeHeader10(tagWithData.Data, PeripheralDeviceTypes.DirectAccess); break; case MediaTagType.Xbox_DMI: txtDecoded.Text = DMI.IsXbox360(tagWithData.Data) ? DMI.PrettifyXbox360(tagWithData.Data) : DMI.PrettifyXbox(tagWithData.Data); break; default: tabDecoded.Visible = false; break; } }
public File() { Header = new Header(this); TOC = new TOC(this); }
static void Main(string[] args) { FileStream stream = File.Open(args[0], FileMode.Open, FileAccess.Read); //Choose one of either 1 or 2 //1. Reading from a binary Excel file ('97-2003 format; *.xls) // # IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream); //2. Reading from a OpenXml Excel file (2007 format; *.xlsx) IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream); //Choose one of either 3, 4, or 5 //3. DataSet - The result of each spreadsheet will be created in the result.Tables //# DataSet result = excelReader.AsDataSet(); //4. DataSet - Create column names from first row // works fine excelReader.IsFirstRowAsColumnNames = true; DataSet result = excelReader.AsDataSet(); DataTable TOCTable = result.Tables["azure-content-pr"]; MakeTreeViewItemTree(result, TOCTable); TOC toc = new TOC(); /* foreach (DataColumn column in TOCTable.Columns) { //Console.WriteLine("{0}, type: {1}", column.ColumnName, column.DataType); /* ID, type: System.String TOC Files, type: System.Double File (H1 heading), type: System.String Title, type: System.String Service, type: System.String Service Slug, type: System.String Author, type: System.String Pillar, type: System.String Directory (In case you have multiple TOC), type: System.String Top Node, type: System.String Node 2 TOC, type: System.String Node 3 TOC, type: System.String Comments/Notes, type: System.String */ /* } */ foreach (DataRow row in TOCTable.Rows) { if (row.Field<System.String>("Service") != "App Service") continue; // ID = row.Field<System.String>("ID"); /// TODO: Console.WriteLine("{0}: {1}", row.Table.Columns["TOC Files"], row.Field<System.Double>("TOC Files")); /* FileName = row.Field<System.String>("File (H1 heading)"); Title = row.Field<System.String>("Title"); Service = row.Field<System.String>("Service"); ServiceSlug = row.Field<System.String>("Service Slug"); Author = row.Field<System.String>("Author"); Pillar = row.Field<System.String>("Pillar"); Directory = row.Field<System.String>("Directory (In case you have multiple TOC)"); RootNode = row.Field<System.String>("Top Node"); Node2 = row.Field<System.String>("Node 2 TOC"); Node3 = row.Field<System.String>("Node 3 TOC"); */ StringBuilder builder = new StringBuilder(); builder.Append("# [" + row.Field<System.String>("Top Node") + "]"); if (row.Field<System.String>("Node 2 TOC") != null && !row.Field<System.String>("Node 2 TOC").Equals(String.Empty)) { builder.Insert(0, '#'); builder.Append("[" + row.Field<System.String>("Node 2 TOC") + "]"); } if (row.Field<System.String>("Node 3 TOC") != null && !row.Field<System.String>("Node 3 TOC").Equals(String.Empty)) { builder.Insert(0, '#'); builder.Append("[" + row.Field<System.String>("Node 3 TOC") + "]"); } builder.Append("[" + row.Field<System.String>("Title") + "]"); builder.Append("(" + row.Field<System.String>("File (H1 heading)") + ")"); //Console.WriteLine(builder.ToString()); //6. Free resources (IExcelDataReader is IDisposable) excelReader.Close(); } }