Support ancient .NET in FileTypes

This commit is contained in:
Matt Nadareski
2024-02-28 21:59:13 -05:00
parent 080c8a749b
commit de59d0252c
49 changed files with 597 additions and 59 deletions

View File

@@ -66,7 +66,11 @@ namespace SabreTools.DatTools
datFile.Items.Remove(key);
datFile.Items.AddRange(key, newItems);
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
}
/// <summary>
@@ -117,7 +121,11 @@ namespace SabreTools.DatTools
// Now add the new list to the key
intDat.Items.Remove(key);
intDat.Items.AddRange(key, newDatItems);
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
}
// If we are matching based on Machine fields of any sort
@@ -152,7 +160,11 @@ namespace SabreTools.DatTools
// Now add the new list to the key
intDat.Items.Remove(key);
intDat.Items.AddRange(key, newDatItems);
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
}
watch.Stop();
@@ -234,7 +246,11 @@ namespace SabreTools.DatTools
intDat.Items.Remove(key);
intDat.Items.AddRange(key, keepDatItems);
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
watch.Stop();
}
@@ -336,7 +352,11 @@ namespace SabreTools.DatTools
dupeData.Items.Add(key, newrom);
}
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
watch.Stop();
@@ -412,7 +432,11 @@ namespace SabreTools.DatTools
if (item.DupeType.HasFlag(DupeType.Internal) || item.DupeType == 0x00)
outDats[item.Source.Index].Items.Add(key, item);
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
watch.Stop();
@@ -481,7 +505,11 @@ namespace SabreTools.DatTools
outerDiffData.Items.Add(key, newrom);
}
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
watch.Stop();
@@ -581,7 +609,11 @@ namespace SabreTools.DatTools
if (item.Source != null && item.Source.Index == index)
indexDat.Items.Add(key, item);
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
}
}
}

View File

@@ -64,7 +64,11 @@ namespace SabreTools.DatTools
Parallel.ForEach(files, Globals.ParallelOptions, item =>
{
Interlocked.Add(ref totalSize, new FileInfo(item).Length);
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
// Process the files in the main folder or any subfolder
logger.User(totalSize, currentSize);
@@ -226,7 +230,11 @@ namespace SabreTools.DatTools
return;
ProcessFileHelper(datFile, item, datItem, basePath, parent);
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
}
/// <summary>
@@ -252,7 +260,11 @@ namespace SabreTools.DatTools
{
Rom emptyRom = new(Path.Combine(empty, "_"), item);
ProcessFileHelper(datFile, item, emptyRom, basePath, parent);
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
}
/// <summary>
@@ -308,7 +320,11 @@ namespace SabreTools.DatTools
logger.Verbose($"Adding blank empty folder: {gamename}");
datFile.Items["null"]?.Add(new Rom(romname, gamename));
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
}
/// <summary>

View File

@@ -87,7 +87,11 @@ namespace SabreTools.DatTools
directories.Add(input);
}
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
// If we don't have any directories, we want to exit
if (directories.Count == 0)

View File

@@ -85,7 +85,11 @@ namespace SabreTools.DatTools
extBDat.Items.Add(key, item);
}
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
// Then return both DatFiles
watch.Stop();
@@ -212,7 +216,11 @@ namespace SabreTools.DatTools
fieldDats[DatItemField.NULL].Items.Add(key, item);
}
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
watch.Stop();
return fieldDats;
@@ -265,7 +273,11 @@ namespace SabreTools.DatTools
// Then set the DAT name to be the parent directory name
tempDat.Header.Name = Path.GetDirectoryName(key);
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
watch.Stop();
return true;
@@ -366,7 +378,11 @@ namespace SabreTools.DatTools
else if (item.ItemType == ItemType.Rom && (item as Rom)!.Size >= radix)
greaterThan.Items.Add(key, item);
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
// Then return both DatFiles
watch.Stop();
@@ -497,7 +513,11 @@ namespace SabreTools.DatTools
Parallel.ForEach(outputTypes, Globals.ParallelOptions, itemType =>
{
FillWithItemType(datFile, typeDats[itemType], itemType);
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
watch.Stop();
return typeDats;
@@ -526,7 +546,11 @@ namespace SabreTools.DatTools
if (item.ItemType == itemType)
indexDat.Items.Add(key, item);
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
}
}
}

View File

@@ -182,8 +182,11 @@ namespace SabreTools.DatTools
{
logger.Error(ex, $"Report '{outfile}' could not be written out");
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
}
catch (Exception ex) when (!throwOnError)
{

View File

@@ -78,6 +78,7 @@ namespace SabreTools.DatTools
try
{
// Write out all required formats
Parallel.ForEach(outfiles.Keys, Globals.ParallelOptions, datFormat =>
{
string outfile = outfiles[datFormat];
@@ -89,8 +90,11 @@ namespace SabreTools.DatTools
{
logger.Error(ex, $"Datfile '{outfile}' could not be written out");
}
#if NET40_OR_GREATER || NETCOREAPP
});
#else
}
#endif
}
catch (Exception ex) when (!throwOnError)
{