Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/nes-containers.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'UnifFile.cs')
-rw-r--r--UnifFile.cs15
1 files changed, 13 insertions, 2 deletions
diff --git a/UnifFile.cs b/UnifFile.cs
index 98d52e0..8ca040e 100644
--- a/UnifFile.cs
+++ b/UnifFile.cs
@@ -18,6 +18,7 @@ namespace com.clusterrr.Famicom.Containers
public UnifFile()
{
+ DumpDate = DateTime.Now;
}
/// <summary>
@@ -290,9 +291,9 @@ namespace com.clusterrr.Famicom.Containers
}
/// <summary>
- /// Calculate CRC32 for PRG and CHR fields and fill CRC32 fields
+ /// Calculate CRC32 for PRG and CHR fields and store it into PCKx and CCKx fields
/// </summary>
- public void CalculateCRCs()
+ public void CalculateAndStoreCRCs()
{
foreach (var key in Fields.Keys.Where(k => k.StartsWith("PRG")))
{
@@ -318,6 +319,16 @@ namespace com.clusterrr.Famicom.Containers
}
}
+ /// <summary>
+ /// Calculate overall CRC32
+ /// </summary>
+ /// <returns></returns>
+ public uint CalculateCRC32()
+ => Crc32Calculator.CalculateCRC32(
+ Enumerable.Concat(Fields.Where(k => k.Key.StartsWith("PRG")).OrderBy(k => k.Key).SelectMany(i => i.Value),
+ Fields.Where(k => k.Key.StartsWith("CHR")).OrderBy(k => k.Key).SelectMany(i => i.Value)).ToArray()
+ );
+
[Flags]
public enum Controller
{