diff --git a/BizHawk.Client.EmuHawk/movie/MovieDetails.cs b/BizHawk.Client.EmuHawk/movie/MovieDetails.cs new file mode 100644 index 0000000000..140ff2fa5c --- /dev/null +++ b/BizHawk.Client.EmuHawk/movie/MovieDetails.cs @@ -0,0 +1,22 @@ +using System; +using System.Drawing; + +namespace BizHawk.Client.EmuHawk +{ + /// + /// Used for the sorting of the moviedetails in PlayMovie.cs + /// + public class MovieDetails + { + public String keys { get; set; } + public String values { get; set; } + public Color backgroundColor { get; set; } + + public MovieDetails() + { + keys = String.Empty; + values = String.Empty; + backgroundColor = Color.White; + } + } +} diff --git a/BizHawk.Client.EmuHawk/movie/PlayMovie.Designer.cs b/BizHawk.Client.EmuHawk/movie/PlayMovie.Designer.cs index 8b843c44c7..f884acbd6f 100644 --- a/BizHawk.Client.EmuHawk/movie/PlayMovie.Designer.cs +++ b/BizHawk.Client.EmuHawk/movie/PlayMovie.Designer.cs @@ -28,284 +28,286 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlayMovie)); - this.Cancel = new System.Windows.Forms.Button(); - this.OK = new System.Windows.Forms.Button(); - this.BrowseMovies = new System.Windows.Forms.Button(); - this.DetailsView = new System.Windows.Forms.ListView(); - this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.SubtitlesBtn = new System.Windows.Forms.Button(); - this.CommentsBtn = new System.Windows.Forms.Button(); - this.MovieCount = new System.Windows.Forms.Label(); - this.ReadOnlyCheckBox = new System.Windows.Forms.CheckBox(); - this.IncludeSubDirectories = new System.Windows.Forms.CheckBox(); - this.ShowStateFiles = new System.Windows.Forms.CheckBox(); - this.Scan = new System.Windows.Forms.Button(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.MatchGameNameCheckBox = new System.Windows.Forms.CheckBox(); - this.MovieView = new BizHawk.Client.EmuHawk.VirtualListView(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.groupBox1.SuspendLayout(); - this.SuspendLayout(); - // - // Cancel - // - this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(687, 352); - this.Cancel.Name = "Cancel"; - this.Cancel.Size = new System.Drawing.Size(75, 23); - this.Cancel.TabIndex = 55; - this.Cancel.Text = "&Cancel"; - this.Cancel.UseVisualStyleBackColor = true; - this.Cancel.Click += new System.EventHandler(this.Cancel_Click); - // - // OK - // - this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.OK.Location = new System.Drawing.Point(606, 352); - this.OK.Name = "OK"; - this.OK.Size = new System.Drawing.Size(75, 23); - this.OK.TabIndex = 50; - this.OK.Text = "&Ok"; - this.toolTip1.SetToolTip(this.OK, "Load selected movie"); - this.OK.UseVisualStyleBackColor = true; - this.OK.Click += new System.EventHandler(this.OK_Click); - // - // BrowseMovies - // - this.BrowseMovies.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.BrowseMovies.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.OpenFile; - this.BrowseMovies.Location = new System.Drawing.Point(12, 337); - this.BrowseMovies.Name = "BrowseMovies"; - this.BrowseMovies.Size = new System.Drawing.Size(31, 23); - this.BrowseMovies.TabIndex = 25; - this.toolTip1.SetToolTip(this.BrowseMovies, "Browse for additional movie files"); - this.BrowseMovies.UseVisualStyleBackColor = true; - this.BrowseMovies.Click += new System.EventHandler(this.BrowseMovies_Click); - // - // DetailsView - // - this.DetailsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlayMovie)); + this.Cancel = new System.Windows.Forms.Button(); + this.OK = new System.Windows.Forms.Button(); + this.BrowseMovies = new System.Windows.Forms.Button(); + this.DetailsView = new System.Windows.Forms.ListView(); + this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.SubtitlesBtn = new System.Windows.Forms.Button(); + this.CommentsBtn = new System.Windows.Forms.Button(); + this.MovieCount = new System.Windows.Forms.Label(); + this.ReadOnlyCheckBox = new System.Windows.Forms.CheckBox(); + this.IncludeSubDirectories = new System.Windows.Forms.CheckBox(); + this.ShowStateFiles = new System.Windows.Forms.CheckBox(); + this.Scan = new System.Windows.Forms.Button(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.MatchGameNameCheckBox = new System.Windows.Forms.CheckBox(); + this.MovieView = new BizHawk.Client.EmuHawk.VirtualListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // Cancel + // + this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.Cancel.Location = new System.Drawing.Point(687, 352); + this.Cancel.Name = "Cancel"; + this.Cancel.Size = new System.Drawing.Size(75, 23); + this.Cancel.TabIndex = 55; + this.Cancel.Text = "&Cancel"; + this.Cancel.UseVisualStyleBackColor = true; + this.Cancel.Click += new System.EventHandler(this.Cancel_Click); + // + // OK + // + this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.OK.Location = new System.Drawing.Point(606, 352); + this.OK.Name = "OK"; + this.OK.Size = new System.Drawing.Size(75, 23); + this.OK.TabIndex = 50; + this.OK.Text = "&Ok"; + this.toolTip1.SetToolTip(this.OK, "Load selected movie"); + this.OK.UseVisualStyleBackColor = true; + this.OK.Click += new System.EventHandler(this.OK_Click); + // + // BrowseMovies + // + this.BrowseMovies.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.BrowseMovies.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.OpenFile; + this.BrowseMovies.Location = new System.Drawing.Point(12, 337); + this.BrowseMovies.Name = "BrowseMovies"; + this.BrowseMovies.Size = new System.Drawing.Size(31, 23); + this.BrowseMovies.TabIndex = 25; + this.toolTip1.SetToolTip(this.BrowseMovies, "Browse for additional movie files"); + this.BrowseMovies.UseVisualStyleBackColor = true; + this.BrowseMovies.Click += new System.EventHandler(this.BrowseMovies_Click); + // + // DetailsView + // + this.DetailsView.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.DetailsView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.DetailsView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader5, this.columnHeader6}); - this.DetailsView.FullRowSelect = true; - this.DetailsView.GridLines = true; - this.DetailsView.HideSelection = false; - this.DetailsView.Location = new System.Drawing.Point(15, 19); - this.DetailsView.Name = "DetailsView"; - this.DetailsView.Size = new System.Drawing.Size(228, 242); - this.DetailsView.TabIndex = 10; - this.toolTip1.SetToolTip(this.DetailsView, "Contains the header information for the selected movie"); - this.DetailsView.UseCompatibleStateImageBehavior = false; - this.DetailsView.View = System.Windows.Forms.View.Details; - // - // columnHeader5 - // - this.columnHeader5.Text = "Header"; - this.columnHeader5.Width = 102; - // - // columnHeader6 - // - this.columnHeader6.Text = "Value"; - this.columnHeader6.Width = 121; - // - // groupBox1 - // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.DetailsView.FullRowSelect = true; + this.DetailsView.GridLines = true; + this.DetailsView.HideSelection = false; + this.DetailsView.Location = new System.Drawing.Point(15, 19); + this.DetailsView.Name = "DetailsView"; + this.DetailsView.Size = new System.Drawing.Size(228, 242); + this.DetailsView.TabIndex = 10; + this.toolTip1.SetToolTip(this.DetailsView, "Contains the header information for the selected movie"); + this.DetailsView.UseCompatibleStateImageBehavior = false; + this.DetailsView.View = System.Windows.Forms.View.Details; + this.DetailsView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.DetailsView_ColumnClick); + // + // columnHeader5 + // + this.columnHeader5.Text = "Header"; + this.columnHeader5.Width = 102; + // + // columnHeader6 + // + this.columnHeader6.Text = "Value"; + this.columnHeader6.Width = 121; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this.SubtitlesBtn); - this.groupBox1.Controls.Add(this.CommentsBtn); - this.groupBox1.Controls.Add(this.DetailsView); - this.groupBox1.Location = new System.Drawing.Point(503, 28); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(259, 303); - this.groupBox1.TabIndex = 6; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Details"; - // - // SubtitlesBtn - // - this.SubtitlesBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.SubtitlesBtn.Enabled = false; - this.SubtitlesBtn.Location = new System.Drawing.Point(125, 267); - this.SubtitlesBtn.Name = "SubtitlesBtn"; - this.SubtitlesBtn.Size = new System.Drawing.Size(75, 23); - this.SubtitlesBtn.TabIndex = 20; - this.SubtitlesBtn.Text = "Subtitles"; - this.SubtitlesBtn.UseVisualStyleBackColor = true; - this.SubtitlesBtn.Click += new System.EventHandler(this.button2_Click); - // - // CommentsBtn - // - this.CommentsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CommentsBtn.Enabled = false; - this.CommentsBtn.Location = new System.Drawing.Point(15, 267); - this.CommentsBtn.Name = "CommentsBtn"; - this.CommentsBtn.Size = new System.Drawing.Size(75, 23); - this.CommentsBtn.TabIndex = 15; - this.CommentsBtn.Text = "Comments"; - this.CommentsBtn.UseVisualStyleBackColor = true; - this.CommentsBtn.Click += new System.EventHandler(this.button1_Click); - // - // MovieCount - // - this.MovieCount.AutoSize = true; - this.MovieCount.Location = new System.Drawing.Point(12, 9); - this.MovieCount.Name = "MovieCount"; - this.MovieCount.Size = new System.Drawing.Size(31, 13); - this.MovieCount.TabIndex = 7; - this.MovieCount.Text = " "; - // - // ReadOnlyCheckBox - // - this.ReadOnlyCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.ReadOnlyCheckBox.AutoSize = true; - this.ReadOnlyCheckBox.Checked = true; - this.ReadOnlyCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.ReadOnlyCheckBox.Location = new System.Drawing.Point(503, 356); - this.ReadOnlyCheckBox.Name = "ReadOnlyCheckBox"; - this.ReadOnlyCheckBox.Size = new System.Drawing.Size(74, 17); - this.ReadOnlyCheckBox.TabIndex = 45; - this.ReadOnlyCheckBox.Text = "Read only"; - this.ReadOnlyCheckBox.UseVisualStyleBackColor = true; - // - // IncludeSubDirectories - // - this.IncludeSubDirectories.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.IncludeSubDirectories.AutoSize = true; - this.IncludeSubDirectories.Location = new System.Drawing.Point(123, 337); - this.IncludeSubDirectories.Name = "IncludeSubDirectories"; - this.IncludeSubDirectories.Size = new System.Drawing.Size(131, 17); - this.IncludeSubDirectories.TabIndex = 35; - this.IncludeSubDirectories.Text = "Include Subdirectories"; - this.IncludeSubDirectories.UseVisualStyleBackColor = true; - this.IncludeSubDirectories.CheckedChanged += new System.EventHandler(this.IncludeSubDirectories_CheckedChanged); - // - // ShowStateFiles - // - this.ShowStateFiles.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.ShowStateFiles.AutoSize = true; - this.ShowStateFiles.Location = new System.Drawing.Point(123, 358); - this.ShowStateFiles.Name = "ShowStateFiles"; - this.ShowStateFiles.Size = new System.Drawing.Size(128, 17); - this.ShowStateFiles.TabIndex = 40; - this.ShowStateFiles.Text = "Show valid .state files"; - this.ShowStateFiles.UseVisualStyleBackColor = true; - this.ShowStateFiles.CheckedChanged += new System.EventHandler(this.ShowStateFiles_CheckedChanged); - // - // Scan - // - this.Scan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.Scan.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Scan; - this.Scan.Location = new System.Drawing.Point(49, 337); - this.Scan.Name = "Scan"; - this.Scan.Size = new System.Drawing.Size(27, 23); - this.Scan.TabIndex = 30; - this.toolTip1.SetToolTip(this.Scan, "Rescan Movie folder for movie files"); - this.Scan.UseVisualStyleBackColor = true; - this.Scan.Click += new System.EventHandler(this.Scan_Click); - // - // MatchGameNameCheckBox - // - this.MatchGameNameCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.MatchGameNameCheckBox.AutoSize = true; - this.MatchGameNameCheckBox.Location = new System.Drawing.Point(260, 337); - this.MatchGameNameCheckBox.Name = "MatchGameNameCheckBox"; - this.MatchGameNameCheckBox.Size = new System.Drawing.Size(150, 17); - this.MatchGameNameCheckBox.TabIndex = 56; - this.MatchGameNameCheckBox.Text = "Match current game name"; - this.MatchGameNameCheckBox.UseVisualStyleBackColor = true; - this.MatchGameNameCheckBox.CheckedChanged += new System.EventHandler(this.MatchGameNameCheckBox_CheckedChanged); - // - // MovieView - // - this.MovieView.AllowDrop = true; - this.MovieView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.groupBox1.Controls.Add(this.SubtitlesBtn); + this.groupBox1.Controls.Add(this.CommentsBtn); + this.groupBox1.Controls.Add(this.DetailsView); + this.groupBox1.Location = new System.Drawing.Point(503, 28); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(259, 303); + this.groupBox1.TabIndex = 6; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Details"; + // + // SubtitlesBtn + // + this.SubtitlesBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.SubtitlesBtn.Enabled = false; + this.SubtitlesBtn.Location = new System.Drawing.Point(125, 267); + this.SubtitlesBtn.Name = "SubtitlesBtn"; + this.SubtitlesBtn.Size = new System.Drawing.Size(75, 23); + this.SubtitlesBtn.TabIndex = 20; + this.SubtitlesBtn.Text = "Subtitles"; + this.SubtitlesBtn.UseVisualStyleBackColor = true; + this.SubtitlesBtn.Click += new System.EventHandler(this.button2_Click); + // + // CommentsBtn + // + this.CommentsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CommentsBtn.Enabled = false; + this.CommentsBtn.Location = new System.Drawing.Point(15, 267); + this.CommentsBtn.Name = "CommentsBtn"; + this.CommentsBtn.Size = new System.Drawing.Size(75, 23); + this.CommentsBtn.TabIndex = 15; + this.CommentsBtn.Text = "Comments"; + this.CommentsBtn.UseVisualStyleBackColor = true; + this.CommentsBtn.Click += new System.EventHandler(this.button1_Click); + // + // MovieCount + // + this.MovieCount.AutoSize = true; + this.MovieCount.Location = new System.Drawing.Point(12, 9); + this.MovieCount.Name = "MovieCount"; + this.MovieCount.Size = new System.Drawing.Size(31, 13); + this.MovieCount.TabIndex = 7; + this.MovieCount.Text = " "; + // + // ReadOnlyCheckBox + // + this.ReadOnlyCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.ReadOnlyCheckBox.AutoSize = true; + this.ReadOnlyCheckBox.Checked = true; + this.ReadOnlyCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.ReadOnlyCheckBox.Location = new System.Drawing.Point(503, 356); + this.ReadOnlyCheckBox.Name = "ReadOnlyCheckBox"; + this.ReadOnlyCheckBox.Size = new System.Drawing.Size(74, 17); + this.ReadOnlyCheckBox.TabIndex = 45; + this.ReadOnlyCheckBox.Text = "Read only"; + this.ReadOnlyCheckBox.UseVisualStyleBackColor = true; + // + // IncludeSubDirectories + // + this.IncludeSubDirectories.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.IncludeSubDirectories.AutoSize = true; + this.IncludeSubDirectories.Location = new System.Drawing.Point(123, 337); + this.IncludeSubDirectories.Name = "IncludeSubDirectories"; + this.IncludeSubDirectories.Size = new System.Drawing.Size(131, 17); + this.IncludeSubDirectories.TabIndex = 35; + this.IncludeSubDirectories.Text = "Include Subdirectories"; + this.IncludeSubDirectories.UseVisualStyleBackColor = true; + this.IncludeSubDirectories.CheckedChanged += new System.EventHandler(this.IncludeSubDirectories_CheckedChanged); + // + // ShowStateFiles + // + this.ShowStateFiles.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.ShowStateFiles.AutoSize = true; + this.ShowStateFiles.Location = new System.Drawing.Point(123, 358); + this.ShowStateFiles.Name = "ShowStateFiles"; + this.ShowStateFiles.Size = new System.Drawing.Size(128, 17); + this.ShowStateFiles.TabIndex = 40; + this.ShowStateFiles.Text = "Show valid .state files"; + this.ShowStateFiles.UseVisualStyleBackColor = true; + this.ShowStateFiles.CheckedChanged += new System.EventHandler(this.ShowStateFiles_CheckedChanged); + // + // Scan + // + this.Scan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.Scan.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Scan; + this.Scan.Location = new System.Drawing.Point(49, 337); + this.Scan.Name = "Scan"; + this.Scan.Size = new System.Drawing.Size(27, 23); + this.Scan.TabIndex = 30; + this.toolTip1.SetToolTip(this.Scan, "Rescan Movie folder for movie files"); + this.Scan.UseVisualStyleBackColor = true; + this.Scan.Click += new System.EventHandler(this.Scan_Click); + // + // MatchGameNameCheckBox + // + this.MatchGameNameCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.MatchGameNameCheckBox.AutoSize = true; + this.MatchGameNameCheckBox.Location = new System.Drawing.Point(260, 337); + this.MatchGameNameCheckBox.Name = "MatchGameNameCheckBox"; + this.MatchGameNameCheckBox.Size = new System.Drawing.Size(150, 17); + this.MatchGameNameCheckBox.TabIndex = 56; + this.MatchGameNameCheckBox.Text = "Match current game name"; + this.MatchGameNameCheckBox.UseVisualStyleBackColor = true; + this.MatchGameNameCheckBox.CheckedChanged += new System.EventHandler(this.MatchGameNameCheckBox_CheckedChanged); + // + // MovieView + // + this.MovieView.AllowDrop = true; + this.MovieView.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.MovieView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.MovieView.BlazingFast = false; + this.MovieView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1, this.columnHeader2, this.columnHeader3, this.columnHeader4}); - this.MovieView.FullRowSelect = true; - this.MovieView.GridLines = true; - this.MovieView.HideSelection = false; - this.MovieView.ItemCount = 0; - this.MovieView.Location = new System.Drawing.Point(12, 28); - this.MovieView.MultiSelect = false; - this.MovieView.Name = "MovieView"; - this.MovieView.selectedItem = -1; - this.MovieView.Size = new System.Drawing.Size(480, 303); - this.MovieView.TabIndex = 5; - this.MovieView.UseCompatibleStateImageBehavior = false; - this.MovieView.View = System.Windows.Forms.View.Details; - this.MovieView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.MovieView_ColumnClick); - this.MovieView.SelectedIndexChanged += new System.EventHandler(this.MovieView_SelectedIndexChanged); - this.MovieView.DragDrop += new System.Windows.Forms.DragEventHandler(this.MovieView_DragDrop); - this.MovieView.DragEnter += new System.Windows.Forms.DragEventHandler(this.MovieView_DragEnter); - this.MovieView.DoubleClick += new System.EventHandler(this.MovieView_DoubleClick); - this.MovieView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MovieView_KeyDown); - // - // columnHeader1 - // - this.columnHeader1.Text = "File"; - this.columnHeader1.Width = 221; - // - // columnHeader2 - // - this.columnHeader2.Text = "SysID"; - this.columnHeader2.Width = 43; - // - // columnHeader3 - // - this.columnHeader3.Text = "Game"; - this.columnHeader3.Width = 129; - // - // columnHeader4 - // - this.columnHeader4.Text = "Length (est.)"; - this.columnHeader4.Width = 82; - // - // PlayMovie - // - this.AcceptButton = this.OK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(774, 387); - this.Controls.Add(this.MatchGameNameCheckBox); - this.Controls.Add(this.Scan); - this.Controls.Add(this.ShowStateFiles); - this.Controls.Add(this.IncludeSubDirectories); - this.Controls.Add(this.ReadOnlyCheckBox); - this.Controls.Add(this.MovieCount); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.MovieView); - this.Controls.Add(this.BrowseMovies); - this.Controls.Add(this.OK); - this.Controls.Add(this.Cancel); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(547, 228); - this.Name = "PlayMovie"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Play Movie"; - this.Load += new System.EventHandler(this.PlayMovie_Load); - this.groupBox1.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); + this.MovieView.FullRowSelect = true; + this.MovieView.GridLines = true; + this.MovieView.HideSelection = false; + this.MovieView.ItemCount = 0; + this.MovieView.Location = new System.Drawing.Point(12, 28); + this.MovieView.MultiSelect = false; + this.MovieView.Name = "MovieView"; + this.MovieView.selectedItem = -1; + this.MovieView.Size = new System.Drawing.Size(480, 303); + this.MovieView.TabIndex = 5; + this.MovieView.UseCompatibleStateImageBehavior = false; + this.MovieView.View = System.Windows.Forms.View.Details; + this.MovieView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.MovieView_ColumnClick); + this.MovieView.SelectedIndexChanged += new System.EventHandler(this.MovieView_SelectedIndexChanged); + this.MovieView.DragDrop += new System.Windows.Forms.DragEventHandler(this.MovieView_DragDrop); + this.MovieView.DragEnter += new System.Windows.Forms.DragEventHandler(this.MovieView_DragEnter); + this.MovieView.DoubleClick += new System.EventHandler(this.MovieView_DoubleClick); + this.MovieView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MovieView_KeyDown); + // + // columnHeader1 + // + this.columnHeader1.Text = "File"; + this.columnHeader1.Width = 221; + // + // columnHeader2 + // + this.columnHeader2.Text = "SysID"; + this.columnHeader2.Width = 43; + // + // columnHeader3 + // + this.columnHeader3.Text = "Game"; + this.columnHeader3.Width = 129; + // + // columnHeader4 + // + this.columnHeader4.Text = "Length (est.)"; + this.columnHeader4.Width = 82; + // + // PlayMovie + // + this.AcceptButton = this.OK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.Cancel; + this.ClientSize = new System.Drawing.Size(774, 387); + this.Controls.Add(this.MatchGameNameCheckBox); + this.Controls.Add(this.Scan); + this.Controls.Add(this.ShowStateFiles); + this.Controls.Add(this.IncludeSubDirectories); + this.Controls.Add(this.ReadOnlyCheckBox); + this.Controls.Add(this.MovieCount); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.MovieView); + this.Controls.Add(this.BrowseMovies); + this.Controls.Add(this.OK); + this.Controls.Add(this.Cancel); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(547, 228); + this.Name = "PlayMovie"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Play Movie"; + this.Load += new System.EventHandler(this.PlayMovie_Load); + this.groupBox1.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/BizHawk.Client.EmuHawk/movie/PlayMovie.cs b/BizHawk.Client.EmuHawk/movie/PlayMovie.cs index b80f26321b..f1ff8db470 100644 --- a/BizHawk.Client.EmuHawk/movie/PlayMovie.cs +++ b/BizHawk.Client.EmuHawk/movie/PlayMovie.cs @@ -11,572 +11,642 @@ using BizHawk.Client.Common; namespace BizHawk.Client.EmuHawk { - public partial class PlayMovie : Form - { - private List _movieList = new List(); - private bool _sortReverse; - private string _sortedCol; + public partial class PlayMovie : Form + { + private List _movieList = new List(); + private bool _sortReverse; + private string _sortedCol; - public PlayMovie() - { - InitializeComponent(); - MovieView.QueryItemText += MovieView_QueryItemText; - MovieView.VirtualMode = true; - _sortReverse = false; - _sortedCol = String.Empty; - } + private bool _sortDetailsReverse; + private string _sortedDetailsCol; + + public PlayMovie() + { + InitializeComponent(); + MovieView.QueryItemText += MovieView_QueryItemText; + MovieView.VirtualMode = true; + _sortReverse = false; + _sortedCol = String.Empty; - void MovieView_QueryItemText(int index, int column, out string text) - { - text = String.Empty; - if (column == 0) //File - { - text = Path.GetFileName(_movieList[index].Filename); - } - if (column == 1) //System - { - text = _movieList[index].Header.SystemID; - } - if (column == 2) //Game - { - text = _movieList[index].Header.GameName; - } - if (column == 3) //Time - { - text = _movieList[index].Time.ToString(@"hh\:mm\:ss\.fff"); - } - } + _sortDetailsReverse = false; + _sortedDetailsCol = String.Empty; + } - private void Cancel_Click(object sender, EventArgs e) - { - Close(); - } + void MovieView_QueryItemText(int index, int column, out string text) + { + text = String.Empty; + if (column == 0) //File + { + text = Path.GetFileName(_movieList[index].Filename); + } + if (column == 1) //System + { + text = _movieList[index].Header.SystemID; + } + if (column == 2) //Game + { + text = _movieList[index].Header.GameName; + } + if (column == 3) //Time + { + text = _movieList[index].Time.ToString(@"hh\:mm\:ss\.fff"); + } + } - private void Run() - { - var indices = MovieView.SelectedIndices; - if (indices.Count > 0) //Import file if necessary - { - GlobalWin.MainForm.StartNewMovie(_movieList[MovieView.SelectedIndices[0]], false); - } - } + private void Cancel_Click(object sender, EventArgs e) + { + Close(); + } - private void OK_Click(object sender, EventArgs e) - { - Global.MovieSession.ReadOnly = ReadOnlyCheckBox.Checked; - Run(); - Close(); - } + private void Run() + { + var indices = MovieView.SelectedIndices; + if (indices.Count > 0) //Import file if necessary + { + GlobalWin.MainForm.StartNewMovie(_movieList[MovieView.SelectedIndices[0]], false); + } + } - private void BrowseMovies_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog { InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null) }; - var filter = "Movie Files (*." + Global.Config.MovieExtension + ")|*." + Global.Config.MovieExtension + "|Savestates|*.state|All Files|*.*"; - ofd.Filter = filter; + private void OK_Click(object sender, EventArgs e) + { + Global.MovieSession.ReadOnly = ReadOnlyCheckBox.Checked; + Run(); + Close(); + } - var result = ofd.ShowHawkDialog(); - if (result == DialogResult.OK) - { - var file = new FileInfo(ofd.FileName); - if (!file.Exists) - { - return; - } - else - { - if (file.Extension.ToUpper() == "STATE") - { - var movie = new Movie(file.FullName); - movie.Load(); //State files will have to load everything unfortunately - if (movie.FrameCount == 0) - { - MessageBox.Show("No input log detected in this savestate, aborting", "Can not load file", MessageBoxButtons.OK, - MessageBoxIcon.Hand); - return; - } - } + private void BrowseMovies_Click(object sender, EventArgs e) + { + var ofd = new OpenFileDialog { InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null) }; + var filter = "Movie Files (*." + Global.Config.MovieExtension + ")|*." + Global.Config.MovieExtension + "|Savestates|*.state|All Files|*.*"; + ofd.Filter = filter; - int? index = AddMovieToList(ofd.FileName, true); - if (index.HasValue) - { - MovieView.SelectedIndices.Clear(); - MovieView.setSelection(index.Value); - MovieView.SelectItem(index.Value, true); - } - } - } - } + var result = ofd.ShowHawkDialog(); + if (result == DialogResult.OK) + { + var file = new FileInfo(ofd.FileName); + if (!file.Exists) + { + return; + } + else + { + if (file.Extension.ToUpper() == "STATE") + { + var movie = new Movie(file.FullName); + movie.Load(); //State files will have to load everything unfortunately + if (movie.FrameCount == 0) + { + MessageBox.Show("No input log detected in this savestate, aborting", "Can not load file", MessageBoxButtons.OK, + MessageBoxIcon.Hand); + return; + } + } - private void AddStateToList(string filename) - { - using (var file = new HawkFile(filename)) - { - if (file.Exists) - { - if (!IsDuplicateOf(filename).HasValue) - { - var movie = new Movie(file.CanonicalFullPath); - movie.Load(); //State files will have to load everything unfortunately - if (movie.FrameCount > 0) - { - _movieList.Add(movie); - _sortReverse = false; - _sortedCol = String.Empty; - } - } - } - } - } + int? index = AddMovieToList(ofd.FileName, true); + if (index.HasValue) + { + MovieView.SelectedIndices.Clear(); + MovieView.setSelection(index.Value); + MovieView.SelectItem(index.Value, true); + } + } + } + } - private int? AddMovieToList(string filename, bool force) - { - using (var file = new HawkFile(filename)) - { - if (!file.Exists) - { - return null; - } - else - { - int? index = IsDuplicateOf(filename); - if (!index.HasValue) - { - PreLoadMovieFile(file, force); - MovieView.ItemCount = _movieList.Count; - UpdateList(); + private void AddStateToList(string filename) + { + using (var file = new HawkFile(filename)) + { + if (file.Exists) + { + if (!IsDuplicateOf(filename).HasValue) + { + var movie = new Movie(file.CanonicalFullPath); + movie.Load(); //State files will have to load everything unfortunately + if (movie.FrameCount > 0) + { + _movieList.Add(movie); + _sortReverse = false; + _sortedCol = String.Empty; + } + } + } + } + } - _sortReverse = false; - _sortedCol = String.Empty; - index = _movieList.Count - 1; - } - return index; - } - } - } + private int? AddMovieToList(string filename, bool force) + { + using (var file = new HawkFile(filename)) + { + if (!file.Exists) + { + return null; + } + else + { + int? index = IsDuplicateOf(filename); + if (!index.HasValue) + { + PreLoadMovieFile(file, force); + MovieView.ItemCount = _movieList.Count; + UpdateList(); - private int? IsDuplicateOf(string filename) - { - for (int i = 0; i < _movieList.Count; i++) - { - if (_movieList[i].Filename == filename) - { - return i; - } - } + _sortReverse = false; + _sortedCol = String.Empty; + index = _movieList.Count - 1; + } + return index; + } + } + } - return null; - } + private int? IsDuplicateOf(string filename) + { + for (int i = 0; i < _movieList.Count; i++) + { + if (_movieList[i].Filename == filename) + { + return i; + } + } - private void PreLoadMovieFile(HawkFile hf, bool force) - { - var movie = new Movie(hf.CanonicalFullPath); - movie.PreLoadText(hf); - try - { - //Don't do this from browse - if (movie.Header[HeaderKeys.GAMENAME] == Global.Game.Name || - Global.Config.PlayMovie_MatchGameName == false || force) - { - _movieList.Add(movie); - } - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } - } + return null; + } - private void UpdateList() - { - MovieView.Refresh(); - UpdateMovieCount(); - } + private void PreLoadMovieFile(HawkFile hf, bool force) + { + var movie = new Movie(hf.CanonicalFullPath); + movie.PreLoadText(hf); + try + { + //Don't do this from browse + if (movie.Header[HeaderKeys.GAMENAME] == Global.Game.Name || + Global.Config.PlayMovie_MatchGameName == false || force) + { + _movieList.Add(movie); + } + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } - private void UpdateMovieCount() - { - MovieCount.Text = _movieList.Count + " movie" - + (_movieList.Count != 1 ? "s" : String.Empty); - } + private void UpdateList() + { + MovieView.Refresh(); + UpdateMovieCount(); + } - private void PreHighlightMovie() - { - if (Global.Game == null) return; - var Indices = new List(); - - //Pull out matching names - for (int i = 0; i < _movieList.Count; i++) - { - if (PathManager.FilesystemSafeName(Global.Game) == _movieList[i].Header.GameName) - { - Indices.Add(i); - } - } - if (Indices.Count == 0) return; - if (Indices.Count == 1) - { - HighlightMovie(Indices[0]); - return; - } + private void UpdateMovieCount() + { + MovieCount.Text = _movieList.Count + " movie" + + (_movieList.Count != 1 ? "s" : String.Empty); + } - //Prefer tas files - var TAS = new List(); - for (int i = 0; i < Indices.Count; i++) - { - if (Path.GetExtension(_movieList[Indices[i]].Filename).ToUpper() == "." + Global.Config.MovieExtension) - { - TAS.Add(i); - } - } + private void PreHighlightMovie() + { + if (Global.Game == null) return; + var Indices = new List(); - if (TAS.Count == 1) - { - HighlightMovie(TAS[0]); - return; - } - else if (TAS.Count > 1) - { - Indices = new List(TAS); - } + //Pull out matching names + for (int i = 0; i < _movieList.Count; i++) + { + if (PathManager.FilesystemSafeName(Global.Game) == _movieList[i].Header.GameName) + { + Indices.Add(i); + } + } + if (Indices.Count == 0) return; + if (Indices.Count == 1) + { + HighlightMovie(Indices[0]); + return; + } - //Final tie breaker - Last used file - var file = new FileInfo(_movieList[Indices[0]].Filename); - var time = file.LastAccessTime; - int mostRecent = Indices.First(); - for (int i = 1; i < Indices.Count; i++) - { - file = new FileInfo(_movieList[Indices[0]].Filename); - if (file.LastAccessTime > time) - { - time = file.LastAccessTime; - mostRecent = Indices[i]; - } - } + //Prefer tas files + var TAS = new List(); + for (int i = 0; i < Indices.Count; i++) + { + if (Path.GetExtension(_movieList[Indices[i]].Filename).ToUpper() == "." + Global.Config.MovieExtension) + { + TAS.Add(i); + } + } - HighlightMovie(mostRecent); - return; + if (TAS.Count == 1) + { + HighlightMovie(TAS[0]); + return; + } + else if (TAS.Count > 1) + { + Indices = new List(TAS); + } - } + //Final tie breaker - Last used file + var file = new FileInfo(_movieList[Indices[0]].Filename); + var time = file.LastAccessTime; + int mostRecent = Indices.First(); + for (int i = 1; i < Indices.Count; i++) + { + file = new FileInfo(_movieList[Indices[0]].Filename); + if (file.LastAccessTime > time) + { + time = file.LastAccessTime; + mostRecent = Indices[i]; + } + } - private void HighlightMovie(int index) - { - MovieView.SelectedIndices.Clear(); - MovieView.setSelection(index); - MovieView.SelectItem(index, true); - } + HighlightMovie(mostRecent); + return; - private void ClearList() - { - _movieList.Clear(); - MovieView.ItemCount = 0; - MovieView.Update(); - } + } - private void ScanFiles() - { - ClearList(); + private void HighlightMovie(int index) + { + MovieView.SelectedIndices.Clear(); + MovieView.setSelection(index); + MovieView.SelectItem(index, true); + } - var directory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null); - if (!Directory.Exists(directory)) - { - Directory.CreateDirectory(directory); - } + private void ClearList() + { + _movieList.Clear(); + MovieView.ItemCount = 0; + MovieView.Update(); + } - Directory.GetFiles(directory, "*." + Global.Config.MovieExtension) - .ToList() - .ForEach(file => AddMovieToList(file, force: false)); + private void ScanFiles() + { + ClearList(); - if (Global.Config.PlayMovie_ShowStateFiles) - { - Directory.GetFiles(directory, "*.state") - .ToList() - .ForEach(file => AddStateToList(file)); - } + var directory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null); + if (!Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } - if (Global.Config.PlayMovie_IncludeSubdir) - { - var subs = Directory.GetDirectories(directory); - foreach (var dir in subs) - { - Directory.GetFiles(dir, "*." + Global.Config.MovieExtension) - .ToList() - .ForEach(file => AddMovieToList(file, force: false)); + Directory.GetFiles(directory, "*." + Global.Config.MovieExtension) + .ToList() + .ForEach(file => AddMovieToList(file, force: false)); - Directory.GetFiles(dir, "*.state") - .ToList() - .ForEach(file => AddStateToList(file)); - } - } - } + if (Global.Config.PlayMovie_ShowStateFiles) + { + Directory.GetFiles(directory, "*.state") + .ToList() + .ForEach(file => AddStateToList(file)); + } - private void PlayMovie_Load(object sender, EventArgs e) - { - IncludeSubDirectories.Checked = Global.Config.PlayMovie_IncludeSubdir; - ShowStateFiles.Checked = Global.Config.PlayMovie_ShowStateFiles; - MatchGameNameCheckBox.Checked = Global.Config.PlayMovie_MatchGameName; - ScanFiles(); - PreHighlightMovie(); - } + if (Global.Config.PlayMovie_IncludeSubdir) + { + var subs = Directory.GetDirectories(directory); + foreach (var dir in subs) + { + Directory.GetFiles(dir, "*." + Global.Config.MovieExtension) + .ToList() + .ForEach(file => AddMovieToList(file, force: false)); - private void MovieView_SelectedIndexChanged(object sender, EventArgs e) - { - toolTip1.SetToolTip(DetailsView, String.Empty); - DetailsView.Items.Clear(); - if (MovieView.SelectedIndices.Count < 1) - { - OK.Enabled = false; - return; - } - else - { - OK.Enabled = true; - } + Directory.GetFiles(dir, "*.state") + .ToList() + .ForEach(file => AddStateToList(file)); + } + } + } - int firstIndex = MovieView.SelectedIndices[0]; - MovieView.ensureVisible(firstIndex); + private void PlayMovie_Load(object sender, EventArgs e) + { + IncludeSubDirectories.Checked = Global.Config.PlayMovie_IncludeSubdir; + ShowStateFiles.Checked = Global.Config.PlayMovie_ShowStateFiles; + MatchGameNameCheckBox.Checked = Global.Config.PlayMovie_MatchGameName; + ScanFiles(); + PreHighlightMovie(); + } - foreach (var kvp in _movieList[firstIndex].Header) - { - var item = new ListViewItem(kvp.Key); - item.SubItems.Add(kvp.Value); + private void MovieView_SelectedIndexChanged(object sender, EventArgs e) + { + toolTip1.SetToolTip(DetailsView, String.Empty); + DetailsView.Items.Clear(); + if (MovieView.SelectedIndices.Count < 1) + { + OK.Enabled = false; + return; + } + else + { + OK.Enabled = true; + } - switch (kvp.Key) - { - case HeaderKeys.SHA1: - if (kvp.Value != Global.Game.Hash) - { - item.BackColor = Color.Pink; - toolTip1.SetToolTip(DetailsView, "Current SHA1: " + Global.Game.Hash); - } - break; - case HeaderKeys.MOVIEVERSION: - if (kvp.Value != HeaderKeys.MovieVersion1) - { - item.BackColor = Color.Yellow; - } - break; - case HeaderKeys.EMULATIONVERSION: - if (kvp.Value != VersionInfo.GetEmuVersion()) - { - item.BackColor = Color.Yellow; - } - break; - case HeaderKeys.PLATFORM: - if (kvp.Value != Global.Game.System) - { - item.BackColor = Color.Pink; - } - break; - } + int firstIndex = MovieView.SelectedIndices[0]; + MovieView.ensureVisible(firstIndex); - DetailsView.Items.Add(item); - } + foreach (var kvp in _movieList[firstIndex].Header) + { + var item = new ListViewItem(kvp.Key); + item.SubItems.Add(kvp.Value); - var FpsItem = new ListViewItem("Fps"); - FpsItem.SubItems.Add(String.Format("{0:0.#######}", _movieList[firstIndex].Fps)); - DetailsView.Items.Add(FpsItem); + switch (kvp.Key) + { + case HeaderKeys.SHA1: + if (kvp.Value != Global.Game.Hash) + { + item.BackColor = Color.Pink; + toolTip1.SetToolTip(DetailsView, "Current SHA1: " + Global.Game.Hash); + } + break; + case HeaderKeys.MOVIEVERSION: + if (kvp.Value != HeaderKeys.MovieVersion1) + { + item.BackColor = Color.Yellow; + } + break; + case HeaderKeys.EMULATIONVERSION: + if (kvp.Value != VersionInfo.GetEmuVersion()) + { + item.BackColor = Color.Yellow; + } + break; + case HeaderKeys.PLATFORM: + if (kvp.Value != Global.Game.System) + { + item.BackColor = Color.Pink; + } + break; + } - var FramesItem = new ListViewItem("Frames"); - FramesItem.SubItems.Add(_movieList[firstIndex].FrameCount.ToString()); - DetailsView.Items.Add(FramesItem); + DetailsView.Items.Add(item); + } - CommentsBtn.Enabled = _movieList[firstIndex].Header.Comments.Any(); - SubtitlesBtn.Enabled = _movieList[firstIndex].Header.Subtitles.Any(); - } + var FpsItem = new ListViewItem("Fps"); + FpsItem.SubItems.Add(String.Format("{0:0.#######}", _movieList[firstIndex].Fps)); + DetailsView.Items.Add(FpsItem); - private void button1_Click(object sender, EventArgs e) - { - var indices = MovieView.SelectedIndices; - if (indices.Count > 0) - { - var form = new EditCommentsForm(); - form.GetMovie(_movieList[MovieView.SelectedIndices[0]]); - form.Show(); - } - } + var FramesItem = new ListViewItem("Frames"); + FramesItem.SubItems.Add(_movieList[firstIndex].FrameCount.ToString()); + DetailsView.Items.Add(FramesItem); + CommentsBtn.Enabled = _movieList[firstIndex].Header.Comments.Any(); + SubtitlesBtn.Enabled = _movieList[firstIndex].Header.Subtitles.Any(); + } - private void button2_Click(object sender, EventArgs e) - { - var indices = MovieView.SelectedIndices; - if (indices.Count > 0) - { - var s = new EditSubtitlesForm { ReadOnly = true }; - s.GetMovie(_movieList[MovieView.SelectedIndices[0]]); - s.Show(); - } - } + + private void button1_Click(object sender, EventArgs e) + { + var indices = MovieView.SelectedIndices; + if (indices.Count > 0) + { + var form = new EditCommentsForm(); + form.GetMovie(_movieList[MovieView.SelectedIndices[0]]); + form.Show(); + } + } - private void MovieView_DoubleClick(object sender, EventArgs e) - { - Run(); - Close(); - } + private void button2_Click(object sender, EventArgs e) + { + var indices = MovieView.SelectedIndices; + if (indices.Count > 0) + { + var s = new EditSubtitlesForm { ReadOnly = true }; + s.GetMovie(_movieList[MovieView.SelectedIndices[0]]); + s.Show(); + } + } - private void MovieView_DragEnter(object sender, DragEventArgs e) - { - e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None; - } + private void MovieView_DoubleClick(object sender, EventArgs e) + { + Run(); + Close(); + } - private void MovieView_DragDrop(object sender, DragEventArgs e) - { - var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop); + private void MovieView_DragEnter(object sender, DragEventArgs e) + { + e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None; + } - filePaths - .Where(path => Path.GetExtension(path) == "." + Global.Config.MovieExtension) - .ToList() - .ForEach(path => AddMovieToList(path, force: true)); - } + private void MovieView_DragDrop(object sender, DragEventArgs e) + { + var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop); - private void MovieView_ColumnClick(object sender, ColumnClickEventArgs e) - { - OrderColumn(e.Column); - } + filePaths + .Where(path => Path.GetExtension(path) == "." + Global.Config.MovieExtension) + .ToList() + .ForEach(path => AddMovieToList(path, force: true)); + } - private void OrderColumn(int columnToOrder) - { - var columnName = MovieView.Columns[columnToOrder].Text; - if (_sortedCol != columnName) - { - _sortReverse = false; - } + private void MovieView_ColumnClick(object sender, ColumnClickEventArgs e) + { + OrderColumn(e.Column); + } - switch (columnName) - { - case "File": - if (_sortReverse) - { - _movieList = _movieList - .OrderByDescending(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.Header.SystemID) - .ThenBy(x => x.Header.GameName) - .ThenBy(x => x.FrameCount) - .ToList(); - } - else - { - _movieList = _movieList - .OrderBy(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.Header.SystemID) - .ThenBy(x => x.Header.GameName) - .ThenBy(x => x.FrameCount) - .ToList(); - } - break; - case "SysID": - if (_sortReverse) - { - _movieList = _movieList - .OrderByDescending(x => x.Header.SystemID) - .ThenBy(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.Header.GameName) - .ThenBy(x => x.FrameCount) - .ToList(); - } - else - { - _movieList = _movieList - .OrderBy(x => x.Header.SystemID) - .ThenBy(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.Header.GameName) - .ThenBy(x => x.FrameCount) - .ToList(); - } - break; - case "Game": - if (_sortReverse) - { - _movieList = _movieList - .OrderByDescending(x => x.Header.GameName) - .ThenBy(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.Header.SystemID) - .ThenBy(x => x.FrameCount) - .ToList(); - } - else - { - _movieList = _movieList - .OrderBy(x => x.Header.GameName) - .ThenBy(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.Header.SystemID) - .ThenBy(x => x.FrameCount) - .ToList(); - } - break; - case "Length (est.)": - if (_sortReverse) - { - _movieList = _movieList - .OrderByDescending(x => x.FrameCount) - .ThenBy(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.Header.SystemID) - .ThenBy(x => x.FrameCount) - .ToList(); - } - else - { - _movieList = _movieList - .OrderBy(x => x.FrameCount) - .ThenBy(x => Path.GetFileName(x.Filename)) - .ThenBy(x => x.Header.SystemID) - .ThenBy(x => x.Header.GameName) - .ToList(); - } - break; - } + private void OrderColumn(int columnToOrder) + { + var columnName = MovieView.Columns[columnToOrder].Text; + if (_sortedCol != columnName) + { + _sortReverse = false; + } - _sortedCol = columnName; - _sortReverse = !_sortReverse; - MovieView.Refresh(); - } + switch (columnName) + { + case "File": + if (_sortReverse) + { + _movieList = _movieList + .OrderByDescending(x => Path.GetFileName(x.Filename)) + .ThenBy(x => x.Header.SystemID) + .ThenBy(x => x.Header.GameName) + .ThenBy(x => x.FrameCount) + .ToList(); + } + else + { + _movieList = _movieList + .OrderBy(x => Path.GetFileName(x.Filename)) + .ThenBy(x => x.Header.SystemID) + .ThenBy(x => x.Header.GameName) + .ThenBy(x => x.FrameCount) + .ToList(); + } + break; + case "SysID": + if (_sortReverse) + { + _movieList = _movieList + .OrderByDescending(x => x.Header.SystemID) + .ThenBy(x => Path.GetFileName(x.Filename)) + .ThenBy(x => x.Header.GameName) + .ThenBy(x => x.FrameCount) + .ToList(); + } + else + { + _movieList = _movieList + .OrderBy(x => x.Header.SystemID) + .ThenBy(x => Path.GetFileName(x.Filename)) + .ThenBy(x => x.Header.GameName) + .ThenBy(x => x.FrameCount) + .ToList(); + } + break; + case "Game": + if (_sortReverse) + { + _movieList = _movieList + .OrderByDescending(x => x.Header.GameName) + .ThenBy(x => Path.GetFileName(x.Filename)) + .ThenBy(x => x.Header.SystemID) + .ThenBy(x => x.FrameCount) + .ToList(); + } + else + { + _movieList = _movieList + .OrderBy(x => x.Header.GameName) + .ThenBy(x => Path.GetFileName(x.Filename)) + .ThenBy(x => x.Header.SystemID) + .ThenBy(x => x.FrameCount) + .ToList(); + } + break; + case "Length (est.)": + if (_sortReverse) + { + _movieList = _movieList + .OrderByDescending(x => x.FrameCount) + .ThenBy(x => Path.GetFileName(x.Filename)) + .ThenBy(x => x.Header.SystemID) + .ThenBy(x => x.FrameCount) + .ToList(); + } + else + { + _movieList = _movieList + .OrderBy(x => x.FrameCount) + .ThenBy(x => Path.GetFileName(x.Filename)) + .ThenBy(x => x.Header.SystemID) + .ThenBy(x => x.Header.GameName) + .ToList(); + } + break; + } - private void IncludeSubDirectories_CheckedChanged(object sender, EventArgs e) - { - Global.Config.PlayMovie_IncludeSubdir = IncludeSubDirectories.Checked; - ScanFiles(); - PreHighlightMovie(); - } + _sortedCol = columnName; + _sortReverse = !_sortReverse; + MovieView.Refresh(); + } - private void ShowStateFiles_CheckedChanged(object sender, EventArgs e) - { - Global.Config.PlayMovie_ShowStateFiles = ShowStateFiles.Checked; - ScanFiles(); - PreHighlightMovie(); - } + private void IncludeSubDirectories_CheckedChanged(object sender, EventArgs e) + { + Global.Config.PlayMovie_IncludeSubdir = IncludeSubDirectories.Checked; + ScanFiles(); + PreHighlightMovie(); + } - private void Scan_Click(object sender, EventArgs e) - { - ScanFiles(); - PreHighlightMovie(); - } + private void ShowStateFiles_CheckedChanged(object sender, EventArgs e) + { + Global.Config.PlayMovie_ShowStateFiles = ShowStateFiles.Checked; + ScanFiles(); + PreHighlightMovie(); + } - private void MatchGameNameCheckBox_CheckedChanged(object sender, EventArgs e) - { - Global.Config.PlayMovie_MatchGameName = MatchGameNameCheckBox.Checked; - ScanFiles(); - PreHighlightMovie(); - } + private void Scan_Click(object sender, EventArgs e) + { + ScanFiles(); + PreHighlightMovie(); + } - private void MovieView_KeyDown(object sender, KeyEventArgs e) - { - if (e.Control && e.KeyCode == Keys.C) - { - var indexes = MovieView.SelectedIndices; - if (indexes.Count > 0) - { - var copyStr = new StringBuilder(); - foreach (int index in indexes) - { - copyStr - .Append(_movieList[index].Filename).Append('\t') - .Append(_movieList[index].Header.SystemID).Append('\t') - .Append(_movieList[index].Header.GameName).Append('\t') - .Append(_movieList[index].Time.ToString(@"hh\:mm\:ss\.fff")) - .AppendLine(); + private void MatchGameNameCheckBox_CheckedChanged(object sender, EventArgs e) + { + Global.Config.PlayMovie_MatchGameName = MatchGameNameCheckBox.Checked; + ScanFiles(); + PreHighlightMovie(); + } - Clipboard.SetDataObject(copyStr.ToString()); - } - } - } - } + private void MovieView_KeyDown(object sender, KeyEventArgs e) + { + if (e.Control && e.KeyCode == Keys.C) + { + var indexes = MovieView.SelectedIndices; + if (indexes.Count > 0) + { + var copyStr = new StringBuilder(); + foreach (int index in indexes) + { + copyStr + .Append(_movieList[index].Filename).Append('\t') + .Append(_movieList[index].Header.SystemID).Append('\t') + .Append(_movieList[index].Header.GameName).Append('\t') + .Append(_movieList[index].Time.ToString(@"hh\:mm\:ss\.fff")) + .AppendLine(); - } + Clipboard.SetDataObject(copyStr.ToString()); + } + } + } + } + + private void DetailsView_ColumnClick(object sender, ColumnClickEventArgs e) + { + OrderDetailsColumn(e.Column); + } + + /// + /// Takes the values from DetailView and puts them in a List of Detail classes, this list is then sorted and put back in the DetailView + /// + /// + private void OrderDetailsColumn(int columnToOrder) + { + List detailsList = new List(); + for (int i = 0; i < DetailsView.Items.Count; i++) + { + detailsList.Add(new MovieDetails { keys = DetailsView.Items[i].Text, values = DetailsView.Items[i].SubItems[1].Text, backgroundColor = DetailsView.Items[i].BackColor }); + } + var columnName = DetailsView.Columns[columnToOrder].Text; + if (_sortedDetailsCol != columnName) + { + _sortDetailsReverse = false; + } + switch (columnName) + { + //Header, Value + case "Header": + if (_sortDetailsReverse) + { + detailsList = detailsList + .OrderByDescending(x => x.keys) + .ThenBy(x => x.values).ToList(); + } + else + { + detailsList = detailsList + .OrderBy(x => x.keys) + .ThenBy(x => x.values).ToList(); + } + break; + case "Value": + if (_sortDetailsReverse) + { + detailsList = detailsList + .OrderByDescending(x => x.values) + .ThenBy(x => x.keys).ToList(); + } + else + { + detailsList = detailsList + .OrderBy(x => x.values) + .ThenBy(x => x.keys).ToList(); + } + break; + } + int firstIndex = MovieView.SelectedIndices[0]; + DetailsView.Items.Clear(); + foreach (var detail in detailsList) + { + ListViewItem item = new ListViewItem { Text = detail.keys, BackColor = detail.backgroundColor }; + item.SubItems.Add(detail.values); + DetailsView.Items.Add(item); + } + _sortedDetailsCol = columnName; + _sortDetailsReverse = !_sortDetailsReverse; + } + } }