🐛Fix create-sidecar adding all filesystems to all optical tracks.

This commit is contained in:
2018-02-07 17:10:21 +00:00
parent b6ec14693e
commit 69294cb165

View File

@@ -33,6 +33,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using DiscImageChef.CommonTypes; using DiscImageChef.CommonTypes;
using DiscImageChef.Decoders.CD; using DiscImageChef.Decoders.CD;
@@ -349,6 +350,11 @@ namespace DiscImageChef.Core
sidecar.OpticalDisc[0].Dimensions = Dimensions.DimensionsFromMediaType(image.Info.MediaType); sidecar.OpticalDisc[0].Dimensions = Dimensions.DimensionsFromMediaType(image.Info.MediaType);
InitProgress(); InitProgress();
UpdateStatus("Checking filesystems");
List<Partition> partitions = Partitions.GetAll(image);
Partitions.AddSchemesToStats(partitions);
foreach(Track trk in tracks) foreach(Track trk in tracks)
{ {
TrackType xmlTrk = new TrackType(); TrackType xmlTrk = new TrackType();
@@ -549,35 +555,32 @@ namespace DiscImageChef.Core
// For fast debugging, skip checksum // For fast debugging, skip checksum
//skipChecksum: //skipChecksum:
UpdateStatus("Checking filesystems on track {0} from sector {1} to {2}", xmlTrk.Sequence.TrackNumber, List<Partition> trkPartitions =
xmlTrk.StartSector, xmlTrk.EndSector); partitions.Where(p => p.Start >= trk.TrackStartSector && p.End <= trk.TrackEndSector).ToList();
List<Partition> partitions = Partitions.GetAll(image);
Partitions.AddSchemesToStats(partitions);
xmlTrk.FileSystemInformation = new PartitionType[1]; xmlTrk.FileSystemInformation = new PartitionType[1];
if(partitions.Count > 0) if(trkPartitions.Count > 0)
{ {
xmlTrk.FileSystemInformation = new PartitionType[partitions.Count]; xmlTrk.FileSystemInformation = new PartitionType[trkPartitions.Count];
for(int i = 0; i < partitions.Count; i++) for(int i = 0; i < trkPartitions.Count; i++)
{ {
xmlTrk.FileSystemInformation[i] = new PartitionType xmlTrk.FileSystemInformation[i] = new PartitionType
{ {
Description = partitions[i].Description, Description = trkPartitions[i].Description,
EndSector = (int)partitions[i].End, EndSector = (int)trkPartitions[i].End,
Name = partitions[i].Name, Name = trkPartitions[i].Name,
Sequence = (int)partitions[i].Sequence, Sequence = (int)trkPartitions[i].Sequence,
StartSector = (int)partitions[i].Start, StartSector = (int)trkPartitions[i].Start,
Type = partitions[i].Type Type = trkPartitions[i].Type
}; };
List<FileSystemType> lstFs = new List<FileSystemType>(); List<FileSystemType> lstFs = new List<FileSystemType>();
foreach(IFilesystem plugin in plugins.PluginsList.Values) foreach(IFilesystem plugin in plugins.PluginsList.Values)
try try
{ {
if(!plugin.Identify(image, partitions[i])) continue; if(!plugin.Identify(image, trkPartitions[i])) continue;
plugin.GetInformation(image, partitions[i], out _, encoding); plugin.GetInformation(image, trkPartitions[i], out _, encoding);
lstFs.Add(plugin.XmlFsType); lstFs.Add(plugin.XmlFsType);
Statistics.AddFilesystem(plugin.XmlFsType.Type); Statistics.AddFilesystem(plugin.XmlFsType.Type);