diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2021-05-28 11:35:21 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2021-05-28 11:35:21 +0300 |
commit | 3896f9b958ea75e00c1d4d9ca032c3b3c7b1da06 (patch) | |
tree | 591383a49649a7ef3463a62c654b14ab1d4437eb | |
parent | 2256bc41712c1038c45b604daac8f4a757159725 (diff) |
FdsBlockParser
-rw-r--r-- | FdsBlockParser.cs | 23 |
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");
+ }
+ }
+ }
+}
|