public static List <RomInformation> GetAllRomList() { List <RomInformation> lAllRomInfo = BQDB.GetAllGameInfo(); foreach (var romInfo in lAllRomInfo) { romInfo.ExpandInfo.LargeIcon = BQIO.GetRomLargeIco(romInfo); romInfo.ExpandInfo.SmallIcon = BQIO.GetRomSmallIco(romInfo); } return(lAllRomInfo); }
//public static List<RomInformation> LoadRom(DirectoryInfo pInputDir, FileInfo pInputFile, InputFileType pType) //{ // List<FileInfo> lInputFiles = null; // if (pType == InputFileType.CompressionFile) // { // BQCompression.UnCompressionFile(pInputFile, new DirectoryInfo(BQDirectory.TempDir)); // lInputFiles = BQIO.GetRomFile(new DirectoryInfo(BQDirectory.TempDir)); // } // else if (pType == InputFileType.Directory) // { // DirectoryInfo tInputDir = new DirectoryInfo(pInput); // lInputFiles = BQIO.GetRomFile(new DirectoryInfo(BQDirectory.TempDir)); // } //} #region 整理好的 public static List <RomInformation> LoadRom(DirectoryInfo pInputDir) { List <RomInformation> lResult = new List <RomInformation>(); List <FileInfo> lFileList = BQIO.GetAllFiles(pInputDir); foreach (var file in lFileList) { if (BQSpecs.CompressionFileExtension.Contains(file.Extension) || BQSpecs.RomFileExtension.Contains(file.Extension)) { lResult.AddRange(LoadRom(file)); } } return(lResult); }
private static List <FileInfo> PreTreatRom(FileInfo pRomFile) { if (BQSpecs.CompressionFileExtension.Contains(pRomFile.Extension)) { BQCompression.UnCompressionFile(pRomFile, new DirectoryInfo(BQDirectory.TempDir)); return(BQIO.GetRomFile(new DirectoryInfo(BQDirectory.TempDir))); } else { return(new List <FileInfo>() { pRomFile }); } }
private void UpdateRomList(ObservableCollection <RomInformation> pRomList) { foreach (var romInfo in _TempRomInfoList) { romInfo.ExpandInfo.LargeIcon = BQIO.GetRomLargeIco(romInfo); romInfo.ExpandInfo.SmallIcon = BQIO.GetRomSmallIco(romInfo); } _TempRomInfoList.ForEach(rominfo => { if (pRomList.FirstOrDefault(rom => rom.BasicInfo.Serial == rominfo.BasicInfo.Serial) == null) { pRomList.Add(rominfo); } }); }
public static List <FileInfo> FiledRomFile(FileInfo pRomFile) { List <FileInfo> lResult = new List <FileInfo>(); if (BQSpecs.RomFileExtension.Contains(pRomFile.Extension.ToLower())) { BQCompression.UnCompressionFile(pRomFile, new DirectoryInfo(BQDirectory.TempDir)); List <FileInfo> lUnCompressionFiles = BQIO.GetRomFile(new DirectoryInfo(BQDirectory.TempDir)); if (lUnCompressionFiles.Count == 0) { lResult = lUnCompressionFiles; } } else { lResult.Add(pRomFile); } return(lResult); }
public static List <RomInformation> InitializeFirstRomList() { List <RomInformation> lAllRomInfo = new List <RomInformation>(); List <string> lRomSerialList = BQIO.GetAllRomFileFromLocal(); for (int i = 0; i < lRomSerialList.Count; i++) { RomInformation lRomInformation = BQDB.GetGameInfo(lRomSerialList[i]); if (lRomInformation != null) { lAllRomInfo.Add(lRomInformation); } } foreach (var romInfo in lAllRomInfo) { romInfo.ExpandInfo.LargeIcon = BQIO.GetRomLargeIco(romInfo); romInfo.ExpandInfo.SmallIcon = BQIO.GetRomSmallIco(romInfo); } return(lAllRomInfo); }
public static List <RomInformation> LoadRom(FileInfo pRomFile, bool isCNRom = false) { List <RomInformation> lRomInformationList = new List <RomInformation>(); if (BQSpecs.CompressionFileExtension.Contains(pRomFile.Extension)) { BQCompression.UnCompressionFile(pRomFile, new DirectoryInfo(BQDirectory.TempDir)); List <FileInfo> lFileList = BQIO.GetRomFile(new DirectoryInfo(BQDirectory.TempDir)); foreach (var file in lFileList) { RomInformation tRomInformation = ParseRom(pRomFile, isCNRom); lRomInformationList.Add(tRomInformation); } } else { RomInformation tRomInformation = ParseRom(pRomFile, isCNRom); lRomInformationList.Add(tRomInformation); } return(lRomInformationList); }
RomInformation IRomParser.ParseRom(FileInfo pRomFile) { if (pRomFile.Extension.ToLower() != ".cia") { return(new RomInformation()); } RomInformation lRomInfo = new RomInformation(); CIAGame cIAGame = new CIAGame(pRomFile.FullName); lRomInfo.BasicInfo.Serial = cIAGame.Serial; lRomInfo.BasicInfo.Title_ID = cIAGame.TitleId; lRomInfo.BasicInfo.Publisher = cIAGame.Publisher; lRomInfo.BasicInfo.Manufacturer = cIAGame.MakerCode; if (cIAGame.Titles.Count > 0) { lRomInfo.BasicInfo.English_Title = cIAGame.Titles[0].ShortDescription; } lRomInfo.ExpandInfo.LargeIcon = BQIO.BitmapToBitmapImage(cIAGame.LargeIcon); lRomInfo.ExpandInfo.SmallIcon = BQIO.BitmapToBitmapImage(cIAGame.SmallIcon); return(lRomInfo); }
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); }