private void LoadRomFromDat(DatDir parentDir, XmlNode romNode) { if (romNode.Attributes == null) { return; } XmlNode name = romNode.Attributes.GetNamedItem("name"); string loadflag = VarFix.String(romNode.Attributes.GetNamedItem("loadflag")); if (name != null) { DatFile dRom = new DatFile(DatFileType.UnSet) { Name = VarFix.String(name), Size = VarFix.ULong(romNode.Attributes.GetNamedItem("size")), CRC = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("crc"), 8), SHA1 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("sha1"), 40), Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")) }; _indexContinue = parentDir.ChildAdd(dRom); } else if (loadflag.ToLower() == "continue") { DatFile tRom = (DatFile)parentDir.Child(_indexContinue); tRom.Size += VarFix.ULong(romNode.Attributes.GetNamedItem("size")); } }
private static void LoadDiskFromDat(ref RvDir tGame, XmlNode romNode) { if (romNode.Attributes == null) { return; } RvFile tRom = new RvFile(FileType.File) { Dat = tGame.Dat, Name = VarFix.CleanFullFileName(romNode.Attributes.GetNamedItem("name")) + ".chd", SHA1CHD = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("sha1"), 40), MD5CHD = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("md5"), 32), Merge = VarFix.CleanFullFileName(romNode.Attributes.GetNamedItem("merge")), Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")) }; if (tRom.SHA1CHD != null) { tRom.FileStatusSet(FileStatus.SHA1CHDFromDAT); } if (tRom.MD5CHD != null) { tRom.FileStatusSet(FileStatus.MD5CHDFromDAT); } tGame.ChildAdd(tRom); }
private static void LoadRomFromDat(RvGame rvGame, XmlNode romNode) { if (romNode.Attributes == null) { return; } XmlNode name = romNode.Attributes.GetNamedItem("name"); string loadflag = VarFix.String(romNode.Attributes.GetNamedItem("loadflag")); if (name != null) { RvRom rvRom = new RvRom(); rvRom.Name = VarFix.CleanFullFileName(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.Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")); _indexContinue = rvGame.AddRom(rvRom); } else if (loadflag.ToLower() == "continue") { RvRom tROM = rvGame.Roms[_indexContinue]; tROM.Size += VarFix.ULong(romNode.Attributes.GetNamedItem("size")); } else if (loadflag.ToLower() == "ignore") { RvRom tROM = rvGame.Roms[_indexContinue]; tROM.Size += VarFix.ULong(romNode.Attributes.GetNamedItem("size")); } }
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 bool LoadDiskFromDat(ref RvDir tGame) { if (DatFileLoader.Next != "(") { DatUpdate.SendAndShowDat(Resources.DatCmpReader_LoadRomFromDat_not_found_after_rom, DatFileLoader.Filename); return(false); } DatFileLoader.Gn(); if (DatFileLoader.Next.ToLower() != "name") { DatUpdate.SendAndShowDat(Resources.DatCmpReader_LoadGameFromDat_Name_not_found_as_first_object_in, DatFileLoader.Filename); return(false); } string filename = VarFix.CleanFullFileName(DatFileLoader.Gn()); RvFile tRom = new RvFile(FileType.File) { Name = filename }; DatFileLoader.Gn(); tRom.Dat = tGame.Dat; while (DatFileLoader.Next != ")") { switch (DatFileLoader.Next.ToLower()) { case "sha1": tRom.SHA1CHD = VarFix.CleanMD5SHA1(DatFileLoader.Gn(), 40); DatFileLoader.Gn(); break; case "md5": tRom.MD5CHD = VarFix.CleanMD5SHA1(DatFileLoader.Gn(), 32); DatFileLoader.Gn(); break; case "merge": tRom.Merge = VarFix.CleanFullFileName(DatFileLoader.Gn()); DatFileLoader.Gn(); break; case "flags": tRom.Status = VarFix.ToLower(DatFileLoader.Gn()); DatFileLoader.Gn(); break; case "nodump": tRom.Status = "nodump"; DatFileLoader.Gn(); break; default: DatUpdate.SendAndShowDat(Resources.DatCmpReader_ReadDat_Error_keyword + DatFileLoader.Next + Resources.DatCmpReader_LoadRomFromDat_not_known_in_rom, DatFileLoader.Filename); DatFileLoader.Gn(); break; } } if (tRom.SHA1CHD != null) { tRom.FileStatusSet(FileStatus.SHA1CHDFromDAT); } if (tRom.MD5CHD != null) { tRom.FileStatusSet(FileStatus.MD5CHDFromDAT); } tGame.ChildAdd(tRom); return(true); }
private static void LoadDiskFromDat(RvGame rvGame, XmlNode romNode) { if (romNode.Attributes == null) { return; } string Name = VarFix.CleanFullFileName(romNode.Attributes.GetNamedItem("name")) + ".chd"; byte[] SHA1CHD = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("sha1"), 40); byte[] MD5CHD = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("md5"), 32); string Merge = VarFix.CleanFullFileName(romNode.Attributes.GetNamedItem("merge")); string Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")); }
private static bool LoadDiskFromDat(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); } string filename = VarFix.CleanFullFileName(DatFileLoader.Gn()); byte[] sha1; byte[] md5; string Merge; string Status; DatFileLoader.Gn(); while (DatFileLoader.Next != ")") { switch (DatFileLoader.Next.ToLower()) { case "sha1": sha1 = VarFix.CleanMD5SHA1(DatFileLoader.Gn(), 40); DatFileLoader.Gn(); break; case "md5": md5 = VarFix.CleanMD5SHA1(DatFileLoader.Gn(), 32); DatFileLoader.Gn(); break; case "merge": Merge = VarFix.CleanFullFileName(DatFileLoader.Gn()); DatFileLoader.Gn(); break; case "flags": Status = VarFix.ToLower(DatFileLoader.Gn()); DatFileLoader.Gn(); break; case "nodump": Status = "nodump"; DatFileLoader.Gn(); break; default: DatUpdate.SendAndShowDat("Error: key word '" + DatFileLoader.Next + "' not known in rom", DatFileLoader.Filename); DatFileLoader.Gn(); break; } } return(true); }
private static void LoadDiskFromDat(DatDir parentDir, XmlNode romNode) { if (romNode.Attributes == null) { return; } DatFile dRom = new DatFile(DatFileType.UnSet) { Name = VarFix.CleanCHD(romNode.Attributes.GetNamedItem("name")), SHA1 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("sha1"), 40), Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")), isDisk = true }; parentDir.ChildAdd(dRom); }
private static void LoadRomFromDat(ref RvDir tGame, XmlNode romNode, FileType thisFileType) { if (romNode.Attributes == null) { return; } XmlNode name = romNode.Attributes.GetNamedItem("name"); string loadflag = VarFix.String(romNode.Attributes.GetNamedItem("loadflag")); if (name != null) { RvFile tRom = new RvFile(thisFileType) // changed { Name = VarFix.CleanFullFileName(name), Size = VarFix.ULong(romNode.Attributes.GetNamedItem("size")), CRC = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("crc"), 8), SHA1 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("sha1"), 40), Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")), Dat = tGame.Dat }; if (tRom.Size != null) { tRom.FileStatusSet(FileStatus.SizeFromDAT); } if (tRom.CRC != null) { tRom.FileStatusSet(FileStatus.CRCFromDAT); } if (tRom.SHA1 != null) { tRom.FileStatusSet(FileStatus.SHA1FromDAT); } _indexContinue = tGame.ChildAdd(tRom); } else if (loadflag.ToLower() == "continue") { RvFile tZippedFile = (RvFile)tGame.Child(_indexContinue); tZippedFile.Size += VarFix.ULong(romNode.Attributes.GetNamedItem("size")); } }
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); }
private static void LoadRomFromDat(DatDir parentDir, XmlNode romNode) { if (romNode.Attributes == null) { return; } DatFile rvRom = new DatFile(DatFileType.UnSet) { Name = VarFix.String(romNode.Attributes.GetNamedItem("name")), Size = VarFix.ULong(romNode.Attributes.GetNamedItem("size")), CRC = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("crc"), 8), SHA1 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("sha1"), 40), MD5 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("md5"), 32), Merge = VarFix.String(romNode.Attributes.GetNamedItem("merge")), Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")), Region = VarFix.ToLower(romNode.Attributes.GetNamedItem("region")) }; parentDir.ChildAdd(rvRom); }
private static void LoadRomFromDat(RvGame rvGame, XmlNode romNode, HeaderFileType datFileType) { if (romNode.Attributes == null) { return; } RvRom rvRom = new RvRom { AltType = datFileType, Name = VarFix.CleanFullFileName(romNode.Attributes.GetNamedItem("name")), Size = VarFix.ULong(romNode.Attributes.GetNamedItem("size")), CRC = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("crc"), 8), SHA1 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("sha1"), 40), MD5 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("md5"), 32), Merge = VarFix.CleanFullFileName(romNode.Attributes.GetNamedItem("merge")), Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")) }; rvGame.AddRom(rvRom); }
private static void LoadRomFromDat(ref RvDir tGame, XmlNode romNode, FileType thisFileType) { if (romNode.Attributes == null) { return; } RvFile tRom = new RvFile(thisFileType) { Dat = tGame.Dat, Size = VarFix.ULong(romNode.Attributes.GetNamedItem("size")), Name = VarFix.CleanFullFileName(romNode.Attributes.GetNamedItem("name")), CRC = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("crc"), 8), SHA1 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("sha1"), 40), MD5 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("md5"), 32), Merge = VarFix.CleanFullFileName(romNode.Attributes.GetNamedItem("merge")), Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")) }; if (tRom.Size != null) { tRom.FileStatusSet(FileStatus.SizeFromDAT); } if (tRom.CRC != null) { tRom.FileStatusSet(FileStatus.CRCFromDAT); } if (tRom.SHA1 != null) { tRom.FileStatusSet(FileStatus.SHA1FromDAT); } if (tRom.MD5 != null) { tRom.FileStatusSet(FileStatus.MD5FromDAT); } tGame.ChildAdd(tRom); }
private static void LoadDiskFromDat(DatDir parentDir, XmlNode romNode) { if (romNode.Attributes == null) { return; } DatFile rvRom = new DatFile(DatFileType.UnSet) { Name = VarFix.String(romNode.Attributes.GetNamedItem("name")) + ".chd", SHA1 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("sha1"), 40), MD5 = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("md5"), 32), Merge = VarFix.String(romNode.Attributes.GetNamedItem("merge")), Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")), isDisk = true }; if (!string.IsNullOrWhiteSpace(rvRom.Merge)) { rvRom.Merge += ".chd"; } parentDir.ChildAdd(rvRom); }
private bool LoadDiskFromDat(DatFileLoader dfl, DatDir parentDir) { dfl.Gn(); if (dfl.Next != "(") { _errorReport?.Invoke(dfl.Filename, "( not found after rom, on line " + dfl.LineNumber); return(false); } dfl.Gn(); if (dfl.Next.ToLower() != "name") { _errorReport?.Invoke(dfl.Filename, "Name not found as first object in ( ), on line " + dfl.LineNumber); return(false); } DatFile dRom = new DatFile(DatFileType.UnSet) { Name = VarFix.String(dfl.Gn()) + ".chd", isDisk = true }; dfl.Gn(); while (dfl.Next != ")") { switch (dfl.Next.ToLower()) { case "sha1": dRom.SHA1 = VarFix.CleanMD5SHA1(dfl.Gn(), 40); break; case "md5": dRom.MD5 = VarFix.CleanMD5SHA1(dfl.Gn(), 32); break; case "region": dRom.Region = VarFix.String(dfl.Gn()); break; case "merge": dRom.Merge = VarFix.String(dfl.Gn()); break; case "index": dfl.Gn(); break; case "flags": dRom.Status = VarFix.ToLower(dfl.Gn()); break; case "nodump": dRom.Status = "nodump"; break; default: _errorReport?.Invoke(dfl.Filename, "Error: key word '" + dfl.Next + "' not known in rom, on line " + dfl.LineNumber); break; } dfl.Gn(); } parentDir.ChildAdd(dRom); return(true); }
private static bool LoadRomFromDat(DatFileLoader dfl, DatDir parentDir, ReportError errorReport) { dfl.Gn(); if (dfl.Next != "(") { errorReport?.Invoke(dfl.Filename, "( not found after rom, on line " + dfl.LineNumber); return(false); } dfl.Gn(); if (dfl.Next.ToLower() != "name") { errorReport?.Invoke(dfl.Filename, "Name not found as first object in ( ), on line " + dfl.LineNumber); return(false); } DatFile dRom = new DatFile(DatFileType.UnSet) { Name = dfl.Gn() }; dfl.Gn(); while (dfl.Next != ")") { switch (dfl.Next.ToLower()) { case "size": dRom.Size = VarFix.ULong(dfl.Gn()); break; case "hash": dfl.Gn(); break; case "crc": case "crc32": dRom.CRC = VarFix.CleanMD5SHA1(dfl.Gn(), 8); break; case "sha1": dRom.SHA1 = VarFix.CleanMD5SHA1(dfl.Gn(), 40); break; case "md5": dRom.MD5 = VarFix.CleanMD5SHA1(dfl.Gn(), 32); break; case "merge": dRom.Merge = VarFix.String(dfl.Gn()); break; case "flags": string flags = VarFix.ToLower(dfl.Gn()); if (string.IsNullOrWhiteSpace(dRom.Status)) { dRom.Status = flags; } break; case "date": dfl.Gn(); break; case "bios": dfl.Gn(); break; case "region": dfl.Gn(); break; case "regiona": case "regionb": while (dfl.Next != ")") { dfl.Gn(); } continue; case "offs": dfl.Gn(); break; case "nodump": dRom.Status = "nodump"; break; case "baddump": dRom.Status = "baddump"; break; default: errorReport?.Invoke(dfl.Filename, "Error: key word '" + dfl.Next + "' not known in rom, on line " + dfl.LineNumber); break; } dfl.Gn(); } parentDir.ChildAdd(dRom); return(true); }