private static bool LoadRomFromDat(RvGame rvGame) { if (DatFileLoader.Next != "(") { DatUpdate.SendAndShowDat("( not found after rom", DatFileLoader.Filename); return false; } DatFileLoader.Gn(); if (DatFileLoader.Next.ToLower() != "name") { DatUpdate.SendAndShowDat("Name not found as first object in ( )", DatFileLoader.Filename); return false; } RvRom rvRom = new RvRom(); rvRom.Name = VarFix.CleanFullFileName(DatFileLoader.Gn()); DatFileLoader.Gn(); while (DatFileLoader.Next != ")") { switch (DatFileLoader.Next.ToLower()) { case "size": rvRom.Size = VarFix.ULong(DatFileLoader.Gn()); DatFileLoader.Gn(); break; case "crc": rvRom.CRC = VarFix.CleanMD5SHA1(DatFileLoader.Gn(), 8); DatFileLoader.Gn(); break; case "sha1": rvRom.SHA1 = VarFix.CleanMD5SHA1(DatFileLoader.Gn(), 40); DatFileLoader.Gn(); break; case "md5": rvRom.MD5 = VarFix.CleanMD5SHA1(DatFileLoader.Gn(), 32); DatFileLoader.Gn(); break; case "merge": rvRom.Merge = VarFix.CleanFullFileName(DatFileLoader.Gn()); DatFileLoader.Gn(); break; case "flags": rvRom.Status = VarFix.ToLower(DatFileLoader.Gn()); DatFileLoader.Gn(); break; case "date": DatFileLoader.Gn(); DatFileLoader.Gn(); break; case "bios": DatFileLoader.Gn(); DatFileLoader.Gn(); break; case "region": DatFileLoader.Gn(); DatFileLoader.Gn(); break; case "offs": DatFileLoader.Gn(); DatFileLoader.Gn(); break; case "nodump": rvRom.Status = "nodump"; DatFileLoader.Gn(); break; default: DatUpdate.SendAndShowDat("Error: key word '" + DatFileLoader.Next + "' not known in rom", DatFileLoader.Filename); DatFileLoader.Gn(); break; } } rvGame.AddRom(rvRom); return true; }
private static void LoadRomFromDat(RvGame rvGame, XmlNode romNode) { if (romNode.Attributes == null) return; RvRom rvRom=new RvRom(); rvRom.Name = VarFix.CleanFullFileName(romNode.Attributes.GetNamedItem("name")); rvRom.Size = VarFix.ULong(romNode.Attributes.GetNamedItem("size")); rvRom.CRC = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("crc"), 8); rvRom.SHA1 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("sha1"), 40); rvRom.MD5 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("md5"), 32); rvRom.Merge = VarFix.CleanFullFileName(romNode.Attributes.GetNamedItem("merge")); rvRom.Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")); rvGame.AddRom(rvRom); }