private static void CheckAttribute(RvGame cGame, string source, RvGame.GameData gParam) { if (string.IsNullOrWhiteSpace(source)) { return; } cGame.AddData(gParam, source); }
private static void CopyDir(DatDir datD, RvFile rvD, RvDat rvDat, HeaderFileType headerFileType, bool gameFile) { DatBase[] datB = datD.ToArray(); if (datB == null) { return; } foreach (DatBase b in datB) { switch (b) { case DatDir nDir: RvFile nd = new RvFile(ConvE(nDir.DatFileType)) { Name = nDir.Name + GetExt(nDir.DatFileType), Dat = rvDat, DatStatus = ConvE(nDir.DatStatus) }; if (nDir.DGame == null && !gameFile) { nd.Tree = new RvTreeRow(); } rvD.ChildAdd(nd); if (nDir.DGame != null) { DatGame dGame = nDir.DGame; RvGame cGame = new RvGame(); CheckAttribute(cGame, dGame.Description, RvGame.GameData.Description); CheckAttribute(cGame, dGame.RomOf, RvGame.GameData.RomOf); CheckAttribute(cGame, dGame.IsBios, RvGame.GameData.IsBios); CheckAttribute(cGame, dGame.SourceFile, RvGame.GameData.Sourcefile); CheckAttribute(cGame, dGame.CloneOf, RvGame.GameData.CloneOf); CheckAttribute(cGame, dGame.SampleOf, RvGame.GameData.SampleOf); CheckAttribute(cGame, dGame.Board, RvGame.GameData.Board); CheckAttribute(cGame, dGame.Year, RvGame.GameData.Year); CheckAttribute(cGame, dGame.Manufacturer, RvGame.GameData.Manufacturer); if (nDir.DGame.IsEmuArc) { cGame.AddData(RvGame.GameData.EmuArc, "yes"); CheckAttribute(cGame, dGame.TitleId, RvGame.GameData.TitleId); CheckAttribute(cGame, dGame.Publisher, RvGame.GameData.Publisher); CheckAttribute(cGame, dGame.Developer, RvGame.GameData.Developer); CheckAttribute(cGame, dGame.Genre, RvGame.GameData.Genre); CheckAttribute(cGame, dGame.SubGenre, RvGame.GameData.SubGenre); CheckAttribute(cGame, dGame.Ratings, RvGame.GameData.Ratings); CheckAttribute(cGame, dGame.Score, RvGame.GameData.Score); CheckAttribute(cGame, dGame.Players, RvGame.GameData.Players); CheckAttribute(cGame, dGame.Enabled, RvGame.GameData.Enabled); CheckAttribute(cGame, dGame.CRC, RvGame.GameData.CRC); CheckAttribute(cGame, dGame.RelatedTo, RvGame.GameData.RelatedTo); CheckAttribute(cGame, dGame.Source, RvGame.GameData.Source); } nd.Game = cGame; } CopyDir(nDir, nd, rvDat, headerFileType, gameFile || nDir.DGame != null); break; case DatFile nFile: RvFile nf = new RvFile(ConvE(nFile.DatFileType)) { Name = nFile.Name, Size = nFile.Size, CRC = nFile.CRC, SHA1 = nFile.SHA1, MD5 = nFile.MD5, Merge = nFile.Merge, Status = nFile.Status, Dat = rvDat, DatStatus = ConvE(nFile.DatStatus), HeaderFileType = headerFileType }; #if dt DateTime dt; if (!string.IsNullOrEmpty(nFile.DateModified) && DateTime.TryParseExact(nFile.DateModified, "yyyy/MM/dd HH:mm:ss", enUS, DateTimeStyles.None, out dt)) { nf.DatModTimeStamp = dt.Ticks; } #endif if (nFile.isDisk) { nf.HeaderFileType = HeaderFileType.CHD; } if (nf.HeaderFileType != HeaderFileType.Nothing) { nf.FileStatusSet(FileStatus.HeaderFileTypeFromDAT); } if (nf.Size != null) { nf.FileStatusSet(FileStatus.SizeFromDAT); } if (nf.CRC != null) { nf.FileStatusSet(FileStatus.CRCFromDAT); } if (nf.SHA1 != null) { nf.FileStatusSet(FileStatus.SHA1FromDAT); } if (nf.MD5 != null) { nf.FileStatusSet(FileStatus.MD5FromDAT); } rvD.ChildAdd(nf); break; } } }