diff --git a/PinCab.Configurator/DatabaseBrowserForm.Designer.cs b/PinCab.Configurator/DatabaseBrowserForm.Designer.cs index 5187337..34a44cf 100644 --- a/PinCab.Configurator/DatabaseBrowserForm.Designer.cs +++ b/PinCab.Configurator/DatabaseBrowserForm.Designer.cs @@ -65,6 +65,9 @@ private void InitializeComponent() this.contextMenuStripGridActions = new System.Windows.Forms.ContextMenuStrip(this.components); this.IpdbInfoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.goToUrlToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addNewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.vpinDatabaseSettingBindingSource = new System.Windows.Forms.BindingSource(this.components); this.txtLog = new System.Windows.Forms.TextBox(); this.splitContainerGridAndLog = new System.Windows.Forms.SplitContainer(); @@ -87,8 +90,6 @@ private void InitializeComponent() this.toolStripStatusLabelSpacer = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripProgressBar = new System.Windows.Forms.ToolStripProgressBar(); this.statusStripBottom = new System.Windows.Forms.StatusStrip(); - this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.panelFilterCriteria.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewEntryList)).BeginInit(); @@ -201,7 +202,7 @@ private void InitializeComponent() this.cmbDatabase.FormattingEnabled = true; this.cmbDatabase.Location = new System.Drawing.Point(65, 55); this.cmbDatabase.Name = "cmbDatabase"; - this.cmbDatabase.Size = new System.Drawing.Size(144, 21); + this.cmbDatabase.Size = new System.Drawing.Size(191, 21); this.cmbDatabase.TabIndex = 12; this.cmbDatabase.Text = "All"; this.cmbDatabase.SelectedIndexChanged += new System.EventHandler(this.cmbDatabase_SelectedIndexChanged); @@ -417,25 +418,47 @@ private void InitializeComponent() this.contextMenuStripGridActions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.IpdbInfoToolStripMenuItem, this.goToUrlToolStripMenuItem, + this.addNewToolStripMenuItem, this.editToolStripMenuItem, this.deleteToolStripMenuItem}); this.contextMenuStripGridActions.Name = "contextMenuStripGridActions"; - this.contextMenuStripGridActions.Size = new System.Drawing.Size(181, 114); + this.contextMenuStripGridActions.Size = new System.Drawing.Size(128, 114); // // IpdbInfoToolStripMenuItem // this.IpdbInfoToolStripMenuItem.Name = "IpdbInfoToolStripMenuItem"; - this.IpdbInfoToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.IpdbInfoToolStripMenuItem.Size = new System.Drawing.Size(127, 22); this.IpdbInfoToolStripMenuItem.Text = "IPDB Info"; this.IpdbInfoToolStripMenuItem.Click += new System.EventHandler(this.IpdbInfoToolStripMenuItem_Click); // // goToUrlToolStripMenuItem // this.goToUrlToolStripMenuItem.Name = "goToUrlToolStripMenuItem"; - this.goToUrlToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.goToUrlToolStripMenuItem.Size = new System.Drawing.Size(127, 22); this.goToUrlToolStripMenuItem.Text = "Go to URL"; this.goToUrlToolStripMenuItem.Click += new System.EventHandler(this.goToUrlToolStripMenuItem_Click); // + // addNewToolStripMenuItem + // + this.addNewToolStripMenuItem.Name = "addNewToolStripMenuItem"; + this.addNewToolStripMenuItem.Size = new System.Drawing.Size(127, 22); + this.addNewToolStripMenuItem.Text = "Add New"; + this.addNewToolStripMenuItem.Click += new System.EventHandler(this.addNewToolStripMenuItem_Click); + // + // editToolStripMenuItem + // + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(127, 22); + this.editToolStripMenuItem.Text = "Edit"; + this.editToolStripMenuItem.Click += new System.EventHandler(this.editToolStripMenuItem_Click); + // + // deleteToolStripMenuItem + // + this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(127, 22); + this.deleteToolStripMenuItem.Text = "Delete"; + this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); + // // vpinDatabaseSettingBindingSource // this.vpinDatabaseSettingBindingSource.DataSource = typeof(PinCab.Utils.Models.DatabaseBrowserEntry); @@ -645,19 +668,6 @@ private void InitializeComponent() this.statusStripBottom.TabIndex = 6; this.statusStripBottom.Text = "statusStrip1"; // - // editToolStripMenuItem - // - this.editToolStripMenuItem.Name = "editToolStripMenuItem"; - this.editToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.editToolStripMenuItem.Text = "Edit"; - this.editToolStripMenuItem.Click += new System.EventHandler(this.editToolStripMenuItem_Click); - // - // deleteToolStripMenuItem - // - this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; - this.deleteToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.deleteToolStripMenuItem.Text = "Delete"; - // // DatabaseBrowserForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -757,5 +767,6 @@ private void InitializeComponent() private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn8; private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addNewToolStripMenuItem; } } \ No newline at end of file diff --git a/PinCab.Configurator/DatabaseBrowserForm.cs b/PinCab.Configurator/DatabaseBrowserForm.cs index 281ecde..dc6623d 100644 --- a/PinCab.Configurator/DatabaseBrowserForm.cs +++ b/PinCab.Configurator/DatabaseBrowserForm.cs @@ -23,10 +23,13 @@ public partial class DatabaseBrowserForm : Form { private readonly DatabaseManager _dbManager = new DatabaseManager(); private readonly ProgramSettingsManager _settingManager = new ProgramSettingsManager(); - //private BackgroundQueue _queue = new BackgroundQueue(); + private IpdbBrowserForm _ipdbForm = new IpdbBrowserForm(string.Empty, true); + private bool _loading = true; private ProgramSettings _settings { get; set; } + private bool notifiedOfSaveWarning = false; + public DatabaseBrowserForm() { InitializeComponent(); @@ -56,9 +59,9 @@ private void ConfigureFilters() //Load from the last state (create a database form manager that persists filter selections to .json setting file) dateTimePickerBegin.Value = _settings.DatabaseBrowserSettings.BeginDate.BeginningOfDay(); dateTimePickerEnd.Value = _settings.DatabaseBrowserSettings.EndDate.EndOfDay(); - var databaseTypeList = EnumExtensions.GetEnumDescriptionList(); - databaseTypeList.Insert(0, "All"); - cmbType.DataSource = databaseTypeList; + var categoryList = EnumExtensions.GetEnumDescriptionList(); + categoryList.Insert(0, "All"); + cmbType.DataSource = categoryList; txtSearch.Text = _settings.DatabaseBrowserSettings.SearchTerm; //Load the database list @@ -108,7 +111,7 @@ private void SetDatabaseGridWidths() count = 1; foreach (var setting in _settings.DatabaseBrowserSettings.RelatedGridColumnWidths) { - if (count <= dataGridViewChildEntries.Columns.Count) + if (count <= dataGridViewChildEntries.Columns.Count) dataGridViewChildEntries.Columns[count - 1].Width = setting; count++; } @@ -585,7 +588,10 @@ private void dataGridViewEntryList_RowContextMenuStripNeeded(object sender, Data private void dataGridViewChildEntries_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { - dataGridViewChildEntries.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells); + if (e.ListChangedType != ListChangedType.Reset && _settings.DatabaseBrowserSettings.RelatedGridColumnWidths.Count == 0) + { + dataGridViewEntryList.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells); + } } private void dataGridViewChildEntries_RowContextMenuStripNeeded(object sender, DataGridViewRowContextMenuStripNeededEventArgs e) @@ -652,10 +658,13 @@ private void DatabaseBrowserForm_FormClosing(object sender, FormClosingEventArgs settings.DatabaseFilter = cmbDatabase.SelectedItem.ToString(); settings.TagFilter = GetAllSelectedTags(); + settings.DatabaseGridColumnWidths = new List(); foreach (DataGridViewColumn column in dataGridViewEntryList.Columns) { settings.DatabaseGridColumnWidths.Add(column.Width); } + + settings.RelatedGridColumnWidths = new List(); foreach (DataGridViewColumn column in dataGridViewChildEntries.Columns) { settings.RelatedGridColumnWidths.Add(column.Width); @@ -675,15 +684,115 @@ private void chkFuzzyMatch_CheckedChanged(object sender, EventArgs e) RebindGridUsingFilter(); } + private DatabaseBrowserEntry GetActiveRow() + { + var data = dataGridViewEntryList.DataSource as BindingSource; + return data.Current as DatabaseBrowserEntry; + } + private void editToolStripMenuItem_Click(object sender, EventArgs e) { - //Get the source database entry + var row = GetActiveRow(); + if (row != null) + { + var entryForm = new EditDatabaseEntryForm(cmbDatabase.SelectedItem.ToString(), row, _dbManager, _ipdbForm); + var result = entryForm.ShowDialog(this); + if (result == DialogResult.OK) + { + //Reload the settings incase a new database was added + _settings = _settingManager.LoadSettings(); + + var contentDatabase = _settings.Databases.First(c => c.Name == cmbDatabase.SelectedItem.ToString()); + + var dbFile = entryForm.GetUpdatedDatabaseEntry(); + dbFile = _dbManager.SanitizeEntry(dbFile); + //Upon Successful response update the entries list (_dbManager.Entires) + //var updatedDatabaseEntry = _dbManager.GetDatabaseBrowserEntry(contentDatabase, entryForm.GetUpdatedDatabaseEntry()); + + //Save the entry to the corresponding _dbManager.Databases (this happens automatically as we update the reference to it) + //var test = _dbManager.Databases[cmbDatabase.SelectedItem.ToString()].Entries.Where(c => c.Id == dbFile.Id); + var databasePath = _dbManager.GetFilesystemWorkPath(contentDatabase); + var databaseToSave = _dbManager.Databases[cmbDatabase.SelectedItem.ToString()]; + _dbManager.SaveDatabaseCache(databaseToSave, databasePath); //Save the actual database .json file + + //Save the pre-processed database to the file system + var existingEntry = _dbManager.Entries.FirstOrDefault(c => c.Id == dbFile.Id); + _dbManager.MapDatabaseEntryToBrowserEntry(contentDatabase, dbFile, existingEntry); + _dbManager.SaveDatabaseCache>(_dbManager.Entries, _dbManager.PreprocessedDatabasePath); + + //Refresh grid (will do that automatically) + NotifyUserOfSaveWarning(); + } + } + } + + public void NotifyUserOfSaveWarning() + { + if (!notifiedOfSaveWarning) + { + MessageBox.Show("Notice: Your entry has been saved to a temporary location. \r\n\r\n" + + "You must sync your changes before the entry is permanently saved.\r\n\r\n" + + "If you fail to sync your changes and exist the program your changes could get overwritten by the scheduled refresh interval.\r\n\r\n" + + "If you don't want this to happen you can set the refresh interval to a very large value and always do manual refreshes or just remember to sync your changes before exiting the database browser.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Warning); + notifiedOfSaveWarning = true; + } + } + + private void addNewToolStripMenuItem_Click(object sender, EventArgs e) + { + var entryForm = new EditDatabaseEntryForm(cmbDatabase.SelectedItem.ToString(), null, _dbManager, _ipdbForm); + var result = entryForm.ShowDialog(this); + if (result == DialogResult.OK) + { + //Reload the settings incase a new database was added + _settings = _settingManager.LoadSettings(); + + var contentDatabase = _settings.Databases.First(c => c.Name == cmbDatabase.SelectedItem.ToString()); + + var dbFile = entryForm.GetUpdatedDatabaseEntry(); + dbFile = _dbManager.SanitizeEntry(dbFile); + //Upon Successful response update the entries list (_dbManager.Entires) + //var updatedDatabaseEntry = _dbManager.GetDatabaseBrowserEntry(contentDatabase, entryForm.GetUpdatedDatabaseEntry()); + + //Save tne entry to the corresponding _dbManager.Databases (this happens automatically as we update the reference to it) + //var test = _dbManager.Databases[cmbDatabase.SelectedItem.ToString()].Entries.Where(c => c.Id == dbFile.Id); + var databasePath = _dbManager.GetFilesystemWorkPath(contentDatabase); + var databaseToSave = _dbManager.Databases[cmbDatabase.SelectedItem.ToString()]; + databaseToSave.Entries.Add(dbFile); + _dbManager.SaveDatabaseCache(databaseToSave, databasePath); //Save the actual database .json file + + //Save the pre-processed database to the file system + //var existingEntry = _dbManager.Entries.FirstOrDefault(c => c.Id == dbFile.Id); + var updatedDatabaseEntry = _dbManager.GetDatabaseBrowserEntry(contentDatabase, entryForm.GetUpdatedDatabaseEntry()); + _dbManager.Entries.Add(updatedDatabaseEntry); + //_dbManager.MapDatabaseEntryToBrowserEntry(contentDatabase, dbFile, updatedDatabaseEntry); + _dbManager.SaveDatabaseCache>(_dbManager.Entries, _dbManager.PreprocessedDatabasePath); + + //Refresh grid + RebindGridUsingFilter(); + NotifyUserOfSaveWarning(); + } + } - //Load the form + private void deleteToolStripMenuItem_Click(object sender, EventArgs e) + { + var row = GetActiveRow(); + if (row != null) + { + //Scan the database it's attached to to see how many related entries need to be removed - //Upon Successful response update the entry + //Prompt to user indicating how many other entries will be cleaned up - //Save the pre-processed database again + //Remove the entry from _dbManager.Databases + + //Remove the entry from _dbManager.Entries + + //Save the actual database .json + + //Save the pre-processed database to the file system + + NotifyUserOfSaveWarning(); + } } } } diff --git a/PinCab.Configurator/EditDatabaseEntryForm.Designer.cs b/PinCab.Configurator/EditDatabaseEntryForm.Designer.cs index 43e3311..ec3a089 100644 --- a/PinCab.Configurator/EditDatabaseEntryForm.Designer.cs +++ b/PinCab.Configurator/EditDatabaseEntryForm.Designer.cs @@ -28,9 +28,31 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.btnSave = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); - this.colorDialogDmdColor = new System.Windows.Forms.ColorDialog(); + this.tabControlGeneral = new System.Windows.Forms.TabControl(); + this.tabPageGeneral = new System.Windows.Forms.TabPage(); + this.label23 = new System.Windows.Forms.Label(); + this.lblLocalTime = new System.Windows.Forms.Label(); + this.cmbDatabase = new System.Windows.Forms.ComboBox(); + this.label22 = new System.Windows.Forms.Label(); + this.btnIpdbUrl = new System.Windows.Forms.Button(); + this.btnUrl = new System.Windows.Forms.Button(); + this.btnAddTag = new System.Windows.Forms.Button(); + this.txtTag = new System.Windows.Forms.TextBox(); + this.lblTags = new System.Windows.Forms.Label(); + this.flowLayoutPanelTags = new System.Windows.Forms.FlowLayoutPanel(); + this.btnFillFromIpdb = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.label18 = new System.Windows.Forms.Label(); + this.dateTimeModified = new System.Windows.Forms.DateTimePicker(); + this.numericRating = new System.Windows.Forms.NumericUpDown(); + this.label17 = new System.Windows.Forms.Label(); + this.numericDownloadCount = new System.Windows.Forms.NumericUpDown(); + this.label16 = new System.Windows.Forms.Label(); + this.numericFileBytes = new System.Windows.Forms.NumericUpDown(); + this.label1 = new System.Windows.Forms.Label(); this.txtIpdbNumber = new System.Windows.Forms.TextBox(); this.label14 = new System.Windows.Forms.Label(); this.txtTheme = new System.Windows.Forms.TextBox(); @@ -43,18 +65,15 @@ private void InitializeComponent() this.button1 = new System.Windows.Forms.Button(); this.cmbCategory = new System.Windows.Forms.ComboBox(); this.lblId = new System.Windows.Forms.Label(); - this.btnGameUrl = new System.Windows.Forms.Button(); - this.txtGameUrl = new System.Windows.Forms.TextBox(); - this.label17 = new System.Windows.Forms.Label(); - this.txtAdded = new System.Windows.Forms.TextBox(); + this.txtFeatures = new System.Windows.Forms.TextBox(); this.label15 = new System.Windows.Forms.Label(); this.txtVersion = new System.Windows.Forms.TextBox(); this.txtAuthors = new System.Windows.Forms.TextBox(); this.label13 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); - this.txtIpdb = new System.Windows.Forms.TextBox(); + this.txtChangeLog = new System.Windows.Forms.TextBox(); this.label10 = new System.Windows.Forms.Label(); - this.txtAuthor = new System.Windows.Forms.TextBox(); + this.txtDescription = new System.Windows.Forms.TextBox(); this.label8 = new System.Windows.Forms.Label(); this.txtFileName = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); @@ -65,13 +84,55 @@ private void InitializeComponent() this.lblManufacturer = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); + this.tabPageAdditionalInfo = new System.Windows.Forms.TabPage(); + this.label24 = new System.Windows.Forms.Label(); + this.btnAddRelatedEntry = new System.Windows.Forms.Button(); + this.dataGridViewRelatedEntries = new System.Windows.Forms.DataGridView(); + this.idDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.majorCategoryDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.urlDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.titleDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.fileNameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.descriptionDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.changeLogDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.authorsDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.versionDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.featuresDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.manufacturerDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.yearDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.playersDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.themeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ipdbNumberDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.fileSizeBytesDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.downloadCountDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ratingDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.lastModifiedDateUtcDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.databaseEntryBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.label21 = new System.Windows.Forms.Label(); + this.dataGridViewScreenshotUrls = new System.Windows.Forms.DataGridView(); + this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.label20 = new System.Windows.Forms.Label(); + this.label19 = new System.Windows.Forms.Label(); + this.dataGridViewAdditionalUrls = new System.Windows.Forms.DataGridView(); + this.Url = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.lblReadableFileSize = new System.Windows.Forms.Label(); + this.tabControlGeneral.SuspendLayout(); + this.tabPageGeneral.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericRating)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericDownloadCount)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericFileBytes)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericYear)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericPlayers)).BeginInit(); + this.tabPageAdditionalInfo.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewRelatedEntries)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.databaseEntryBindingSource)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewScreenshotUrls)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewAdditionalUrls)).BeginInit(); this.SuspendLayout(); // // btnSave // - this.btnSave.Location = new System.Drawing.Point(12, 550); + this.btnSave.Location = new System.Drawing.Point(4, 685); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(75, 23); this.btnSave.TabIndex = 8; @@ -82,7 +143,7 @@ private void InitializeComponent() // btnCancel // this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(118, 550); + this.btnCancel.Location = new System.Drawing.Point(93, 685); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 9; @@ -90,42 +151,312 @@ private void InitializeComponent() this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // + // tabControlGeneral + // + this.tabControlGeneral.Controls.Add(this.tabPageGeneral); + this.tabControlGeneral.Controls.Add(this.tabPageAdditionalInfo); + this.tabControlGeneral.Dock = System.Windows.Forms.DockStyle.Top; + this.tabControlGeneral.Location = new System.Drawing.Point(0, 0); + this.tabControlGeneral.Name = "tabControlGeneral"; + this.tabControlGeneral.SelectedIndex = 0; + this.tabControlGeneral.Size = new System.Drawing.Size(600, 679); + this.tabControlGeneral.TabIndex = 131; + // + // tabPageGeneral + // + this.tabPageGeneral.Controls.Add(this.lblReadableFileSize); + this.tabPageGeneral.Controls.Add(this.label23); + this.tabPageGeneral.Controls.Add(this.lblLocalTime); + this.tabPageGeneral.Controls.Add(this.cmbDatabase); + this.tabPageGeneral.Controls.Add(this.label22); + this.tabPageGeneral.Controls.Add(this.btnIpdbUrl); + this.tabPageGeneral.Controls.Add(this.btnUrl); + this.tabPageGeneral.Controls.Add(this.btnAddTag); + this.tabPageGeneral.Controls.Add(this.txtTag); + this.tabPageGeneral.Controls.Add(this.lblTags); + this.tabPageGeneral.Controls.Add(this.flowLayoutPanelTags); + this.tabPageGeneral.Controls.Add(this.btnFillFromIpdb); + this.tabPageGeneral.Controls.Add(this.button2); + this.tabPageGeneral.Controls.Add(this.label18); + this.tabPageGeneral.Controls.Add(this.dateTimeModified); + this.tabPageGeneral.Controls.Add(this.numericRating); + this.tabPageGeneral.Controls.Add(this.label17); + this.tabPageGeneral.Controls.Add(this.numericDownloadCount); + this.tabPageGeneral.Controls.Add(this.label16); + this.tabPageGeneral.Controls.Add(this.numericFileBytes); + this.tabPageGeneral.Controls.Add(this.label1); + this.tabPageGeneral.Controls.Add(this.txtIpdbNumber); + this.tabPageGeneral.Controls.Add(this.label14); + this.tabPageGeneral.Controls.Add(this.txtTheme); + this.tabPageGeneral.Controls.Add(this.label11); + this.tabPageGeneral.Controls.Add(this.numericYear); + this.tabPageGeneral.Controls.Add(this.numericPlayers); + this.tabPageGeneral.Controls.Add(this.label9); + this.tabPageGeneral.Controls.Add(this.label2); + this.tabPageGeneral.Controls.Add(this.txtManufacturer); + this.tabPageGeneral.Controls.Add(this.button1); + this.tabPageGeneral.Controls.Add(this.cmbCategory); + this.tabPageGeneral.Controls.Add(this.lblId); + this.tabPageGeneral.Controls.Add(this.txtFeatures); + this.tabPageGeneral.Controls.Add(this.label15); + this.tabPageGeneral.Controls.Add(this.txtVersion); + this.tabPageGeneral.Controls.Add(this.txtAuthors); + this.tabPageGeneral.Controls.Add(this.label13); + this.tabPageGeneral.Controls.Add(this.label12); + this.tabPageGeneral.Controls.Add(this.txtChangeLog); + this.tabPageGeneral.Controls.Add(this.label10); + this.tabPageGeneral.Controls.Add(this.txtDescription); + this.tabPageGeneral.Controls.Add(this.label8); + this.tabPageGeneral.Controls.Add(this.txtFileName); + this.tabPageGeneral.Controls.Add(this.label7); + this.tabPageGeneral.Controls.Add(this.txtTitle); + this.tabPageGeneral.Controls.Add(this.label6); + this.tabPageGeneral.Controls.Add(this.txtUrl); + this.tabPageGeneral.Controls.Add(this.label5); + this.tabPageGeneral.Controls.Add(this.lblManufacturer); + this.tabPageGeneral.Controls.Add(this.label4); + this.tabPageGeneral.Controls.Add(this.label3); + this.tabPageGeneral.Location = new System.Drawing.Point(4, 22); + this.tabPageGeneral.Name = "tabPageGeneral"; + this.tabPageGeneral.Padding = new System.Windows.Forms.Padding(3); + this.tabPageGeneral.Size = new System.Drawing.Size(592, 653); + this.tabPageGeneral.TabIndex = 0; + this.tabPageGeneral.Text = "General"; + this.tabPageGeneral.UseVisualStyleBackColor = true; + // + // label23 + // + this.label23.AutoSize = true; + this.label23.Location = new System.Drawing.Point(256, 535); + this.label23.Name = "label23"; + this.label23.Size = new System.Drawing.Size(59, 13); + this.label23.TabIndex = 177; + this.label23.Text = "Local Time"; + // + // lblLocalTime + // + this.lblLocalTime.AutoSize = true; + this.lblLocalTime.Location = new System.Drawing.Point(321, 535); + this.lblLocalTime.Name = "lblLocalTime"; + this.lblLocalTime.Size = new System.Drawing.Size(91, 13); + this.lblLocalTime.TabIndex = 176; + this.lblLocalTime.Text = "(Local Time Here)"; + // + // cmbDatabase + // + this.cmbDatabase.FormattingEnabled = true; + this.cmbDatabase.Location = new System.Drawing.Point(71, 8); + this.cmbDatabase.Name = "cmbDatabase"; + this.cmbDatabase.Size = new System.Drawing.Size(230, 21); + this.cmbDatabase.TabIndex = 175; + // + // label22 + // + this.label22.AutoSize = true; + this.label22.Location = new System.Drawing.Point(13, 11); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(53, 13); + this.label22.TabIndex = 174; + this.label22.Text = "Database"; + // + // 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(160, 453); + this.btnIpdbUrl.Name = "btnIpdbUrl"; + this.btnIpdbUrl.Size = new System.Drawing.Size(26, 23); + this.btnIpdbUrl.TabIndex = 173; + this.btnIpdbUrl.UseVisualStyleBackColor = true; + this.btnIpdbUrl.Click += new System.EventHandler(this.btnIpdbUrl_Click); + // + // btnUrl + // + this.btnUrl.BackgroundImage = global::PinCab.Configurator.Properties.Resources.BrowserLink_75x; + this.btnUrl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.btnUrl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnUrl.ForeColor = System.Drawing.SystemColors.Control; + this.btnUrl.Location = new System.Drawing.Point(499, 83); + this.btnUrl.Name = "btnUrl"; + this.btnUrl.Size = new System.Drawing.Size(26, 23); + this.btnUrl.TabIndex = 172; + this.btnUrl.UseVisualStyleBackColor = true; + this.btnUrl.Click += new System.EventHandler(this.btnUrl_Click); + // + // btnAddTag + // + this.btnAddTag.Location = new System.Drawing.Point(279, 559); + this.btnAddTag.Name = "btnAddTag"; + this.btnAddTag.Size = new System.Drawing.Size(75, 23); + this.btnAddTag.TabIndex = 171; + this.btnAddTag.Text = "Add Tag"; + this.btnAddTag.UseVisualStyleBackColor = true; + this.btnAddTag.Click += new System.EventHandler(this.btnAddTag_Click); + // + // txtTag + // + this.txtTag.Location = new System.Drawing.Point(71, 560); + this.txtTag.Name = "txtTag"; + this.txtTag.Size = new System.Drawing.Size(202, 20); + this.txtTag.TabIndex = 170; + // + // lblTags + // + this.lblTags.AutoSize = true; + this.lblTags.Location = new System.Drawing.Point(30, 559); + this.lblTags.Name = "lblTags"; + this.lblTags.Size = new System.Drawing.Size(31, 13); + this.lblTags.TabIndex = 169; + this.lblTags.Text = "Tags"; + // + // flowLayoutPanelTags + // + this.flowLayoutPanelTags.Location = new System.Drawing.Point(73, 586); + this.flowLayoutPanelTags.Name = "flowLayoutPanelTags"; + this.flowLayoutPanelTags.Size = new System.Drawing.Size(509, 62); + this.flowLayoutPanelTags.TabIndex = 168; + // + // btnFillFromIpdb + // + this.btnFillFromIpdb.Location = new System.Drawing.Point(192, 453); + this.btnFillFromIpdb.Name = "btnFillFromIpdb"; + this.btnFillFromIpdb.Size = new System.Drawing.Size(98, 23); + this.btnFillFromIpdb.TabIndex = 167; + this.btnFillFromIpdb.Text = "Fill From IPDB"; + this.btnFillFromIpdb.UseVisualStyleBackColor = true; + this.btnFillFromIpdb.Click += new System.EventHandler(this.btnFillFromIpdb_Click); + // + // button2 + // + this.button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button2.ForeColor = System.Drawing.SystemColors.Control; + this.button2.Location = new System.Drawing.Point(159, 453); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(27, 23); + this.button2.TabIndex = 166; + this.button2.UseVisualStyleBackColor = true; + // + // label18 + // + this.label18.AutoSize = true; + this.label18.Location = new System.Drawing.Point(0, 535); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(72, 13); + this.label18.TabIndex = 165; + this.label18.Text = "Modified UTC"; + // + // dateTimeModified + // + this.dateTimeModified.CustomFormat = "MM/dd/yyyy HH:mm:ss tt"; + this.dateTimeModified.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimeModified.Location = new System.Drawing.Point(73, 533); + this.dateTimeModified.Name = "dateTimeModified"; + this.dateTimeModified.Size = new System.Drawing.Size(177, 20); + this.dateTimeModified.TabIndex = 164; + this.dateTimeModified.ValueChanged += new System.EventHandler(this.dateTimeModified_ValueChanged); + // + // numericRating + // + this.numericRating.Location = new System.Drawing.Point(256, 506); + this.numericRating.Maximum = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.numericRating.Name = "numericRating"; + this.numericRating.Size = new System.Drawing.Size(64, 20); + this.numericRating.TabIndex = 163; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Location = new System.Drawing.Point(212, 508); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(38, 13); + this.label17.TabIndex = 162; + this.label17.Text = "Rating"; + // + // numericDownloadCount + // + this.numericDownloadCount.Location = new System.Drawing.Point(72, 506); + this.numericDownloadCount.Maximum = new decimal(new int[] { + 9999999, + 0, + 0, + 0}); + this.numericDownloadCount.Name = "numericDownloadCount"; + this.numericDownloadCount.Size = new System.Drawing.Size(124, 20); + this.numericDownloadCount.TabIndex = 161; + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(2, 508); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(65, 13); + this.label16.TabIndex = 160; + this.label16.Text = "Download #"; + // + // numericFileBytes + // + this.numericFileBytes.Location = new System.Drawing.Point(73, 478); + this.numericFileBytes.Maximum = new decimal(new int[] { + 276447231, + 23283, + 0, + 0}); + this.numericFileBytes.Name = "numericFileBytes"; + this.numericFileBytes.Size = new System.Drawing.Size(124, 20); + this.numericFileBytes.TabIndex = 159; + this.numericFileBytes.ValueChanged += new System.EventHandler(this.numericFileBytes_ValueChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(15, 480); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(52, 13); + this.label1.TabIndex = 158; + this.label1.Text = "File Bytes"; + // // txtIpdbNumber // - this.txtIpdbNumber.Enabled = false; - this.txtIpdbNumber.Location = new System.Drawing.Point(72, 439); + this.txtIpdbNumber.Location = new System.Drawing.Point(73, 453); this.txtIpdbNumber.Name = "txtIpdbNumber"; this.txtIpdbNumber.Size = new System.Drawing.Size(80, 20); - this.txtIpdbNumber.TabIndex = 116; + this.txtIpdbNumber.TabIndex = 157; // // label14 // this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(21, 442); + this.label14.Location = new System.Drawing.Point(22, 456); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(42, 13); - this.label14.TabIndex = 115; + this.label14.TabIndex = 156; this.label14.Text = "IPDB #"; // // txtTheme // - this.txtTheme.Location = new System.Drawing.Point(72, 415); + this.txtTheme.Location = new System.Drawing.Point(73, 429); this.txtTheme.Name = "txtTheme"; this.txtTheme.Size = new System.Drawing.Size(366, 20); - this.txtTheme.TabIndex = 114; + this.txtTheme.TabIndex = 155; // // label11 // this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(21, 418); + this.label11.Location = new System.Drawing.Point(22, 432); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(40, 13); - this.label11.TabIndex = 113; + this.label11.TabIndex = 154; this.label11.Text = "Theme"; // // numericYear // - this.numericYear.Location = new System.Drawing.Point(214, 389); + this.numericYear.Location = new System.Drawing.Point(215, 403); this.numericYear.Maximum = new decimal(new int[] { 9999, 0, @@ -133,11 +464,11 @@ private void InitializeComponent() 0}); this.numericYear.Name = "numericYear"; this.numericYear.Size = new System.Drawing.Size(90, 20); - this.numericYear.TabIndex = 112; + this.numericYear.TabIndex = 153; // // numericPlayers // - this.numericPlayers.Location = new System.Drawing.Point(71, 389); + this.numericPlayers.Location = new System.Drawing.Point(72, 403); this.numericPlayers.Maximum = new decimal(new int[] { 10, 0, @@ -145,305 +476,583 @@ private void InitializeComponent() 0}); this.numericPlayers.Name = "numericPlayers"; this.numericPlayers.Size = new System.Drawing.Size(90, 20); - this.numericPlayers.TabIndex = 111; + this.numericPlayers.TabIndex = 152; // // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(167, 391); + this.label9.Location = new System.Drawing.Point(168, 405); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(29, 13); - this.label9.TabIndex = 110; + this.label9.TabIndex = 151; this.label9.Text = "Year"; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(20, 391); + this.label2.Location = new System.Drawing.Point(21, 405); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(41, 13); - this.label2.TabIndex = 109; + this.label2.TabIndex = 150; this.label2.Text = "Players"; // // txtManufacturer // - this.txtManufacturer.Location = new System.Drawing.Point(72, 364); + this.txtManufacturer.Location = new System.Drawing.Point(73, 378); this.txtManufacturer.Name = "txtManufacturer"; this.txtManufacturer.Size = new System.Drawing.Size(366, 20); - this.txtManufacturer.TabIndex = 108; + this.txtManufacturer.TabIndex = 149; // // button1 // - this.button1.BackgroundImage = global::PinCab.Configurator.Properties.Resources.BrowserLink_75x; this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button1.ForeColor = System.Drawing.SystemColors.Control; - this.button1.Location = new System.Drawing.Point(497, 69); + this.button1.Location = new System.Drawing.Point(498, 83); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(27, 23); - this.button1.TabIndex = 107; + this.button1.TabIndex = 148; this.button1.UseVisualStyleBackColor = true; // // cmbCategory // this.cmbCategory.FormattingEnabled = true; - this.cmbCategory.Location = new System.Drawing.Point(71, 40); + this.cmbCategory.Location = new System.Drawing.Point(72, 54); this.cmbCategory.Name = "cmbCategory"; this.cmbCategory.Size = new System.Drawing.Size(230, 21); - this.cmbCategory.TabIndex = 106; + this.cmbCategory.TabIndex = 147; // // lblId // this.lblId.AutoSize = true; - this.lblId.Location = new System.Drawing.Point(68, 9); + this.lblId.Location = new System.Drawing.Point(69, 35); this.lblId.Name = "lblId"; this.lblId.Size = new System.Drawing.Size(88, 13); - this.lblId.TabIndex = 105; + this.lblId.TabIndex = 146; this.lblId.Text = "(Auto Generated)"; // - // 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(440, 507); - this.btnGameUrl.Name = "btnGameUrl"; - this.btnGameUrl.Size = new System.Drawing.Size(27, 23); - this.btnGameUrl.TabIndex = 104; - this.btnGameUrl.UseVisualStyleBackColor = true; - // - // txtGameUrl + // txtFeatures // - this.txtGameUrl.Location = new System.Drawing.Point(68, 507); - this.txtGameUrl.Name = "txtGameUrl"; - this.txtGameUrl.Size = new System.Drawing.Size(366, 20); - this.txtGameUrl.TabIndex = 103; - // - // label17 - // - this.label17.AutoSize = true; - this.label17.Location = new System.Drawing.Point(-1, 510); - this.label17.Name = "label17"; - this.label17.Size = new System.Drawing.Size(54, 13); - this.label17.TabIndex = 102; - this.label17.Text = "Game Url:"; - // - // txtAdded - // - this.txtAdded.Enabled = false; - this.txtAdded.Location = new System.Drawing.Point(71, 260); - this.txtAdded.Multiline = true; - this.txtAdded.Name = "txtAdded"; - this.txtAdded.Size = new System.Drawing.Size(421, 49); - this.txtAdded.TabIndex = 101; + this.txtFeatures.Location = new System.Drawing.Point(72, 274); + this.txtFeatures.Multiline = true; + this.txtFeatures.Name = "txtFeatures"; + this.txtFeatures.Size = new System.Drawing.Size(421, 49); + this.txtFeatures.TabIndex = 145; // // label15 // this.label15.AutoSize = true; - this.label15.Location = new System.Drawing.Point(14, 263); + this.label15.Location = new System.Drawing.Point(15, 277); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(48, 13); - this.label15.TabIndex = 100; + this.label15.TabIndex = 144; this.label15.Text = "Features"; // // txtVersion // - this.txtVersion.Enabled = false; - this.txtVersion.Location = new System.Drawing.Point(71, 341); + this.txtVersion.Location = new System.Drawing.Point(72, 355); this.txtVersion.Name = "txtVersion"; this.txtVersion.Size = new System.Drawing.Size(80, 20); - this.txtVersion.TabIndex = 99; + this.txtVersion.TabIndex = 143; // // txtAuthors // - this.txtAuthors.Location = new System.Drawing.Point(71, 315); + this.txtAuthors.Location = new System.Drawing.Point(72, 329); this.txtAuthors.Name = "txtAuthors"; this.txtAuthors.Size = new System.Drawing.Size(420, 20); - this.txtAuthors.TabIndex = 98; + this.txtAuthors.TabIndex = 142; // // label13 // this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(20, 344); + this.label13.Location = new System.Drawing.Point(21, 358); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(42, 13); - this.label13.TabIndex = 97; + this.label13.TabIndex = 141; this.label13.Text = "Version"; // // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(19, 318); + this.label12.Location = new System.Drawing.Point(20, 332); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(43, 13); - this.label12.TabIndex = 96; + this.label12.TabIndex = 140; this.label12.Text = "Authors"; // - // txtIpdb + // txtChangeLog // - this.txtIpdb.Location = new System.Drawing.Point(71, 203); - this.txtIpdb.Multiline = true; - this.txtIpdb.Name = "txtIpdb"; - this.txtIpdb.Size = new System.Drawing.Size(420, 51); - this.txtIpdb.TabIndex = 95; + this.txtChangeLog.Location = new System.Drawing.Point(72, 217); + this.txtChangeLog.Multiline = true; + this.txtChangeLog.Name = "txtChangeLog"; + this.txtChangeLog.Size = new System.Drawing.Size(420, 51); + this.txtChangeLog.TabIndex = 139; // // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(2, 206); + this.label10.Location = new System.Drawing.Point(3, 220); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(65, 13); - this.label10.TabIndex = 94; + this.label10.TabIndex = 138; this.label10.Text = "Change Log"; // - // txtAuthor + // txtDescription // - this.txtAuthor.Location = new System.Drawing.Point(70, 151); - this.txtAuthor.Multiline = true; - this.txtAuthor.Name = "txtAuthor"; - this.txtAuthor.Size = new System.Drawing.Size(421, 46); - this.txtAuthor.TabIndex = 93; + this.txtDescription.Location = new System.Drawing.Point(71, 165); + this.txtDescription.Multiline = true; + this.txtDescription.Name = "txtDescription"; + this.txtDescription.Size = new System.Drawing.Size(421, 46); + this.txtDescription.TabIndex = 137; // // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(6, 154); + this.label8.Location = new System.Drawing.Point(7, 168); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(60, 13); - this.label8.TabIndex = 92; + this.label8.TabIndex = 136; this.label8.Text = "Description"; // // txtFileName // - this.txtFileName.Location = new System.Drawing.Point(71, 123); + this.txtFileName.Location = new System.Drawing.Point(72, 137); this.txtFileName.Name = "txtFileName"; this.txtFileName.Size = new System.Drawing.Size(420, 20); - this.txtFileName.TabIndex = 91; + this.txtFileName.TabIndex = 135; // // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(12, 126); + this.label7.Location = new System.Drawing.Point(13, 140); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(54, 13); - this.label7.TabIndex = 90; + this.label7.TabIndex = 134; this.label7.Text = "File Name"; // // txtTitle // - this.txtTitle.Location = new System.Drawing.Point(71, 97); + this.txtTitle.Location = new System.Drawing.Point(72, 111); this.txtTitle.Name = "txtTitle"; this.txtTitle.Size = new System.Drawing.Size(420, 20); - this.txtTitle.TabIndex = 89; + this.txtTitle.TabIndex = 133; // // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(33, 100); + this.label6.Location = new System.Drawing.Point(34, 114); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(27, 13); - this.label6.TabIndex = 88; + this.label6.TabIndex = 132; this.label6.Text = "Title"; // // txtUrl // - this.txtUrl.Location = new System.Drawing.Point(70, 71); + this.txtUrl.Location = new System.Drawing.Point(71, 85); this.txtUrl.Name = "txtUrl"; this.txtUrl.Size = new System.Drawing.Size(421, 20); - this.txtUrl.TabIndex = 87; + this.txtUrl.TabIndex = 131; // // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(38, 74); + this.label5.Location = new System.Drawing.Point(39, 88); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(20, 13); - this.label5.TabIndex = 86; + this.label5.TabIndex = 130; this.label5.Text = "Url"; // // lblManufacturer // this.lblManufacturer.AutoSize = true; - this.lblManufacturer.Location = new System.Drawing.Point(-3, 367); + this.lblManufacturer.Location = new System.Drawing.Point(-2, 381); this.lblManufacturer.Name = "lblManufacturer"; this.lblManufacturer.Size = new System.Drawing.Size(70, 13); - this.lblManufacturer.TabIndex = 85; + this.lblManufacturer.TabIndex = 129; this.lblManufacturer.Text = "Manufacturer"; // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(13, 43); + this.label4.Location = new System.Drawing.Point(14, 57); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(49, 13); - this.label4.TabIndex = 84; + this.label4.TabIndex = 128; this.label4.Text = "Category"; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(43, 9); + this.label3.Location = new System.Drawing.Point(44, 35); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(19, 13); - this.label3.TabIndex = 83; + this.label3.TabIndex = 127; this.label3.Text = "Id:"; // + // tabPageAdditionalInfo + // + this.tabPageAdditionalInfo.Controls.Add(this.label24); + this.tabPageAdditionalInfo.Controls.Add(this.btnAddRelatedEntry); + this.tabPageAdditionalInfo.Controls.Add(this.dataGridViewRelatedEntries); + this.tabPageAdditionalInfo.Controls.Add(this.label21); + this.tabPageAdditionalInfo.Controls.Add(this.dataGridViewScreenshotUrls); + this.tabPageAdditionalInfo.Controls.Add(this.label20); + this.tabPageAdditionalInfo.Controls.Add(this.label19); + this.tabPageAdditionalInfo.Controls.Add(this.dataGridViewAdditionalUrls); + this.tabPageAdditionalInfo.Location = new System.Drawing.Point(4, 22); + this.tabPageAdditionalInfo.Name = "tabPageAdditionalInfo"; + this.tabPageAdditionalInfo.Padding = new System.Windows.Forms.Padding(3); + this.tabPageAdditionalInfo.Size = new System.Drawing.Size(592, 653); + this.tabPageAdditionalInfo.TabIndex = 1; + this.tabPageAdditionalInfo.Text = "Additional Data"; + this.tabPageAdditionalInfo.UseVisualStyleBackColor = true; + // + // label24 + // + this.label24.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label24.AutoSize = true; + this.label24.Location = new System.Drawing.Point(306, 16); + this.label24.Name = "label24"; + this.label24.Size = new System.Drawing.Size(278, 13); + this.label24.TabIndex = 138; + this.label24.Text = "(Double click left most part of a row to navigate to the Url)"; + // + // btnAddRelatedEntry + // + this.btnAddRelatedEntry.Location = new System.Drawing.Point(6, 526); + this.btnAddRelatedEntry.Name = "btnAddRelatedEntry"; + this.btnAddRelatedEntry.Size = new System.Drawing.Size(131, 23); + this.btnAddRelatedEntry.TabIndex = 137; + this.btnAddRelatedEntry.Text = "Add Related Entry"; + this.btnAddRelatedEntry.UseVisualStyleBackColor = true; + // + // dataGridViewRelatedEntries + // + this.dataGridViewRelatedEntries.AllowUserToAddRows = false; + this.dataGridViewRelatedEntries.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridViewRelatedEntries.AutoGenerateColumns = false; + this.dataGridViewRelatedEntries.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; + this.dataGridViewRelatedEntries.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridViewRelatedEntries.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.idDataGridViewTextBoxColumn, + this.majorCategoryDataGridViewTextBoxColumn, + this.urlDataGridViewTextBoxColumn, + this.titleDataGridViewTextBoxColumn, + this.fileNameDataGridViewTextBoxColumn, + this.descriptionDataGridViewTextBoxColumn, + this.changeLogDataGridViewTextBoxColumn, + this.authorsDataGridViewTextBoxColumn, + this.versionDataGridViewTextBoxColumn, + this.featuresDataGridViewTextBoxColumn, + this.manufacturerDataGridViewTextBoxColumn, + this.yearDataGridViewTextBoxColumn, + this.playersDataGridViewTextBoxColumn, + this.themeDataGridViewTextBoxColumn, + this.ipdbNumberDataGridViewTextBoxColumn, + this.fileSizeBytesDataGridViewTextBoxColumn, + this.downloadCountDataGridViewTextBoxColumn, + this.ratingDataGridViewTextBoxColumn, + this.lastModifiedDateUtcDataGridViewTextBoxColumn}); + this.dataGridViewRelatedEntries.DataSource = this.databaseEntryBindingSource; + this.dataGridViewRelatedEntries.Location = new System.Drawing.Point(9, 282); + this.dataGridViewRelatedEntries.Name = "dataGridViewRelatedEntries"; + this.dataGridViewRelatedEntries.ReadOnly = true; + this.dataGridViewRelatedEntries.Size = new System.Drawing.Size(576, 238); + this.dataGridViewRelatedEntries.TabIndex = 136; + // + // idDataGridViewTextBoxColumn + // + this.idDataGridViewTextBoxColumn.DataPropertyName = "Id"; + this.idDataGridViewTextBoxColumn.HeaderText = "Id"; + this.idDataGridViewTextBoxColumn.Name = "idDataGridViewTextBoxColumn"; + this.idDataGridViewTextBoxColumn.ReadOnly = true; + this.idDataGridViewTextBoxColumn.Width = 41; + // + // majorCategoryDataGridViewTextBoxColumn + // + this.majorCategoryDataGridViewTextBoxColumn.DataPropertyName = "MajorCategory"; + this.majorCategoryDataGridViewTextBoxColumn.HeaderText = "Major Category"; + this.majorCategoryDataGridViewTextBoxColumn.Name = "majorCategoryDataGridViewTextBoxColumn"; + this.majorCategoryDataGridViewTextBoxColumn.ReadOnly = true; + this.majorCategoryDataGridViewTextBoxColumn.Width = 95; + // + // urlDataGridViewTextBoxColumn + // + this.urlDataGridViewTextBoxColumn.DataPropertyName = "Url"; + this.urlDataGridViewTextBoxColumn.HeaderText = "Url"; + this.urlDataGridViewTextBoxColumn.Name = "urlDataGridViewTextBoxColumn"; + this.urlDataGridViewTextBoxColumn.ReadOnly = true; + this.urlDataGridViewTextBoxColumn.Visible = false; + // + // titleDataGridViewTextBoxColumn + // + this.titleDataGridViewTextBoxColumn.DataPropertyName = "Title"; + this.titleDataGridViewTextBoxColumn.HeaderText = "Title"; + this.titleDataGridViewTextBoxColumn.Name = "titleDataGridViewTextBoxColumn"; + this.titleDataGridViewTextBoxColumn.ReadOnly = true; + this.titleDataGridViewTextBoxColumn.Width = 52; + // + // fileNameDataGridViewTextBoxColumn + // + this.fileNameDataGridViewTextBoxColumn.DataPropertyName = "FileName"; + this.fileNameDataGridViewTextBoxColumn.HeaderText = "FileName"; + this.fileNameDataGridViewTextBoxColumn.Name = "fileNameDataGridViewTextBoxColumn"; + this.fileNameDataGridViewTextBoxColumn.ReadOnly = true; + this.fileNameDataGridViewTextBoxColumn.Visible = false; + // + // descriptionDataGridViewTextBoxColumn + // + this.descriptionDataGridViewTextBoxColumn.DataPropertyName = "Description"; + this.descriptionDataGridViewTextBoxColumn.HeaderText = "Description"; + this.descriptionDataGridViewTextBoxColumn.Name = "descriptionDataGridViewTextBoxColumn"; + this.descriptionDataGridViewTextBoxColumn.ReadOnly = true; + this.descriptionDataGridViewTextBoxColumn.Visible = false; + // + // changeLogDataGridViewTextBoxColumn + // + this.changeLogDataGridViewTextBoxColumn.DataPropertyName = "ChangeLog"; + this.changeLogDataGridViewTextBoxColumn.HeaderText = "ChangeLog"; + this.changeLogDataGridViewTextBoxColumn.Name = "changeLogDataGridViewTextBoxColumn"; + this.changeLogDataGridViewTextBoxColumn.ReadOnly = true; + this.changeLogDataGridViewTextBoxColumn.Visible = false; + // + // authorsDataGridViewTextBoxColumn + // + this.authorsDataGridViewTextBoxColumn.DataPropertyName = "Authors"; + this.authorsDataGridViewTextBoxColumn.HeaderText = "Authors"; + this.authorsDataGridViewTextBoxColumn.Name = "authorsDataGridViewTextBoxColumn"; + this.authorsDataGridViewTextBoxColumn.ReadOnly = true; + this.authorsDataGridViewTextBoxColumn.Visible = false; + // + // versionDataGridViewTextBoxColumn + // + this.versionDataGridViewTextBoxColumn.DataPropertyName = "Version"; + this.versionDataGridViewTextBoxColumn.HeaderText = "Version"; + this.versionDataGridViewTextBoxColumn.Name = "versionDataGridViewTextBoxColumn"; + this.versionDataGridViewTextBoxColumn.ReadOnly = true; + this.versionDataGridViewTextBoxColumn.Visible = false; + // + // featuresDataGridViewTextBoxColumn + // + this.featuresDataGridViewTextBoxColumn.DataPropertyName = "Features"; + this.featuresDataGridViewTextBoxColumn.HeaderText = "Features"; + this.featuresDataGridViewTextBoxColumn.Name = "featuresDataGridViewTextBoxColumn"; + this.featuresDataGridViewTextBoxColumn.ReadOnly = true; + this.featuresDataGridViewTextBoxColumn.Visible = false; + // + // manufacturerDataGridViewTextBoxColumn + // + this.manufacturerDataGridViewTextBoxColumn.DataPropertyName = "Manufacturer"; + this.manufacturerDataGridViewTextBoxColumn.HeaderText = "Manufacturer"; + this.manufacturerDataGridViewTextBoxColumn.Name = "manufacturerDataGridViewTextBoxColumn"; + this.manufacturerDataGridViewTextBoxColumn.ReadOnly = true; + this.manufacturerDataGridViewTextBoxColumn.Visible = false; + // + // yearDataGridViewTextBoxColumn + // + this.yearDataGridViewTextBoxColumn.DataPropertyName = "Year"; + this.yearDataGridViewTextBoxColumn.HeaderText = "Year"; + this.yearDataGridViewTextBoxColumn.Name = "yearDataGridViewTextBoxColumn"; + this.yearDataGridViewTextBoxColumn.ReadOnly = true; + this.yearDataGridViewTextBoxColumn.Visible = false; + // + // playersDataGridViewTextBoxColumn + // + this.playersDataGridViewTextBoxColumn.DataPropertyName = "Players"; + this.playersDataGridViewTextBoxColumn.HeaderText = "Players"; + this.playersDataGridViewTextBoxColumn.Name = "playersDataGridViewTextBoxColumn"; + this.playersDataGridViewTextBoxColumn.ReadOnly = true; + this.playersDataGridViewTextBoxColumn.Visible = false; + // + // themeDataGridViewTextBoxColumn + // + this.themeDataGridViewTextBoxColumn.DataPropertyName = "Theme"; + this.themeDataGridViewTextBoxColumn.HeaderText = "Theme"; + this.themeDataGridViewTextBoxColumn.Name = "themeDataGridViewTextBoxColumn"; + this.themeDataGridViewTextBoxColumn.ReadOnly = true; + this.themeDataGridViewTextBoxColumn.Visible = false; + // + // ipdbNumberDataGridViewTextBoxColumn + // + this.ipdbNumberDataGridViewTextBoxColumn.DataPropertyName = "IpdbNumber"; + this.ipdbNumberDataGridViewTextBoxColumn.HeaderText = "IpdbNumber"; + this.ipdbNumberDataGridViewTextBoxColumn.Name = "ipdbNumberDataGridViewTextBoxColumn"; + this.ipdbNumberDataGridViewTextBoxColumn.ReadOnly = true; + this.ipdbNumberDataGridViewTextBoxColumn.Visible = false; + // + // fileSizeBytesDataGridViewTextBoxColumn + // + this.fileSizeBytesDataGridViewTextBoxColumn.DataPropertyName = "FileSizeBytes"; + this.fileSizeBytesDataGridViewTextBoxColumn.HeaderText = "FileSizeBytes"; + this.fileSizeBytesDataGridViewTextBoxColumn.Name = "fileSizeBytesDataGridViewTextBoxColumn"; + this.fileSizeBytesDataGridViewTextBoxColumn.ReadOnly = true; + this.fileSizeBytesDataGridViewTextBoxColumn.Visible = false; + // + // downloadCountDataGridViewTextBoxColumn + // + this.downloadCountDataGridViewTextBoxColumn.DataPropertyName = "DownloadCount"; + this.downloadCountDataGridViewTextBoxColumn.HeaderText = "DownloadCount"; + this.downloadCountDataGridViewTextBoxColumn.Name = "downloadCountDataGridViewTextBoxColumn"; + this.downloadCountDataGridViewTextBoxColumn.ReadOnly = true; + this.downloadCountDataGridViewTextBoxColumn.Visible = false; + // + // ratingDataGridViewTextBoxColumn + // + this.ratingDataGridViewTextBoxColumn.DataPropertyName = "Rating"; + this.ratingDataGridViewTextBoxColumn.HeaderText = "Rating"; + this.ratingDataGridViewTextBoxColumn.Name = "ratingDataGridViewTextBoxColumn"; + this.ratingDataGridViewTextBoxColumn.ReadOnly = true; + this.ratingDataGridViewTextBoxColumn.Visible = false; + // + // lastModifiedDateUtcDataGridViewTextBoxColumn + // + this.lastModifiedDateUtcDataGridViewTextBoxColumn.DataPropertyName = "LastModifiedDateUtc"; + this.lastModifiedDateUtcDataGridViewTextBoxColumn.HeaderText = "LastModifiedDateUtc"; + this.lastModifiedDateUtcDataGridViewTextBoxColumn.Name = "lastModifiedDateUtcDataGridViewTextBoxColumn"; + this.lastModifiedDateUtcDataGridViewTextBoxColumn.ReadOnly = true; + this.lastModifiedDateUtcDataGridViewTextBoxColumn.Visible = false; + // + // databaseEntryBindingSource + // + this.databaseEntryBindingSource.DataSource = typeof(VirtualPinball.Database.Models.DatabaseEntry); + // + // label21 + // + this.label21.AutoSize = true; + this.label21.Location = new System.Drawing.Point(11, 266); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(79, 13); + this.label21.TabIndex = 135; + this.label21.Text = "Related Entries"; + // + // dataGridViewScreenshotUrls + // + this.dataGridViewScreenshotUrls.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridViewScreenshotUrls.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; + this.dataGridViewScreenshotUrls.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableWithoutHeaderText; + this.dataGridViewScreenshotUrls.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridViewScreenshotUrls.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.dataGridViewTextBoxColumn1}); + this.dataGridViewScreenshotUrls.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; + this.dataGridViewScreenshotUrls.Location = new System.Drawing.Point(9, 152); + this.dataGridViewScreenshotUrls.Name = "dataGridViewScreenshotUrls"; + this.dataGridViewScreenshotUrls.Size = new System.Drawing.Size(575, 100); + this.dataGridViewScreenshotUrls.TabIndex = 134; + this.dataGridViewScreenshotUrls.DoubleClick += new System.EventHandler(this.dataGridViewScreenshotUrls_DoubleClick); + // + // dataGridViewTextBoxColumn1 + // + this.dataGridViewTextBoxColumn1.HeaderText = "Url"; + this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; + this.dataGridViewTextBoxColumn1.Width = 45; + // + // label20 + // + this.label20.AutoSize = true; + this.label20.Location = new System.Drawing.Point(8, 136); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(82, 13); + this.label20.TabIndex = 133; + this.label20.Text = "Screenshot Urls"; + // + // label19 + // + this.label19.AutoSize = true; + this.label19.Location = new System.Drawing.Point(8, 16); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(129, 13); + this.label19.TabIndex = 132; + this.label19.Text = "Additional Information Urls"; + // + // dataGridViewAdditionalUrls + // + this.dataGridViewAdditionalUrls.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridViewAdditionalUrls.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; + this.dataGridViewAdditionalUrls.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableWithoutHeaderText; + this.dataGridViewAdditionalUrls.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridViewAdditionalUrls.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Url}); + this.dataGridViewAdditionalUrls.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; + this.dataGridViewAdditionalUrls.Location = new System.Drawing.Point(11, 32); + this.dataGridViewAdditionalUrls.Name = "dataGridViewAdditionalUrls"; + this.dataGridViewAdditionalUrls.Size = new System.Drawing.Size(573, 100); + this.dataGridViewAdditionalUrls.TabIndex = 131; + // + // Url + // + this.Url.HeaderText = "Url"; + this.Url.Name = "Url"; + this.Url.Width = 45; + // + // lblReadableFileSize + // + this.lblReadableFileSize.AutoSize = true; + this.lblReadableFileSize.Location = new System.Drawing.Point(203, 480); + this.lblReadableFileSize.Name = "lblReadableFileSize"; + this.lblReadableFileSize.Size = new System.Drawing.Size(96, 13); + this.lblReadableFileSize.TabIndex = 178; + this.lblReadableFileSize.Text = "(Readable Filesize)"; + // // EditDatabaseEntryForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(581, 583); - this.Controls.Add(this.txtIpdbNumber); - this.Controls.Add(this.label14); - this.Controls.Add(this.txtTheme); - this.Controls.Add(this.label11); - this.Controls.Add(this.numericYear); - this.Controls.Add(this.numericPlayers); - this.Controls.Add(this.label9); - this.Controls.Add(this.label2); - this.Controls.Add(this.txtManufacturer); - this.Controls.Add(this.button1); - this.Controls.Add(this.cmbCategory); - this.Controls.Add(this.lblId); - this.Controls.Add(this.btnGameUrl); - this.Controls.Add(this.txtGameUrl); - this.Controls.Add(this.label17); - this.Controls.Add(this.txtAdded); - this.Controls.Add(this.label15); - this.Controls.Add(this.txtVersion); - this.Controls.Add(this.txtAuthors); - this.Controls.Add(this.label13); - this.Controls.Add(this.label12); - this.Controls.Add(this.txtIpdb); - this.Controls.Add(this.label10); - this.Controls.Add(this.txtAuthor); - this.Controls.Add(this.label8); - this.Controls.Add(this.txtFileName); - this.Controls.Add(this.label7); - this.Controls.Add(this.txtTitle); - this.Controls.Add(this.label6); - this.Controls.Add(this.txtUrl); - this.Controls.Add(this.label5); - this.Controls.Add(this.lblManufacturer); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); + this.ClientSize = new System.Drawing.Size(600, 719); + this.Controls.Add(this.tabControlGeneral); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnSave); - this.MinimumSize = new System.Drawing.Size(550, 622); + this.MinimumSize = new System.Drawing.Size(616, 758); this.Name = "EditDatabaseEntryForm"; - this.Text = "Edit Game"; + this.Text = "Edit Database Entry"; + this.tabControlGeneral.ResumeLayout(false); + this.tabPageGeneral.ResumeLayout(false); + this.tabPageGeneral.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericRating)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericDownloadCount)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericFileBytes)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericYear)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericPlayers)).EndInit(); + this.tabPageAdditionalInfo.ResumeLayout(false); + this.tabPageAdditionalInfo.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewRelatedEntries)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.databaseEntryBindingSource)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewScreenshotUrls)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewAdditionalUrls)).EndInit(); this.ResumeLayout(false); - this.PerformLayout(); } #endregion private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.ColorDialog colorDialogDmdColor; + private System.Windows.Forms.TabControl tabControlGeneral; + private System.Windows.Forms.TabPage tabPageAdditionalInfo; + private System.Windows.Forms.DataGridView dataGridViewScreenshotUrls; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; + private System.Windows.Forms.Label label20; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.DataGridView dataGridViewAdditionalUrls; + private System.Windows.Forms.DataGridViewTextBoxColumn Url; + private System.Windows.Forms.DataGridView dataGridViewRelatedEntries; + private System.Windows.Forms.Label label21; + private System.Windows.Forms.TabPage tabPageGeneral; + private System.Windows.Forms.Button btnAddTag; + private System.Windows.Forms.TextBox txtTag; + private System.Windows.Forms.Label lblTags; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelTags; + private System.Windows.Forms.Button btnFillFromIpdb; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.DateTimePicker dateTimeModified; + private System.Windows.Forms.NumericUpDown numericRating; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.NumericUpDown numericDownloadCount; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.NumericUpDown numericFileBytes; + private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox txtIpdbNumber; private System.Windows.Forms.Label label14; private System.Windows.Forms.TextBox txtTheme; @@ -456,18 +1065,15 @@ private void InitializeComponent() private System.Windows.Forms.Button button1; private System.Windows.Forms.ComboBox cmbCategory; private System.Windows.Forms.Label lblId; - private System.Windows.Forms.Button btnGameUrl; - private System.Windows.Forms.TextBox txtGameUrl; - private System.Windows.Forms.Label label17; - private System.Windows.Forms.TextBox txtAdded; + private System.Windows.Forms.TextBox txtFeatures; private System.Windows.Forms.Label label15; private System.Windows.Forms.TextBox txtVersion; private System.Windows.Forms.TextBox txtAuthors; private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label12; - private System.Windows.Forms.TextBox txtIpdb; + private System.Windows.Forms.TextBox txtChangeLog; private System.Windows.Forms.Label label10; - private System.Windows.Forms.TextBox txtAuthor; + private System.Windows.Forms.TextBox txtDescription; private System.Windows.Forms.Label label8; private System.Windows.Forms.TextBox txtFileName; private System.Windows.Forms.Label label7; @@ -478,5 +1084,34 @@ private void InitializeComponent() private System.Windows.Forms.Label lblManufacturer; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button btnIpdbUrl; + private System.Windows.Forms.Button btnUrl; + private System.Windows.Forms.ComboBox cmbDatabase; + private System.Windows.Forms.Label label22; + private System.Windows.Forms.Label lblLocalTime; + private System.Windows.Forms.Label label23; + private System.Windows.Forms.Button btnAddRelatedEntry; + private System.Windows.Forms.BindingSource databaseEntryBindingSource; + private System.Windows.Forms.DataGridViewTextBoxColumn idDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn majorCategoryDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn urlDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn titleDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn fileNameDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn descriptionDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn changeLogDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn authorsDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn versionDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn featuresDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn manufacturerDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn yearDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn playersDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn themeDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn ipdbNumberDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn fileSizeBytesDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn downloadCountDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn ratingDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn lastModifiedDateUtcDataGridViewTextBoxColumn; + private System.Windows.Forms.Label label24; + private System.Windows.Forms.Label lblReadableFileSize; } } \ No newline at end of file diff --git a/PinCab.Configurator/EditDatabaseEntryForm.cs b/PinCab.Configurator/EditDatabaseEntryForm.cs index 11462b6..9d3853d 100644 --- a/PinCab.Configurator/EditDatabaseEntryForm.cs +++ b/PinCab.Configurator/EditDatabaseEntryForm.cs @@ -3,6 +3,7 @@ using PinCab.Utils.Models; using PinCab.Utils.Utils; using PinCab.Utils.ViewModels; +using PinCab.Utils.WinForms; using System; using System.Collections.Generic; using System.ComponentModel; @@ -13,31 +14,124 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using VirtualPinball.Database.Models; namespace PinCab.Configurator { public partial class EditDatabaseEntryForm : Form { - private FrontEndGameViewModel _setting { get; set; } + private DatabaseBrowserEntry _entry { get; set; } //private string originalFileName { get; set; } - private FrontEndManager _manager { get; set; } - private string _databaseFile { get; set; } + private DatabaseManager _manager { get; set; } private IpdbBrowserForm _ipdbForm = null; private bool isNewEntry = false; - public EditDatabaseEntryForm(FrontEndGameViewModel setting, string databaseFile, FrontEndManager manager, IpdbBrowserForm ipdbForm) + private DatabaseEntry _dbEntry { get; set; } + public EditDatabaseEntryForm(string databaseName, DatabaseBrowserEntry entry, DatabaseManager manager, IpdbBrowserForm ipdbForm) { InitializeComponent(); + _manager = manager; + _ipdbForm = ipdbForm; + _entry = entry; + DialogResult = DialogResult.None; + if (entry == null) + { + isNewEntry = true; + _entry = new DatabaseBrowserEntry(); + _dbEntry = new DatabaseEntry(); + _dbEntry.Id = 1; + if (manager.Databases[databaseName].Entries.Count > 0) + _dbEntry.Id = manager.Databases[databaseName].Entries.Max(c => c.Id) + 1; + } + else + { + _dbEntry = manager.Databases[entry.DatabaseName].Entries.First(c => c.Id == entry.Id); + } + LoadForm(); } private void LoadForm() { - txtManufacturer.Text = _setting.Manufacturer; - txtTheme.Text = _setting.Theme; - txtAuthor.Text = _setting.Author; - txtVersion.Text = _setting.Version; - txtIpdb.Text = _setting.IPDBNumber; - txtAdded.Text = _setting.DateAdded.ToString(); - txtGameUrl.Text = _setting.TableFileUrl; + //Load the database list + var databaseNames = _manager.Databases + .OrderBy(c => c.Key).Select(c => c.Key).ToList(); + cmbDatabase.DataSource = databaseNames; + + foreach (string databaseName in cmbDatabase.Items) + { + if (databaseName == _entry.DatabaseName) + cmbDatabase.SelectedItem = databaseName; + } + + if (!isNewEntry) + cmbDatabase.Enabled = false; //Do not allow saving an entry accross databases + + var categoryList = EnumExtensions.GetEnumDescriptionList(); + cmbCategory.DataSource = categoryList; + + foreach (string categoryName in cmbCategory.Items) + { + if (categoryName == _entry.Type.GetDescriptionAttr()) + cmbCategory.SelectedItem = categoryName; + } + + if (!isNewEntry) + lblId.Text = _dbEntry.Id.ToString(); + else + lblId.Text = "(Auto Generated)"; + + txtUrl.Text = _dbEntry.Url; + txtTitle.Text = _dbEntry.Title; + txtFileName.Text = _dbEntry.FileName; + txtDescription.Text = _dbEntry.Description; + txtChangeLog.Text = _dbEntry.ChangeLog; + txtFeatures.Text = _dbEntry.Features; + txtAuthors.Text = _dbEntry.Authors; + txtVersion.Text = _dbEntry.Version; + txtManufacturer.Text = _dbEntry.Manufacturer; + numericPlayers.Value = _dbEntry.Players.HasValue ? _dbEntry.Players.Value : 0; + numericYear.Value = _dbEntry.Year.HasValue ? _dbEntry.Year.Value : 0; + txtTheme.Text = _dbEntry.Theme; + txtIpdbNumber.Text = _dbEntry.IpdbNumber.HasValue ? _dbEntry.IpdbNumber.Value.ToString() : ""; + numericFileBytes.Value = _dbEntry.FileSizeBytes.HasValue ? _dbEntry.FileSizeBytes.Value : 0; + numericDownloadCount.Value = _dbEntry.DownloadCount.HasValue ? _dbEntry.DownloadCount.Value : 0; + numericRating.Value = _dbEntry.Rating.HasValue ? _dbEntry.Rating.Value : 0; + dateTimeModified.Value = _dbEntry.LastModifiedDateUtc.HasValue ? _dbEntry.LastModifiedDateUtc.Value : DateTime.UtcNow; + + foreach (var tag in _dbEntry.Tags) + { + TagObject tagwinforms = new TagObject(tag, null); + tagwinforms.Init(); + flowLayoutPanelTags.Controls.Add(tagwinforms); + } + + flowLayoutPanelTags.Padding = new Padding(3, 3, 3, 3); + + if (_dbEntry.AdditionalInfoUrls != null) + { + foreach (var url in _dbEntry.AdditionalInfoUrls) + { + dataGridViewAdditionalUrls.Rows.Add(url); + } + } + if (_dbEntry.ScreenshotUrls != null) + { + foreach (var url in _dbEntry.ScreenshotUrls) + { + dataGridViewScreenshotUrls.Rows.Add(url); + } + } + + var relatedEntries = new List(); + if (_dbEntry.RelatedEntries != null) + { + foreach (var entryId in _dbEntry.RelatedEntries) + { + var dbEntry = _manager.Databases[cmbDatabase.SelectedItem.ToString()].Entries.FirstOrDefault(c => c.Id == entryId); + if (dbEntry != null) + relatedEntries.Add(dbEntry); + } + } + databaseEntryBindingSource.DataSource = relatedEntries.ToSortableBindingList(); } private void btnCancel_Click(object sender, EventArgs e) @@ -45,56 +139,214 @@ private void btnCancel_Click(object sender, EventArgs e) Close(); } + public DatabaseEntry GetUpdatedDatabaseEntry() + { + _dbEntry.MajorCategory = cmbCategory.SelectedItem.ToString().GetValueFromDescription(); + _dbEntry.Url = txtUrl.Text; + _dbEntry.Title = txtTitle.Text; + _dbEntry.FileName = txtFileName.Text; + _dbEntry.Description = txtDescription.Text; + _dbEntry.ChangeLog = txtChangeLog.Text; + _dbEntry.Features = txtFeatures.Text; + _dbEntry.Authors = txtAuthors.Text; + _dbEntry.Version = txtVersion.Text; + _dbEntry.Manufacturer = txtManufacturer.Text; + _dbEntry.Players = Convert.ToInt32(numericPlayers.Value); + _dbEntry.Year = Convert.ToInt32(numericYear.Value); + _dbEntry.Theme = txtTheme.Text; + + int ipdbNum = 0; + bool result = int.TryParse(txtIpdbNumber.Text, out ipdbNum); + if (result) + _dbEntry.IpdbNumber = ipdbNum; + else + _dbEntry.IpdbNumber = null; + + _dbEntry.FileSizeBytes = Convert.ToInt32(numericFileBytes.Value); + _dbEntry.DownloadCount = Convert.ToInt32(numericDownloadCount.Value); + _dbEntry.Rating = Convert.ToInt32(numericRating.Value); + _dbEntry.LastModifiedDateUtc = dateTimeModified.Value; + _dbEntry.Tags = GetAllSelectedTags(); + _dbEntry.AdditionalInfoUrls = GetAllAdditionalUrls(); + _dbEntry.ScreenshotUrls = GetAllScreenshotUrls(); + _dbEntry.RelatedEntries = GetAllRelatedFileIds(); + + return _dbEntry; + } + + private List GetAllRelatedFileIds() + { + var list = new List(); + foreach (DataGridViewRow row in dataGridViewRelatedEntries.Rows) + { + list.Add(Convert.ToInt32(row.Cells["idDataGridViewTextBoxColumn"].Value)); + } + if (list.Count == 0) + return null; + return list.OrderBy(c => c).ToList(); + } + + private List GetAllAdditionalUrls() + { + var list = new List(); + foreach (DataGridViewRow row in dataGridViewAdditionalUrls.Rows) + { + if (!string.IsNullOrEmpty(row.Cells[0].Value?.ToString())) + list.Add(row.Cells[0].Value.ToString()); + } + if (list.Count == 0) + return null; + return list; + } + + private List GetAllScreenshotUrls() + { + var list = new List(); + foreach (DataGridViewRow row in dataGridViewScreenshotUrls.Rows) + { + if (!string.IsNullOrEmpty(row.Cells[0].Value?.ToString())) + list.Add(row.Cells[0].Value.ToString()); + } + if (list.Count == 0) + return null; + return list; + } + + private bool ValidateEntry() + { + List issues = new List(); + if (string.IsNullOrEmpty(txtTitle.Text)) + issues.Add("Title is a required field"); + if (string.IsNullOrEmpty(txtUrl.Text)) + issues.Add("Url is a required field"); + if (dateTimeModified.Value > DateTime.UtcNow) + issues.Add("Modified date cannot be in the future."); + + int ipdbNum = 0; + if (txtIpdbNumber.Text.Length > 0) + { + bool success = int.TryParse(txtIpdbNumber.Text, out ipdbNum); + if (!success) + issues.Add("IPDB Number is not numeric."); + } + + //Validate Url + Uri uriResult; + var successUri = Uri.TryCreate(txtUrl.Text, UriKind.Absolute, out uriResult); + if (!successUri) + issues.Add("Url entered is not a valid url. Url: " + txtUrl.Text); + + var additionalUrls = GetAllAdditionalUrls(); + if (additionalUrls != null) + { + foreach(var url in additionalUrls) + { + successUri = Uri.TryCreate(url, UriKind.Absolute, out uriResult); + if (!successUri) + issues.Add("Additional url entered is not a valid url. Url: " + url); + } + } + + var screenshotUrls = GetAllScreenshotUrls(); + if (screenshotUrls != null) + { + foreach (var url in screenshotUrls) + { + successUri = Uri.TryCreate(url, UriKind.Absolute, out uriResult); + if (!successUri) + issues.Add("Screenshot url entered is not a valid url. Url: " + url); + } + } + + if (issues.Count > 0) + MessageBox.Show(string.Join("\r\n", issues), "Issues List"); + return (issues.Count == 0); //True if 0 (no issues), false if >= 1 issues + } + private void btnSave_Click(object sender, EventArgs e) { - //var result = GetSettingFromControls(); - //if (string.IsNullOrEmpty(result.Description)) - //{ - // MessageBox.Show("Description is a required field"); - // return; - //} - //if (string.IsNullOrEmpty(result.FileName)) - //{ - // MessageBox.Show("File Name is a required field"); - // return; - //} + var valid = ValidateEntry(); + if (!valid) + return; + + var updatedDbEntry = GetUpdatedDatabaseEntry(); //_manager.SaveGame(result, null); - //DialogResult = DialogResult.OK; - //Close(); + DialogResult = DialogResult.OK; + Close(); + } + + public List GetAllSelectedTags() + { + var list = new List(); + foreach (var control in flowLayoutPanelTags.Controls) + { + list.Add((control as Label).Text); + } + return list; + } + + private void btnAddTag_Click(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(txtTag.Text)) + { + string tag = txtTag.Text; + TagObject tagwinforms = new TagObject(tag, null); //Pass in action on what to do if a tag is removed + tagwinforms.Init(); + flowLayoutPanelTags.Controls.Add(tagwinforms); + } + } + + private void btnUrl_Click(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(txtUrl.Text)) + System.Diagnostics.Process.Start(txtUrl.Text); } private void btnIpdbUrl_Click(object sender, EventArgs e) { - if (!string.IsNullOrEmpty(txtIpdb.Text)) - System.Diagnostics.Process.Start("https://www.ipdb.org/machine.cgi?id=" + txtIpdb.Text); + if (!string.IsNullOrEmpty(txtIpdbNumber.Text)) + System.Diagnostics.Process.Start("https://www.ipdb.org/machine.cgi?id=" + txtIpdbNumber.Text); + } + + private void dateTimeModified_ValueChanged(object sender, EventArgs e) + { + lblLocalTime.Text = dateTimeModified.Value.ToLocalTime().ToString("MM/dd/yyyy HH:mm:ss tt"); } private void btnFillFromIpdb_Click(object sender, EventArgs e) { - //_ipdbForm.SearchText(txtTableName.Text); - //if (isNewEntry) - // _ipdbForm.chkOverrideDisplayName.Checked = true; - //var result = _ipdbForm.ShowDialog(this); - //if (result == DialogResult.OK) - //{ - // //Fill the data - // var ipdbEntry = _ipdbForm.GetActiveRowEntry(); - // if (_ipdbForm.chkOverrideDisplayName.Checked) - // txtDisplayName.Text = ipdbEntry.Title; - // txtManufacturer.Text = ipdbEntry.ManufacturerShortName; - // txtYear.Text = ipdbEntry.DateOfManufacture?.Year.ToString(); - // txtTheme.Text = ipdbEntry.Theme; - // txtIpdb.Text = ipdbEntry.IpdbId.ToString(); - // txtType.Text = ipdbEntry.TypeShortName; - // txtPlayers.Text = ipdbEntry.Players.ToString(); - //} - } - - private void btnGameUrl_Click(object sender, EventArgs e) - { - if (!string.IsNullOrEmpty(txtGameUrl.Text)) - System.Diagnostics.Process.Start(txtGameUrl.Text); + _ipdbForm.SearchText(txtTitle.Text); + if (isNewEntry) + _ipdbForm.chkOverrideDisplayName.Checked = true; + var result = _ipdbForm.ShowDialog(this); + if (result == DialogResult.OK) + { + //Fill the data + var ipdbEntry = _ipdbForm.GetActiveRowEntry(); + if (_ipdbForm.chkOverrideDisplayName.Checked) + txtTitle.Text = ipdbEntry.Title; + txtManufacturer.Text = ipdbEntry.ManufacturerShortName; + if (ipdbEntry.DateOfManufacture.HasValue) + numericYear.Value = ipdbEntry.DateOfManufacture.Value.Year; + txtTheme.Text = ipdbEntry.Theme; + txtIpdbNumber.Text = ipdbEntry.IpdbId.ToString(); + numericPlayers.Value = ipdbEntry.Players.HasValue ? ipdbEntry.Players.Value : 0; + } + } + + private void dataGridViewScreenshotUrls_DoubleClick(object sender, EventArgs e) + { + if (dataGridViewScreenshotUrls.SelectedRows.Count > 0) + { + var row = dataGridViewScreenshotUrls.SelectedRows[0]; + System.Diagnostics.Process.Start(row.Cells[0].Value.ToString()); + } + } + + private void numericFileBytes_ValueChanged(object sender, EventArgs e) + { + lblReadableFileSize.Text = Convert.ToInt64(numericFileBytes.Value).FileSizeHumanReadable(); } } } diff --git a/PinCab.Configurator/EditDatabaseEntryForm.resx b/PinCab.Configurator/EditDatabaseEntryForm.resx index 264a001..dd2b1e4 100644 --- a/PinCab.Configurator/EditDatabaseEntryForm.resx +++ b/PinCab.Configurator/EditDatabaseEntryForm.resx @@ -117,7 +117,22 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 + + 17, 17 + + + True + + + True + + + True + + + True + \ No newline at end of file diff --git a/PinCab.Configurator/GameManagerForm.Designer.cs b/PinCab.Configurator/GameManagerForm.Designer.cs index 15aeb26..2189f1a 100644 --- a/PinCab.Configurator/GameManagerForm.Designer.cs +++ b/PinCab.Configurator/GameManagerForm.Designer.cs @@ -723,7 +723,7 @@ private void InitializeComponent() this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(955, 24); this.menuStrip1.TabIndex = 6; - this.menuStrip1.Text = "menuStrip1"; + this.menuStrip1.Text = "menuStripGameManager"; // // fileToolStripMenuItem // @@ -791,7 +791,7 @@ private void InitializeComponent() // toolStripStatusLabelSpacer // this.toolStripStatusLabelSpacer.Name = "toolStripStatusLabelSpacer"; - this.toolStripStatusLabelSpacer.Size = new System.Drawing.Size(740, 17); + this.toolStripStatusLabelSpacer.Size = new System.Drawing.Size(771, 17); this.toolStripStatusLabelSpacer.Spring = true; // // toolStripProgressBar diff --git a/PinCab.Configurator/IpdbBrowserForm.cs b/PinCab.Configurator/IpdbBrowserForm.cs index 889ccfa..7e6e807 100644 --- a/PinCab.Configurator/IpdbBrowserForm.cs +++ b/PinCab.Configurator/IpdbBrowserForm.cs @@ -32,7 +32,7 @@ public IpdbBrowserForm(string startText = "", bool hideForm = false) private void LoadDatabase() { var ipdbDatabase = _dbManager.GetIpdbContentDatabase(); - if (!_dbManager.DatabaseExistsOnFilesystem(ipdbDatabase)) + if (!_dbManager.DatabaseWorkFileExistsOnFilesystem(ipdbDatabase)) { _dbManager.DownloadDatabase(ipdbDatabase, true); } diff --git a/PinCab.Configurator/Pincab.Configurator.csproj b/PinCab.Configurator/Pincab.Configurator.csproj index 26d8bcc..5aee717 100644 --- a/PinCab.Configurator/Pincab.Configurator.csproj +++ b/PinCab.Configurator/Pincab.Configurator.csproj @@ -126,7 +126,9 @@ ..\packages\Serilog.Sinks.File.4.1.0\lib\net45\Serilog.Sinks.File.dll + + ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net46\System.Data.SQLite.dll @@ -313,6 +315,7 @@ + diff --git a/PinCab.Configurator/Properties/DataSources/VirtualPinball.Database.Models.DatabaseEntry.datasource b/PinCab.Configurator/Properties/DataSources/VirtualPinball.Database.Models.DatabaseEntry.datasource new file mode 100644 index 0000000..a6ad11a --- /dev/null +++ b/PinCab.Configurator/Properties/DataSources/VirtualPinball.Database.Models.DatabaseEntry.datasource @@ -0,0 +1,10 @@ + + + + VirtualPinball.Database.Models.DatabaseEntry, VirtualPinball.Database.Models, Version=1.0.14.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/PinCab.Configurator/SettingsForm.Designer.cs b/PinCab.Configurator/SettingsForm.Designer.cs index 65690b4..c3e5ece 100644 --- a/PinCab.Configurator/SettingsForm.Designer.cs +++ b/PinCab.Configurator/SettingsForm.Designer.cs @@ -103,6 +103,7 @@ private void InitializeComponent() this.btnB2SScreenresFilePath = new System.Windows.Forms.Button(); this.label8 = new System.Windows.Forms.Label(); this.tbSettings = new System.Windows.Forms.TabControl(); + this.btnFilePathDatabaseBrowser = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); this.tabPageDatabases.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gvContentDatabases)).BeginInit(); @@ -162,6 +163,7 @@ private void InitializeComponent() // // tabPageDatabases // + this.tabPageDatabases.Controls.Add(this.btnFilePathDatabaseBrowser); this.tabPageDatabases.Controls.Add(this.label19); this.tabPageDatabases.Controls.Add(this.gvContentDatabases); this.tabPageDatabases.Controls.Add(this.cmbContentDatabaseType); @@ -364,11 +366,11 @@ private void InitializeComponent() // label14 // this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(64, 221); + this.label14.Location = new System.Drawing.Point(31, 221); this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(23, 13); + this.label14.Size = new System.Drawing.Size(56, 13); this.label14.TabIndex = 52; - this.label14.Text = "Url:"; + this.label14.Text = "Url / Path:"; // // tabPageRecording // @@ -950,6 +952,19 @@ private void InitializeComponent() this.tbSettings.Size = new System.Drawing.Size(682, 363); this.tbSettings.TabIndex = 7; // + // btnFilePathDatabaseBrowser + // + this.btnFilePathDatabaseBrowser.BackgroundImage = global::PinCab.Configurator.Properties.Resources.FolderOpened_75x; + this.btnFilePathDatabaseBrowser.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.btnFilePathDatabaseBrowser.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnFilePathDatabaseBrowser.ForeColor = System.Drawing.SystemColors.Control; + this.btnFilePathDatabaseBrowser.Location = new System.Drawing.Point(532, 215); + this.btnFilePathDatabaseBrowser.Name = "btnFilePathDatabaseBrowser"; + this.btnFilePathDatabaseBrowser.Size = new System.Drawing.Size(38, 23); + this.btnFilePathDatabaseBrowser.TabIndex = 66; + this.btnFilePathDatabaseBrowser.UseVisualStyleBackColor = true; + this.btnFilePathDatabaseBrowser.Click += new System.EventHandler(this.btnFilePathDatabaseBrowser_Click); + // // SettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1060,5 +1075,6 @@ private void InitializeComponent() private System.Windows.Forms.DataGridViewTextBoxColumn urlDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn accessTokenDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn typeDataGridViewTextBoxColumn; + private System.Windows.Forms.Button btnFilePathDatabaseBrowser; } } \ No newline at end of file diff --git a/PinCab.Configurator/SettingsForm.cs b/PinCab.Configurator/SettingsForm.cs index 5f03e7f..77e7e67 100644 --- a/PinCab.Configurator/SettingsForm.cs +++ b/PinCab.Configurator/SettingsForm.cs @@ -352,6 +352,18 @@ private void gvContentDatabases_SelectionChanged(object sender, EventArgs e) cmbContentDatabaseType.SelectedItem = data.Type.GetDescriptionAttr(); } + private void btnFilePathDatabaseBrowser_Click(object sender, EventArgs e) + { + using (OpenFileDialog fileDialog = new OpenFileDialog()) + { + fileDialog.Filter = "JSON Files|*.json|All files (*.*)|*.*"; + fileDialog.RestoreDirectory = true; + var result = fileDialog.ShowDialog(this); + if (result == DialogResult.OK) + txtContentDatabaseUrl.Text = fileDialog.FileName; + } + } + //private void gvContentDatabases_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) //{ // gvContentDatabases.ClearSelection(); diff --git a/PinCab.Utils/Extensions/StringExtensions.cs b/PinCab.Utils/Extensions/StringExtensions.cs index 40e2e2d..672593b 100644 --- a/PinCab.Utils/Extensions/StringExtensions.cs +++ b/PinCab.Utils/Extensions/StringExtensions.cs @@ -56,5 +56,16 @@ public static string IfEmptyThenNull(this string text) return null; return text; } + + public static string FileSizeHumanReadable(this long byteCount) + { + string[] suf = { "B", "KB", "MB", "GB", "TB", "PB", "EB" }; //Longs run out around EB + if (byteCount == 0) + return "0" + suf[0]; + long bytes = Math.Abs(byteCount); + int place = Convert.ToInt32(Math.Floor(Math.Log(bytes, 1024))); + double num = Math.Round(bytes / Math.Pow(1024, place), 1); + return (Math.Sign(byteCount) * num).ToString() + " " + suf[place]; + } } } diff --git a/PinCab.Utils/Utils/DatabaseManager.cs b/PinCab.Utils/Utils/DatabaseManager.cs index 8461d54..472afe0 100644 --- a/PinCab.Utils/Utils/DatabaseManager.cs +++ b/PinCab.Utils/Utils/DatabaseManager.cs @@ -40,6 +40,8 @@ public class DatabaseManager private ReportProgressDelegate _reportProgress; public ProgramSettings Settings { get { return _settings; } } + public string PreprocessedDatabasePath { get { return preprocessedDatabasePath; } } + public DatabaseManager(ReportProgressDelegate reportProgress = null) { _settings = _settingManager.LoadSettings(); @@ -69,7 +71,7 @@ public ToolResult RefreshAllDatabases() { foreach (var database in _settings.Databases) { - if (!DatabaseExistsOnFilesystem(database)) //Force a refersh if one or more of the databases disappeared from the file system + if (!DatabaseWorkFileExistsOnFilesystem(database)) //Force a refersh if one or more of the databases disappeared from the file system { _settings.LastDatabaseRefreshTimeUtc = DateTime.UtcNow.AddMinutes((_settings.DatabaseUpdateRecheckMinutes * -1) - 1); } @@ -102,6 +104,44 @@ public ToolResult RefreshAllDatabases() return result; } + public void SanitizeAllDatabaseEntries(PinballDatabase database) + { + foreach (var file in database.Entries) + SanitizeEntry(file); + } + + public DatabaseEntry SanitizeEntry(DatabaseEntry entry) + { + if (entry.ScreenshotUrls?.Count == 0) + entry.ScreenshotUrls = null; + if (entry.RelatedEntries?.Count == 0) + entry.RelatedEntries = null; + if (entry.Tags?.Count == 0) + entry.Tags = null; + if (entry.AdditionalInfoUrls?.Count == 0) + entry.AdditionalInfoUrls = null; + if (entry.RelatedEntries != null) + entry.RelatedEntries = entry.RelatedEntries.Distinct().OrderBy(c => c).ToList(); + + if (string.IsNullOrEmpty(entry.Version)) + entry.Version = null; + if (string.IsNullOrEmpty(entry.Manufacturer)) + entry.Manufacturer = null; + if (string.IsNullOrEmpty(entry.Authors)) + entry.Authors = null; + if (string.IsNullOrEmpty(entry.Features)) + entry.Features = null; + if (string.IsNullOrEmpty(entry.Theme)) + entry.Theme = null; + if (string.IsNullOrEmpty(entry.Url)) + entry.Url = null; + if (string.IsNullOrEmpty(entry.ChangeLog)) + entry.ChangeLog = null; + if (string.IsNullOrEmpty(entry.Description)) + entry.Description = null; + return entry; + } + public ToolResult DownloadDatabase(ContentDatabase database, bool forceDownload = false) { var result = new ToolResult(); @@ -110,11 +150,11 @@ public ToolResult DownloadDatabase(ContentDatabase database, bool forceDownload DateTime.UtcNow.AddMinutes(_settings.DatabaseUpdateRecheckMinutes * -1) || forceDownload) { - bool success = DownloadDatabaseToFilesystem(database, GetFilesystemPath(database)); + bool success = DownloadDatabaseToFilesystem(database, GetFilesystemWorkPath(database)); if (success) - result.Messages.Add(new ValidationMessage($"Downloaded {database.Url} to {GetFilesystemPath(database)}", MessageLevel.Information)); + result.Messages.Add(new ValidationMessage($"Downloaded {database.Url} to {GetFilesystemWorkPath(database)}", MessageLevel.Information)); else - result.Messages.Add(new ValidationMessage($"Unable to download {database.Url} to {GetFilesystemPath(database)}", MessageLevel.Error)); + result.Messages.Add(new ValidationMessage($"Unable to download {database.Url} to {GetFilesystemWorkPath(database)}", MessageLevel.Error)); result.Result = true; //Inidicate we downloaded something } @@ -130,6 +170,9 @@ public ToolResult DownloadDatabase(ContentDatabase database, bool forceDownload private bool DownloadDatabaseToFilesystem(ContentDatabase database, string downloadPath) { + //If it's not a url, just consider it already downloaded + if (File.Exists(database.Url)) + return true; try { using (WebClient wc = new WebClient()) @@ -160,35 +203,66 @@ public void LoadAllDatabases() public void LoadDatabase(ContentDatabase database) { - if (File.Exists(GetFilesystemPath(database)) && database.Type == DatabaseType.PinballDatabase) + if (File.Exists(GetFilesystemWorkPath(database)) && database.Type == DatabaseType.PinballDatabase) { - var db = JsonConvert.DeserializeObject(File.ReadAllText(GetFilesystemPath(database))); + var db = JsonConvert.DeserializeObject(File.ReadAllText(GetFilesystemWorkPath(database)), GetJsonSerilizerSettings()); + SanitizeAllDatabaseEntries(db); Databases.Add(database.Name, db); } - else if (File.Exists(GetFilesystemPath(database)) && database.Type == DatabaseType.IPDB) + else if (File.Exists(GetFilesystemWorkPath(database)) && database.Type == DatabaseType.IPDB) { - IpdbDatabase = JsonConvert.DeserializeObject(File.ReadAllText(GetFilesystemPath(database))); + IpdbDatabase = JsonConvert.DeserializeObject(File.ReadAllText(GetFilesystemWorkPath(database)), GetJsonSerilizerSettings()); } } - public bool DatabaseExistsOnFilesystem(ContentDatabase database) + /// + /// Checks if the mirrored database exists on the file system. We download from a URL first. + /// Then save to local databases folder. + /// If it's a pointer to a local file already, we still mirror the file and end up updated it in both the mirroed location + /// and the official location + /// + /// + /// + public bool DatabaseWorkFileExistsOnFilesystem(ContentDatabase database) { if (!string.IsNullOrEmpty(database.Url)) { - var uri = new Uri(database.Url); - var fullFilePath = $"{databaseFolder}\\{uri.Segments.Last()}"; + string fullFilePath = $"{databaseFolder}\\{database.Name}.json"; if (File.Exists(fullFilePath)) return true; + //if (File.Exists(database.Url)) //If this is a local file system path instead of a url get the file path + //{ + // var fi = new FileInfo(database.Url); + // fullFilePath = $"{databaseFolder}\\{fi.Name}"; + // if (File.Exists(fullFilePath)) + // return true; + //} + //else //Url based paths + //{ + // var uri = new Uri(database.Url); + // fullFilePath = $"{databaseFolder}\\{uri.Segments.Last()}"; + // if (File.Exists(fullFilePath)) + // return true; + //} } return false; } - public string GetFilesystemPath(ContentDatabase database) + public string GetFilesystemWorkPath(ContentDatabase database) { if (!string.IsNullOrEmpty(database.Url)) { - var uri = new Uri(database.Url); - return $"{databaseFolder}\\{uri.Segments.Last()}"; + return $"{databaseFolder}\\{database.Name}.json"; + //if (File.Exists(database.Url)) //If this is a local file system path instead of a url get the file path + //{ + // var fi = new FileInfo(database.Url); + // return $"{databaseFolder}\\{fi.Name}"; + //} + //else //Url based path + //{ + // var uri = new Uri(database.Url); + // return $"{databaseFolder}\\{uri.Segments.Last()}"; + //} } return null; } @@ -215,7 +289,7 @@ public List GetAllEntries(bool forceReload) else { _reportProgress?.Invoke(10); - entries = JsonConvert.DeserializeObject>(File.ReadAllText(preprocessedDatabasePath)); + entries = JsonConvert.DeserializeObject>(File.ReadAllText(preprocessedDatabasePath), GetJsonSerilizerSettings()); Entries = entries; Log.Information("{toolname}: Loaded preprocessed database.", ToolName, preprocessedDatabasePath); _reportProgress?.Invoke(100); @@ -265,7 +339,7 @@ public List GetEntrysByDatabase(ContentDatabase database, //database (reached refresh timeframe or the preprocessed database doesn't exist yet) else if (IsValid(database) && !forceReload) { - var loadedEntries = JsonConvert.DeserializeObject>(File.ReadAllText(preprocessedDatabasePath)); + var loadedEntries = JsonConvert.DeserializeObject>(File.ReadAllText(preprocessedDatabasePath), GetJsonSerilizerSettings()); return loadedEntries.Where(p => p.DatabaseType == DatabaseType.PinballDatabase && p.DatabaseName == database.Name).ToList(); } @@ -284,17 +358,20 @@ private HashSet GetDatabaseBrowserEntries(ContentDatabase Log.Information("{tool}: Skipped adding {entry} because it didn't pass the data check.", ToolName, entry.Title); //Add the related entries - foreach(var relatedEntry in databaseEntry.RelatedEntries) + if (databaseEntry.RelatedEntries != null) { - var relatedContentEntry = Databases[database.Name].Entries.FirstOrDefault(c => c.Id == relatedEntry); - var newEntry = GetDatabaseBrowserEntry(database, relatedContentEntry); - if (IsValidBrowserEntry(newEntry)) + foreach (var relatedEntry in databaseEntry.RelatedEntries) { - entry.RelatedEntries.Add(newEntry); - entry.Tags.UnionWith(newEntry.Tags); + var relatedContentEntry = Databases[database.Name].Entries.FirstOrDefault(c => c.Id == relatedEntry); + var newEntry = GetDatabaseBrowserEntry(database, relatedContentEntry); + if (IsValidBrowserEntry(newEntry)) + { + entry.RelatedEntries.Add(newEntry); + entry.Tags.UnionWith(newEntry.Tags); + } + else + Log.Information("{tool}: Skipped related entry adding {entry} because it didn't pass the data check.", ToolName, relatedContentEntry.Title); } - else - Log.Information("{tool}: Skipped related entry adding {entry} because it didn't pass the data check.", ToolName, relatedContentEntry.Title); } } @@ -353,24 +430,28 @@ private HashSet GetTags(DatabaseBrowserEntry entry) return tags; } - private DatabaseBrowserEntry GetDatabaseBrowserEntry(ContentDatabase database, DatabaseEntry file) + public DatabaseBrowserEntry GetDatabaseBrowserEntry(ContentDatabase database, DatabaseEntry file) { - var entry = new DatabaseBrowserEntry() - { - Id = file.Id, - Authors = file.Authors, - ChangeLog = string.IsNullOrEmpty(file.ChangeLog) ? string.Empty : file.ChangeLog, - DatabaseType = DatabaseType.PinballDatabase, - Description = string.IsNullOrEmpty(file.Description) ? string.Empty : file.Description, - IpdbId = file.IpdbNumber, - Title = file.Title, - Type = file.MajorCategory, - Url = file.Url, - Version = file.Version, - Tags = file.Tags.ToHashSet(), - DatabaseName = database.Name, - LastUpdated = file.LastModifiedDateUtc.HasValue ? file.LastModifiedDateUtc.Value : new DateTime(1900, 1, 1), - }; + var entry = new DatabaseBrowserEntry(); + entry = MapDatabaseEntryToBrowserEntry(database, file, entry); + return entry; + } + + public DatabaseBrowserEntry MapDatabaseEntryToBrowserEntry(ContentDatabase database, DatabaseEntry file, DatabaseBrowserEntry entry) + { + entry.Id = file.Id; + entry.Authors = file.Authors; + entry.ChangeLog = string.IsNullOrEmpty(file.ChangeLog) ? string.Empty : file.ChangeLog; + entry.DatabaseType = DatabaseType.PinballDatabase; + entry.Description = string.IsNullOrEmpty(file.Description) ? string.Empty : file.Description; + entry.IpdbId = file.IpdbNumber; + entry.Title = file.Title; + entry.Type = file.MajorCategory; + entry.Url = file.Url; + entry.Version = file.Version; + entry.Tags = file.Tags?.ToHashSet(); + entry.DatabaseName = database.Name; + entry.LastUpdated = file.LastModifiedDateUtc.HasValue ? file.LastModifiedDateUtc.Value : new DateTime(1900, 1, 1); if (string.IsNullOrEmpty(file.Title) && !string.IsNullOrEmpty(file.FileName)) { @@ -387,12 +468,13 @@ private DatabaseBrowserEntry GetDatabaseBrowserEntry(ContentDatabase database, D entry.Description += "\r\n\r\nFeatures:\r\n" + file.Features; var tableInfoTags = file.ConvertTableInfoToTags(); + if (entry.Tags == null) + entry.Tags = new HashSet(); entry.Tags.UnionWith(tableInfoTags); List TagsByIpdbNumber = GetIpdbTags(entry); entry.Tags.UnionWith(TagsByIpdbNumber); //entry.Tags = entry.Tags.NormalizeTagList(); - return entry; } @@ -437,11 +519,11 @@ public void SaveDatabaseCache(T database, string fileAndPathToDatabase) using (StreamWriter sw = new StreamWriter(fileAndPathToDatabase, false)) using (JsonWriter writer = new JsonTextWriter(sw)) { - GetJsonSerilizerSettings().Serialize(writer, database); + GetJsonSerilizer().Serialize(writer, database); } } - private JsonSerializer GetJsonSerilizerSettings() + private JsonSerializer GetJsonSerilizer() { JsonSerializer serializer = new JsonSerializer(); serializer.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); @@ -450,5 +532,14 @@ private JsonSerializer GetJsonSerilizerSettings() serializer.Formatting = Formatting.Indented; return serializer; } + + private JsonSerializerSettings GetJsonSerilizerSettings() + { + JsonSerializerSettings settings = new JsonSerializerSettings() + { + NullValueHandling = NullValueHandling.Ignore, + }; + return settings; + } } }