From: <che...@us...> - 2007-06-12 12:35:25
|
Revision: 516 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=516&view=rev Author: chef_koch Date: 2007-06-12 05:35:18 -0700 (Tue, 12 Jun 2007) Log Message: ----------- reverted changes, sorry for the problems :( Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.resx Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs 2007-06-11 19:57:40 UTC (rev 515) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs 2007-06-12 12:35:18 UTC (rev 516) @@ -28,14 +28,13 @@ using System.Diagnostics; using System.Drawing; using System.Windows.Forms; -using System.Threading; -using MediaPortal.GUI.Library; - +using GUIPrograms; +using GUIPrograms.Database; using GUIPrograms.ApplicationItems; using GUIPrograms.FileItems; -using GUIPrograms.Imports; + namespace GUIPrograms.Design { /// <summary> @@ -43,60 +42,52 @@ /// </summary> public class FileInfoScraperForm : Form { - #region InitControls - private ApplicationItem m_CurApp; - private MediaPortal.UserInterface.Controls.MPListView listViewFileList; + private Panel leftPanel; + private Panel rightPanel; + private Splitter splitterVert; + private ListView FileList; private ColumnHeader FileTitle; + private ColumnHeader columnHeader1; private ColumnHeader status; - private MediaPortal.UserInterface.Controls.MPButton buttonStartSearch; - private MediaPortal.UserInterface.Controls.MPButton buttonSaveSearch; - private MediaPortal.UserInterface.Controls.MPButton buttonClose; - private LinkLabel linkLabelAllGame; + private ColumnHeader columnHeader2; + private ListView MatchList; + private Label lblFiles; + private Label lblMatches; + private Button btnStartSearch; + private Button btnSaveSearch; + private Button btnCancel; + private LinkLabel allGameLink; + private Button checkAllButton; private ToolTip toolTip1; - private MediaPortal.UserInterface.Controls.MPComboBox filterComboBox; - private MediaPortal.UserInterface.Controls.MPButton ResetFilterButton; + private Button uncheckAllButton; + private Button buttonSelectBestMatch; + private Label filterLabel; + private ComboBox filterComboBox; + private Button ResetFilterButton; private NumericUpDown MinRelevanceNum; - private MediaPortal.UserInterface.Controls.MPLabel label1; + private Label label1; + private Button LaunchURLButton; private Panel bottomPanel; private ContextMenu menuFileList; private MenuItem mnuCheckWithoutImages; private MenuItem mnuCheckWithoutOverview; + private ProgressBar progressBar; + private Panel progressPanel; + private Label progressStatusLabel; + private Button cancelButton; private IContainer components; + + int mStartTime = 0; // timer stuff private ContextMenu menuSaveDetails; private MenuItem menuItem4; private MenuItem menuDataAndImages; private MenuItem menuData; private MenuItem menuImages; - private MediaPortal.UserInterface.Controls.MPGroupBox groupBoxMatchList; - private MediaPortal.UserInterface.Controls.MPListView listViewMatchList; - private ColumnHeader columnHeader1; - private ColumnHeader columnHeader2; - private MediaPortal.UserInterface.Controls.MPGroupBox groupBoxFileList; - private MediaPortal.UserInterface.Controls.MPCheckBox checkboxFileList; private MediaPortal.UserInterface.Controls.MPLabel label2; - private MediaPortal.UserInterface.Controls.MPLabel labelLaunchUrlInfo; - - #endregion - - #region Variables / Init - - int mStartTime = 0; - private SplitContainer splitContainer1; - private MediaPortal.UserInterface.Controls.MPGroupBox groupBoxFilter; - private StatusStrip statusStrip; - private ToolStripStatusLabel toolStripStatusLabel; - private ToolStripProgressBar toolStripProgressBar; - private MediaPortal.UserInterface.Controls.MPLabel labelPlatform; - private ToolStripDropDownButton toolStripDropDownButton1; - private ToolStripMenuItem cancelSearchToolStripMenuItem; // timer stuff - - bool isSearching = false; bool stopSearching = false; - ScraperSaveType saveType = ScraperSaveType.DataAndImages; - public ApplicationItem CurApp { get @@ -145,207 +136,549 @@ base.Dispose(disposing); } - public void Setup() + #region Windows Form Designer generated code + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() { - SyncFileList(); - UpdateButtonStates(); - } + this.components = new System.ComponentModel.Container(); + System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FileInfoScraperForm)); + this.bottomPanel = new System.Windows.Forms.Panel(); + this.label2 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.progressPanel = new System.Windows.Forms.Panel(); + this.cancelButton = new MediaPortal.UserInterface.Controls.MPButton(); + this.progressStatusLabel = new MediaPortal.UserInterface.Controls.MPLabel(); + this.progressBar = new System.Windows.Forms.ProgressBar(); + this.label1 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.MinRelevanceNum = new System.Windows.Forms.NumericUpDown(); + this.ResetFilterButton = new MediaPortal.UserInterface.Controls.MPButton(); + this.filterComboBox = new MediaPortal.UserInterface.Controls.MPComboBox(); + this.filterLabel = new MediaPortal.UserInterface.Controls.MPLabel(); + this.buttonSelectBestMatch = new MediaPortal.UserInterface.Controls.MPButton(); + this.allGameLink = new System.Windows.Forms.LinkLabel(); + this.btnCancel = new MediaPortal.UserInterface.Controls.MPButton(); + this.btnSaveSearch = new MediaPortal.UserInterface.Controls.MPButton(); + this.btnStartSearch = new MediaPortal.UserInterface.Controls.MPButton(); + this.leftPanel = new System.Windows.Forms.Panel(); + this.uncheckAllButton = new MediaPortal.UserInterface.Controls.MPButton(); + this.checkAllButton = new MediaPortal.UserInterface.Controls.MPButton(); + this.lblFiles = new MediaPortal.UserInterface.Controls.MPLabel(); + this.FileList = new System.Windows.Forms.ListView(); + this.FileTitle = new System.Windows.Forms.ColumnHeader(); + this.status = new System.Windows.Forms.ColumnHeader(); + this.menuFileList = new System.Windows.Forms.ContextMenu(); + this.mnuCheckWithoutImages = new System.Windows.Forms.MenuItem(); + this.mnuCheckWithoutOverview = new System.Windows.Forms.MenuItem(); + this.splitterVert = new System.Windows.Forms.Splitter(); + this.rightPanel = new System.Windows.Forms.Panel(); + this.LaunchURLButton = new MediaPortal.UserInterface.Controls.MPButton(); + this.lblMatches = new MediaPortal.UserInterface.Controls.MPLabel(); + this.MatchList = new System.Windows.Forms.ListView(); + this.columnHeader1 = new System.Windows.Forms.ColumnHeader(); + this.columnHeader2 = new System.Windows.Forms.ColumnHeader(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.menuSaveDetails = new System.Windows.Forms.ContextMenu(); + this.menuDataAndImages = new System.Windows.Forms.MenuItem(); + this.menuItem4 = new System.Windows.Forms.MenuItem(); + this.menuData = new System.Windows.Forms.MenuItem(); + this.menuImages = new System.Windows.Forms.MenuItem(); + this.bottomPanel.SuspendLayout(); + this.progressPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.MinRelevanceNum)).BeginInit(); + this.leftPanel.SuspendLayout(); + this.rightPanel.SuspendLayout(); + this.SuspendLayout(); + // + // bottomPanel + // + this.bottomPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.bottomPanel.Controls.Add(this.label2); + this.bottomPanel.Controls.Add(this.progressPanel); + this.bottomPanel.Controls.Add(this.label1); + this.bottomPanel.Controls.Add(this.MinRelevanceNum); + this.bottomPanel.Controls.Add(this.ResetFilterButton); + this.bottomPanel.Controls.Add(this.filterComboBox); + this.bottomPanel.Controls.Add(this.filterLabel); + this.bottomPanel.Controls.Add(this.buttonSelectBestMatch); + this.bottomPanel.Controls.Add(this.allGameLink); + this.bottomPanel.Controls.Add(this.btnCancel); + this.bottomPanel.Controls.Add(this.btnSaveSearch); + this.bottomPanel.Controls.Add(this.btnStartSearch); + this.bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom; + this.bottomPanel.Location = new System.Drawing.Point(0, 422); + this.bottomPanel.Name = "bottomPanel"; + this.bottomPanel.Size = new System.Drawing.Size(752, 112); + this.bottomPanel.TabIndex = 0; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(520, 8); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(224, 40); + this.label2.TabIndex = 28; + this.label2.Text = "Warning: Don\'t overuse the allgame scraper! Do lookups with small sets of games (" + + "max. 20 games)."; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // progressPanel + // + this.progressPanel.Controls.Add(this.cancelButton); + this.progressPanel.Controls.Add(this.progressStatusLabel); + this.progressPanel.Controls.Add(this.progressBar); + this.progressPanel.Enabled = false; + this.progressPanel.Location = new System.Drawing.Point(8, 69); + this.progressPanel.Name = "progressPanel"; + this.progressPanel.Size = new System.Drawing.Size(480, 40); + this.progressPanel.TabIndex = 27; + // + // cancelButton + // + this.cancelButton.Location = new System.Drawing.Point(392, 16); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(88, 23); + this.cancelButton.TabIndex = 29; + this.cancelButton.Text = "Cancel Search"; + this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); + // + // progressStatusLabel + // + this.progressStatusLabel.Location = new System.Drawing.Point(0, 20); + this.progressStatusLabel.Name = "progressStatusLabel"; + this.progressStatusLabel.Size = new System.Drawing.Size(392, 16); + this.progressStatusLabel.TabIndex = 28; + this.progressStatusLabel.Text = "Progress status"; + // + // progressBar + // + this.progressBar.Location = new System.Drawing.Point(0, 0); + this.progressBar.Name = "progressBar"; + this.progressBar.Size = new System.Drawing.Size(480, 16); + this.progressBar.TabIndex = 27; + // + // label1 + // + this.label1.Location = new System.Drawing.Point(344, 6); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(88, 14); + this.label1.TabIndex = 25; + this.label1.Text = "Min. Relevance"; + // + // MinRelevanceNum + // + this.MinRelevanceNum.Increment = new System.Decimal(new int[] { + 10, + 0, + 0, + 0}); + this.MinRelevanceNum.Location = new System.Drawing.Point(432, 3); + this.MinRelevanceNum.Name = "MinRelevanceNum"; + this.MinRelevanceNum.Size = new System.Drawing.Size(56, 20); + this.MinRelevanceNum.TabIndex = 24; + this.toolTip1.SetToolTip(this.MinRelevanceNum, "This is the minimal RELEVANCE value to autoselect a match"); + this.MinRelevanceNum.Value = new System.Decimal(new int[] { + 70, + 0, + 0, + 0}); + this.MinRelevanceNum.ValueChanged += new System.EventHandler(this.MinRelevanceNum_ValueChanged); + // + // ResetFilterButton + // + this.ResetFilterButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.ResetFilterButton.Location = new System.Drawing.Point(282, 3); + this.ResetFilterButton.Name = "ResetFilterButton"; + this.ResetFilterButton.Size = new System.Drawing.Size(40, 21); + this.ResetFilterButton.TabIndex = 23; + this.ResetFilterButton.Text = "Clear"; + this.toolTip1.SetToolTip(this.ResetFilterButton, "Reset Filter"); + this.ResetFilterButton.Click += new System.EventHandler(this.ResetFilterButton_Click); + // + // filterComboBox + // + this.filterComboBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.filterComboBox.Items.AddRange(new object[] { + "Arcade", + "Atari 5200", + "Atari 7800", + "Atari Lynx", + "Atari ST", + "Atari Video Computer System", + "Commodore 64/128", + "Commodore Amiga", + "Game Boy", + "Game Boy Advance", + "Game Boy Color", + "Neo Geo", + "Nintendo 64", + "Nintendo Entertainment System", + "PlayStation", + "Sega Dreamcast", + "Sega Game Gear", + "Sega Genesis", + "Sega Master System", + "Super NES", + "TurboGrafx-16"}); + this.filterComboBox.Location = new System.Drawing.Point(72, 3); + this.filterComboBox.Name = "filterComboBox"; + this.filterComboBox.Size = new System.Drawing.Size(208, 21); + this.filterComboBox.TabIndex = 22; + this.toolTip1.SetToolTip(this.filterComboBox, "Enter platform to filter results"); + this.filterComboBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.filterComboBox_KeyUp); + this.filterComboBox.SelectedIndexChanged += new System.EventHandler(this.filterComboBox_SelectedIndexChanged); + // + // filterLabel + // + this.filterLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.filterLabel.Location = new System.Drawing.Point(8, 5); + this.filterLabel.Name = "filterLabel"; + this.filterLabel.Size = new System.Drawing.Size(80, 16); + this.filterLabel.TabIndex = 21; + this.filterLabel.Text = "Platform:"; + // + // buttonSelectBestMatch + // + this.buttonSelectBestMatch.Enabled = false; + this.buttonSelectBestMatch.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.buttonSelectBestMatch.Location = new System.Drawing.Point(168, 32); + this.buttonSelectBestMatch.Name = "buttonSelectBestMatch"; + this.buttonSelectBestMatch.Size = new System.Drawing.Size(160, 32); + this.buttonSelectBestMatch.TabIndex = 20; + this.buttonSelectBestMatch.Text = "2) Select Best Match"; + this.toolTip1.SetToolTip(this.buttonSelectBestMatch, "Select the best match for all checked files ("); + this.buttonSelectBestMatch.Click += new System.EventHandler(this.buttonSelectBestMatch_Click); + // + // allGameLink + // + this.allGameLink.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.allGameLink.Location = new System.Drawing.Point(616, 56); + this.allGameLink.Name = "allGameLink"; + this.allGameLink.Size = new System.Drawing.Size(128, 16); + this.allGameLink.TabIndex = 3; + this.allGameLink.TabStop = true; + this.allGameLink.Text = "http://www.allgame.com"; + this.allGameLink.TextAlign = System.Drawing.ContentAlignment.TopRight; + this.allGameLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.allGameLink_LinkClicked); + // + // btnCancel + // + this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnCancel.Location = new System.Drawing.Point(668, 76); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.TabIndex = 2; + this.btnCancel.Text = "Close"; + this.btnCancel.Click += new System.EventHandler(this.button3_Click); + // + // btnSaveSearch + // + this.btnSaveSearch.Enabled = false; + this.btnSaveSearch.Location = new System.Drawing.Point(328, 32); + this.btnSaveSearch.Name = "btnSaveSearch"; + this.btnSaveSearch.Size = new System.Drawing.Size(160, 32); + this.btnSaveSearch.TabIndex = 1; + this.btnSaveSearch.Text = "3) Download && Save Details"; + this.toolTip1.SetToolTip(this.btnSaveSearch, "Download selected matches and save results to MediaPortal!"); + this.btnSaveSearch.Click += new System.EventHandler(this.btnSaveSearch_Click); + // + // btnStartSearch + // + this.btnStartSearch.Enabled = false; + this.btnStartSearch.Location = new System.Drawing.Point(8, 32); + this.btnStartSearch.Name = "btnStartSearch"; + this.btnStartSearch.Size = new System.Drawing.Size(160, 32); + this.btnStartSearch.TabIndex = 0; + this.btnStartSearch.Text = "1) Start Search"; + this.toolTip1.SetToolTip(this.btnStartSearch, "Search Details for all the checked files"); + this.btnStartSearch.Click += new System.EventHandler(this.btnStartSearch_Click); + // + // leftPanel + // + this.leftPanel.Controls.Add(this.uncheckAllButton); + this.leftPanel.Controls.Add(this.checkAllButton); + this.leftPanel.Controls.Add(this.lblFiles); + this.leftPanel.Controls.Add(this.FileList); + this.leftPanel.Dock = System.Windows.Forms.DockStyle.Left; + this.leftPanel.Location = new System.Drawing.Point(0, 0); + this.leftPanel.Name = "leftPanel"; + this.leftPanel.Size = new System.Drawing.Size(360, 422); + this.leftPanel.TabIndex = 5; + // + // uncheckAllButton + // + this.uncheckAllButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.uncheckAllButton.Image = ((System.Drawing.Image)(resources.GetObject("uncheckAllButton.Image"))); + this.uncheckAllButton.Location = new System.Drawing.Point(320, 8); + this.uncheckAllButton.Name = "uncheckAllButton"; + this.uncheckAllButton.Size = new System.Drawing.Size(32, 32); + this.uncheckAllButton.TabIndex = 16; + this.toolTip1.SetToolTip(this.uncheckAllButton, "Uncheck all"); + this.uncheckAllButton.Click += new System.EventHandler(this.uncheckAllButton_Click); + // + // checkAllButton + // + this.checkAllButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.checkAllButton.Image = ((System.Drawing.Image)(resources.GetObject("checkAllButton.Image"))); + this.checkAllButton.Location = new System.Drawing.Point(288, 8); + this.checkAllButton.Name = "checkAllButton"; + this.checkAllButton.Size = new System.Drawing.Size(32, 32); + this.checkAllButton.TabIndex = 15; + this.toolTip1.SetToolTip(this.checkAllButton, "Check all"); + this.checkAllButton.Click += new System.EventHandler(this.checkAllButton_Click); + // + // lblFiles + // + this.lblFiles.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.lblFiles.Location = new System.Drawing.Point(8, 16); + this.lblFiles.Name = "lblFiles"; + this.lblFiles.Size = new System.Drawing.Size(200, 16); + this.lblFiles.TabIndex = 14; + this.lblFiles.Text = "Files"; + // + // FileList + // + this.FileList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.FileList.CheckBoxes = true; + this.FileList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.FileTitle, + this.status}); + this.FileList.ContextMenu = this.menuFileList; + this.FileList.FullRowSelect = true; + this.FileList.HideSelection = false; + this.FileList.LabelEdit = true; + this.FileList.Location = new System.Drawing.Point(8, 40); + this.FileList.Name = "FileList"; + this.FileList.Size = new System.Drawing.Size(344, 368); + this.FileList.TabIndex = 13; + this.FileList.View = System.Windows.Forms.View.Details; + this.FileList.MouseUp += new System.Windows.Forms.MouseEventHandler(this.FileList_MouseUp); + this.FileList.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.FileList_AfterLabelEdit); + this.FileList.SelectedIndexChanged += new System.EventHandler(this.FileList_SelectedIndexChanged); + // + // FileTitle + // + this.FileTitle.Text = "Title"; + this.FileTitle.Width = 218; + // + // status + // + this.status.Text = "Status"; + this.status.Width = 102; + // + // menuFileList + // + this.menuFileList.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.mnuCheckWithoutImages, + this.mnuCheckWithoutOverview}); + // + // mnuCheckWithoutImages + // + this.mnuCheckWithoutImages.Index = 0; + this.mnuCheckWithoutImages.Text = "Check all files without images"; + this.mnuCheckWithoutImages.Click += new System.EventHandler(this.mnuCheckWithoutImages_Click); + // + // mnuCheckWithoutOverview + // + this.mnuCheckWithoutOverview.Index = 1; + this.mnuCheckWithoutOverview.Text = "Check all files without an overview"; + this.mnuCheckWithoutOverview.Click += new System.EventHandler(this.mnuCheckWithoutOverview_Click); + // + // splitterVert + // + this.splitterVert.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.splitterVert.Location = new System.Drawing.Point(360, 0); + this.splitterVert.Name = "splitterVert"; + this.splitterVert.Size = new System.Drawing.Size(5, 422); + this.splitterVert.TabIndex = 6; + this.splitterVert.TabStop = false; + // + // rightPanel + // + this.rightPanel.Controls.Add(this.LaunchURLButton); + this.rightPanel.Controls.Add(this.lblMatches); + this.rightPanel.Controls.Add(this.MatchList); + this.rightPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.rightPanel.Location = new System.Drawing.Point(365, 0); + this.rightPanel.Name = "rightPanel"; + this.rightPanel.Size = new System.Drawing.Size(387, 422); + this.rightPanel.TabIndex = 7; + // + // LaunchURLButton + // + this.LaunchURLButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.LaunchURLButton.Enabled = false; + this.LaunchURLButton.Location = new System.Drawing.Point(272, 12); + this.LaunchURLButton.Name = "LaunchURLButton"; + this.LaunchURLButton.Size = new System.Drawing.Size(104, 24); + this.LaunchURLButton.TabIndex = 16; + this.LaunchURLButton.Text = "Launch URL"; + this.toolTip1.SetToolTip(this.LaunchURLButton, "Show allgame-page in your browser"); + this.LaunchURLButton.Click += new System.EventHandler(this.LaunchURLButton_Click); + // + // lblMatches + // + this.lblMatches.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.lblMatches.Location = new System.Drawing.Point(16, 18); + this.lblMatches.Name = "lblMatches"; + this.lblMatches.Size = new System.Drawing.Size(56, 16); + this.lblMatches.TabIndex = 15; + this.lblMatches.Text = "Matches:"; + // + // MatchList + // + this.MatchList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.MatchList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader2}); + this.MatchList.FullRowSelect = true; + this.MatchList.HideSelection = false; + this.MatchList.Location = new System.Drawing.Point(16, 40); + this.MatchList.MultiSelect = false; + this.MatchList.Name = "MatchList"; + this.MatchList.Size = new System.Drawing.Size(358, 368); + this.MatchList.TabIndex = 14; + this.MatchList.View = System.Windows.Forms.View.Details; + this.MatchList.DoubleClick += new System.EventHandler(this.MatchList_DoubleClick); + this.MatchList.SelectedIndexChanged += new System.EventHandler(this.MatchList_SelectedIndexChanged); + // + // columnHeader1 + // + this.columnHeader1.Text = "Title (Platform)"; + this.columnHeader1.Width = 247; + // + // columnHeader2 + // + this.columnHeader2.Text = "Relevance"; + this.columnHeader2.Width = 80; + // + // menuSaveDetails + // + this.menuSaveDetails.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.menuDataAndImages, + this.menuItem4, + this.menuData, + this.menuImages}); + // + // menuDataAndImages + // + this.menuDataAndImages.Index = 0; + this.menuDataAndImages.Text = "Save Data and download images"; + this.menuDataAndImages.Click += new System.EventHandler(this.menuDataAndImages_Click); + // + // menuItem4 + // + this.menuItem4.Index = 1; + this.menuItem4.Text = "-"; + // + // menuData + // + this.menuData.Index = 2; + this.menuData.Text = "Save Data only"; + this.menuData.Click += new System.EventHandler(this.menuData_Click); + // + // menuImages + // + this.menuImages.Index = 3; + this.menuImages.Text = "Download images only"; + this.menuImages.Click += new System.EventHandler(this.menuImages_Click); + // + // FileInfoScraperForm + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(752, 534); + this.Controls.Add(this.rightPanel); + this.Controls.Add(this.splitterVert); + this.Controls.Add(this.leftPanel); + this.Controls.Add(this.bottomPanel); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "FileInfoScraperForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Search fileinfo"; + this.bottomPanel.ResumeLayout(false); + this.progressPanel.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.MinRelevanceNum)).EndInit(); + this.leftPanel.ResumeLayout(false); + this.rightPanel.ResumeLayout(false); + this.ResumeLayout(false); - #endregion - - #region Properties / Helper Routines - - private FileItem GetSelectedFileItem() - { - if (listViewFileList.FocusedItem == null) return null; - if (listViewFileList.FocusedItem.Tag == null) return null; - - return listViewFileList.FocusedItem.Tag as FileItem; } - - private FileItemInfo GetSelectedMatchItem() - { - if (listViewMatchList.CheckedItems == null) return null; - if (listViewMatchList.CheckedItems[0] == null) return null; - if (listViewMatchList.CheckedItems[0].Tag == null) return null; - - return listViewMatchList.CheckedItems[0].Tag as FileItemInfo; - } - - private bool IsGoodMatch(FileItemInfo info) - { - bool result = (filterComboBox.Text == "") || (info.Platform.ToLower().IndexOf(filterComboBox.Text.ToLower()) == 0); - if (result) - { - result = (info.RelevanceNorm >= MinRelevanceNum.Value); - } - return result; - } - - private void SelectBestMatch(ListViewItem curItem) - { - if (curItem.Tag == null) return; - - FileItem file = curItem.Tag as FileItem; - if (file == null) return; - if (file.FileInfoList == null) return; - - foreach (FileItemInfo info in file.FileInfoList) - { - // check if - // - info is from platform, which is set in combobox - // - has minimum relevance - if (!IsGoodMatch(info)) continue; - - // if file has no favourite yet - if (file.FileInfoFavourite == null) - { - file.FileInfoFavourite = info; - continue; - } - - /* this needs adding the gameurl to database - // prevously selected infoitem - if (file.GameURL == info.GameURL) - { - file.FileInfoFavourite = info; - continue; - } - */ - - // file has already a favourite - // is info's relevance better than current favourite's relevance - if (info.RelevanceNorm > file.FileInfoFavourite.RelevanceNorm) - file.FileInfoFavourite = info; - } - - if (file.FileInfoFavourite != null) - { - curItem.SubItems[1].Text = String.Format("best: {0}%", file.FileInfoFavourite.RelevanceNorm); - } - else - { - curItem.SubItems[1].Text = "no match"; - } - } - #endregion - #region Display - private void UpdateButtonStates() + public void Setup() { - // labels to update - groupBoxFileList.Text = String.Format("Files ({0} of {1} selected)", listViewFileList.CheckedItems.Count, listViewFileList.Items.Count); - - // button states to update - buttonStartSearch.Enabled = (listViewFileList.CheckedItems.Count > 0); - - if (!buttonStartSearch.Enabled) - buttonSaveSearch.Enabled = false; - - // when search is active, only cancel button should be enabled - groupBoxFileList.Enabled = (!isSearching); - groupBoxMatchList.Enabled = (!isSearching); - groupBoxFilter.Enabled = (!isSearching); - buttonStartSearch.Enabled = (!isSearching); - buttonSaveSearch.Enabled = (!isSearching); - buttonClose.Enabled = (!isSearching); - toolStripDropDownButton1.Enabled = isSearching; + SyncListView(); + SyncFileLabel(); } - private void ChangeFileSelection() + private void SyncListView() { - SyncMatchList(GetSelectedFileItem()); - } + if (m_CurApp == null) + return; - private void SyncFileList() - { - if (m_CurApp == null) return; - - listViewFileList.BeginUpdate(); + FileList.BeginUpdate(); try { - listViewFileList.Items.Clear(); + FileList.Items.Clear(); // add all files foreach (FileItem file in m_CurApp.Files) { ListViewItem curItem = new ListViewItem(file.Title); - file.ToFileInfoFavourite(); curItem.Tag = file; if (!file.IsFolder) { - ListViewItem newItem = listViewFileList.Items.Add(curItem); + ListViewItem newItem = FileList.Items.Add(curItem); newItem.SubItems.Add("<unknown>"); } } } finally { - listViewFileList.EndUpdate(); + FileList.EndUpdate(); } } - private void SyncMatchList(FileItem file) + private void button3_Click(object sender, EventArgs e) { - listViewMatchList.BeginUpdate(); - try + if ((m_CurApp != null) && (filterComboBox.Text != "")) { - listViewMatchList.Items.Clear(); - - if (file == null) return; - if (file.FileInfoList == null) return; - - foreach (FileItemInfo item in file.FileInfoList) - { - if (!IsGoodMatch(item)) continue; - - ListViewItem curItem = new ListViewItem(String.Format("{0} ({1})", item.Title, item.Platform)); - curItem.SubItems.Add(String.Format("{0}%", item.RelevanceNorm)); - curItem.Tag = item; - - // selected item? - if (file.FileInfoFavourite != null) - if (file.FileInfoFavourite == item) - { - curItem.Checked = true; - } - - listViewMatchList.Items.Add(curItem); - } + m_CurApp.SystemDefault = filterComboBox.Text; + m_CurApp.InsertOrUpdateSettings(); } - finally - { - listViewMatchList.EndUpdate(); - } + this.Close(); } - private void InitProgressBar(string msg) + void InitProgressBar(string msg) { - toolStripProgressBar.Value = 0; - if (listViewFileList.CheckedItems.Count - 1 > 0) + progressPanel.Enabled = true; + progressBar.Value = 0; + if (FileList.CheckedItems.Count - 1 > 0) { - toolStripProgressBar.Maximum = listViewFileList.CheckedItems.Count - 1; + progressBar.Maximum = FileList.CheckedItems.Count - 1; } else { - toolStripProgressBar.Maximum = 1; + progressBar.Maximum = 1; } - toolStripProgressBar.Step = 1; - toolStripStatusLabel.Text = msg; + progressBar.Step = 1; + progressStatusLabel.Text = msg; mStartTime = (int)(DateTime.Now.Ticks / 10000); // reset timer! } - private void StepProgressBar() + void StepProgressBar() { string strTimeRemaining = ""; - toolStripProgressBar.PerformStep(); - if (toolStripProgressBar.Value > 1) + progressBar.PerformStep(); + if (progressBar.Value > 1) { int nTimeElapsed = ((int)(DateTime.Now.Ticks / 10000)) - mStartTime; - double TimePerItem = nTimeElapsed / toolStripProgressBar.Value - 1; - int nTotalTime = (int)(toolStripProgressBar.Maximum * TimePerItem); + double TimePerItem = nTimeElapsed / progressBar.Value - 1; + int nTotalTime = (int)(progressBar.Maximum * TimePerItem); int nTimeRemaining = nTotalTime - nTimeElapsed; int nSecondsRemaining = nTimeRemaining / 1000; int nMinutesRemaining = nSecondsRemaining / 60; @@ -353,124 +686,292 @@ strTimeRemaining = String.Format(" ({0}m {1}s remaining)", nMinutesRemaining, nSecondsRemaining); } - toolStripStatusLabel.Text = String.Format("Searching file {0} of {1} ", toolStripProgressBar.Value, toolStripProgressBar.Maximum + 1) + strTimeRemaining; + progressStatusLabel.Text = String.Format("Searching file {0} of {1} ", progressBar.Value, progressBar.Maximum + 1) + strTimeRemaining; } - private void DeInitProgressBar(string msg) + void DeInitProgressBar(string msg) { - toolStripStatusLabel.Text = msg; + progressPanel.Enabled = false; + progressStatusLabel.Text = msg; } - #endregion + private void btnStartSearch_Click(object sender, EventArgs e) + { + int numberOfSearches = 0; + bool bSuccess = true; + InitProgressBar("Starting search"); + foreach (ListViewItem curItem in FileList.CheckedItems) + { + if (stopSearching) + break; + ListViewItem nextItem = null; + FileItem file = (FileItem)curItem.Tag; + if (file != null) + { + if (curItem.Index < FileList.Items.Count - 1) + { + nextItem = FileList.Items[curItem.Index + 1]; + } + else + { + nextItem = curItem; + } + nextItem.EnsureVisible(); + // if (!bSuccess) + // { + // curItem.SubItems[1].Text = String.Format("waiting for reconnection..."); + // System.Threading.Thread.Sleep(5126); + // } + numberOfSearches = numberOfSearches + 1; + if (numberOfSearches > 20) + { + curItem.SubItems[1].Text = String.Format("waiting..."); + System.Threading.Thread.Sleep(20000); + System.Windows.Forms.Application.DoEvents(); + numberOfSearches = 0; + } + curItem.SubItems[1].Text = String.Format("searching..."); + curItem.Font = new Font(curItem.Font, curItem.Font.Style | FontStyle.Bold); + System.Windows.Forms.Application.DoEvents(); + bSuccess = file.FindFileInfo(curItem.Text, ScraperType.ALLGAME); + curItem.SubItems[1].Text = String.Format("{0} matches", file.FileInfoList.Count); + StepProgressBar(); + buttonSelectBestMatch.Enabled = true; + System.Windows.Forms.Application.DoEvents(); + } + } + ChangeFileSelection(); + if (stopSearching) + { + DeInitProgressBar("Search aborted"); + } + else + { + DeInitProgressBar("Search finished"); + } + stopSearching = false; + } - #region ControlEvents - #region Lists - - private void listViewFileList_SelectedIndexChanged(object sender, EventArgs e) + private FileItem GetSelectedFileItem() { - ChangeFileSelection(); + FileItem res = null; + if (FileList.FocusedItem != null) + { + if (FileList.FocusedItem.Tag != null) + { + res = (FileItem)FileList.FocusedItem.Tag; + } + } + return res; } - private void listViewFileList_ItemChecked(object sender, ItemCheckedEventArgs e) + private FileItemInfo GetSelectedMatchItem() { - UpdateButtonStates(); + FileItemInfo res = null; + if (MatchList.SelectedItems != null) + { + if (MatchList.SelectedItems[0] != null) + { + if (MatchList.SelectedItems[0].Tag != null) + { + res = (FileItemInfo)MatchList.SelectedItems[0].Tag; + } + } + } + return res; } - private void listViewMatchList_ItemCheck(object sender, ItemCheckEventArgs e) + + private bool IsGoodMatch(FileItemInfo info) { - if (e.NewValue == CheckState.Checked) + bool result = (filterComboBox.Text == "") || (info.Platform.ToLower().IndexOf(filterComboBox.Text.ToLower()) == 0); + if (result) { - if (listViewMatchList.CheckedItems == null) return; - foreach (ListViewItem item in listViewMatchList.CheckedItems) - if (item.Index != e.Index) - item.Checked = false; + result = (info.RelevanceNorm >= MinRelevanceNum.Value); } + return result; } - private void listViewMatchList_ItemChecked(object sender, ItemCheckedEventArgs e) + private void SyncMatchesList(FileItem file) { - if (e.Item.Checked == false) return; + LaunchURLButton.Enabled = false; + MatchList.BeginUpdate(); + try + { + MatchList.Items.Clear(); + if (file != null) + { + if (file.FileInfoList != null) + { + foreach (FileItemInfo item in file.FileInfoList) + { + if (IsGoodMatch(item)) + { + ListViewItem curItem = new ListViewItem(String.Format("{0} ({1})", item.Title, item.Platform)); + curItem.SubItems.Add(String.Format("{0}%", item.RelevanceNorm)); + // curItem.SubItems[1].Text = String.Format("{0}%", item.Relevance); + curItem.Tag = item; + curItem = MatchList.Items.Add(curItem); + // selected item? + if ((file.FileInfoFavourite != null) && (file.FileInfoFavourite == item)) + { + curItem.Selected = true; + LaunchURLButton.Enabled = true; + } + } + } + } + } + } + finally + { + MatchList.EndUpdate(); + } - FileItem file = GetSelectedFileItem(); - if (file == null) return; + } - if (e.Item.Tag == null) return; - FileItemInfo info = e.Item.Tag as FileItemInfo; - if (info == null) return; - file.FileInfoFavourite = info; - buttonSaveSearch.Enabled = true; - listViewFileList.FocusedItem.SubItems[1].Text = String.Format("best: {0}%", file.FileInfoFavourite.RelevanceNorm); + private void ChangeFileSelection() + { + FileItem file = GetSelectedFileItem(); + SyncMatchesList(file); } - private void listViewMatchList_SelectedIndexChanged(object sender, EventArgs e) + private void FileList_SelectedIndexChanged(object sender, EventArgs e) { - if (listViewMatchList.SelectedItems.Count == 0) return; - if (listViewMatchList.SelectedItems[0].Tag == null) return; - FileItemInfo info = listViewMatchList.SelectedItems[0].Tag as FileItemInfo; - if (info == null) return; - - info.LaunchURL(); + ChangeFileSelection(); } - private void checkboxFileList_CheckedChanged(object sender, EventArgs e) + private void allGameLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - if (checkboxFileList.Checked) + if (allGameLink.Text == null) + return; + if (allGameLink.Text.Length > 0) { - foreach (ListViewItem curItem in listViewFileList.Items) - curItem.Checked = true; + ProcessStartInfo sInfo = new ProcessStartInfo(allGameLink.Text); + Process.Start(sInfo); } - else - { - foreach (ListViewItem curItem in listViewFileList.Items) - curItem.Checked = false; - } - UpdateButtonStates(); } - #endregion + private void LaunchSelectedMatchURL() + { + FileItemInfo info = GetSelectedMatchItem(); + if (info == null) + return; + info.LaunchURL(); + } - #region Buttons - private void btnStartSearch_Click(object sender, EventArgs e) + private void MatchList_DoubleClick(object sender, EventArgs e) { - SearchStart(); + LaunchSelectedMatchURL(); } - private void btnSaveSearch_Click(object sender, EventArgs e) + private void checkAllButton_Click(object sender, EventArgs e) { - menuSaveDetails.Show(buttonSaveSearch, new Point(0, buttonSaveSearch.Height)); + foreach (ListViewItem curItem in FileList.Items) + { + curItem.Checked = true; + } + btnStartSearch.Enabled = (FileList.CheckedItems.Count > 0); + SyncFileLabel(); } - private void cancelSearchToolStripMenuItem_Click(object sender, EventArgs e) + private void uncheckAllButton_Click(object sender, EventArgs e) { - stopSearching = true; + foreach (ListViewItem curItem in FileList.Items) + { + curItem.Checked = false; + } + btnStartSearch.Enabled = false; + buttonSelectBestMatch.Enabled = false; + btnSaveSearch.Enabled = false; + SyncFileLabel(); } - private void buttonClose_Click(object sender, EventArgs e) + private void MatchList_SelectedIndexChanged(object sender, EventArgs e) { - if ((m_CurApp != null) && (filterComboBox.Text != "")) + FileItem file = GetSelectedFileItem(); + if (file == null) + return; + + if (MatchList.SelectedIndices.Count > 0) { - m_CurApp.SystemDefault = filterComboBox.Text; - //m_CurApp.Write(); + FileItemInfo info = GetSelectedMatchItem(); + file.FileInfoFavourite = info; + LaunchURLButton.Enabled = true; + btnSaveSearch.Enabled = true; + FileList.FocusedItem.SubItems[1].Text = String.Format("best: {0}%", file.FileInfoFavourite.RelevanceNorm); } - this.Close(); + else + { + file.FileInfoFavourite = null; + LaunchURLButton.Enabled = false; + } } - private void allGameLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + private void btnSaveSearch_Click(object sender, EventArgs e) { - if (linkLabelAllGame.Text == null) return; + menuSaveDetails.Show(btnSaveSearch, new Point(0, btnSaveSearch.Height)); + } - if (linkLabelAllGame.Text.Length > 0) + void SaveSearch(ScraperSaveType saveType) + { + int numberOfSearches = 0; + InitProgressBar("Starting search"); + ListViewItem nextItem = null; + foreach (ListViewItem curItem in FileList.CheckedItems) { - ProcessStartInfo sInfo = new ProcessStartInfo(linkLabelAllGame.Text); - Process.Start(sInfo); + if (stopSearching) + break; + FileItem file = (FileItem)curItem.Tag; + if (file != null) + { + if (curItem.Index < FileList.Items.Count - 1) + { + nextItem = FileList.Items[curItem.Index + 1]; + } + else + { + nextItem = curItem; + } + nextItem.EnsureVisible(); + StepProgressBar(); + if (file.FileInfoFavourite != null) + { + numberOfSearches++; + numberOfSearches = numberOfSearches + 1; + if (numberOfSearches > 20) + { + curItem.SubItems[1].Text = String.Format("waiting..."); + System.Windows.Forms.Application.DoEvents(); + System.Threading.Thread.Sleep(20000); + numberOfSearches = 0; + } + curItem.SubItems[1].Text = String.Format("<searching...>"); + System.Windows.Forms.Application.DoEvents(); + file.FindFileInfoDetail(m_CurApp, file.FileInfoFavourite, ScraperType.ALLGAME, saveType); + if ((saveType == ScraperSaveType.DataAndImages) || (saveType == ScraperSaveType.Data)) + { + file.SaveFromFileInfoFavourite(); + } + curItem.SubItems[1].Text = String.Format("<saved>"); + System.Windows.Forms.Application.DoEvents(); + } + } } + if (stopSearching) + { + DeInitProgressBar("Search aborted"); + } + else + { + DeInitProgressBar("Search finished"); + } + stopSearching = false; } - #endregion - private void filterComboBox_SelectedIndexChanged(object sender, EventArgs e) { ChangeFileSelection(); @@ -490,17 +991,69 @@ ChangeFileSelection(); } + private void buttonSelectBestMatch_Click(object sender, EventArgs e) + { + foreach (ListViewItem curItem in FileList.CheckedItems) + { + FileItem file = (FileItem)curItem.Tag; + if (file != null) + { + if (file.FileInfoList != null) + { + file.FileInfoFavourite = null; + foreach (FileItemInfo item in file.FileInfoList) + { + if (IsGoodMatch(item)) + { + btnSaveSearch.Enabled = true; + file.FileInfoFavourite = item; + break; + } + } + if (file.FileInfoFavourite != null) + { + curItem.SubItems[1].Text = String.Format("best: {0}%", file.FileInfoFavourite.RelevanceNorm); + } + else + { + curItem.SubItems[1].Text = "no match"; + } + } + } + } + ChangeFileSelection(); + } + private void MinRelevanceNum_ValueChanged(object sender, EventArgs e) { ChangeFileSelection(); } - #region Menus + private void LaunchURLButton_Click(object sender, EventArgs e) + { + LaunchSelectedMatchURL(); + } + private void FileList_MouseUp(object sender, MouseEventArgs e) + { + SyncButtons(); + } + + void SyncButtons() + { + btnStartSearch.Enabled = (FileList.CheckedItems.Count > 0); + if (!btnStartSearch.Enabled) + { + buttonSelectBestMatch.Enabled = false; + btnSaveSearch.Enabled = false; + } + SyncFileLabel(); + } + private void mnuCheckWithoutImages_Click(object sender, EventArgs e) { FileItem curFile; - foreach (ListViewItem curItem in listViewFileList.Items) + foreach (ListViewItem curItem in FileList.Items) { curFile = (FileItem)curItem.Tag; if (curFile != null) @@ -512,13 +1065,14 @@ curItem.Checked = false; } } - buttonStartSearch.Enabled = (listViewFileList.CheckedItems.Count > 0); - UpdateButtonStates(); + btnStartSearch.Enabled = (FileList.CheckedItems.Count > 0); + SyncFileLabel(); } + private void mnuCheckWithoutOverview_Click(object sender, EventArgs e) { FileItem curFile; - foreach (ListViewItem curItem in listViewFileList.Items) + foreach (ListViewItem curItem in FileList.Items) { curFile = (FileItem)curItem.Tag; if (curFile != null) @@ -530,672 +1084,42 @@ curItem.Checked = false; } } - buttonStartSearch.Enabled = (listViewFileList.CheckedItems.Count > 0); - UpdateButtonStates(); + btnStartSearch.Enabled = (FileList.CheckedItems.Count > 0); + SyncFileLabel(); } - - private void menuDataAndImages_Click(object sender, EventArgs e) + + private void SyncFileLabel() { - saveType = ScraperSaveType.DataAndImages; - SearchSave(); + lblFiles.Text = String.Format("Files: ({0} of {1} selected)", FileList.CheckedItems.Count, FileList.Items.Count); } - private void menuData_Click(object sender, EventArgs e) - { - saveType = ScraperSaveType.Data; - SearchSave(); - } - private void menuImages_Click(object sender, EventArgs e) - { - saveType = ScraperSaveType.Images; - SearchSave(); - } - #endregion - - #endregion - - #region Threads - - private void SearchStart() + private void FileList_AfterLabelEdit(object sender, LabelEditEventArgs e) { - Thread thread = new Thread(new ThreadStart(SearchStartThread)); - thread.Priority = ThreadPriority.BelowNormal; - thread.Name = "MyPrograms SearchStart"; - thread.Start(); + FileItem curItem = GetSelectedFileItem(); + if (curItem == null) + return; + curItem.TitleOptimized = e.Label; } - private void SearchStartThread() + private void cancelButton_Click(object sender, EventArgs e) { - isSearching = true; - UpdateButtonStates(); - - int numberOfSearches = 0; - bool bSuccess = true; - InitProgressBar("Starting search"); - foreach (ListViewItem curItem in listViewFileList.CheckedItems) - { - if (stopSearching) break; - if (curItem.Tag == null) continue; - - FileItem file = curItem.Tag as FileItem; - if (file == null) continue; - - ListViewItem nextItem = null; - - if (curItem.Index < listViewFileList.Items.Count - 1) - { - nextItem = listViewFileList.Items[curItem.Index + 1]; - } - else - { - nextItem = curItem; - } - nextItem.EnsureVisible(); - // if (!bSuccess) - // { - // curItem.SubItems[1].Text = String.Format("waiting for reconnection..."); - // System.Threading.Thread.Sleep(5126); - // } - numberOfSearches = numberOfSearches + 1; - if (numberOfSearches > 20) - { - curItem.SubItems[1].Text = String.Format("waiting..."); - System.Threading.Thread.Sleep(20000); - System.Windows.Forms.Application.DoEvents(); - numberOfSearches = 0; - } - curItem.SubItems[1].Text = String.Format("searching..."); - curItem.Font = new Font(curItem.Font, curItem.Font.Style | FontStyle.Bold); - System.Windows.Forms.Application.DoEvents(); - bSuccess = file.FindFileInfo(file.Title, ScraperType.ALLGAME); - - SelectBestMatch(curItem); - - StepProgressBar(); - System.Windows.Forms.Application.DoEvents(); - } - ChangeFileSelection(); - if (stopSearching) - { - DeInitProgressBar("Search aborted"); - } - else - { - DeInitProgressBar("Search finished"); - } - - stopSearching = false; - isSearching = false; - UpdateButtonStates(); + stopSearching = true; } - private void SearchSave() + private void menuDataAndImages_Click(object sender, EventArgs e) { - Thread thread = new Thread(new ThreadStart(SearchSaveThread)); - thread.Priority = ThreadPriority.BelowNormal; - thread.Name = "MyPrograms SearchSave"; - thread.Start(); + SaveSearch(ScraperSaveType.DataAndImages); } - private void SearchSaveThread() + private void menuData_Click(object sender, EventArgs e) { - isSearching = true; - UpdateButtonStates(); - - int numberOfSearches = 0; - InitProgressBar("Starting search"); - ListViewItem nextItem = null; - - foreach (ListViewItem curItem in listViewFileList.CheckedItems) - { - if (stopSearching) - break; - FileItem file = (FileItem)curItem.Tag; - - if (file == null) - continue; - - if (curItem.Index < listViewFileList.Items.Count - 1) - { - nextItem = listViewFileList.Items[curItem.Index + 1]; - } - else - { - nextItem = curItem; - } - nextItem.EnsureVisible(); - StepProgressBar(); - if (file.FileInfoFavourite != null) - { - numberOfSearches++; - numberOfSearches = numberOfSearches + 1; - if (numberOfSearches > 20) - { - curItem.SubItems[1].Text = String.Format("waiting..."); - System.Windows.Forms.Application.DoEvents(); - System.Threading.Thread.Sleep(20000); - numberOfSearches = 0; - } - curItem.SubItems[1].Text = String.Format("<searching...>"); - System.Windows.Forms.Application.DoEvents(); - file.FindFileInfoDetail(m_CurApp, file.FileInfoFavourite, ScraperType.ALLGAME, saveType); - if ((saveType == ScraperSaveType.DataAndImages) || (saveType == ScraperSaveType.Data)) - { - file.SaveFromFileInfoFavourite(); - } - curItem.SubItems[1].Text = String.Format("<saved>"); - System.Windows.Forms.Application.DoEvents(); - } - } - if (stopSearching) - { - DeInitProgressBar("Search aborted"); - } - else - { - DeInitProgressBar("Search finished"); - } - - stopSearching = false; - isSearching = false; - UpdateButtonStates(); + SaveSearch(ScraperSaveType.Data); } - #endregion - - #region Windows Form Designer generated code - /// <summary> - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// </summary> - private void InitializeComponent() + private void menuImages_Click(object sender, EventArgs e) { - this.components = new System.ComponentModel.Container(); - this.bottomPanel = new System.Windows.Forms.Panel(); - this.label2 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.groupBoxFilter = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.labelPlatform = new MediaPortal.UserInterface.Controls.MPLabel(); - this.filterComboBox = new MediaPortal.UserInterface.Controls.MPComboBox(); - this.ResetFilterButton = new MediaPortal.UserInterface.Controls.MPButton(); - this.MinRelevanceNum = new System.Windows.Forms.NumericUpDown(); - this.label1 = new MediaPortal.UserInterface.Controls.MPLabel(); - this.linkLabelAllGame = new System.Windows.Forms.LinkLabel(); - this.buttonClose = new MediaPortal.UserInterface.Controls.MPButton(); - this.buttonSaveSearch = new MediaPortal.UserInterface.Controls.MPButton(); - this.buttonStartSearch = new MediaPortal.UserInterface.Controls.MPButton(); - this.listViewFileList = new MediaPortal.UserInterface.Controls.MPListView(); - this.FileTitle = new System.Windows.Forms.ColumnHeader(); - this.status = new System.Windows.Forms.ColumnHeader(); - this.menuFileList = new System.Windows.Forms.ContextMenu(); - this.mnuCheckWithoutImages = new System.Windows.Forms.MenuItem(); - this.mnuCheckWithoutOverview = new System.Windows.Forms.MenuItem(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.menuSaveDetails = new System.Windows.Forms.ContextMenu(); - this.menuDataAndImages = new System.Windows.Forms.MenuItem(); - this.menuItem4 = new System.Windows.Forms.MenuItem(); - this.menuData = new System.Windows.Forms.MenuItem(); - this.menuImages = new System.Windows.Forms.MenuItem(); - this.groupBoxMatchList = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.labelLaunchUrlInfo = new MediaPortal.UserInterface.Controls.MPLabel(); - this.listViewMatchList = new MediaPortal.UserInterface.Controls.MPListView(); - this.columnHeader1 = new System.Windows.Forms.ColumnHeader(); - this.columnHeader2 = new System.Windows.Forms.ColumnHeader(); - this.groupBoxFileList = new MediaPortal.UserInterface.Controls.MPGroupBox(); - this.checkboxFileList = new MediaPortal.UserInterface.Controls.MPCheckBox(); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.statusStrip = new System.Windows.Forms.StatusStrip(); - this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripPro... [truncated message content] |