mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Convert Disk to Rom for rebuilding
This commit is contained in:
@@ -3486,7 +3486,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
empties = archive.GetEmptyFolders();
|
empties = archive.GetEmptyFolders();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add add all of the found empties to the DAT
|
// Add add all of the found empties to the DAT
|
||||||
Parallel.ForEach(empties, Globals.ParallelOptions, empty =>
|
Parallel.ForEach(empties, Globals.ParallelOptions, empty =>
|
||||||
{
|
{
|
||||||
@@ -3537,7 +3537,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
if (datItem.ItemType != ItemType.Rom && datItem.ItemType != ItemType.Disk)
|
if (datItem.ItemType != ItemType.Rom && datItem.ItemType != ItemType.Disk)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -4103,20 +4103,16 @@ namespace SabreTools.Library.DatFiles
|
|||||||
outputFormat = OutputFormat.Folder;
|
outputFormat = OutputFormat.Folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepopluate a few key strings based on DatItem type
|
// If we have a disk, change it into a Rom for later use
|
||||||
string crc = null;
|
if (datItem.ItemType == ItemType.Disk)
|
||||||
string sha1 = null;
|
|
||||||
if (datItem.ItemType == ItemType.Rom)
|
|
||||||
{
|
{
|
||||||
crc = ((Rom)datItem).CRC;
|
datItem = ((Disk)datItem).ConvertToRom();
|
||||||
sha1 = ((Rom)datItem).SHA1;
|
|
||||||
}
|
|
||||||
else if (datItem.ItemType == ItemType.Disk)
|
|
||||||
{
|
|
||||||
crc = "";
|
|
||||||
sha1 = ((Disk)datItem).SHA1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prepopluate a few key strings
|
||||||
|
string crc = ((Rom)datItem).CRC ?? string.Empty;
|
||||||
|
string sha1 = ((Rom)datItem).SHA1 ?? string.Empty;
|
||||||
|
|
||||||
// Find if the file has duplicates in the DAT
|
// Find if the file has duplicates in the DAT
|
||||||
bool hasDuplicates = datItem.HasDuplicates(this);
|
bool hasDuplicates = datItem.HasDuplicates(this);
|
||||||
|
|
||||||
@@ -5503,7 +5499,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
Globals.Logger.Error("Datfile {0} could not be written out: {1}", outfile, ex.ToString());
|
Globals.Logger.Error("Datfile {0} could not be written out: {1}", outfile, ex.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -180,6 +180,65 @@ namespace SabreTools.Library.DatItems
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Convert a disk to the closest Rom approximation
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Rom ConvertToRom()
|
||||||
|
{
|
||||||
|
var rom = new Rom()
|
||||||
|
{
|
||||||
|
Name = this.Name,
|
||||||
|
ItemType = ItemType.Rom,
|
||||||
|
DupeType = this.DupeType,
|
||||||
|
|
||||||
|
CRC = null,
|
||||||
|
MD5 = this.MD5,
|
||||||
|
SHA1 = this.SHA1,
|
||||||
|
SHA256 = this.SHA256,
|
||||||
|
SHA384 = this.SHA384,
|
||||||
|
SHA512 = this.SHA512,
|
||||||
|
|
||||||
|
MergeTag = this.MergeTag,
|
||||||
|
Region = this.Region,
|
||||||
|
ItemStatus = this.ItemStatus,
|
||||||
|
Optional = this.Optional,
|
||||||
|
|
||||||
|
MachineName = this.MachineName,
|
||||||
|
Comment = this.Comment,
|
||||||
|
MachineDescription = this.MachineDescription,
|
||||||
|
Year = this.Year,
|
||||||
|
Manufacturer = this.Manufacturer,
|
||||||
|
Publisher = this.Publisher,
|
||||||
|
RomOf = this.RomOf,
|
||||||
|
CloneOf = this.CloneOf,
|
||||||
|
SampleOf = this.SampleOf,
|
||||||
|
Supported = this.Supported,
|
||||||
|
SourceFile = this.SourceFile,
|
||||||
|
Runnable = this.Runnable,
|
||||||
|
Board = this.Board,
|
||||||
|
RebuildTo = this.RebuildTo,
|
||||||
|
Devices = this.Devices,
|
||||||
|
SlotOptions = this.SlotOptions,
|
||||||
|
Infos = this.Infos,
|
||||||
|
MachineType = this.MachineType,
|
||||||
|
|
||||||
|
PartName = this.PartName,
|
||||||
|
PartInterface = this.PartInterface,
|
||||||
|
Features = this.Features,
|
||||||
|
AreaName = this.AreaName,
|
||||||
|
AreaSize = this.AreaSize,
|
||||||
|
|
||||||
|
SystemID = this.SystemID,
|
||||||
|
System = this.System,
|
||||||
|
SourceID = this.SourceID,
|
||||||
|
Source = this.Source,
|
||||||
|
Remove = this.Remove,
|
||||||
|
};
|
||||||
|
|
||||||
|
return rom;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
#region Comparision Methods
|
||||||
|
|||||||
Reference in New Issue
Block a user