private static RomInformation ParseRom(FileInfo pRomFile) { RomInformation lRomInformation = new RomInformation(); lRomInformation.ExpandInfo.RomType = pRomFile.Extension.TrimStart('.'); BQLog.WriteMsgToUI("解析Rom。"); foreach (var romParser in _RomParserList) { MergeRomInfo(lRomInformation, romParser.ParseRom(pRomFile)); } if (lRomInformation.BasicInfo.Serial == "") { BQLog.WriteMsgToUI("解析Rom失败。"); return(null); } if (lRomInformation.ExpandInfo.LargeIcon != null) { BQLog.WriteMsgToUI("保持大图标文件"); BQIO.SaveLargeIco(lRomInformation.ExpandInfo.LargeIcon, lRomInformation); } if (lRomInformation.ExpandInfo.SmallIcon != null) { BQLog.WriteMsgToUI("保持小图标文件"); BQIO.SaveSmallIco(lRomInformation.ExpandInfo.SmallIcon, lRomInformation); } BQLog.WriteMsgToUI("复制Rom文件"); BQIO.CopyRomToRomFolder(lRomInformation, pRomFile); return(lRomInformation); }
private static RomInformation ParseRom(FileInfo pRomFile, bool isCNRom = false) { RomInformation lRomInformation = new RomInformation(); lRomInformation.ExpandInfo.RomType = pRomFile.Extension.TrimStart('.'); foreach (var romParser in _RomParserList) { MergeRomInfo(lRomInformation, romParser.ParseRom(pRomFile)); } if (lRomInformation.BasicInfo.Serial != "") { if (lRomInformation.BasicInfo.Serial.Length == 10) { lRomInformation.BasicInfo.Serial = lRomInformation.BasicInfo.Serial.Substring(0, 4) + lRomInformation.BasicInfo.Serial.Substring(6, 4); } lRomInformation.BasicInfo.SourceSerial = lRomInformation.BasicInfo.Serial; UpdateRomInfoToDB(lRomInformation); if (isCNRom) { lRomInformation.BasicInfo.SourceSerial = lRomInformation.BasicInfo.Serial; lRomInformation.BasicInfo.Serial = CreateCNSerial(lRomInformation.BasicInfo.SourceSerial); UpdateRomInfoToDB(lRomInformation); } } if (lRomInformation.ExpandInfo.LargeIcon != null) { BQIO.SaveLargeIco(lRomInformation.ExpandInfo.LargeIcon, lRomInformation); } if (lRomInformation.ExpandInfo.SmallIcon != null) { BQIO.SaveSmallIco(lRomInformation.ExpandInfo.SmallIcon, lRomInformation); } if (BQIO.CheckRomFileExist(lRomInformation) == false) { BQIO.CopyRomToRomFolder(lRomInformation, pRomFile); } switch (pRomFile.Extension.ToLower()) { case ".3ds": lRomInformation.ExpandInfo.Existed3DS = true; break; case ".3dz": lRomInformation.ExpandInfo.Existed3DZ = true; break; case ".cia": lRomInformation.ExpandInfo.ExistedCIA = true; break; default: break; } return(lRomInformation); }