private void InitilizeForm() { TaskStart(new Action(() => { try { BQLog.UpdateProgress("初始化组件", 1, 5); BQCore.Initialize(); } catch (BQException bqE) { System.Windows.MessageBox.Show(bqE.BQErrorMessage); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.ToString()); } try { BQLog.UpdateProgress("初始化Rom列表", 4, 5); InitializeRomList(); } catch (Exception ex) { System.Windows.MessageBox.Show("Initialize Rom List Error"); System.Windows.MessageBox.Show(ex.ToString()); } BQLog.UpdateProgress("初始化完成", 5, 5); }), UpdateLocalRomList); }
public static void Initialize() { // initialize components _RomParserList = Assembly.Load("BQRomParsers").GetTypes() .Where(elementClass => typeof(IRomParser).IsAssignableFrom(elementClass)).Select(type => (IRomParser)Activator.CreateInstance(type)).ToList(); _RomInfoNetCrawlerList = Assembly.Load("BQNetCrawlers").GetTypes() .Where(elementClass => typeof(IRomInfoNetCrawler).IsAssignableFrom(elementClass)).Select(type => (IRomInfoNetCrawler)Activator.CreateInstance(type)).ToList(); // initialize work folder BQDirectory.Initilize(); // Check3dsdb try { BQLog.UpdateProgress("初始化Rom信息", 2, 5); if (!BQ3dsdbXML.Check3dsdb()) { BQ3dsdbXML.Update3dsdbXMLFile(); } } catch (Exception ex) { throw new BQException() { Source = ex.Source, BQErrorMessage = "Update DB Error" }; } try { BQLog.UpdateProgress("初始化Rom数据库", 3, 5); // CheckDB if (!BQDB.CheckDBExist()) { BQDB.CreateNewDB(); List <RomInformation> AllRomInfoList = BQ3dsdbXML.GetAllRomInfo(); BQDB.InsertRomInfoList(AllRomInfoList); } } catch (Exception ex) { throw new BQException() { Source = ex.Source, BQErrorMessage = "Update DB Error" }; } }
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); }