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:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-04-23 03:57:30 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-04-23 03:57:30 +0300
commit526245c8e1298eb0a5cfee0e929f054cf8033158 (patch)
tree2e8b6398f9b21e7576b0b20566f2caae3b99dd40 /FdsBlockDiskInfo.cs
parent3eeeea564cd5446d3692c16af8c0d19ec674d127 (diff)
FDS blocks are IEquatable now
Diffstat (limited to 'FdsBlockDiskInfo.cs')
-rw-r--r--FdsBlockDiskInfo.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/FdsBlockDiskInfo.cs b/FdsBlockDiskInfo.cs
index 3bdb0e8..38805d8 100644
--- a/FdsBlockDiskInfo.cs
+++ b/FdsBlockDiskInfo.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace com.clusterrr.Famicom.Containers
{
[StructLayout(LayoutKind.Sequential, Size = 58, Pack = 1, CharSet = CharSet.Ansi)]
- public class FdsBlockDiskInfo : IFdsBlock
+ public class FdsBlockDiskInfo : IFdsBlock, IEquatable<FdsBlockDiskInfo>
{
public enum DiskSides
{
@@ -80,11 +80,11 @@ namespace com.clusterrr.Famicom.Containers
public bool IsValid { get => blockType == 1; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
- char[] diskVerification = "*NINTENDO-HVC*".ToCharArray();
+ byte[] diskVerification = Encoding.ASCII.GetBytes("*NINTENDO-HVC*");
/// <summary>
/// Literal ASCII string: *NINTENDO-HVC*
/// </summary>
- public string DiskVerification { get => new string(diskVerification).Trim(new char[] { '\0', ' ' }); /*set => diskVerification = value.PadRight(14).ToCharArray(0, value.Length > 14 ? 14 : value.Length);*/ }
+ public string DiskVerification => Encoding.ASCII.GetString(diskVerification).Trim(new char[] { '\0', ' ' }); /*set => diskVerification = value.PadRight(14).ToCharArray(0, value.Length > 14 ? 14 : value.Length);*/
[MarshalAs(UnmanagedType.U1)]
private byte manufacturerCode;
@@ -349,5 +349,10 @@ namespace com.clusterrr.Famicom.Containers
}
public override string ToString() => GameName;
+
+ public bool Equals(FdsBlockDiskInfo other)
+ {
+ return Enumerable.SequenceEqual(this.ToBytes(), other.ToBytes());
+ }
}
}