/// <summary> /// /// </summary> public MainWindow() { _zipFileRepository = RepositoryManager.GetInstanceOf<IZipFileRepository>(); _gameRepository = RepositoryManager.GetInstanceOf<IMameGameRepository>(); _settingsService = ServiceManager.GetInstanceOf<IMameMinerSettingsService>(); _zipFileService = ServiceManager.GetInstanceOf<IZipFileService>(); InitializeComponent(); SetStatus("Main Window Created"); }
/// <summary> /// /// </summary> /// <param name="settingsService"></param> public SettingsWindow(IMameMinerSettingsService settingsService) { InitializeComponent(); _settingsService = settingsService; if(_settingsService != null) { this.GameExportPathTextBox.Text = _settingsService.GetMameExportPath(); this.PathToMameExeTextBox.Text = _settingsService.GetMameExecutablePath(); this.RomImportPathTextBox.Text = _settingsService.GetMameImportPath(); } }
/// <summary> /// /// </summary> public MainWindow() { _zipFileRepository = RepositoryManager.GetInstanceOf<IZipFileRepository>(); _gameRepository = RepositoryManager.GetInstanceOf<IMameGameRepository>(); _settingsService = ServiceManager.GetInstanceOf<IMameMinerSettingsService>(); _zipFileService = ServiceManager.GetInstanceOf<IZipFileService>(); InitializeComponent(); SetStatus("Main Window Created"); if (_settingsService.GetMameExecutablePath() == string.Empty || _settingsService.GetMameExportPath() == string.Empty || _settingsService.GetMameImportPath() == string.Empty) { new SettingsWindow(_settingsService).ShowDialog(); } }
//private ConcurrentQueue<SQLiteCommand> _cmdInsertQueue; /// <summary> /// /// </summary> public StandardZipFileService(IMameMinerSettingsService settingsService) { _dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.Create), "MameMiner", "mame_games.db"); _connectionString = string.Format("Data Source={0};Version=3;", _dbPath); if (!Directory.Exists(Path.GetDirectoryName(_dbPath))) { Directory.CreateDirectory(Path.GetDirectoryName(_dbPath)); } if (!File.Exists(_dbPath)) { CreateDatabase(); } _settingsService = settingsService; //_cmdInsertQueue = new ConcurrentQueue<SQLiteCommand>(); //Task.Factory.StartNew(() => //{ // while (true) // { // SQLiteCommand cmd = null; // if (_cmdInsertQueue.TryDequeue(out cmd)) // { // using (var connection = new SQLiteConnection(_connectionString)) // { // connection.Open(); // cmd.Connection = connection; // cmd.ExecuteNonQuery(); // connection.Close(); // } // } // } //}); }
public RomDetailsView(MameGame game) { InitializeComponent(); _game = game; if (_game == null) return; _zipFileRepository = RepositoryManager.GetInstanceOf<IZipFileRepository>(); _zipFileService = ServiceManager.GetInstanceOf<IZipFileService>(); _settingsService = ServiceManager.GetInstanceOf<IMameMinerSettingsService>(); this.GameNameTextBlock.Text = _game.GameName; this.GameDescriptionTextBlock.Text = _game.GameDescription; Task.Factory.StartNew(() => { var hasDuplicates = _game.GroupBy(x => x.RomName).Any(g => g.Count() > 1); var sb = new StringBuilder(); sb.AppendLine(string.Format("Report for : {0}.", game.GameDescription)); sb.AppendLine(string.Format("Number of Players : {0}.", game.NumberOfPlayers)); sb.AppendLine("==== Report on Game ===="); sb.AppendLine(string.Format("Game Driver Status : {0}", game.GameState.ToString())); sb.AppendLine(string.Format("Bad Dump? : {0}", game.Any(g => g.BadDump))); sb.AppendLine(string.Format("Bad CRC? : {0}", game.Any(g => g.BadCRC))); sb.AppendLine(string.Format("Bad SHA1?: {0}", game.Any(g => g.BadSHA1))); if (game.Any(g => g.BadDump)) { sb.AppendLine("At least one rom in the collection is recognized as beeing a bad dump. You may not be able to run this game."); } if(game.GameState == GameWorkingStateEnum.Preliminary) { sb.AppendLine("This game is ony preliminarily developed in Mame. Do not expect it to run."); } if (hasDuplicates) { sb.AppendLine("At least one rom is a duplicate entry from listrom results. You may not be able to run this game."); } sb.AppendLine("==== Report on Roms ===="); var missing = _zipFileRepository.FindMissingRoms(game); if (missing.Any()) { foreach (var m in missing) { sb.AppendLine(string.Format("Missing Rom with name of {0}", m.RomName, m.CRC)); } sb.AppendLine("You may not be able to play a game generated with missing roms."); } else { sb.AppendLine("No roms missing."); } Dispatcher.Invoke(() => GameDetailsTextBlock.Text = sb.ToString()); }); }