About This File
Dat-O-Matic dat file parsing system which I created for a very special project that I am working on; I figured it would save some of the developers out there several hours of leg work creating their own. Currently it parses UTF/Text dat files found on http://datomatic.no-intro.org/ I plan on adding functionality of allowing it to parse XML/Text type DAT files at some point in time. Without further delay here is how you use this bad boy.
Include a reference
Initialize the code
var myMethod = new DatFileProcessor();
var myGames = myMethod.ProcessFile(@"c:\path\to\my\datfile.dat");
This will read your DAT file into an object type that will be held much like a list type, and here is a quick and dirty way to loop through all of the data that can be found from that DAT file.
Looping through games
foreach (var myGame in myGames)
Overview - The Layout of a DAT
name "Circus Attractions (Europe) (Compilation - Milestones)"
description "Circus Attractions (Europe) (Compilation - Milestones)"
rom ( name "Circus Attractions (Europe) (Compilation - Milestones).ipf" size 928295 crc 83BA36E2 md5 1B54BFAA5325EC1D654BF035299B0CCF sha1 516672412F3532F823088FD71A669D30E226D5CA )
Index - Stores the line number within the file where the game has been located
Name - Stores the proper name of the game found in line #2 above
RomCrc - Stores the CRC value of the rom found in line #3
RomSha - Stores the SHA1 value of the rom found in line #3
RomMd5 - Stores the MD5 value of the rom found in line #3
RomName - Stores the literal name of the rom found in line #3
RomSize - Stores the size of the current rom found in line #3
RomSerial - When applicable this will store the value of a games serial (typically found in line #3/#4)
Anyways ladies and gents, I just wanted to spread my works for any of our brilliant software developers out there who need a quick and simple way of parsing DAT files; I will add a searching algorithm in later as well. Thanks everyone!