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-05-28 11:35:21 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-05-28 11:35:21 +0300
commit3896f9b958ea75e00c1d4d9ca032c3b3c7b1da06 (patch)
tree591383a49649a7ef3463a62c654b14ab1d4437eb
parent2256bc41712c1038c45b604daac8f4a757159725 (diff)
FdsBlockParser
-rw-r--r--FdsBlockParser.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/FdsBlockParser.cs b/FdsBlockParser.cs
new file mode 100644
index 0000000..23722d7
--- /dev/null
+++ b/FdsBlockParser.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace com.clusterrr.Famicom.Containers
+{
+ public static class FdsBlockParser
+ {
+ public static IFdsBlock FromBytes(byte[] data)
+ {
+ // Check block type
+ switch (data[0])
+ {
+ case 0: return FdsBlockDiskInfo.FromBytes(data);
+ case 1: return FdsBlockFileAmount.FromBytes(data);
+ case 2: return FdsBlockFileHeader.FromBytes(data);
+ case 3: return FdsBlockFileData.FromBytes(data);
+ default: throw new InvalidDataException("Invalid FDS block type");
+ }
+ }
+ }
+}