diff options
-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");
+ }
+ }
+ }
+}
|