diff --git a/ChatRoomRecorder/BindingListChatRooms.cs b/ChatRoomRecorder/BindingListChatRooms.cs index 4488d8d..ade7343 100644 --- a/ChatRoomRecorder/BindingListChatRooms.cs +++ b/ChatRoomRecorder/BindingListChatRooms.cs @@ -13,6 +13,16 @@ public void Append(List chatRooms) FilterItems(); } + public void Delete(List chatRooms) + { + foreach (ChatRoom chatRoom in chatRooms) + { + _unfilteredItems.Remove(chatRoom); + } + + FilterItems(); + } + public void Flush() { _unfilteredItems.Clear(); diff --git a/ChatRoomRecorder/ChatRoomRecorder.csproj b/ChatRoomRecorder/ChatRoomRecorder.csproj index 52beeba..55eac73 100644 --- a/ChatRoomRecorder/ChatRoomRecorder.csproj +++ b/ChatRoomRecorder/ChatRoomRecorder.csproj @@ -7,16 +7,16 @@ True en-US true - 1.6.2 + 1.6.3 Copyright (C) 2024 Sagal Vanderklok https://chatroomrecorder.com | https://github.com/sagalvanderklok/chatroomrecorder AnyCPU;x86;x64 - + - + @@ -31,4 +31,7 @@ Resources.Designer.cs + + + \ No newline at end of file diff --git a/ChatRoomRecorder/MainForm.Designer.cs b/ChatRoomRecorder/MainForm.Designer.cs index 94eb273..45f9951 100644 --- a/ChatRoomRecorder/MainForm.Designer.cs +++ b/ChatRoomRecorder/MainForm.Designer.cs @@ -72,6 +72,9 @@ private void InitializeComponent() SeenColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); UrlColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); ChatRoomsContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(components); + CopyUrlToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + SetActionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + SetResolutionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); RemoveChatRoomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ChatRoomsBindingSource = new System.Windows.Forms.BindingSource(components); ChatRoomsSplitContainer2 = new System.Windows.Forms.SplitContainer(); @@ -106,13 +109,13 @@ private void InitializeComponent() StreamlinkPathTextBox = new System.Windows.Forms.TextBox(); LogTabPage = new System.Windows.Forms.TabPage(); LogListBox = new System.Windows.Forms.ListBox(); + LogContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(components); + CopyLogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); AboutTabPage = new System.Windows.Forms.TabPage(); LicenseTextBox = new System.Windows.Forms.TextBox(); ChatRoomsUpdateTimer = new System.Windows.Forms.Timer(components); FormCloseTimer = new System.Windows.Forms.Timer(components); SettingsBindingSource = new System.Windows.Forms.BindingSource(components); - LogContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(components); - CopyLogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)FilesBindingSource).BeginInit(); TabControl.SuspendLayout(); WebBrowserTabPage.SuspendLayout(); @@ -150,9 +153,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)UpdateIntervalNumericUpDown).BeginInit(); ((System.ComponentModel.ISupportInitialize)StripchatConcurrentUpdatesNumericUpDown).BeginInit(); LogTabPage.SuspendLayout(); + LogContextMenuStrip.SuspendLayout(); AboutTabPage.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)SettingsBindingSource).BeginInit(); - LogContextMenuStrip.SuspendLayout(); SuspendLayout(); // // TabControl @@ -170,7 +173,7 @@ private void InitializeComponent() TabControl.Padding = new System.Drawing.Point(5, 5); TabControl.SelectedIndex = 0; TabControl.Size = new System.Drawing.Size(784, 561); - TabControl.TabIndex = 19; + TabControl.TabIndex = 0; // // WebBrowserTabPage // @@ -225,12 +228,12 @@ private void InitializeComponent() // StopButton.Dock = System.Windows.Forms.DockStyle.Fill; StopButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + StopButton.Image = Properties.Resources.stop; StopButton.Location = new System.Drawing.Point(102, 0); StopButton.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); StopButton.Name = "StopButton"; StopButton.Size = new System.Drawing.Size(46, 23); - StopButton.TabIndex = 40; - StopButton.Text = "×"; + StopButton.TabIndex = 3; StopButton.UseVisualStyleBackColor = true; StopButton.Click += StopButton_Click; // @@ -238,12 +241,12 @@ private void InitializeComponent() // ForwardButton.Dock = System.Windows.Forms.DockStyle.Fill; ForwardButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + ForwardButton.Image = Properties.Resources.forward; ForwardButton.Location = new System.Drawing.Point(52, 0); ForwardButton.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); ForwardButton.Name = "ForwardButton"; ForwardButton.Size = new System.Drawing.Size(46, 23); - ForwardButton.TabIndex = 10; - ForwardButton.Text = "→"; + ForwardButton.TabIndex = 2; ForwardButton.UseVisualStyleBackColor = true; ForwardButton.Click += ForwardButton_Click; // @@ -251,12 +254,12 @@ private void InitializeComponent() // BackButton.Dock = System.Windows.Forms.DockStyle.Fill; BackButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + BackButton.Image = Properties.Resources.back; BackButton.Location = new System.Drawing.Point(0, 0); BackButton.Margin = new System.Windows.Forms.Padding(0, 0, 2, 0); BackButton.Name = "BackButton"; BackButton.Size = new System.Drawing.Size(48, 23); - BackButton.TabIndex = 9; - BackButton.Text = "←"; + BackButton.TabIndex = 1; BackButton.UseVisualStyleBackColor = true; BackButton.Click += BackButton_Click; // @@ -264,12 +267,12 @@ private void InitializeComponent() // NavigateButton.Dock = System.Windows.Forms.DockStyle.Fill; NavigateButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + NavigateButton.Image = Properties.Resources.enter; NavigateButton.Location = new System.Drawing.Point(152, 0); NavigateButton.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); NavigateButton.Name = "NavigateButton"; NavigateButton.Size = new System.Drawing.Size(46, 23); - NavigateButton.TabIndex = 7; - NavigateButton.Text = "↩"; + NavigateButton.TabIndex = 4; NavigateButton.UseVisualStyleBackColor = true; NavigateButton.Click += NavigateButton_Click; // @@ -282,7 +285,7 @@ private void InitializeComponent() AddressBarTextBox.Margin = new System.Windows.Forms.Padding(2, 0, 0, 0); AddressBarTextBox.Name = "AddressBarTextBox"; AddressBarTextBox.Size = new System.Drawing.Size(574, 23); - AddressBarTextBox.TabIndex = 8; + AddressBarTextBox.TabIndex = 5; AddressBarTextBox.KeyDown += AddressBarTextBox_KeyDown; // // WebView2Panel @@ -307,7 +310,7 @@ private void InitializeComponent() WebView2.Name = "WebView2"; WebView2.Size = new System.Drawing.Size(774, 494); WebView2.Source = new System.Uri("about:blank", System.UriKind.Absolute); - WebView2.TabIndex = 42; + WebView2.TabIndex = 6; WebView2.ZoomFactor = 1D; WebView2.CoreWebView2InitializationCompleted += WebView2_CoreWebView2InitializationCompleted; WebView2.ContentLoading += WebView2_ContentLoading; @@ -369,7 +372,7 @@ private void InitializeComponent() UrlTextBox.Margin = new System.Windows.Forms.Padding(2, 0, 0, 0); UrlTextBox.Name = "UrlTextBox"; UrlTextBox.Size = new System.Drawing.Size(624, 23); - UrlTextBox.TabIndex = 6; + UrlTextBox.TabIndex = 4; UrlTextBox.WordWrap = false; UrlTextBox.TextChanged += UrlTextBox_TextChanged; UrlTextBox.KeyDown += UrlTextBox_KeyDown; @@ -378,12 +381,12 @@ private void InitializeComponent() // AddChatRoomFromUrlButton.Dock = System.Windows.Forms.DockStyle.Fill; AddChatRoomFromUrlButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - AddChatRoomFromUrlButton.Image = (System.Drawing.Image)resources.GetObject("AddChatRoomFromUrlButton.Image"); + AddChatRoomFromUrlButton.Image = Properties.Resources.url; AddChatRoomFromUrlButton.Location = new System.Drawing.Point(0, 0); AddChatRoomFromUrlButton.Margin = new System.Windows.Forms.Padding(0, 0, 2, 0); AddChatRoomFromUrlButton.Name = "AddChatRoomFromUrlButton"; AddChatRoomFromUrlButton.Size = new System.Drawing.Size(48, 23); - AddChatRoomFromUrlButton.TabIndex = 7; + AddChatRoomFromUrlButton.TabIndex = 1; AddChatRoomFromUrlButton.UseVisualStyleBackColor = true; AddChatRoomFromUrlButton.Click += AddChatRoomFromUrlButton_Click; // @@ -391,12 +394,12 @@ private void InitializeComponent() // AddChatRoomsFromFileButton.Dock = System.Windows.Forms.DockStyle.Fill; AddChatRoomsFromFileButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - AddChatRoomsFromFileButton.Image = (System.Drawing.Image)resources.GetObject("AddChatRoomsFromFileButton.Image"); + AddChatRoomsFromFileButton.Image = Properties.Resources.file; AddChatRoomsFromFileButton.Location = new System.Drawing.Point(52, 0); AddChatRoomsFromFileButton.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); AddChatRoomsFromFileButton.Name = "AddChatRoomsFromFileButton"; AddChatRoomsFromFileButton.Size = new System.Drawing.Size(46, 23); - AddChatRoomsFromFileButton.TabIndex = 8; + AddChatRoomsFromFileButton.TabIndex = 2; AddChatRoomsFromFileButton.UseVisualStyleBackColor = true; AddChatRoomsFromFileButton.Click += AddChatRoomsFromFileButton_Click; // @@ -404,12 +407,12 @@ private void InitializeComponent() // AddChatRoomsFromFolderButton.Dock = System.Windows.Forms.DockStyle.Fill; AddChatRoomsFromFolderButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - AddChatRoomsFromFolderButton.Image = (System.Drawing.Image)resources.GetObject("AddChatRoomsFromFolderButton.Image"); + AddChatRoomsFromFolderButton.Image = Properties.Resources.folder; AddChatRoomsFromFolderButton.Location = new System.Drawing.Point(102, 0); AddChatRoomsFromFolderButton.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); AddChatRoomsFromFolderButton.Name = "AddChatRoomsFromFolderButton"; AddChatRoomsFromFolderButton.Size = new System.Drawing.Size(46, 23); - AddChatRoomsFromFolderButton.TabIndex = 9; + AddChatRoomsFromFolderButton.TabIndex = 3; AddChatRoomsFromFolderButton.UseVisualStyleBackColor = true; AddChatRoomsFromFolderButton.Click += AddChatRoomsFromFolderButton_Click; // @@ -434,6 +437,7 @@ private void InitializeComponent() ChatRoomsSplitContainer1.Size = new System.Drawing.Size(776, 496); ChatRoomsSplitContainer1.SplitterDistance = 351; ChatRoomsSplitContainer1.TabIndex = 12; + ChatRoomsSplitContainer1.TabStop = false; // // ChatRoomsSplitContainer3 // @@ -452,6 +456,7 @@ private void InitializeComponent() ChatRoomsSplitContainer3.Size = new System.Drawing.Size(776, 351); ChatRoomsSplitContainer3.SplitterDistance = 125; ChatRoomsSplitContainer3.TabIndex = 12; + ChatRoomsSplitContainer3.TabStop = false; // // CategoriesTreeView // @@ -470,7 +475,7 @@ private void InitializeComponent() CategoriesTreeView.Name = "CategoriesTreeView"; CategoriesTreeView.SelectedImageIndex = 1; CategoriesTreeView.Size = new System.Drawing.Size(125, 351); - CategoriesTreeView.TabIndex = 0; + CategoriesTreeView.TabIndex = 5; CategoriesTreeView.BeforeLabelEdit += CategoriesTreeView_BeforeLabelEdit; CategoriesTreeView.AfterLabelEdit += CategoriesTreeView_AfterLabelEdit; CategoriesTreeView.AfterCollapse += CategoriesTreeView_AfterCollapse; @@ -562,7 +567,7 @@ private void InitializeComponent() ChatRoomsDataGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; ChatRoomsDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; ChatRoomsDataGridView.Size = new System.Drawing.Size(647, 351); - ChatRoomsDataGridView.TabIndex = 11; + ChatRoomsDataGridView.TabIndex = 6; ChatRoomsDataGridView.CellBeginEdit += ChatRoomsDataGridView_CellBeginEdit; ChatRoomsDataGridView.CellEndEdit += ChatRoomsDataGridView_CellEndEdit; ChatRoomsDataGridView.CellLeave += ChatRoomsDataGridView_CellLeave; @@ -628,15 +633,34 @@ private void InitializeComponent() // // ChatRoomsContextMenuStrip // - ChatRoomsContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { RemoveChatRoomToolStripMenuItem }); + ChatRoomsContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { CopyUrlToolStripMenuItem, SetActionToolStripMenuItem, SetResolutionToolStripMenuItem, RemoveChatRoomToolStripMenuItem }); ChatRoomsContextMenuStrip.Name = "ChatRoomsContextMenuStrip"; - ChatRoomsContextMenuStrip.Size = new System.Drawing.Size(118, 26); + ChatRoomsContextMenuStrip.Size = new System.Drawing.Size(147, 92); ChatRoomsContextMenuStrip.Opening += ChatRoomsContextMenuStrip_Opening; // + // CopyUrlToolStripMenuItem + // + CopyUrlToolStripMenuItem.Name = "CopyUrlToolStripMenuItem"; + CopyUrlToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + CopyUrlToolStripMenuItem.Text = "Copy URL"; + CopyUrlToolStripMenuItem.Click += CopyUrlToolStripMenuItem_Click; + // + // SetActionToolStripMenuItem + // + SetActionToolStripMenuItem.Name = "SetActionToolStripMenuItem"; + SetActionToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + SetActionToolStripMenuItem.Text = "Set action"; + // + // SetResolutionToolStripMenuItem + // + SetResolutionToolStripMenuItem.Name = "SetResolutionToolStripMenuItem"; + SetResolutionToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + SetResolutionToolStripMenuItem.Text = "Set resolution"; + // // RemoveChatRoomToolStripMenuItem // RemoveChatRoomToolStripMenuItem.Name = "RemoveChatRoomToolStripMenuItem"; - RemoveChatRoomToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + RemoveChatRoomToolStripMenuItem.Size = new System.Drawing.Size(146, 22); RemoveChatRoomToolStripMenuItem.Text = "Remove"; RemoveChatRoomToolStripMenuItem.Click += RemoveChatRoomToolStripMenuItem_Click; // @@ -657,6 +681,7 @@ private void InitializeComponent() ChatRoomsSplitContainer2.Size = new System.Drawing.Size(776, 141); ChatRoomsSplitContainer2.SplitterDistance = 125; ChatRoomsSplitContainer2.TabIndex = 1; + ChatRoomsSplitContainer2.TabStop = false; // // ThumbnailPictureBox // @@ -704,8 +729,9 @@ private void InitializeComponent() FilesDataGridView.Name = "FilesDataGridView"; FilesDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; FilesDataGridView.Size = new System.Drawing.Size(647, 141); - FilesDataGridView.TabIndex = 0; + FilesDataGridView.TabIndex = 7; FilesDataGridView.CellMouseDoubleClick += FilesDataGridView_CellMouseDoubleClick; + FilesDataGridView.KeyDown += FilesDataGridView_KeyDown; // // FileNameColumn // @@ -811,7 +837,7 @@ private void InitializeComponent() OutputDirectoryTextBox.Name = "OutputDirectoryTextBox"; OutputDirectoryTextBox.ReadOnly = true; OutputDirectoryTextBox.Size = new System.Drawing.Size(350, 23); - OutputDirectoryTextBox.TabIndex = 24; + OutputDirectoryTextBox.TabIndex = 1; OutputDirectoryTextBox.Click += OutputDirectoryTextBox_Click; // // FFmpegPathTextBox @@ -823,7 +849,7 @@ private void InitializeComponent() FFmpegPathTextBox.Name = "FFmpegPathTextBox"; FFmpegPathTextBox.ReadOnly = true; FFmpegPathTextBox.Size = new System.Drawing.Size(350, 23); - FFmpegPathTextBox.TabIndex = 22; + FFmpegPathTextBox.TabIndex = 2; FFmpegPathTextBox.Click += FFmpegPathTextBox_Click; // // ChaturbateConcurrentUpdatesNumericUpDown @@ -836,7 +862,7 @@ private void InitializeComponent() ChaturbateConcurrentUpdatesNumericUpDown.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); ChaturbateConcurrentUpdatesNumericUpDown.Name = "ChaturbateConcurrentUpdatesNumericUpDown"; ChaturbateConcurrentUpdatesNumericUpDown.Size = new System.Drawing.Size(350, 23); - ChaturbateConcurrentUpdatesNumericUpDown.TabIndex = 35; + ChaturbateConcurrentUpdatesNumericUpDown.TabIndex = 4; ChaturbateConcurrentUpdatesNumericUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; ChaturbateConcurrentUpdatesNumericUpDown.Value = new decimal(new int[] { 1, 0, 0, 0 }); // @@ -850,7 +876,7 @@ private void InitializeComponent() BongaCamsConcurrentUpdatesNumericUpDown.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); BongaCamsConcurrentUpdatesNumericUpDown.Name = "BongaCamsConcurrentUpdatesNumericUpDown"; BongaCamsConcurrentUpdatesNumericUpDown.Size = new System.Drawing.Size(350, 23); - BongaCamsConcurrentUpdatesNumericUpDown.TabIndex = 36; + BongaCamsConcurrentUpdatesNumericUpDown.TabIndex = 5; BongaCamsConcurrentUpdatesNumericUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; BongaCamsConcurrentUpdatesNumericUpDown.Value = new decimal(new int[] { 1, 0, 0, 0 }); // @@ -864,7 +890,7 @@ private void InitializeComponent() UpdateIntervalNumericUpDown.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); UpdateIntervalNumericUpDown.Name = "UpdateIntervalNumericUpDown"; UpdateIntervalNumericUpDown.Size = new System.Drawing.Size(350, 23); - UpdateIntervalNumericUpDown.TabIndex = 38; + UpdateIntervalNumericUpDown.TabIndex = 7; UpdateIntervalNumericUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; UpdateIntervalNumericUpDown.Value = new decimal(new int[] { 1, 0, 0, 0 }); // @@ -944,7 +970,7 @@ private void InitializeComponent() StripchatConcurrentUpdatesNumericUpDown.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); StripchatConcurrentUpdatesNumericUpDown.Name = "StripchatConcurrentUpdatesNumericUpDown"; StripchatConcurrentUpdatesNumericUpDown.Size = new System.Drawing.Size(350, 23); - StripchatConcurrentUpdatesNumericUpDown.TabIndex = 40; + StripchatConcurrentUpdatesNumericUpDown.TabIndex = 6; StripchatConcurrentUpdatesNumericUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; StripchatConcurrentUpdatesNumericUpDown.Value = new decimal(new int[] { 1, 0, 0, 0 }); // @@ -980,7 +1006,7 @@ private void InitializeComponent() DefaultActionComboBox.Margin = new System.Windows.Forms.Padding(0, 5, 0, 0); DefaultActionComboBox.Name = "DefaultActionComboBox"; DefaultActionComboBox.Size = new System.Drawing.Size(350, 23); - DefaultActionComboBox.TabIndex = 43; + DefaultActionComboBox.TabIndex = 8; // // DefaultResolutionComboBox // @@ -991,7 +1017,7 @@ private void InitializeComponent() DefaultResolutionComboBox.Margin = new System.Windows.Forms.Padding(0, 5, 0, 0); DefaultResolutionComboBox.Name = "DefaultResolutionComboBox"; DefaultResolutionComboBox.Size = new System.Drawing.Size(350, 23); - DefaultResolutionComboBox.TabIndex = 44; + DefaultResolutionComboBox.TabIndex = 9; // // StreamlinkPathLabel // @@ -1013,7 +1039,7 @@ private void InitializeComponent() StreamlinkPathTextBox.Name = "StreamlinkPathTextBox"; StreamlinkPathTextBox.ReadOnly = true; StreamlinkPathTextBox.Size = new System.Drawing.Size(350, 23); - StreamlinkPathTextBox.TabIndex = 46; + StreamlinkPathTextBox.TabIndex = 3; StreamlinkPathTextBox.Click += StreamlinkPathTextBox_Click; // // LogTabPage @@ -1043,6 +1069,20 @@ private void InitializeComponent() LogListBox.Size = new System.Drawing.Size(776, 529); LogListBox.TabIndex = 0; // + // LogContextMenuStrip + // + LogContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { CopyLogToolStripMenuItem }); + LogContextMenuStrip.Name = "LogContextMenuStrip"; + LogContextMenuStrip.Size = new System.Drawing.Size(103, 26); + LogContextMenuStrip.Opening += LogContextMenuStrip_Opening; + // + // CopyLogToolStripMenuItem + // + CopyLogToolStripMenuItem.Name = "CopyLogToolStripMenuItem"; + CopyLogToolStripMenuItem.Size = new System.Drawing.Size(102, 22); + CopyLogToolStripMenuItem.Text = "Copy"; + CopyLogToolStripMenuItem.Click += CopyLogToolStripMenuItem_Click; + // // AboutTabPage // AboutTabPage.Controls.Add(LicenseTextBox); @@ -1077,20 +1117,6 @@ private void InitializeComponent() FormCloseTimer.Interval = 1000; FormCloseTimer.Tick += FormCloseTimer_Tick; // - // LogContextMenuStrip - // - LogContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { CopyLogToolStripMenuItem }); - LogContextMenuStrip.Name = "LogContextMenuStrip"; - LogContextMenuStrip.Size = new System.Drawing.Size(103, 26); - LogContextMenuStrip.Opening += LogContextMenuStrip_Opening; - // - // CopyLogToolStripMenuItem - // - CopyLogToolStripMenuItem.Name = "CopyLogToolStripMenuItem"; - CopyLogToolStripMenuItem.Size = new System.Drawing.Size(102, 22); - CopyLogToolStripMenuItem.Text = "Copy"; - CopyLogToolStripMenuItem.Click += CopyLogToolStripMenuItem_Click; - // // MainForm // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -1144,10 +1170,10 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)UpdateIntervalNumericUpDown).EndInit(); ((System.ComponentModel.ISupportInitialize)StripchatConcurrentUpdatesNumericUpDown).EndInit(); LogTabPage.ResumeLayout(false); + LogContextMenuStrip.ResumeLayout(false); AboutTabPage.ResumeLayout(false); AboutTabPage.PerformLayout(); ((System.ComponentModel.ISupportInitialize)SettingsBindingSource).EndInit(); - LogContextMenuStrip.ResumeLayout(false); ResumeLayout(false); } @@ -1223,7 +1249,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem AddCategoryToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem RemoveCategoryToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem RenameCategoryToolStripMenuItem; - private System.Windows.Forms.Button button1; private System.Windows.Forms.Button AddChatRoomFromUrlButton; private System.Windows.Forms.Button AddChatRoomsFromFileButton; private System.Windows.Forms.Button AddChatRoomsFromFolderButton; @@ -1231,6 +1256,9 @@ private void InitializeComponent() private System.Windows.Forms.ListBox LogListBox; private System.Windows.Forms.ContextMenuStrip LogContextMenuStrip; private System.Windows.Forms.ToolStripMenuItem CopyLogToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem SetActionToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem SetResolutionToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem CopyUrlToolStripMenuItem; } } diff --git a/ChatRoomRecorder/MainForm.cs b/ChatRoomRecorder/MainForm.cs index d33ac06..a6800c6 100644 --- a/ChatRoomRecorder/MainForm.cs +++ b/ChatRoomRecorder/MainForm.cs @@ -19,43 +19,64 @@ public partial class MainForm : Form public MainForm() { - InitializeComponent(); - - Text = string.Format("{0} {1}", Assembly.GetEntryAssembly().GetName().Name, Assembly.GetEntryAssembly().GetName().Version.ToString(3)); - - LicenseTextBox.Text = string.Format("{0}\r\n\r\n{1}\r\n\r\n{2}", - LicenseTextBox.Text, - ((AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(Assembly.GetEntryAssembly(), typeof(AssemblyDescriptionAttribute))).Description, - ((AssemblyCopyrightAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(Assembly.GetEntryAssembly(), typeof(AssemblyCopyrightAttribute))).Copyright); - - DefaultActionComboBox.DataSource = new ChatRoomAction[] { ChatRoomAction.None, ChatRoomAction.Monitor, ChatRoomAction.Record }; - DefaultResolutionComboBox.DataSource = ChatRoomResolution.CommonResolutions; - - c_defaultSettings.CopyTo(_settings); - SettingsBindingSource.DataSource = _settings; - OutputDirectoryTextBox.DataBindings.Add("Text", SettingsBindingSource, c_outputDirectorySettingName); - FFmpegPathTextBox.DataBindings.Add("Text", SettingsBindingSource, c_ffmpegPathSettingName); - StreamlinkPathTextBox.DataBindings.Add("Text", SettingsBindingSource, c_streamlinkPathSettingName); - ChaturbateConcurrentUpdatesNumericUpDown.DataBindings.Add("Value", SettingsBindingSource, c_chaturbateConcurrentUpdatesSettingName); - BongaCamsConcurrentUpdatesNumericUpDown.DataBindings.Add("Value", SettingsBindingSource, c_bongaCamsConcurrentUpdatesSettingName); - StripchatConcurrentUpdatesNumericUpDown.DataBindings.Add("Value", SettingsBindingSource, c_stripchatConcurrentUpdatesSettingName); - UpdateIntervalNumericUpDown.DataBindings.Add("Value", SettingsBindingSource, c_updateIntervalSettingName); - DefaultActionComboBox.DataBindings.Add("SelectedItem", SettingsBindingSource, c_defaultActionSettingName); - DefaultResolutionComboBox.DataBindings.Add("SelectedItem", SettingsBindingSource, c_defaultResolutionSettingName); - _settings.PropertyChanged += Settings_PropertyChanged; - - ChatRoomsBindingSource.DataSource = _chatRoomsList; - ActionColumn.DataSource = new ChatRoomAction[] { ChatRoomAction.None, ChatRoomAction.Monitor, ChatRoomAction.Record }; - ResolutionColumn.DataSource = ChatRoomResolution.CommonResolutions; - - FilesBindingSource.DataSource = _filesList; - - foreach (ChatRoomWebsite website in Enum.GetValues(typeof(ChatRoomWebsite))) + lock (_lock) { - _lastUpdates.Add(website, DateTime.Now); - } + InitializeComponent(); + + Text = string.Format("{0} {1}", Assembly.GetEntryAssembly().GetName().Name, Assembly.GetEntryAssembly().GetName().Version.ToString(3)); + + ChatRoomsBindingSource.DataSource = _chatRoomsList; + ActionColumn.DataSource = new ChatRoomAction[] { ChatRoomAction.None, ChatRoomAction.Monitor, ChatRoomAction.Record }; + ResolutionColumn.DataSource = ChatRoomResolution.CommonResolutions; + + foreach (ChatRoomAction action in Enum.GetValues(typeof(ChatRoomAction))) + { + ToolStripMenuItem item = new(); + item.Text = action.ToString(); + item.Tag = action; + item.Click += SetActionChatRoomToolStripMenuItem_Click; + SetActionToolStripMenuItem.DropDownItems.Add(item); + } + + foreach (ChatRoomResolution resolution in ChatRoomResolution.CommonResolutions) + { + ToolStripMenuItem item = new(); + item.Text = resolution.ToString(); + item.Tag = resolution; + item.Click += SetResolutionChatRoomToolStripMenuItem_Click; + SetResolutionToolStripMenuItem.DropDownItems.Add(item); + } + + FilesBindingSource.DataSource = _filesList; + + DefaultActionComboBox.DataSource = new ChatRoomAction[] { ChatRoomAction.None, ChatRoomAction.Monitor, ChatRoomAction.Record }; + DefaultResolutionComboBox.DataSource = ChatRoomResolution.CommonResolutions; - ReadData(); + c_defaultSettings.CopyTo(_settings); + SettingsBindingSource.DataSource = _settings; + OutputDirectoryTextBox.DataBindings.Add("Text", SettingsBindingSource, c_outputDirectorySettingName); + FFmpegPathTextBox.DataBindings.Add("Text", SettingsBindingSource, c_ffmpegPathSettingName); + StreamlinkPathTextBox.DataBindings.Add("Text", SettingsBindingSource, c_streamlinkPathSettingName); + ChaturbateConcurrentUpdatesNumericUpDown.DataBindings.Add("Value", SettingsBindingSource, c_chaturbateConcurrentUpdatesSettingName); + BongaCamsConcurrentUpdatesNumericUpDown.DataBindings.Add("Value", SettingsBindingSource, c_bongaCamsConcurrentUpdatesSettingName); + StripchatConcurrentUpdatesNumericUpDown.DataBindings.Add("Value", SettingsBindingSource, c_stripchatConcurrentUpdatesSettingName); + UpdateIntervalNumericUpDown.DataBindings.Add("Value", SettingsBindingSource, c_updateIntervalSettingName); + DefaultActionComboBox.DataBindings.Add("SelectedItem", SettingsBindingSource, c_defaultActionSettingName); + DefaultResolutionComboBox.DataBindings.Add("SelectedItem", SettingsBindingSource, c_defaultResolutionSettingName); + _settings.PropertyChanged += Settings_PropertyChanged; + + LicenseTextBox.Text = string.Format("{0}\r\n\r\n{1}\r\n\r\n{2}", + LicenseTextBox.Text, + ((AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(Assembly.GetEntryAssembly(), typeof(AssemblyDescriptionAttribute))).Description, + ((AssemblyCopyrightAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(Assembly.GetEntryAssembly(), typeof(AssemblyCopyrightAttribute))).Copyright); + + foreach (ChatRoomWebsite website in Enum.GetValues(typeof(ChatRoomWebsite))) + { + _lastUpdates.Add(website, DateTime.Now); + } + + ReadData(); + } } private void WebView2_CoreWebView2InitializationCompleted(object sender, Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs e) @@ -206,7 +227,7 @@ private void UpdateChatRooms() } } - private void SaveChatRoom(ChatRoom chatRoom, bool updateRow) + private void SaveChatRoom(ChatRoom chatRoom, bool resetItem) { lock (_lock) { @@ -215,9 +236,9 @@ private void SaveChatRoom(ChatRoom chatRoom, bool updateRow) { WriteData(c_chatRoomsTableName, 0, chatRoom, null, null); - if (updateRow) + if (resetItem) { - ChatRoomsDataGridView.InvalidateRow(index); + _chatRoomsList.ResetItem(index); } } } @@ -324,11 +345,17 @@ private void AddChatRoomFromUrl() { if (!ChatRoomExists(parsedUrl)) { - AddChatRoom(parsedUrl); + List chatRooms = new(); - TreeNode node = CategoriesTreeView.SelectedNode; - CategoriesTreeView.SelectedNode = null; - CategoriesTreeView.SelectedNode = node; + chatRooms.Add(AddChatRoom(parsedUrl)); + + ShowChatRooms(chatRooms, false); + + UrlTextBox.Text = string.Empty; + + int index = _chatRoomsList.IndexOf(chatRooms[0]); + ChatRoomsDataGridView.Rows[index].Selected = true; + ChatRoomsDataGridView.FirstDisplayedScrollingRowIndex = index; } else { @@ -348,19 +375,25 @@ private void AddChatRoomsFromFile() { try { + HashSet> parsedUrls = new(); + string[] urls = File.ReadAllLines(ofd.FileName); foreach (string url in urls) { - Tuple parsedUrl = ChatRoom.ParseUrl(url); - if (parsedUrl != null && !ChatRoomExists(parsedUrl)) + parsedUrls.Add(ChatRoom.ParseUrl(url)); + } + + List chatRooms = new(); + + foreach (Tuple parsedUrl in parsedUrls) + { + if (!ChatRoomExists(parsedUrl)) { - AddChatRoom(parsedUrl); + chatRooms.Add(AddChatRoom(parsedUrl)); } } - TreeNode node = CategoriesTreeView.SelectedNode; - CategoriesTreeView.SelectedNode = null; - CategoriesTreeView.SelectedNode = node; + ShowChatRooms(chatRooms, false); MessageBox.Show(c_chatRoomsAddedMessage, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); } @@ -387,17 +420,17 @@ private void AddChatRoomsFromFolder() parsedUrls.Add(ChatRoom.ParseUrl(file.Name)); } + List chatRooms = new(); + foreach (Tuple parsedUrl in parsedUrls) { if (!ChatRoomExists(parsedUrl)) { - AddChatRoom(parsedUrl); + chatRooms.Add(AddChatRoom(parsedUrl)); } } - TreeNode node = CategoriesTreeView.SelectedNode; - CategoriesTreeView.SelectedNode = null; - CategoriesTreeView.SelectedNode = node; + ShowChatRooms(chatRooms, false); MessageBox.Show(c_chatRoomsAddedMessage, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); } @@ -430,7 +463,7 @@ private bool ChatRoomExists(Tuple parsedUrl) return false; } - private void AddChatRoom(Tuple parsedUrl) + private ChatRoom AddChatRoom(Tuple parsedUrl) { lock (_lock) { @@ -446,6 +479,8 @@ private void AddChatRoom(Tuple parsedUrl) category.ChatRooms.Add(chatRoom); WriteData(c_chatRoomsTableName, 1, chatRoom, category, null); + + return chatRoom; } } @@ -454,6 +489,8 @@ private void FilterChatRooms() lock (_lock) { _chatRoomsList.Filter = UrlTextBox.Text; + + ChatRoomsDataGridView.ClearSelection(); } } @@ -489,7 +526,7 @@ private void CategoriesTreeView_AfterLabelEdit(object sender, NodeLabelEditEvent private void CategoriesTreeView_AfterSelect(object sender, TreeViewEventArgs e) { - ShowChatRooms(); + ShowChatRooms(((Category)CategoriesTreeView.SelectedNode.Tag).ChatRooms, true); } private void AddCategoryToolStripMenuItem_Click(object sender, EventArgs e) @@ -525,12 +562,16 @@ private void CategoriesContextMenuStrip_Opening(object sender, CancelEventArgs e RenameCategoryToolStripMenuItem.Enabled = CategoriesTreeView.SelectedNode != null && CategoriesTreeView.SelectedNode.Tag != _root; } - private void ShowChatRooms() + private void ShowChatRooms(List chatRooms, bool flush) { lock (_lock) { - _chatRoomsList.Flush(); - _chatRoomsList.Append(((Category)CategoriesTreeView.SelectedNode.Tag).ChatRooms); + if (flush) + { + _chatRoomsList.Flush(); + } + + _chatRoomsList.Append(chatRooms); } } @@ -552,7 +593,7 @@ private void AddCategory() private void RemoveCategory() { - if (MessageBox.Show(c_confirmCategoryRemovingMessage, string.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) + if (MessageBox.Show(c_confirmCategoryRemovingMessage, string.Empty, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { TreeNode currentNode = CategoriesTreeView.SelectedNode; TreeNode parentNode = currentNode.Parent; @@ -643,6 +684,36 @@ private void ChatRoomsDataGridView_SelectionChanged(object sender, EventArgs e) ShowThumbnail(); } + private void CopyUrlToolStripMenuItem_Click(object sender, EventArgs e) + { + List urls = new(); + foreach (DataGridViewRow selectedRow in ChatRoomsDataGridView.SelectedRows) + { + urls.Add(_chatRoomsList[selectedRow.Index].ChatRoomUrl); + } + Clipboard.SetText(string.Join("\r\n", urls)); + } + + private void SetActionChatRoomToolStripMenuItem_Click(object sender, EventArgs e) + { + foreach (DataGridViewRow selectedRow in ChatRoomsDataGridView.SelectedRows) + { + _chatRoomsList[selectedRow.Index].Action = (ChatRoomAction)((ToolStripMenuItem)sender).Tag; + + SaveChatRoom(_chatRoomsList[selectedRow.Index], true); + } + } + + private void SetResolutionChatRoomToolStripMenuItem_Click(object sender, EventArgs e) + { + foreach (DataGridViewRow selectedRow in ChatRoomsDataGridView.SelectedRows) + { + _chatRoomsList[selectedRow.Index].PreferredResolution = (ChatRoomResolution)((ToolStripMenuItem)sender).Tag; + + SaveChatRoom(_chatRoomsList[selectedRow.Index], true); + } + } + private void RemoveChatRoomToolStripMenuItem_Click(object sender, EventArgs e) { RemoveChatRoom(); @@ -650,10 +721,12 @@ private void RemoveChatRoomToolStripMenuItem_Click(object sender, EventArgs e) private void ChatRoomsContextMenuStrip_Opening(object sender, CancelEventArgs e) { + CopyUrlToolStripMenuItem.Enabled = ChatRoomsDataGridView.SelectedRows.Count > 0; + SetActionToolStripMenuItem.Enabled = ChatRoomsDataGridView.SelectedRows.Count > 0; + SetResolutionToolStripMenuItem.Enabled = ChatRoomsDataGridView.SelectedRows.Count > 0; RemoveChatRoomToolStripMenuItem.Enabled = ChatRoomsDataGridView.SelectedRows.Count > 0; } - private void ShowFiles() { _filesList.Clear(); @@ -732,7 +805,7 @@ private void ShowThumbnail() private void RemoveChatRoom() { - if (MessageBox.Show(c_confirmChatRoomsRemovingMessage, string.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) + if (MessageBox.Show(c_confirmChatRoomsRemovingMessage, string.Empty, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { lock (_lock) { @@ -743,33 +816,16 @@ private void RemoveChatRoom() chatRooms.Add(_chatRoomsList[row.Index]); } + _chatRoomsList.Delete(chatRooms); + foreach (ChatRoom chatRoom in chatRooms) { - WriteData(c_chatRoomsTableName, -1, chatRoom, null, null); + ((Category)CategoriesTreeView.SelectedNode.Tag).ChatRooms.Remove(chatRoom); - Stack cs = new Stack(); - cs.Push(_root); - while (cs.Count > 0) - { - if (!cs.Peek().ChatRooms.Remove(chatRoom)) - { - foreach (Category category in cs.Pop().Categories) - { - cs.Push(category); - } - } - else - { - break; - } - } + WriteData(c_chatRoomsTableName, -1, chatRoom, null, null); chatRoom.Dispose(); } - - TreeNode node = CategoriesTreeView.SelectedNode; - CategoriesTreeView.SelectedNode = null; - CategoriesTreeView.SelectedNode = node; } } } @@ -778,6 +834,21 @@ private void RemoveChatRoom() #region FilesDataGridView functioning + private void FilesDataGridView_KeyDown(object sender, KeyEventArgs e) + { + switch (e.KeyCode) + { + case Keys.Enter: + OpenFile(); + e.Handled = true; + break; + case Keys.Delete: + RemoveFile(); + e.Handled = true; + break; + } + } + private void FilesDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { OpenFile(); @@ -817,7 +888,7 @@ private void OpenFile() private void RemoveFile() { - if (MessageBox.Show(c_confirmFilesRemovingMessage, string.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) + if (MessageBox.Show(c_confirmFilesRemovingMessage, string.Empty, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { try { @@ -857,7 +928,7 @@ private void ThumbnailContextMenuStrip_Opening(object sender, CancelEventArgs e) private void RemoveThumbnail() { - if (MessageBox.Show(c_confirmThumbnailRemovingMessage, string.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) + if (MessageBox.Show(c_confirmThumbnailRemovingMessage, string.Empty, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { try { @@ -1129,21 +1200,22 @@ private void MoveChatRooms(Point point) if (newNode != oldNode) { - Category oldCategory = (Category)oldNode.Tag; - Category newCategory = (Category)newNode.Tag; + List chatRooms = new List(); - foreach (DataGridViewRow selectedRow in ChatRoomsDataGridView.SelectedRows) + foreach (DataGridViewRow row in ChatRoomsDataGridView.SelectedRows) { - ChatRoom chatRoom = _chatRoomsList[selectedRow.Index]; + chatRooms.Add(_chatRoomsList[row.Index]); + } - WriteData(c_chatRoomsTableName, 0, chatRoom, null, newCategory); + _chatRoomsList.Delete(chatRooms); - oldCategory.ChatRooms.Remove(chatRoom); - newCategory.ChatRooms.Add(chatRoom); - } + foreach (ChatRoom chatRoom in chatRooms) + { + ((Category)oldNode.Tag).ChatRooms.Remove(chatRoom); + ((Category)newNode.Tag).ChatRooms.Add(chatRoom); - CategoriesTreeView.SelectedNode = null; - CategoriesTreeView.SelectedNode = oldNode; + WriteData(c_chatRoomsTableName, 0, chatRoom, null, (Category)newNode.Tag); + } } } } @@ -1162,8 +1234,6 @@ private void MoveCategories(Point point) Category dstCategory = (Category)dstNode.Tag; Category parentCategory = (Category)parentNode.Tag; - WriteData(c_categoriesTableName, 0, null, curCategory, dstCategory); - parentCategory.Categories.Remove(curCategory); dstCategory.Categories.Add(curCategory); @@ -1178,6 +1248,8 @@ private void MoveCategories(Point point) CategoriesTreeView.SelectedNode = null; CategoriesTreeView.SelectedNode = curNode; + + WriteData(c_categoriesTableName, 0, null, curCategory, dstCategory); } } } @@ -1594,13 +1666,13 @@ private void WriteData(string table, int operation, ChatRoom chatRoom, Category private const string c_unsupportedUrlMessage = "The URL is incorrect! Only http://* and https://* URLs are supported!"; private const string c_unsupportedWebSiteMessage = "The URL is incorrect! Supported websites are Chaturbate, BongaCams and Stripchat!"; private const string c_duplicateChatRoomMessage = "The chat room is already existed!"; - private const string c_confirmCategoryRemovingMessage = "Do you really want to remove selected category?"; + private const string c_confirmCategoryRemovingMessage = "The category will be removed!"; private const string c_categoryNotEmptyMessage = "The category is not empty!"; - private const string c_confirmChatRoomsRemovingMessage = "Do you really want to remove selected chat rooms?"; + private const string c_confirmChatRoomsRemovingMessage = "The selected chat rooms will be removed!"; private const string c_fileOpeningErrorMessage = "The file can't be opened!"; - private const string c_confirmFilesRemovingMessage = "Do you really want to remove selected files?"; + private const string c_confirmFilesRemovingMessage = "The selected files will be removed!"; private const string c_fileRemovingErrorMessage = "The file can't be removed!"; - private const string c_confirmThumbnailRemovingMessage = "Do you really want to remove this thumbnail?"; + private const string c_confirmThumbnailRemovingMessage = "The thumbnail will be removed!"; private const string c_thumbnailRemovingErrorMessage = "The thumbnail can't be removed!"; private const string c_chatRoomsAddingErrorMessage = "The chat rooms can't be added!"; private const string c_chatRoomsAddedMessage = "The chat rooms have been added!"; diff --git a/ChatRoomRecorder/MainForm.resx b/ChatRoomRecorder/MainForm.resx index 60f60f1..b56eac3 100644 --- a/ChatRoomRecorder/MainForm.resx +++ b/ChatRoomRecorder/MainForm.resx @@ -1,7 +1,7 @@