-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
446 additions
and
75 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using PinCab.Utils.Extensions; | ||
using PinCab.Utils.Models; | ||
using PinCab.Utils.Utils; | ||
using PinCab.Utils.ViewModels; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Drawing; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace PinCab.Configurator | ||
{ | ||
public partial class AddNewGameForm : Form | ||
{ | ||
private string _databaseFile { get; set; } | ||
private FrontEndManager _manager { get; set; } | ||
private FrontEnd _frontEnd { get; set; } | ||
public AddNewGameForm(FrontEnd frontEnd, string databaseFile, FrontEndManager manager) | ||
{ | ||
InitializeComponent(); | ||
_databaseFile = databaseFile; | ||
_manager = manager; | ||
_frontEnd = frontEnd; | ||
LoadNewEntries(); | ||
} | ||
|
||
private void LoadNewEntries() | ||
{ | ||
if (_frontEnd.System == FrontEndSystem.PinballX) | ||
{ | ||
var selectedSystem = _manager.GetPinballXSystemByDatabaseFile(_databaseFile); | ||
var gameList = _manager.GetGamesForFrontEndAndDatabase(_frontEnd, _databaseFile); | ||
|
||
//Now find all files in the systems folder that don't already exist in the gameList | ||
var di = new DirectoryInfo(selectedSystem.TablePath); | ||
if (di.Exists) | ||
{ | ||
var files = di.GetFiles(); | ||
var tablePathsAlreadyInDatabase = gameList.Select(c => c.FullPathToTable); | ||
foreach (var file in files) | ||
{ | ||
if (selectedSystem.Type == Platform.VP && | ||
file.Extension.In(".vpt", ".vpx") && | ||
!tablePathsAlreadyInDatabase.Any(c => c == file.FullName)) | ||
{ | ||
lstFiles.Items.Add(file.FullName); | ||
} | ||
else if (selectedSystem.Type == Platform.FP && | ||
file.Extension.In(".fpt") && | ||
!tablePathsAlreadyInDatabase.Any(c => c == file.FullName)) | ||
{ | ||
lstFiles.Items.Add(file.FullName); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void btnSelect_Click(object sender, EventArgs e) | ||
{ | ||
Close(); | ||
} | ||
|
||
private void button1_Click(object sender, EventArgs e) | ||
{ | ||
Close(); | ||
} | ||
|
||
private void lstFiles_SelectedIndexChanged(object sender, EventArgs e) | ||
{ | ||
DialogResult = DialogResult.OK; | ||
Close(); | ||
} | ||
} | ||
} |
Oops, something went wrong.