mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Merge branch 'master' of https://github.com/SabreTools/SabreTools
This commit is contained in:
@@ -3486,7 +3486,7 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
empties = archive.GetEmptyFolders();
|
||||
}
|
||||
|
||||
|
||||
// Add add all of the found empties to the DAT
|
||||
Parallel.ForEach(empties, Globals.ParallelOptions, empty =>
|
||||
{
|
||||
@@ -3537,7 +3537,7 @@ namespace SabreTools.Library.DatFiles
|
||||
if (datItem.ItemType != ItemType.Rom && datItem.ItemType != ItemType.Disk)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -4103,20 +4103,16 @@ namespace SabreTools.Library.DatFiles
|
||||
outputFormat = OutputFormat.Folder;
|
||||
}
|
||||
|
||||
// Prepopluate a few key strings based on DatItem type
|
||||
string crc = null;
|
||||
string sha1 = null;
|
||||
if (datItem.ItemType == ItemType.Rom)
|
||||
// If we have a disk, change it into a Rom for later use
|
||||
if (datItem.ItemType == ItemType.Disk)
|
||||
{
|
||||
crc = ((Rom)datItem).CRC;
|
||||
sha1 = ((Rom)datItem).SHA1;
|
||||
}
|
||||
else if (datItem.ItemType == ItemType.Disk)
|
||||
{
|
||||
crc = "";
|
||||
sha1 = ((Disk)datItem).SHA1;
|
||||
datItem = ((Disk)datItem).ConvertToRom();
|
||||
}
|
||||
|
||||
// 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
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -178,8 +178,24 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
public string Publisher
|
||||
{
|
||||
get { return _machine.Publisher; }
|
||||
set { _machine.Publisher = value; }
|
||||
get
|
||||
{
|
||||
if (_machine == null)
|
||||
{
|
||||
_machine = new Machine();
|
||||
}
|
||||
|
||||
return _machine.Publisher;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_machine == null)
|
||||
{
|
||||
_machine = new Machine();
|
||||
}
|
||||
|
||||
_machine.Publisher = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -263,8 +279,24 @@ namespace SabreTools.Library.DatItems
|
||||
/// <remarks>yes = true, partial = null, no = false</remarks>
|
||||
public bool? Supported
|
||||
{
|
||||
get { return _machine.Supported; }
|
||||
set { _machine.Supported = value; }
|
||||
get
|
||||
{
|
||||
if (_machine == null)
|
||||
{
|
||||
_machine = new Machine();
|
||||
}
|
||||
|
||||
return _machine.Supported;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_machine == null)
|
||||
{
|
||||
_machine = new Machine();
|
||||
}
|
||||
|
||||
_machine.Supported = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1065,7 +1097,7 @@ namespace SabreTools.Library.DatItems
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
#region Comparision Methods
|
||||
|
||||
@@ -293,6 +293,18 @@ namespace SabreTools.Library.DatItems
|
||||
dupefound = false;
|
||||
}
|
||||
|
||||
// If we have a file that has no known size, rely on the hashes only
|
||||
else if ((this.Size == -1)
|
||||
&& ((this._crc.IsNullOrWhiteSpace() || newOther._crc.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._crc, newOther._crc))
|
||||
&& ((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._md5, newOther._md5))
|
||||
&& ((this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha1, newOther._sha1))
|
||||
&& ((this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha256, newOther._sha256))
|
||||
&& ((this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha384, newOther._sha384))
|
||||
&& ((this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha512, newOther._sha512)))
|
||||
{
|
||||
dupefound = true;
|
||||
}
|
||||
|
||||
// Otherwise if we get a partial match
|
||||
else if ((this.Size == newOther.Size)
|
||||
&& ((this._crc.IsNullOrWhiteSpace() || newOther._crc.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._crc, newOther._crc))
|
||||
|
||||
Reference in New Issue
Block a user