diff --git a/PinCab.Configurator/AddEditGameForm.Designer.cs b/PinCab.Configurator/AddEditGameForm.Designer.cs index 693961b..8da9992 100644 --- a/PinCab.Configurator/AddEditGameForm.Designer.cs +++ b/PinCab.Configurator/AddEditGameForm.Designer.cs @@ -72,14 +72,15 @@ private void InitializeComponent() this.label17 = new System.Windows.Forms.Label(); this.txtModified = new System.Windows.Forms.TextBox(); this.txtGameUrl = new System.Windows.Forms.TextBox(); - this.btnGameUrl = new System.Windows.Forms.Button(); - this.btnIpdbUrl = new System.Windows.Forms.Button(); this.txtRating = new System.Windows.Forms.TextBox(); this.label18 = new System.Windows.Forms.Label(); this.txtPlayers = new System.Windows.Forms.TextBox(); this.label19 = new System.Windows.Forms.Label(); this.cmbAlternateExe = new System.Windows.Forms.ComboBox(); this.btnDatabaseBrowser = new System.Windows.Forms.Button(); + this.btnShowNew = new System.Windows.Forms.Button(); + this.btnIpdbUrl = new System.Windows.Forms.Button(); + this.btnGameUrl = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 @@ -92,7 +93,6 @@ private void InitializeComponent() // // btnSave // - this.btnSave.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnSave.Location = new System.Drawing.Point(12, 550); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(75, 23); @@ -410,7 +410,7 @@ private void InitializeComponent() // // btnSelectFile // - this.btnSelectFile.Location = new System.Drawing.Point(301, 15); + this.btnSelectFile.Location = new System.Drawing.Point(381, 14); this.btnSelectFile.Name = "btnSelectFile"; this.btnSelectFile.Size = new System.Drawing.Size(75, 23); this.btnSelectFile.TabIndex = 48; @@ -451,32 +451,6 @@ private void InitializeComponent() this.txtGameUrl.Size = new System.Drawing.Size(366, 20); this.txtGameUrl.TabIndex = 61; // - // btnGameUrl - // - this.btnGameUrl.BackgroundImage = global::PinCab.Configurator.Properties.Resources.BrowserLink_75x; - this.btnGameUrl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.btnGameUrl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnGameUrl.ForeColor = System.Drawing.SystemColors.Control; - this.btnGameUrl.Location = new System.Drawing.Point(453, 425); - this.btnGameUrl.Name = "btnGameUrl"; - this.btnGameUrl.Size = new System.Drawing.Size(27, 23); - this.btnGameUrl.TabIndex = 62; - this.btnGameUrl.UseVisualStyleBackColor = true; - this.btnGameUrl.Click += new System.EventHandler(this.btnGameUrl_Click); - // - // btnIpdbUrl - // - this.btnIpdbUrl.BackgroundImage = global::PinCab.Configurator.Properties.Resources.BrowserLink_75x; - this.btnIpdbUrl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.btnIpdbUrl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnIpdbUrl.ForeColor = System.Drawing.SystemColors.Control; - this.btnIpdbUrl.Location = new System.Drawing.Point(167, 210); - this.btnIpdbUrl.Name = "btnIpdbUrl"; - this.btnIpdbUrl.Size = new System.Drawing.Size(26, 23); - this.btnIpdbUrl.TabIndex = 63; - this.btnIpdbUrl.UseVisualStyleBackColor = true; - this.btnIpdbUrl.Click += new System.EventHandler(this.btnIpdbUrl_Click); - // // txtRating // this.txtRating.Location = new System.Drawing.Point(215, 245); @@ -519,7 +493,7 @@ private void InitializeComponent() // // btnDatabaseBrowser // - this.btnDatabaseBrowser.Location = new System.Drawing.Point(382, 15); + this.btnDatabaseBrowser.Location = new System.Drawing.Point(462, 14); this.btnDatabaseBrowser.Name = "btnDatabaseBrowser"; this.btnDatabaseBrowser.Size = new System.Drawing.Size(107, 23); this.btnDatabaseBrowser.TabIndex = 69; @@ -527,11 +501,48 @@ private void InitializeComponent() this.btnDatabaseBrowser.UseVisualStyleBackColor = true; this.btnDatabaseBrowser.Click += new System.EventHandler(this.btnDatabaseBrowser_Click); // + // btnShowNew + // + this.btnShowNew.Location = new System.Drawing.Point(300, 14); + this.btnShowNew.Name = "btnShowNew"; + this.btnShowNew.Size = new System.Drawing.Size(75, 23); + this.btnShowNew.TabIndex = 70; + this.btnShowNew.Text = "Add New"; + this.btnShowNew.UseVisualStyleBackColor = true; + this.btnShowNew.Click += new System.EventHandler(this.btnShowNew_Click); + // + // btnIpdbUrl + // + this.btnIpdbUrl.BackgroundImage = global::PinCab.Configurator.Properties.Resources.BrowserLink_75x; + this.btnIpdbUrl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.btnIpdbUrl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnIpdbUrl.ForeColor = System.Drawing.SystemColors.Control; + this.btnIpdbUrl.Location = new System.Drawing.Point(167, 210); + this.btnIpdbUrl.Name = "btnIpdbUrl"; + this.btnIpdbUrl.Size = new System.Drawing.Size(26, 23); + this.btnIpdbUrl.TabIndex = 63; + this.btnIpdbUrl.UseVisualStyleBackColor = true; + this.btnIpdbUrl.Click += new System.EventHandler(this.btnIpdbUrl_Click); + // + // btnGameUrl + // + this.btnGameUrl.BackgroundImage = global::PinCab.Configurator.Properties.Resources.BrowserLink_75x; + this.btnGameUrl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.btnGameUrl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnGameUrl.ForeColor = System.Drawing.SystemColors.Control; + this.btnGameUrl.Location = new System.Drawing.Point(453, 425); + this.btnGameUrl.Name = "btnGameUrl"; + this.btnGameUrl.Size = new System.Drawing.Size(27, 23); + this.btnGameUrl.TabIndex = 62; + this.btnGameUrl.UseVisualStyleBackColor = true; + this.btnGameUrl.Click += new System.EventHandler(this.btnGameUrl_Click); + // // AddEditGameForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(534, 583); + this.ClientSize = new System.Drawing.Size(581, 583); + this.Controls.Add(this.btnShowNew); this.Controls.Add(this.btnDatabaseBrowser); this.Controls.Add(this.cmbAlternateExe); this.Controls.Add(this.txtPlayers); @@ -645,5 +656,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label19; private System.Windows.Forms.ComboBox cmbAlternateExe; private System.Windows.Forms.Button btnDatabaseBrowser; + private System.Windows.Forms.Button btnShowNew; } } \ No newline at end of file diff --git a/PinCab.Configurator/AddEditGameForm.cs b/PinCab.Configurator/AddEditGameForm.cs index c26e1ad..5e22b29 100644 --- a/PinCab.Configurator/AddEditGameForm.cs +++ b/PinCab.Configurator/AddEditGameForm.cs @@ -32,7 +32,9 @@ public AddEditGameForm(FrontEndGameViewModel setting, string databaseFile, Front _databaseFile = databaseFile; _ipdbForm = ipdbForm; if (string.IsNullOrEmpty(setting.Description)) + { isNewEntry = true; + } if (_ipdbForm == null) _ipdbForm = new IpdbBrowserForm(txtTableName.Text, true); LoadForm(); @@ -90,6 +92,7 @@ private FrontEndGameViewModel GetSettingFromControls() _setting.Players = txtPlayCount.Text.IfEmptyThenNull(); _setting.TimesPlayed = Convert.ToInt32(txtPlayCount.Text); _setting.SecondsPlayed = Convert.ToInt32(txtSeconds.Text); + _setting.Enabled = chkEnabled.Checked; if (!string.IsNullOrEmpty(txtAdded.Text)) { DateTime result; @@ -139,6 +142,7 @@ private void btnSave_Click(object sender, EventArgs e) } _manager.SaveGame(result); + DialogResult = DialogResult.OK; Close(); } @@ -209,5 +213,26 @@ private void btnDatabaseBrowser_Click(object sender, EventArgs e) form.SearchByText(txtDisplayName.Text, new DateTime(1900,1,1), DateTime.Today.AddDays(1), new List()); var result = form.ShowDialog(this); } + + private void btnShowNew_Click(object sender, EventArgs e) + { + var addNewForm = new AddNewGameForm(_setting.FrontEnd, _setting.DatabaseFile, _manager); + var result = addNewForm.ShowDialog(this); + if (result == DialogResult.OK) + { + if (addNewForm.lstFiles.SelectedItem != null) //Can't select from an empty list + { + var fi = new FileInfo(addNewForm.lstFiles.SelectedItem.ToString()); + var endIndex = fi.Name.LastIndexOf(fi.Extension); + originalFileName = txtTableName.Text; + txtTableName.Text = fi.Name.Substring(0, endIndex); + if (isNewEntry) + { + txtModified.Text = fi.LastWriteTime.ToString(); + txtAdded.Text = fi.CreationTime.ToString(); + } + } + } + } } } diff --git a/PinCab.Configurator/AddNewGameForm.Designer.cs b/PinCab.Configurator/AddNewGameForm.Designer.cs new file mode 100644 index 0000000..4585a95 --- /dev/null +++ b/PinCab.Configurator/AddNewGameForm.Designer.cs @@ -0,0 +1,88 @@ + +namespace PinCab.Configurator +{ + partial class AddNewGameForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lstFiles = new System.Windows.Forms.ListBox(); + this.btnSelect = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // lstFiles + // + this.lstFiles.Dock = System.Windows.Forms.DockStyle.Top; + this.lstFiles.FormattingEnabled = true; + this.lstFiles.Location = new System.Drawing.Point(0, 0); + this.lstFiles.Name = "lstFiles"; + this.lstFiles.Size = new System.Drawing.Size(455, 212); + this.lstFiles.TabIndex = 0; + this.lstFiles.SelectedIndexChanged += new System.EventHandler(this.lstFiles_SelectedIndexChanged); + // + // btnSelect + // + this.btnSelect.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnSelect.Location = new System.Drawing.Point(2, 224); + this.btnSelect.Name = "btnSelect"; + this.btnSelect.Size = new System.Drawing.Size(75, 23); + this.btnSelect.TabIndex = 1; + this.btnSelect.Text = "Select"; + this.btnSelect.UseVisualStyleBackColor = true; + this.btnSelect.Click += new System.EventHandler(this.btnSelect_Click); + // + // button1 + // + this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.button1.Location = new System.Drawing.Point(103, 224); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 2; + this.button1.Text = "Cancel"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // AddNewGameForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(455, 259); + this.Controls.Add(this.button1); + this.Controls.Add(this.btnSelect); + this.Controls.Add(this.lstFiles); + this.Name = "AddNewGameForm"; + this.Text = "Add New Game"; + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Button btnSelect; + private System.Windows.Forms.Button button1; + public System.Windows.Forms.ListBox lstFiles; + } +} \ No newline at end of file diff --git a/PinCab.Configurator/AddNewGameForm.cs b/PinCab.Configurator/AddNewGameForm.cs new file mode 100644 index 0000000..4142cd9 --- /dev/null +++ b/PinCab.Configurator/AddNewGameForm.cs @@ -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(); + } + } +} diff --git a/PinCab.Configurator/AddNewGameForm.resx b/PinCab.Configurator/AddNewGameForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/PinCab.Configurator/AddNewGameForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/PinCab.Configurator/GameManagerForm.Designer.cs b/PinCab.Configurator/GameManagerForm.Designer.cs index 2b03e15..3a61a85 100644 --- a/PinCab.Configurator/GameManagerForm.Designer.cs +++ b/PinCab.Configurator/GameManagerForm.Designer.cs @@ -49,6 +49,7 @@ private void InitializeComponent() this.showGamesWithUpdatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.refreshListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openMediaFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.tableAuditToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.txtLog = new System.Windows.Forms.TextBox(); this.backgroundWorkerProgressBar = new System.ComponentModel.BackgroundWorker(); this.panel1 = new System.Windows.Forms.Panel(); @@ -68,6 +69,10 @@ private void InitializeComponent() this.mediaAuditToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.massRecordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.statusStripBottom = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabelSpacer = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripProgressBar = new System.Windows.Forms.ToolStripProgressBar(); this.fileNameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.descriptionDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.manufacturerDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -99,11 +104,6 @@ private void InitializeComponent() this.ManufacturerMediaStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.hasWheelImageDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.frontEndGameBindingSource = new System.Windows.Forms.BindingSource(this.components); - this.statusStripBottom = new System.Windows.Forms.StatusStrip(); - this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusLabelSpacer = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripProgressBar = new System.Windows.Forms.ToolStripProgressBar(); - this.tableAuditToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -112,8 +112,8 @@ private void InitializeComponent() this.contextMenuStripGridActions.SuspendLayout(); this.panel1.SuspendLayout(); this.menuStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.frontEndGameBindingSource)).BeginInit(); this.statusStripBottom.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.frontEndGameBindingSource)).BeginInit(); this.SuspendLayout(); // // splitContainer1 @@ -282,6 +282,7 @@ private void InitializeComponent() this.launchGameToolStripMenuItem.Name = "launchGameToolStripMenuItem"; this.launchGameToolStripMenuItem.Size = new System.Drawing.Size(302, 22); this.launchGameToolStripMenuItem.Text = "Launch Game"; + this.launchGameToolStripMenuItem.Click += new System.EventHandler(this.launchGameToolStripMenuItem_Click); // // viewIPDBPageToolStripMenuItem // @@ -316,6 +317,12 @@ private void InitializeComponent() this.openMediaFolderToolStripMenuItem.Text = "Open Media Folder"; this.openMediaFolderToolStripMenuItem.Click += new System.EventHandler(this.openMediaFolderToolStripMenuItem_Click); // + // tableAuditToolStripMenuItem + // + this.tableAuditToolStripMenuItem.Name = "tableAuditToolStripMenuItem"; + this.tableAuditToolStripMenuItem.Size = new System.Drawing.Size(302, 22); + this.tableAuditToolStripMenuItem.Text = "Table Audit"; + // // txtLog // this.txtLog.Dock = System.Windows.Forms.DockStyle.Fill; @@ -491,6 +498,36 @@ private void InitializeComponent() this.helpToolStripMenuItem.Text = "Help"; this.helpToolStripMenuItem.Click += new System.EventHandler(this.helpToolStripMenuItem_Click); // + // statusStripBottom + // + this.statusStripBottom.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel, + this.toolStripStatusLabelSpacer, + this.toolStripProgressBar}); + this.statusStripBottom.Location = new System.Drawing.Point(0, 531); + this.statusStripBottom.Name = "statusStripBottom"; + this.statusStripBottom.Size = new System.Drawing.Size(955, 22); + this.statusStripBottom.TabIndex = 10; + this.statusStripBottom.Text = "statusStrip1"; + // + // toolStripStatusLabel + // + this.toolStripStatusLabel.Name = "toolStripStatusLabel"; + this.toolStripStatusLabel.Size = new System.Drawing.Size(67, 17); + this.toolStripStatusLabel.Text = "Status Here"; + // + // toolStripStatusLabelSpacer + // + this.toolStripStatusLabelSpacer.Name = "toolStripStatusLabelSpacer"; + this.toolStripStatusLabelSpacer.Size = new System.Drawing.Size(771, 17); + this.toolStripStatusLabelSpacer.Spring = true; + // + // toolStripProgressBar + // + this.toolStripProgressBar.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + this.toolStripProgressBar.Name = "toolStripProgressBar"; + this.toolStripProgressBar.Size = new System.Drawing.Size(100, 16); + // // fileNameDataGridViewTextBoxColumn // this.fileNameDataGridViewTextBoxColumn.DataPropertyName = "FileName"; @@ -735,42 +772,6 @@ private void InitializeComponent() // this.frontEndGameBindingSource.DataSource = typeof(PinCab.Utils.ViewModels.FrontEndGameViewModel); // - // statusStripBottom - // - this.statusStripBottom.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripStatusLabel, - this.toolStripStatusLabelSpacer, - this.toolStripProgressBar}); - this.statusStripBottom.Location = new System.Drawing.Point(0, 531); - this.statusStripBottom.Name = "statusStripBottom"; - this.statusStripBottom.Size = new System.Drawing.Size(955, 22); - this.statusStripBottom.TabIndex = 10; - this.statusStripBottom.Text = "statusStrip1"; - // - // toolStripStatusLabel - // - this.toolStripStatusLabel.Name = "toolStripStatusLabel"; - this.toolStripStatusLabel.Size = new System.Drawing.Size(67, 17); - this.toolStripStatusLabel.Text = "Status Here"; - // - // toolStripStatusLabelSpacer - // - this.toolStripStatusLabelSpacer.Name = "toolStripStatusLabelSpacer"; - this.toolStripStatusLabelSpacer.Size = new System.Drawing.Size(740, 17); - this.toolStripStatusLabelSpacer.Spring = true; - // - // toolStripProgressBar - // - this.toolStripProgressBar.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this.toolStripProgressBar.Name = "toolStripProgressBar"; - this.toolStripProgressBar.Size = new System.Drawing.Size(100, 16); - // - // tableAuditToolStripMenuItem - // - this.tableAuditToolStripMenuItem.Name = "tableAuditToolStripMenuItem"; - this.tableAuditToolStripMenuItem.Size = new System.Drawing.Size(302, 22); - this.tableAuditToolStripMenuItem.Text = "Table Audit"; - // // GameManagerForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -794,9 +795,9 @@ private void InitializeComponent() this.panel1.PerformLayout(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.frontEndGameBindingSource)).EndInit(); this.statusStripBottom.ResumeLayout(false); this.statusStripBottom.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.frontEndGameBindingSource)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/PinCab.Configurator/GameManagerForm.cs b/PinCab.Configurator/GameManagerForm.cs index a409660..6ae0823 100644 --- a/PinCab.Configurator/GameManagerForm.cs +++ b/PinCab.Configurator/GameManagerForm.cs @@ -361,5 +361,10 @@ private void backgroundWorkerProgressBar_ProgressChanged(object sender, Progress { toolStripProgressBar.Value = e.ProgressPercentage; } + + private void launchGameToolStripMenuItem_Click(object sender, EventArgs e) + { + + } } } diff --git a/PinCab.Configurator/Pincab.Configurator.csproj b/PinCab.Configurator/Pincab.Configurator.csproj index e865950..e8f9776 100644 --- a/PinCab.Configurator/Pincab.Configurator.csproj +++ b/PinCab.Configurator/Pincab.Configurator.csproj @@ -154,6 +154,12 @@ AboutBoxForm.cs + + Form + + + AddNewGameForm.cs + Form @@ -235,6 +241,9 @@ AboutBoxForm.cs + + AddNewGameForm.cs + IpdbBrowserForm.cs diff --git a/PinCab.Utils/Extensions/ObjectExtensions.cs b/PinCab.Utils/Extensions/ObjectExtensions.cs index 22922af..a856b9b 100644 --- a/PinCab.Utils/Extensions/ObjectExtensions.cs +++ b/PinCab.Utils/Extensions/ObjectExtensions.cs @@ -9,6 +9,27 @@ namespace PinCab.Utils.Extensions { public static class ObjectExtensions { + /// + /// Returns true if current object is equal to any of the items in objs[] or false if there are no matches. (Safe if the object this method extends is null) (Do not use in Linq to SQL queries.) + /// + /// + /// + /// + public static bool In(this T obj, params T[] objs) + { + if (objs == null) + return obj == null; + + foreach (T o in objs) + { + if (obj == null && o == null) + return true; + else if (obj?.Equals(o) == true) + return true; + } + return false; + } + public static Object GetPropValue(this Object obj, String name) { foreach (String part in name.Split('.')) diff --git a/PinCab.Utils/Utils/FrontEndManager.cs b/PinCab.Utils/Utils/FrontEndManager.cs index fec37e8..22563c1 100644 --- a/PinCab.Utils/Utils/FrontEndManager.cs +++ b/PinCab.Utils/Utils/FrontEndManager.cs @@ -131,6 +131,15 @@ private PinballXGame MapViewToGame(PinballXSystem system, PinballXGame pbxGame, return pbxGame; } + public PinballXSystem GetPinballXSystemByDatabaseFile(string fileName) + { + if (_pinballXSystems != null) + { + return _pinballXSystems.FirstOrDefault(c => c.DatabaseFiles.Any(d => d == fileName)); + } + return null; + } + public List GetGamesForFrontEndAndDatabase(FrontEnd frontEnd, string databaseFile) { var frontEndGames = new List(); diff --git a/PinCab.Utils/ViewModels/FrontEndGameViewModel.cs b/PinCab.Utils/ViewModels/FrontEndGameViewModel.cs index bbc386e..0f6d5ee 100644 --- a/PinCab.Utils/ViewModels/FrontEndGameViewModel.cs +++ b/PinCab.Utils/ViewModels/FrontEndGameViewModel.cs @@ -20,6 +20,7 @@ public FrontEndGameViewModel() TopperStatus = MediaStatus.NotFound; ManufacturerMediaStatus = MediaStatus.NotFound; MediaItems = new List(); + Enabled = true; } public FrontEnd FrontEnd { get; set; }