From efa09fb45741e88c6a5f81c423d9c752f6175b7b Mon Sep 17 00:00:00 2001 From: Andy <88590076+AAndyProgram@users.noreply.github.com> Date: Sat, 30 Mar 2024 09:40:52 +0300 Subject: [PATCH] 2024.3.30.0 UPDATE DOWNLOAD GROUP ENVIRONMENT Add the ability to filter users who have been (not)downloaded in the last x days. DownloadedInfoForm: fix possible bug Feed: fix scrolling bug IUserData, UserDataBase, UserDataBind: remove 'FitToAddParams' UserDataBase: update 'GetLVIGroup' function; wrong decision to set 'LastUpdated' date AutoDownloader: remove 'All' and 'Default' options SettingsCLS: refactoring the code and XML file --- SCrawler/API/Base/IUserData.vb | 1 - SCrawler/API/Base/UserDataBase.vb | 57 +- SCrawler/API/UserDataBind.vb | 5 - SCrawler/API/YouTube/UserData.vb | 2 +- .../Download/Automation/AutoDownloader.vb | 41 +- .../AutoDownloaderEditorForm.Designer.vb | 132 +-- .../Automation/AutoDownloaderEditorForm.resx | 86 +- .../Automation/AutoDownloaderEditorForm.vb | 15 +- SCrawler/Download/DownloadedInfoForm.vb | 95 +- SCrawler/Download/Feed/DownloadFeedForm.vb | 3 + SCrawler/Download/Groups/DownloadGroup.vb | 371 +++++-- .../Groups/DownloadGroupCollection.vb | 118 ++- SCrawler/Download/Groups/GroupDefaults.vb | 367 +++++-- .../Groups/GroupEditorForm.Designer.vb | 18 +- SCrawler/Download/Groups/GroupEditorForm.vb | 9 +- .../Download/Groups/GroupListForm.Designer.vb | 78 ++ SCrawler/Download/Groups/GroupListForm.resx | 120 +++ SCrawler/Download/Groups/GroupListForm.vb | 300 ++++++ SCrawler/Download/Groups/GroupParameters.vb | 166 ++- .../Editors/GlobalSettingsForm.Designer.vb | 87 +- SCrawler/Editors/GlobalSettingsForm.resx | 3 + SCrawler/Editors/GlobalSettingsForm.vb | 12 +- SCrawler/LabelsKeeper.vb | 11 +- SCrawler/ListImagesLoader.vb | 30 +- SCrawler/MainFrame.Designer.vb | 286 +----- SCrawler/MainFrame.resx | 19 - SCrawler/MainFrame.vb | 423 ++++---- SCrawler/MainFrameObjects.vb | 6 +- SCrawler/MainMod.vb | 14 - SCrawler/SCrawler.vbproj | 10 +- SCrawler/SettingsCLS.vb | 955 +++++++++++------- SCrawler/ViewFilter.vb | 263 ----- 32 files changed, 2404 insertions(+), 1699 deletions(-) create mode 100644 SCrawler/Download/Groups/GroupListForm.Designer.vb create mode 100644 SCrawler/Download/Groups/GroupListForm.resx create mode 100644 SCrawler/Download/Groups/GroupListForm.vb delete mode 100644 SCrawler/ViewFilter.vb diff --git a/SCrawler/API/Base/IUserData.vb b/SCrawler/API/Base/IUserData.vb index 0ecf299..14077f7 100644 --- a/SCrawler/API/Base/IUserData.vb +++ b/SCrawler/API/Base/IUserData.vb @@ -59,7 +59,6 @@ Namespace API.Base ReadOnly Property DownloadedTotal(Optional ByVal Total As Boolean = True) As Integer ReadOnly Property DownloadedInformation As String Property HasError As Boolean - ReadOnly Property FitToAddParams As Boolean ReadOnly Property Key As String Property DownloadImages As Boolean Property DownloadVideos As Boolean diff --git a/SCrawler/API/Base/UserDataBase.vb b/SCrawler/API/Base/UserDataBase.vb index eb62213..d520226 100644 --- a/SCrawler/API/Base/UserDataBase.vb +++ b/SCrawler/API/Base/UserDataBase.vb @@ -312,7 +312,7 @@ Namespace API.Base End Set End Property Protected Sub UserSiteNameUpdate(ByVal NewName As String) - If Not NewName.IsEmptyString And (UserSiteName.IsEmptyString Or Settings.UserSiteNameUpdateEveryTime) Then UserSiteName = NewName + If Not NewName.IsEmptyString And (UserSiteName.IsEmptyString Or Settings.UpdateUserSiteNameEveryTime) Then UserSiteName = NewName End Sub Friend ReadOnly Property UserModel As UsageModel Implements IUserData.UserModel Get @@ -829,48 +829,19 @@ BlockNullPicture: Return ListImagesLoader.ApplyLVIColor(Me, New ListViewItem(ToString(), GetLVIGroup(Destination)) With {.Name = LVIKey, .Tag = LVIKey}, True) End If End Function - Friend Overridable ReadOnly Property FitToAddParams As Boolean Implements IUserData.FitToAddParams - Get - With Settings - If IsSubscription And Not .MainFrameUsersShowSubscriptions Then Return False - If Not IsSubscription And Not .MainFrameUsersShowDefaults Then Return False - If LastUpdated.HasValue And Not .ViewDateMode.Value = ShowingDates.Off Then - Dim f As Date = If(.ViewDateFrom.HasValue, .ViewDateFrom.Value.Date, Date.MinValue.Date) - Dim t As Date = If(.ViewDateTo.HasValue, .ViewDateTo.Value.Date, Date.MaxValue.Date) - Select Case DirectCast(.ViewDateMode.Value, ShowingDates) - Case ShowingDates.In : If Not LastUpdated.Value.ValueBetween(f, t) Then Return False - Case ShowingDates.Not : If LastUpdated.Value.ValueBetween(f, t) Then Return False - End Select - End If - If Not .Labels.ExcludedIgnore AndAlso .Labels.Excluded.ValuesList.ListContains(Labels) Then Return False - If .SelectedSites.Count = 0 OrElse .SelectedSites.Contains(Site) Then - Select Case .ShowingMode.Value - Case ShowingModes.Regular : Return Not Temporary And Not Favorite - Case ShowingModes.Temporary : Return Temporary - Case ShowingModes.Favorite : Return Favorite - Case ShowingModes.Deleted : Return Not UserExists - Case ShowingModes.Suspended : Return UserSuspended - Case ShowingModes.Labels : Return Settings.Labels.Current.ValuesList.ListContains(Labels) - Case ShowingModes.NoLabels : Return Labels.Count = 0 - Case Else : Return True - End Select - Else - Return False - End If - End With - End Get - End Property Friend Function GetLVIGroup(ByVal Destination As ListView) As ListViewGroup Implements IUserData.GetLVIGroup Try - If Settings.ShowingMode.Value = ShowingModes.Labels And Not Settings.ShowGroupsInsteadLabels Then - If Labels.Count > 0 And Settings.Labels.Current.Count > 0 Then - For i% = 0 To Labels.Count - 1 - If Settings.Labels.Current.Contains(Labels(i)) Then Return Destination.Groups.Item(Labels(i)) - Next + With Settings + If Not .ShowAllUsers.Value AndAlso (.AdvancedFilter.Labels.Count > 0 Or .AdvancedFilter.LabelsNo) AndAlso Not .ShowGroupsInsteadLabels Then + If Labels.Count > 0 And .AdvancedFilter.Labels.Count > 0 Then + For i% = 0 To Labels.Count - 1 + If .AdvancedFilter.Labels.Contains(Labels(i)) Then Return Destination.Groups.Item(Labels(i)) + Next + End If + ElseIf Settings.GroupUsers Then + Return Destination.Groups.Item(GetLviGroupName(HOST, Temporary, Favorite, IsCollection)) End If - ElseIf Settings.GroupUsers Then - Return Destination.Groups.Item(GetLviGroupName(HOST, Temporary, Favorite, IsCollection)) - End If + End With Return Destination.Groups.Item(LabelsKeeper.NoLabeledName) Catch ex As Exception Return Destination.Groups.Item(LabelsKeeper.NoLabeledName) @@ -1269,8 +1240,10 @@ BlockNullPicture: Dim mca& = If(ContentMissingExists, _ContentList.LongCount(Function(c) MissingFinder(c)), 0) If DownloadedTotal(False) > 0 Or _EnvirChanged Or Not mcb = mca Or _ForceSaveUserData Then If Not __isChannelsSupport Then - LastUpdated = Now - RunScript() + If DownloadedTotal(False) > 0 Then + LastUpdated = Now + RunScript() + End If DownloadedPictures(True) = SFile.GetFiles(MyFile.CutPath, "*.jpg|*.jpeg|*.png|*.gif|*.webm",, EDP.ReturnValue).Count DownloadedVideos(True) = SFile.GetFiles(MyFile.CutPath, "*.mp4|*.mkv|*.mov", SearchOption.AllDirectories, EDP.ReturnValue).Count If Labels.Contains(LabelsKeeper.NoParsedUser) Then Labels.Remove(LabelsKeeper.NoParsedUser) diff --git a/SCrawler/API/UserDataBind.vb b/SCrawler/API/UserDataBind.vb index b3295c8..2de6cd9 100644 --- a/SCrawler/API/UserDataBind.vb +++ b/SCrawler/API/UserDataBind.vb @@ -276,11 +276,6 @@ Namespace API Set(ByVal NewDate As Date?) End Set End Property - Friend Overrides ReadOnly Property FitToAddParams As Boolean - Get - Return Count > 0 AndAlso Collections.Exists(Function(c) c.FitToAddParams) - End Get - End Property Friend Overrides Property ScriptUse As Boolean Get Return Count > 0 AndAlso Collections.All(Function(c) c.ScriptUse) diff --git a/SCrawler/API/YouTube/UserData.vb b/SCrawler/API/YouTube/UserData.vb index b0e5006..4a49332 100644 --- a/SCrawler/API/YouTube/UserData.vb +++ b/SCrawler/API/YouTube/UserData.vb @@ -230,7 +230,7 @@ Namespace API.YouTube End If If list.Count > 0 Then With list(0) - If Settings.UserSiteNameUpdateEveryTime Or UserSiteName.IsEmptyString Then UserSiteName = .UserTitle + If Settings.UpdateUserSiteNameEveryTime Or UserSiteName.IsEmptyString Then UserSiteName = .UserTitle If FriendlyName.IsEmptyString Then FriendlyName = UserSiteName End With _TempMediaList.AddRange(list.Select(Function(c) New UserMedia(c) With {.URL = If(IsSubscription, c.ThumbnailUrlMedia, .URL)})) diff --git a/SCrawler/Download/Automation/AutoDownloader.vb b/SCrawler/Download/Automation/AutoDownloader.vb index 1a2236c..2f5eadb 100644 --- a/SCrawler/Download/Automation/AutoDownloader.vb +++ b/SCrawler/Download/Automation/AutoDownloader.vb @@ -18,8 +18,6 @@ Namespace DownloadObjects Friend Event PauseChanged(ByVal Value As PauseModes) Friend Enum Modes As Integer None = 0 - [Default] = 1 - All = 2 Specified = 3 Groups = 4 End Enum @@ -295,6 +293,9 @@ Namespace DownloadObjects Return $"{Name} ({GetWorkingState()}): last download date: {GetLastDateString()}; next run: {GetNextDateString()}" End If End Function + Friend Overrides Function ToStringViewFilters() As String + Return $"Scheduler plan '{Name}'{IIf(IsManual, " (manual)", String.Empty)}" + End Function #End Region #End Region #Region "Initializer" @@ -314,7 +315,9 @@ Namespace DownloadObjects Friend Sub New(ByVal x As EContainer) Me.New Initialization = True - Mode = x.Value(Name_Mode).FromXML(Of Integer)(Modes.None) + Dim m% = x.Value(Name_Mode).FromXML(Of Integer)(Modes.None) + If m = 1 Or m = 2 Then m = Modes.Specified + Mode = m Import(x) If Name.IsEmptyString Then Name = "Default" Groups.ListAddList(x.Value(Name_Groups).StringToList(Of String)("|"), LAP.NotContainsOnly) @@ -555,38 +558,6 @@ Namespace DownloadObjects End Try End Sub Select Case Mode - Case Modes.All - Dim CheckLabels As Predicate(Of IUserData) = Function(ByVal u As IUserData) As Boolean - If LabelsExcluded.Count = 0 Then - Return True - ElseIf u.Labels.Count = 0 Then - Return True - Else - Return Not u.Labels.ListContains(LabelsExcluded) - End If - End Function - Dim CheckSites As Predicate(Of IUserData) = Function(u) SitesExcluded.Count = 0 OrElse Not SitesExcluded.Contains(u.Site) - Dim ExistsPredicate As Predicate(Of IUserData) - If Subscriptions Then - If SubscriptionsOnly Then - ExistsPredicate = UserExistsSubscriptionsPredicate - Else - ExistsPredicate = UserExistsPredicate - End If - Else - ExistsPredicate = UserExistsNonSubscriptionsPredicate - End If - users.ListAddList(Settings.GetUsers(Function(u) ExistsPredicate(u) And CheckLabels.Invoke(u) And CheckSites.Invoke(u))) - If UsersCount <> 0 And users.Count > 0 Then - users = users.ListTake(If(UsersCount > 0, -1, -2), Math.Abs(UsersCount)) - If UsersCount < 0 Then users = users.ListReverse - End If - Case Modes.Default - Using g As New GroupParameters - g.LabelsExcluded.ListAddList(LabelsExcluded) - g.SitesExcluded.ListAddList(SitesExcluded) - users.ListAddList(DownloadGroup.GetUsers(g)) - End Using Case Modes.Specified : users.ListAddList(DownloadGroup.GetUsers(Me)) Case Modes.Groups If Groups.Count > 0 And Settings.Groups.Count > 0 Then diff --git a/SCrawler/Download/Automation/AutoDownloaderEditorForm.Designer.vb b/SCrawler/Download/Automation/AutoDownloaderEditorForm.Designer.vb index ac1e948..aee5ea9 100644 --- a/SCrawler/Download/Automation/AutoDownloaderEditorForm.Designer.vb +++ b/SCrawler/Download/Automation/AutoDownloaderEditorForm.Designer.vb @@ -25,16 +25,14 @@ Namespace DownloadObjects Me.components = New System.ComponentModel.Container() Dim CONTAINER_MAIN As System.Windows.Forms.ToolStripContainer Dim TP_MODE As System.Windows.Forms.TableLayoutPanel - Dim ActionButton5 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton() + Dim ActionButton1 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(AutoDownloaderEditorForm)) - Dim ActionButton6 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton() + Dim ActionButton2 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton() Dim TP_NOTIFY As System.Windows.Forms.TableLayoutPanel - Dim ActionButton7 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton() - Dim ActionButton8 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton() + Dim ActionButton3 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton() + Dim ActionButton4 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton() Dim TT_MAIN As System.Windows.Forms.ToolTip Me.DEF_GROUP = New SCrawler.DownloadObjects.Groups.GroupDefaults() - Me.OPT_ALL = New System.Windows.Forms.RadioButton() - Me.OPT_DEFAULT = New System.Windows.Forms.RadioButton() Me.OPT_SPEC = New System.Windows.Forms.RadioButton() Me.OPT_DISABLED = New System.Windows.Forms.RadioButton() Me.OPT_GROUP = New System.Windows.Forms.RadioButton() @@ -67,13 +65,13 @@ Namespace DownloadObjects 'CONTAINER_MAIN.ContentPanel ' CONTAINER_MAIN.ContentPanel.Controls.Add(Me.DEF_GROUP) - CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(476, 388) + CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(476, 519) CONTAINER_MAIN.Dock = System.Windows.Forms.DockStyle.Fill CONTAINER_MAIN.LeftToolStripPanelVisible = False CONTAINER_MAIN.Location = New System.Drawing.Point(0, 0) CONTAINER_MAIN.Name = "CONTAINER_MAIN" CONTAINER_MAIN.RightToolStripPanelVisible = False - CONTAINER_MAIN.Size = New System.Drawing.Size(476, 413) + CONTAINER_MAIN.Size = New System.Drawing.Size(476, 519) CONTAINER_MAIN.TabIndex = 0 CONTAINER_MAIN.TopToolStripPanelVisible = False ' @@ -83,23 +81,27 @@ Namespace DownloadObjects Me.DEF_GROUP.ColumnCount = 1 Me.DEF_GROUP.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) Me.DEF_GROUP.Controls.Add(TP_MODE, 0, 0) - Me.DEF_GROUP.Controls.Add(Me.TXT_GROUPS, 0, 8) - Me.DEF_GROUP.Controls.Add(TP_NOTIFY, 0, 9) - Me.DEF_GROUP.Controls.Add(Me.TXT_TIMER, 0, 11) - Me.DEF_GROUP.Controls.Add(Me.NUM_DELAY, 0, 12) - Me.DEF_GROUP.Controls.Add(Me.LBL_LAST_TIME_UP, 0, 13) - Me.DEF_GROUP.Controls.Add(Me.CH_MANUAL, 0, 10) + Me.DEF_GROUP.Controls.Add(Me.TXT_GROUPS, 0, 12) + Me.DEF_GROUP.Controls.Add(TP_NOTIFY, 0, 13) + Me.DEF_GROUP.Controls.Add(Me.TXT_TIMER, 0, 15) + Me.DEF_GROUP.Controls.Add(Me.NUM_DELAY, 0, 16) + Me.DEF_GROUP.Controls.Add(Me.LBL_LAST_TIME_UP, 0, 17) + Me.DEF_GROUP.Controls.Add(Me.CH_MANUAL, 0, 14) Me.DEF_GROUP.Dock = System.Windows.Forms.DockStyle.Fill Me.DEF_GROUP.Location = New System.Drawing.Point(0, 0) Me.DEF_GROUP.Name = "DEF_GROUP" - Me.DEF_GROUP.RowCount = 15 + Me.DEF_GROUP.RowCount = 19 Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) + Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) + Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) + Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) + Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) @@ -108,23 +110,21 @@ Namespace DownloadObjects Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) - Me.DEF_GROUP.Size = New System.Drawing.Size(476, 388) + Me.DEF_GROUP.Size = New System.Drawing.Size(476, 519) Me.DEF_GROUP.TabIndex = 0 ' 'TP_MODE ' TP_MODE.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.[Single] - TP_MODE.ColumnCount = 5 - TP_MODE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0!)) - TP_MODE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0!)) - TP_MODE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0!)) - TP_MODE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0!)) - TP_MODE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0!)) - TP_MODE.Controls.Add(Me.OPT_ALL, 1, 0) - TP_MODE.Controls.Add(Me.OPT_DEFAULT, 2, 0) - TP_MODE.Controls.Add(Me.OPT_SPEC, 3, 0) + TP_MODE.ColumnCount = 3 + TP_MODE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333!)) + TP_MODE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333!)) + TP_MODE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333!)) + TP_MODE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20.0!)) + TP_MODE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20.0!)) + TP_MODE.Controls.Add(Me.OPT_SPEC, 1, 0) TP_MODE.Controls.Add(Me.OPT_DISABLED, 0, 0) - TP_MODE.Controls.Add(Me.OPT_GROUP, 4, 0) + TP_MODE.Controls.Add(Me.OPT_GROUP, 2, 0) TP_MODE.Dock = System.Windows.Forms.DockStyle.Fill TP_MODE.Location = New System.Drawing.Point(1, 1) TP_MODE.Margin = New System.Windows.Forms.Padding(0) @@ -134,39 +134,13 @@ Namespace DownloadObjects TP_MODE.Size = New System.Drawing.Size(474, 25) TP_MODE.TabIndex = 0 ' - 'OPT_ALL - ' - Me.OPT_ALL.AutoSize = True - Me.OPT_ALL.Dock = System.Windows.Forms.DockStyle.Fill - Me.OPT_ALL.Location = New System.Drawing.Point(98, 4) - Me.OPT_ALL.Name = "OPT_ALL" - Me.OPT_ALL.Size = New System.Drawing.Size(87, 17) - Me.OPT_ALL.TabIndex = 1 - Me.OPT_ALL.TabStop = True - Me.OPT_ALL.Text = "ALL" - TT_MAIN.SetToolTip(Me.OPT_ALL, "Download all users") - Me.OPT_ALL.UseVisualStyleBackColor = True - ' - 'OPT_DEFAULT - ' - Me.OPT_DEFAULT.AutoSize = True - Me.OPT_DEFAULT.Dock = System.Windows.Forms.DockStyle.Fill - Me.OPT_DEFAULT.Location = New System.Drawing.Point(192, 4) - Me.OPT_DEFAULT.Name = "OPT_DEFAULT" - Me.OPT_DEFAULT.Size = New System.Drawing.Size(87, 17) - Me.OPT_DEFAULT.TabIndex = 2 - Me.OPT_DEFAULT.TabStop = True - Me.OPT_DEFAULT.Text = "Default" - TT_MAIN.SetToolTip(Me.OPT_DEFAULT, "All users marked ""Ready for download""") - Me.OPT_DEFAULT.UseVisualStyleBackColor = True - ' 'OPT_SPEC ' Me.OPT_SPEC.AutoSize = True Me.OPT_SPEC.Dock = System.Windows.Forms.DockStyle.Fill - Me.OPT_SPEC.Location = New System.Drawing.Point(286, 4) + Me.OPT_SPEC.Location = New System.Drawing.Point(161, 4) Me.OPT_SPEC.Name = "OPT_SPEC" - Me.OPT_SPEC.Size = New System.Drawing.Size(87, 17) + Me.OPT_SPEC.Size = New System.Drawing.Size(150, 17) Me.OPT_SPEC.TabIndex = 3 Me.OPT_SPEC.TabStop = True Me.OPT_SPEC.Text = "Specified" @@ -179,7 +153,7 @@ Namespace DownloadObjects Me.OPT_DISABLED.Dock = System.Windows.Forms.DockStyle.Fill Me.OPT_DISABLED.Location = New System.Drawing.Point(4, 4) Me.OPT_DISABLED.Name = "OPT_DISABLED" - Me.OPT_DISABLED.Size = New System.Drawing.Size(87, 17) + Me.OPT_DISABLED.Size = New System.Drawing.Size(150, 17) Me.OPT_DISABLED.TabIndex = 0 Me.OPT_DISABLED.TabStop = True Me.OPT_DISABLED.Text = "Disabled" @@ -190,9 +164,9 @@ Namespace DownloadObjects ' Me.OPT_GROUP.AutoSize = True Me.OPT_GROUP.Dock = System.Windows.Forms.DockStyle.Fill - Me.OPT_GROUP.Location = New System.Drawing.Point(380, 4) + Me.OPT_GROUP.Location = New System.Drawing.Point(318, 4) Me.OPT_GROUP.Name = "OPT_GROUP" - Me.OPT_GROUP.Size = New System.Drawing.Size(90, 17) + Me.OPT_GROUP.Size = New System.Drawing.Size(152, 17) Me.OPT_GROUP.TabIndex = 4 Me.OPT_GROUP.TabStop = True Me.OPT_GROUP.Text = "Groups" @@ -201,16 +175,16 @@ Namespace DownloadObjects ' 'TXT_GROUPS ' - ActionButton5.BackgroundImage = CType(resources.GetObject("ActionButton5.BackgroundImage"), System.Drawing.Image) - ActionButton5.Name = "Edit" - ActionButton6.BackgroundImage = CType(resources.GetObject("ActionButton6.BackgroundImage"), System.Drawing.Image) - ActionButton6.Name = "Clear" - Me.TXT_GROUPS.Buttons.Add(ActionButton5) - Me.TXT_GROUPS.Buttons.Add(ActionButton6) + ActionButton1.BackgroundImage = CType(resources.GetObject("ActionButton1.BackgroundImage"), System.Drawing.Image) + ActionButton1.Name = "Edit" + ActionButton2.BackgroundImage = CType(resources.GetObject("ActionButton2.BackgroundImage"), System.Drawing.Image) + ActionButton2.Name = "Clear" + Me.TXT_GROUPS.Buttons.Add(ActionButton1) + Me.TXT_GROUPS.Buttons.Add(ActionButton2) Me.TXT_GROUPS.CaptionText = "Groups" Me.TXT_GROUPS.CaptionWidth = 50.0R Me.TXT_GROUPS.Dock = System.Windows.Forms.DockStyle.Fill - Me.TXT_GROUPS.Location = New System.Drawing.Point(4, 224) + Me.TXT_GROUPS.Location = New System.Drawing.Point(4, 331) Me.TXT_GROUPS.Name = "TXT_GROUPS" Me.TXT_GROUPS.Size = New System.Drawing.Size(468, 22) Me.TXT_GROUPS.TabIndex = 1 @@ -228,7 +202,7 @@ Namespace DownloadObjects TP_NOTIFY.Controls.Add(Me.CH_SHOW_PIC_USER, 3, 0) TP_NOTIFY.Controls.Add(Me.CH_NOTIFY_SIMPLE, 1, 0) TP_NOTIFY.Dock = System.Windows.Forms.DockStyle.Fill - TP_NOTIFY.Location = New System.Drawing.Point(1, 250) + TP_NOTIFY.Location = New System.Drawing.Point(1, 357) TP_NOTIFY.Margin = New System.Windows.Forms.Padding(0) TP_NOTIFY.Name = "TP_NOTIFY" TP_NOTIFY.RowCount = 1 @@ -286,24 +260,24 @@ Namespace DownloadObjects ' 'TXT_TIMER ' - ActionButton7.BackgroundImage = CType(resources.GetObject("ActionButton7.BackgroundImage"), System.Drawing.Image) - ActionButton7.Name = "Refresh" - Me.TXT_TIMER.Buttons.Add(ActionButton7) + ActionButton3.BackgroundImage = CType(resources.GetObject("ActionButton3.BackgroundImage"), System.Drawing.Image) + ActionButton3.Name = "Refresh" + Me.TXT_TIMER.Buttons.Add(ActionButton3) Me.TXT_TIMER.CaptionText = "Timer" Me.TXT_TIMER.CaptionToolTipEnabled = True Me.TXT_TIMER.CaptionToolTipText = "Timer (in minutes)" Me.TXT_TIMER.CaptionWidth = 50.0R Me.TXT_TIMER.Dock = System.Windows.Forms.DockStyle.Fill - Me.TXT_TIMER.Location = New System.Drawing.Point(4, 308) + Me.TXT_TIMER.Location = New System.Drawing.Point(4, 415) Me.TXT_TIMER.Name = "TXT_TIMER" Me.TXT_TIMER.Size = New System.Drawing.Size(468, 22) Me.TXT_TIMER.TabIndex = 4 ' 'NUM_DELAY ' - ActionButton8.BackgroundImage = CType(resources.GetObject("ActionButton8.BackgroundImage"), System.Drawing.Image) - ActionButton8.Name = "Refresh" - Me.NUM_DELAY.Buttons.Add(ActionButton8) + ActionButton4.BackgroundImage = CType(resources.GetObject("ActionButton4.BackgroundImage"), System.Drawing.Image) + ActionButton4.Name = "Refresh" + Me.NUM_DELAY.Buttons.Add(ActionButton4) Me.NUM_DELAY.CaptionText = "Delay" Me.NUM_DELAY.CaptionToolTipEnabled = True Me.NUM_DELAY.CaptionToolTipText = "Startup delay" @@ -311,7 +285,7 @@ Namespace DownloadObjects Me.NUM_DELAY.ClearTextByButtonClear = False Me.NUM_DELAY.ControlMode = PersonalUtilities.Forms.Controls.TextBoxExtended.ControlModes.NumericUpDown Me.NUM_DELAY.Dock = System.Windows.Forms.DockStyle.Fill - Me.NUM_DELAY.Location = New System.Drawing.Point(4, 337) + Me.NUM_DELAY.Location = New System.Drawing.Point(4, 444) Me.NUM_DELAY.Name = "NUM_DELAY" Me.NUM_DELAY.NumberMaximum = New Decimal(New Integer() {1440, 0, 0, 0}) Me.NUM_DELAY.NumberUpDownAlign = System.Windows.Forms.LeftRightAlignment.Left @@ -324,7 +298,7 @@ Namespace DownloadObjects Me.LBL_LAST_TIME_UP.AutoSize = True Me.LBL_LAST_TIME_UP.Dock = System.Windows.Forms.DockStyle.Fill Me.LBL_LAST_TIME_UP.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, CType(204, Byte)) - Me.LBL_LAST_TIME_UP.Location = New System.Drawing.Point(4, 363) + Me.LBL_LAST_TIME_UP.Location = New System.Drawing.Point(4, 470) Me.LBL_LAST_TIME_UP.Name = "LBL_LAST_TIME_UP" Me.LBL_LAST_TIME_UP.Size = New System.Drawing.Size(468, 25) Me.LBL_LAST_TIME_UP.TabIndex = 6 @@ -335,7 +309,7 @@ Namespace DownloadObjects ' Me.CH_MANUAL.AutoSize = True Me.CH_MANUAL.Dock = System.Windows.Forms.DockStyle.Fill - Me.CH_MANUAL.Location = New System.Drawing.Point(4, 282) + Me.CH_MANUAL.Location = New System.Drawing.Point(4, 389) Me.CH_MANUAL.Name = "CH_MANUAL" Me.CH_MANUAL.Size = New System.Drawing.Size(468, 19) Me.CH_MANUAL.TabIndex = 3 @@ -348,15 +322,15 @@ Namespace DownloadObjects ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(476, 413) + Me.ClientSize = New System.Drawing.Size(476, 519) Me.Controls.Add(CONTAINER_MAIN) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.Icon = Global.SCrawler.My.Resources.Resources.ArrowDownIcon_Blue_24 Me.KeyPreview = True Me.MaximizeBox = False - Me.MaximumSize = New System.Drawing.Size(492, 452) + Me.MaximumSize = New System.Drawing.Size(492, 558) Me.MinimizeBox = False - Me.MinimumSize = New System.Drawing.Size(492, 452) + Me.MinimumSize = New System.Drawing.Size(492, 558) Me.Name = "AutoDownloaderEditorForm" Me.ShowInTaskbar = False Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide @@ -378,8 +352,6 @@ Namespace DownloadObjects End Sub Private WithEvents DEF_GROUP As DownloadObjects.Groups.GroupDefaults Private WithEvents TXT_GROUPS As PersonalUtilities.Forms.Controls.TextBoxExtended - Private WithEvents OPT_ALL As RadioButton - Private WithEvents OPT_DEFAULT As RadioButton Private WithEvents OPT_SPEC As RadioButton Private WithEvents OPT_DISABLED As RadioButton Private WithEvents CH_NOTIFY As CheckBox diff --git a/SCrawler/Download/Automation/AutoDownloaderEditorForm.resx b/SCrawler/Download/Automation/AutoDownloaderEditorForm.resx index b2ef0b7..bdebe69 100644 --- a/SCrawler/Download/Automation/AutoDownloaderEditorForm.resx +++ b/SCrawler/Download/Automation/AutoDownloaderEditorForm.resx @@ -123,8 +123,14 @@ False + + False + + + 17, 17 + - + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp @@ -182,7 +188,7 @@ AAAASUVORK5CYII= - + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO xAAADsQBlSsOGwAAAIZJREFUOE+1j10KwCAMgz2b755xl/IsvnaL2K20UfbDAmEako+ZROSTafjE12Go @@ -193,53 +199,41 @@ False - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6 - JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsTAAALEwEAmpwYAAACOElE - QVQ4T2P4//8/QczOJyyqHpzfiE0OQwAZC8iqszAzs7CJ69o4BR768V/W2jcGXQ0KB4aFNS3dDQtnrbCb - ePCK48wTN1wXXXzge/jXf/clV55zC4hIIatF0cjIyMikElzc57z0wX+XHd/+2+//99/ywP//xlu//tdb - +eK/4Zp3/1WTOhYzARViNUAluKjTdf37/0ZTTn9TbdhwXblhwwW1/qOP1Ja9+K8w+95/6cm3/6v2Xvkv - qKjniGGAoIqRpW3/4e8S9uGdzFz82gwMDFxAzCxm4ZegtuLDf+VJ1/8rZM25IqLvnM/CximCYYCic1QN - v7x2JIwPwyrJ3XNUylddE9G2TWNmZOBDl4czmJiZMSRBmFdSyYyJgUEQmxwIYxWEYXZBCUls4sgYq6CA - prWNbtG8nXKeaVPR5XiVjSxEzf0yYXy4BBMLO6eQjoOXZvrkbbazrv53Xf/2v4CSbjBMXkhBl1/CMyNZ - qWnvGy5pNQ+YONwAfjXzAOupl/47LLr333L50/96q9/8l23YdES6cO5KuYqVW+R7Tj6SnfP0v4hryjyY - HhQDmFjYeHVKFp7WX/Xuv9Kq9/+Vd/z7r7rv/3+l7f//y676DEwDN/9L+BVvYkKLCTgDhNkkVUyVlr74 - qbbz73/VOTc/qsy89kWx+9h7qbQpJwS1bbOAscGGrB6EUTggLOqf16C55ft/HlnNAFZOXgVWdi4FRgYG - VnR1MIwhwMTCyqEQ37qEmZVDFF0OE/9nAACtFF4Ey6OP+wAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6 - JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsTAAALEwEAmpwYAAACOElE - QVQ4T2P4//8/QczOJyyqHpzfiE0OQwAZC8iqszAzs7CJ69o4BR768V/W2jcGXQ0KB4aFNS3dDQtnrbCb - ePCK48wTN1wXXXzge/jXf/clV55zC4hIIatF0cjIyMikElzc57z0wX+XHd/+2+//99/ywP//xlu//tdb - +eK/4Zp3/1WTOhYzARViNUAluKjTdf37/0ZTTn9TbdhwXblhwwW1/qOP1Ja9+K8w+95/6cm3/6v2Xvkv - qKjniGGAoIqRpW3/4e8S9uGdzFz82gwMDFxAzCxm4ZegtuLDf+VJ1/8rZM25IqLvnM/CximCYYCic1QN - v7x2JIwPwyrJ3XNUylddE9G2TWNmZOBDl4czmJiZMSRBmFdSyYyJgUEQmxwIYxWEYXZBCUls4sgYq6CA - prWNbtG8nXKeaVPR5XiVjSxEzf0yYXy4BBMLO6eQjoOXZvrkbbazrv53Xf/2v4CSbjBMXkhBl1/CMyNZ - qWnvGy5pNQ+YONwAfjXzAOupl/47LLr333L50/96q9/8l23YdES6cO5KuYqVW+R7Tj6SnfP0v4hryjyY - HhQDmFjYeHVKFp7WX/Xuv9Kq9/+Vd/z7r7rv/3+l7f//y676DEwDN/9L+BVvYkKLCTgDhNkkVUyVlr74 - qbbz73/VOTc/qsy89kWx+9h7qbQpJwS1bbOAscGGrB6EUTggLOqf16C55ft/HlnNAFZOXgVWdi4FRgYG - VnR1MIwhwMTCyqEQ37qEmZVDFF0OE/9nAACtFF4Ey6OP+wAAAABJRU5ErkJggg== - - - - False - - - 17, 17 - - - False - - - 17, 17 - Show a simple notification instead of a user notification. This means that if any user data has been downloaded with the plan, a simple notification will be shown with the number of users downloaded. The 'Image' and 'User icon' parameters will be ignored. + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6 + JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsTAAALEwEAmpwYAAACOElE + QVQ4T2P4//8/QczOJyyqHpzfiE0OQwAZC8iqszAzs7CJ69o4BR768V/W2jcGXQ0KB4aFNS3dDQtnrbCb + ePCK48wTN1wXXXzge/jXf/clV55zC4hIIatF0cjIyMikElzc57z0wX+XHd/+2+//99/ywP//xlu//tdb + +eK/4Zp3/1WTOhYzARViNUAluKjTdf37/0ZTTn9TbdhwXblhwwW1/qOP1Ja9+K8w+95/6cm3/6v2Xvkv + qKjniGGAoIqRpW3/4e8S9uGdzFz82gwMDFxAzCxm4ZegtuLDf+VJ1/8rZM25IqLvnM/CximCYYCic1QN + v7x2JIwPwyrJ3XNUylddE9G2TWNmZOBDl4czmJiZMSRBmFdSyYyJgUEQmxwIYxWEYXZBCUls4sgYq6CA + prWNbtG8nXKeaVPR5XiVjSxEzf0yYXy4BBMLO6eQjoOXZvrkbbazrv53Xf/2v4CSbjBMXkhBl1/CMyNZ + qWnvGy5pNQ+YONwAfjXzAOupl/47LLr333L50/96q9/8l23YdES6cO5KuYqVW+R7Tj6SnfP0v4hryjyY + HhQDmFjYeHVKFp7WX/Xuv9Kq9/+Vd/z7r7rv/3+l7f//y676DEwDN/9L+BVvYkKLCTgDhNkkVUyVlr74 + qbbz73/VOTc/qsy89kWx+9h7qbQpJwS1bbOAscGGrB6EUTggLOqf16C55ft/HlnNAFZOXgVWdi4FRgYG + VnR1MIwhwMTCyqEQ37qEmZVDFF0OE/9nAACtFF4Ey6OP+wAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6 + JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsTAAALEwEAmpwYAAACOElE + QVQ4T2P4//8/QczOJyyqHpzfiE0OQwAZC8iqszAzs7CJ69o4BR768V/W2jcGXQ0KB4aFNS3dDQtnrbCb + ePCK48wTN1wXXXzge/jXf/clV55zC4hIIatF0cjIyMikElzc57z0wX+XHd/+2+//99/ywP//xlu//tdb + +eK/4Zp3/1WTOhYzARViNUAluKjTdf37/0ZTTn9TbdhwXblhwwW1/qOP1Ja9+K8w+95/6cm3/6v2Xvkv + qKjniGGAoIqRpW3/4e8S9uGdzFz82gwMDFxAzCxm4ZegtuLDf+VJ1/8rZM25IqLvnM/CximCYYCic1QN + v7x2JIwPwyrJ3XNUylddE9G2TWNmZOBDl4czmJiZMSRBmFdSyYyJgUEQmxwIYxWEYXZBCUls4sgYq6CA + prWNbtG8nXKeaVPR5XiVjSxEzf0yYXy4BBMLO6eQjoOXZvrkbbazrv53Xf/2v4CSbjBMXkhBl1/CMyNZ + qWnvGy5pNQ+YONwAfjXzAOupl/47LLr333L50/96q9/8l23YdES6cO5KuYqVW+R7Tj6SnfP0v4hryjyY + HhQDmFjYeHVKFp7WX/Xuv9Kq9/+Vd/z7r7rv/3+l7f//y676DEwDN/9L+BVvYkKLCTgDhNkkVUyVlr74 + qbbz73/VOTc/qsy89kWx+9h7qbQpJwS1bbOAscGGrB6EUTggLOqf16C55ft/HlnNAFZOXgVWdi4FRgYG + VnR1MIwhwMTCyqEQ37qEmZVDFF0OE/9nAACtFF4Ey6OP+wAAAABJRU5ErkJggg== + + \ No newline at end of file diff --git a/SCrawler/Download/Automation/AutoDownloaderEditorForm.vb b/SCrawler/Download/Automation/AutoDownloaderEditorForm.vb index 9cd5d3a..177e8d9 100644 --- a/SCrawler/Download/Automation/AutoDownloaderEditorForm.vb +++ b/SCrawler/Download/Automation/AutoDownloaderEditorForm.vb @@ -46,11 +46,14 @@ Namespace DownloadObjects With Plan Select Case .Mode Case DModes.None : OPT_DISABLED.Checked = True - Case DModes.All : OPT_ALL.Checked = True - Case DModes.Default : OPT_DEFAULT.Checked = True Case DModes.Specified : OPT_SPEC.Checked = True Case DModes.Groups : OPT_GROUP.Checked = True End Select + + TXT_GROUPS.CaptionWidth = Groups.GroupDefaults.CaptionWidthDefault + TXT_TIMER.CaptionWidth = Groups.GroupDefaults.CaptionWidthDefault + NUM_DELAY.CaptionWidth = Groups.GroupDefaults.CaptionWidthDefault + DEF_GROUP.Set(Plan) If MyGroups.Count > 0 Then TXT_GROUPS.Text = MyGroups.ListToString If Settings.Groups.Count = 0 Then TXT_GROUPS.Clear() : TXT_GROUPS.Enabled = False @@ -83,8 +86,6 @@ Namespace DownloadObjects With Plan Select Case True Case OPT_DISABLED.Checked : .Mode = DModes.None - Case OPT_ALL.Checked : .Mode = DModes.All - Case OPT_DEFAULT.Checked : .Mode = DModes.Default Case OPT_SPEC.Checked : .Mode = DModes.Specified Case OPT_GROUP.Checked : .Mode = DModes.Groups End Select @@ -107,17 +108,17 @@ Namespace DownloadObjects Private Sub TXT_GROUPS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_GROUPS.ActionOnButtonClick Select Case Sender.DefaultButton Case ActionButton.DefaultButtons.Edit - Using f As New LabelsForm(MyGroups, Settings.Groups.Select(Function(g) g.Name)) With {.Text = "Groups", .Icon = My.Resources.GroupByIcon_16} + Using f As New LabelsForm(MyGroups, (From g As Groups.DownloadGroup In Settings.Groups Where Not g.IsViewFilter Select g.Name)) With {.Text = "Groups", .Icon = My.Resources.GroupByIcon_16} f.ShowDialog() If f.DialogResult = DialogResult.OK Then MyGroups.ListAddList(f.LabelsList, LAP.ClearBeforeAdd) : TXT_GROUPS.Text = MyGroups.ListToString End Using Case ActionButton.DefaultButtons.Clear : MyGroups.Clear() End Select End Sub - Private Sub ChangeEnabled() Handles OPT_DISABLED.CheckedChanged, OPT_ALL.CheckedChanged, OPT_DEFAULT.CheckedChanged, + Private Sub ChangeEnabled() Handles OPT_DISABLED.CheckedChanged, OPT_SPEC.CheckedChanged, OPT_GROUP.CheckedChanged, CH_NOTIFY.CheckedChanged, CH_NOTIFY_SIMPLE.CheckedChanged - DEF_GROUP.Enabled(OPT_ALL.Checked Or OPT_DEFAULT.Checked Or OPT_SPEC.Checked, OPT_ALL.Checked) = OPT_SPEC.Checked + DEF_GROUP.Enabled = OPT_SPEC.Checked TXT_GROUPS.Enabled = OPT_GROUP.Checked TXT_TIMER.Enabled = Not OPT_DISABLED.Checked NUM_DELAY.Enabled = Not OPT_DISABLED.Checked diff --git a/SCrawler/Download/DownloadedInfoForm.vb b/SCrawler/Download/DownloadedInfoForm.vb index c0bde9f..a039060 100644 --- a/SCrawler/Download/DownloadedInfoForm.vb +++ b/SCrawler/Download/DownloadedInfoForm.vb @@ -28,7 +28,7 @@ Namespace DownloadObjects End Enum Friend Property ViewMode As ViewModes Get - Return IIf(MENU_VIEW_ALL.Checked, ViewModes.All, ViewModes.Session) + Return IIf(ControlInvokeFast(ToolbarTOP, MENU_VIEW_ALL, Function() MENU_VIEW_ALL.Checked, True, EDP.ReturnValue), ViewModes.All, ViewModes.Session) End Get Set(ByVal SMode As ViewModes) Settings.InfoViewMode.Value = CInt(SMode) @@ -57,7 +57,7 @@ Namespace DownloadObjects InitializeComponent() _UsersListSession = New List(Of IUserData) _UsersListAll = New List(Of IUserData) - If Settings.InfoViewMode.Value = CInt(ViewModes.All) Then + If Settings.InfoViewMode.Value = ViewModes.All Then MENU_VIEW_SESSION.Checked = False MENU_VIEW_ALL.Checked = True Else @@ -66,8 +66,6 @@ Namespace DownloadObjects End If OPT_DEFAULT.Checked = Settings.InfoViewDefault OPT_SUBSCRIPTIONS.Checked = Not Settings.InfoViewDefault - Settings.InfoViewMode.Value = ViewMode - RefillList() End Sub #End Region #Region "Form handlers" @@ -78,11 +76,11 @@ Namespace DownloadObjects MyView.Import() MyView.SetFormSize() End If - BTT_CLEAR.Visible = ViewMode = ViewModes.Session - RefillList() + ControlInvokeFast(ToolbarTOP, BTT_CLEAR, Sub() BTT_CLEAR.Visible = ViewMode = ViewModes.Session, EDP.None) Catch Finally Opened = True + RefillList() End Try End Sub Private Sub DownloadedInfoForm_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing @@ -116,51 +114,50 @@ Namespace DownloadObjects End Function End Class Private Sub RefillList() Handles BTT_REFRESH.Click - Try - Dim lClear As Action = Sub() LIST_DOWN.Items.Clear() - If LIST_DOWN.InvokeRequired Then LIST_DOWN.Invoke(lClear) Else lClear.Invoke - If ViewMode = ViewModes.Session Then - With Downloader.Downloaded - If .Count > 0 Then - With .Select(Function(u) Settings.GetUser(u, False)).Reverse - If _UsersListSession.Count > 0 Then _UsersListSession.ListWithRemove(.Self, New ListAddParams With {.DisableDispose = True}) - If _UsersListSession.Count > 0 Then - _UsersListSession.InsertRange(0, .Self) - Else - _UsersListSession.AddRange(.Self) - End If - End With - End If - End With - Else - _UsersListAll.ListAddList(Settings.GetUsers(Function(u) True), LAP.ClearBeforeAdd) - If _UsersListAll.Count > 0 Then _UsersListAll.Sort(New UsersDateOrder) - End If - Dim isDefault As Boolean = OPT_DEFAULT.Checked - If Current.Count > 0 Then Current.RemoveAll(Function(u) u.IsSubscription = isDefault) - If Current.Count > 0 Then - For Each user As IUserData In Current - If LIST_DOWN.InvokeRequired Then - LIST_DOWN.Invoke(Sub() LIST_DOWN.Items.Add(user.DownloadedInformation)) - Else - LIST_DOWN.Items.Add(user.DownloadedInformation) - End If - Next - If _LatestSelected.ValueBetween(0, LIST_DOWN.Items.Count - 1) Then - Dim aSel As Action = Sub() LIST_DOWN.SelectedIndex = _LatestSelected - If LIST_DOWN.InvokeRequired Then LIST_DOWN.Invoke(aSel) Else aSel.Invoke + If Opened Then + Try + ControlInvokeFast(LIST_DOWN, Sub() LIST_DOWN.Items.Clear()) + If ViewMode = ViewModes.Session Then + With Downloader.Downloaded + If .Count > 0 Then + With .Select(Function(u) Settings.GetUser(u, False)).Reverse + If _UsersListSession.Count > 0 Then _UsersListSession.ListWithRemove(.Self, New ListAddParams With {.DisableDispose = True}) + If _UsersListSession.Count > 0 Then + _UsersListSession.InsertRange(0, .Self) + Else + _UsersListSession.AddRange(.Self) + End If + End With + End If + End With + Else + _UsersListAll.ListAddList(Settings.GetUsers(Function(u) True), LAP.ClearBeforeAdd) + If _UsersListAll.Count > 0 Then _UsersListAll.Sort(New UsersDateOrder) + End If + Dim isDefault As Boolean = OPT_DEFAULT.Checked + If Current.Count > 0 Then Current.RemoveAll(Function(u) u Is Nothing OrElse u.IsSubscription = isDefault) + If Current.Count > 0 Then + ControlInvokeFast(LIST_DOWN, + Sub() + For Each user As IUserData In Current + LIST_DOWN.Items.Add(user.DownloadedInformation) + Next + If _LatestSelected.ValueBetween(0, LIST_DOWN.Items.Count - 1) Then + LIST_DOWN.SelectedIndex = _LatestSelected + Else + _LatestSelected = -1 + End If + End Sub) Else _LatestSelected = -1 End If - Else - _LatestSelected = -1 - End If - Catch ies As InvalidOperationException - Catch ex As Exception - ErrorsDescriber.Execute(EDP.SendToLog, ex, "[DownloadedInfoForm.RefillList]") - Finally - UpdateNavigationButtons(Nothing) - End Try + Catch ies As InvalidOperationException + Catch ex As Exception + ErrorsDescriber.Execute(EDP.SendToLog, ex, "[DownloadedInfoForm.RefillList]") + Finally + UpdateNavigationButtons(Nothing) + End Try + End If End Sub #End Region #Region "Toolbar controls" @@ -251,7 +248,7 @@ Namespace DownloadObjects #End Region #Region "Downloader handlers" Friend Sub Downloader_DownloadCountChange() - If ViewMode = ViewModes.Session Then RefillList() + If Opened AndAlso ViewMode = ViewModes.Session Then RefillList() End Sub #End Region End Class diff --git a/SCrawler/Download/Feed/DownloadFeedForm.vb b/SCrawler/Download/Feed/DownloadFeedForm.vb index cb9632d..1c2e33b 100644 --- a/SCrawler/Download/Feed/DownloadFeedForm.vb +++ b/SCrawler/Download/Feed/DownloadFeedForm.vb @@ -1449,6 +1449,9 @@ Namespace DownloadObjects If Not b Then ScrollSuspended = False End Sub) End Sub + Private Sub DownloadFeedForm_Deactivate(sender As Object, e As EventArgs) Handles Me.Deactivate + If Not LatestScrollValueDisabled Then LatestScrollValue = ControlInvokeFast(TP_DATA, Function() TP_DATA.VerticalScroll.Value, 0, EDP.ReturnValue) + End Sub Private Sub TP_DATA_Paint(sender As Object, e As PaintEventArgs) Handles TP_DATA.Paint If Not MyDefs.Initializing And Not ScrollSuspended And FeedEndless Then If Not LatestScrollValueDisabled Then LatestScrollValue = ControlInvokeFast(TP_DATA, Function() TP_DATA.VerticalScroll.Value, 0) diff --git a/SCrawler/Download/Groups/DownloadGroup.vb b/SCrawler/Download/Groups/DownloadGroup.vb index 0042e66..a3d711c 100644 --- a/SCrawler/Download/Groups/DownloadGroup.vb +++ b/SCrawler/Download/Groups/DownloadGroup.vb @@ -10,22 +10,44 @@ Imports SCrawler.API.Base Imports PersonalUtilities.Functions.XML Imports PersonalUtilities.Functions.XML.Base Namespace DownloadObjects.Groups - Friend Class DownloadGroup : Inherits GroupParameters : Implements IIndexable, IEContainerProvider + Friend Class DownloadGroup : Inherits GroupParameters : Implements IIndexable, IEContainerProvider, IComparable(Of DownloadGroup) #Region "Events" Friend Delegate Sub GroupEventHandler(ByVal Sender As DownloadGroup) Friend Event Deleted As GroupEventHandler Friend Event Updated As GroupEventHandler #End Region +#Region "XML names" + Private Const Name_FilterViewMode As String = "FilterViewMode" + Private Const Name_FilterGroupUsers As String = "FilterGroupUsers" + Private Const Name_FilterShowGroupsInsteadLabels As String = "FilterShowGroupsInsteadLabels" +#End Region #Region "Declarations" #Region "Controls" Private WithEvents BTT_EDIT As ToolStripMenuItem Private WithEvents BTT_DELETE As ToolStripMenuItem - Private WithEvents BTT_DOWNLOAD As ToolStripMenuItem - Private WithEvents BTT_DOWNLOAD_FULL As ToolStripMenuItem + Private WithEvents BTT_DOWNLOAD As ToolStripKeyMenuItem + Private WithEvents BTT_CLONE_ADD As ToolStripMenuItem + Private WithEvents BTT_CLONE_TEMP As ToolStripKeyMenuItem Private ReadOnly SEP_1 As ToolStripSeparator - Private WithEvents BTT_MENU As ToolStripMenuItem + Private ReadOnly SEP_2 As ToolStripSeparator + Private WithEvents BTT_MENU As ToolStripKeyMenuItem +#End Region +#Region "Filter declarations" + Friend Property FilterViewMode As ViewModes = ViewModes.IconLarge + Friend Property FilterGroupUsers As Boolean = True + Friend Property FilterShowGroupsInsteadLabels As Boolean = True #End Region Private File As SFile = Nothing + Friend Overrides Property Name As String + Get + Return MyBase.Name + End Get + Set(ByVal NewName As String) + Dim b As Boolean = Not MyBase.Name.IsEmptyString AndAlso Not MyBase.Name = NewName + MyBase.Name = NewName + If b Then RaiseEvent Updated(Me) + End Set + End Property Friend Property NameBefore As String = String.Empty Private _Key As String = String.Empty Friend ReadOnly Property Key As String @@ -49,55 +71,114 @@ Namespace DownloadObjects.Groups DirectCast(Obj, DownloadGroup).Index = _Index Return Obj End Function + Friend Shared ReadOnly Property GroupImage As Bitmap + Get + Return My.Resources.GroupByIcon_16.ToBitmap + End Get + End Property #End Region #Region "Initializers" Friend ReadOnly NeedToSave As Boolean = False Friend Sub New() - BTT_MENU = New ToolStripMenuItem With { + Me.New(True) + End Sub + Friend Sub New(ByVal InitButtons As Boolean) + If InitButtons Then + BTT_MENU = New ToolStripKeyMenuItem With { .ToolTipText = "Download users of this group", .AutoToolTip = True, - .Image = My.Resources.GroupByIcon_16.ToBitmap + .Image = GroupImage } - BTT_DELETE = New ToolStripMenuItem With { - .Image = PersonalUtilities.My.Resources.DeletePic_Red_24, - .BackColor = MyColor.DeleteBack, - .ForeColor = MyColor.DeleteFore, - .Text = "Delete", - .ToolTipText = String.Empty, - .AutoToolTip = False - } - BTT_EDIT = New ToolStripMenuItem With { - .Image = PersonalUtilities.My.Resources.PencilPic_16, - .BackColor = MyColor.EditBack, - .ForeColor = MyColor.EditFore, - .Text = "Edit", - .ToolTipText = String.Empty, - .AutoToolTip = False - } - SEP_1 = New ToolStripSeparator - BTT_DOWNLOAD = New ToolStripMenuItem With { - .Image = My.Resources.StartPic_Green_16, - .Text = "Download", - .ToolTipText = "Download users of this group (respect the 'Ready for download' parameter)", - .AutoToolTip = True - } - BTT_DOWNLOAD_FULL = New ToolStripMenuItem With { - .Image = My.Resources.StartPic_Green_16, - .Text = "Download FULL", - .ToolTipText = "Download users of this group (ignore the 'Ready for download' parameter)", - .AutoToolTip = True - } - BTT_MENU.DropDownItems.AddRange({BTT_EDIT, BTT_DELETE, SEP_1, BTT_DOWNLOAD, BTT_DOWNLOAD_FULL}) + BTT_DELETE = New ToolStripMenuItem With { + .Image = PersonalUtilities.My.Resources.DeletePic_Red_24, + .BackColor = MyColor.DeleteBack, + .ForeColor = MyColor.DeleteFore, + .Text = "Delete", + .ToolTipText = String.Empty, + .AutoToolTip = False + } + BTT_EDIT = New ToolStripMenuItem With { + .Image = PersonalUtilities.My.Resources.PencilPic_16, + .BackColor = MyColor.EditBack, + .ForeColor = MyColor.EditFore, + .Text = "Edit", + .ToolTipText = String.Empty, + .AutoToolTip = False + } + BTT_CLONE_ADD = New ToolStripMenuItem With { + .Image = PersonalUtilities.My.Resources.PlusPic_Green_24, + .BackColor = MyColor.OkBack, + .ForeColor = MyColor.OkFore, + .Text = "Clone and add", + .ToolTipText = "Clone the group, change parameters and add this group as a new one", + .AutoToolTip = True + } + BTT_CLONE_TEMP = New ToolStripKeyMenuItem With { + .Image = PersonalUtilities.My.Resources.PlusPic_Green_24, + .BackColor = MyColor.OkBack, + .ForeColor = MyColor.OkFore, + .Text = "Clone and download", + .ToolTipText = "Clone the group, change parameters and download filtered users (this group will not be added as a new one)", + .AutoToolTip = True + } + SEP_1 = New ToolStripSeparator + SEP_2 = New ToolStripSeparator + BTT_DOWNLOAD = New ToolStripKeyMenuItem With { + .Image = My.Resources.StartPic_Green_16, + .Text = "Download", + .ToolTipText = "Download users of this group (respect the 'Ready for download' parameter)", + .AutoToolTip = True + } + BTT_MENU.DropDownItems.AddRange({BTT_EDIT, BTT_DELETE, SEP_1, BTT_CLONE_ADD, BTT_CLONE_TEMP, SEP_2, BTT_DOWNLOAD}) + End If End Sub Friend Sub New(ByVal e As EContainer) - Me.New + Me.New(Not e.Value(Name_IsViewFilter).FromXML(Of Boolean)(False)) Import(e) End Sub #End Region +#Region "Import/Export" + Protected Overrides Sub Import(ByVal e As EContainer) + MyBase.Import(e) + If IsViewFilter Then + FilterViewMode = e.Value(Name_FilterViewMode).FromXML(Of Integer)(ViewModes.IconLarge) + FilterGroupUsers = e.Value(Name_FilterGroupUsers).FromXML(Of Boolean)(True) + FilterShowGroupsInsteadLabels = e.Value(Name_FilterShowGroupsInsteadLabels).FromXML(Of Boolean)(True) + End If + End Sub + Protected Overrides Function Export(ByVal e As EContainer) As EContainer + MyBase.Export(e) + e.AddRange({New EContainer(Name_FilterViewMode, CInt(FilterViewMode)), + New EContainer(Name_FilterGroupUsers, FilterGroupUsers.BoolToInteger), + New EContainer(Name_FilterShowGroupsInsteadLabels, FilterShowGroupsInsteadLabels.BoolToInteger)}) + Return e + End Function +#End Region +#Region "Copy" + Friend Overloads Overrides Function Copy() As Object + Return (New DownloadGroup).Copy(Me) + End Function + Friend Overloads Overrides Function Copy(ByVal Source As Object) As Object + MyBase.Copy(Source) + If TypeOf Source Is DownloadGroup Then + With DirectCast(Source, DownloadGroup) + If .IsViewFilter Then + FilterViewMode = .FilterViewMode + FilterGroupUsers = .FilterGroupUsers + FilterShowGroupsInsteadLabels = .FilterShowGroupsInsteadLabels + End If + End With + End If + Return Me + End Function +#End Region #Region "ToString" Public Overrides Function ToString() As String Return $"{IIf(Index.ValueBetween(0, 8), $"#{Index + 1}: ", String.Empty)}{Name}" End Function + Friend Overrides Function ToStringViewFilters() As String + Return $"{IIf(IsViewFilter, "View filter", "Group")} '{Name}'" + End Function #End Region #Region "GetControl" Private _ControlSent As Boolean = False @@ -111,9 +192,39 @@ Namespace DownloadObjects.Groups End Function #End Region #Region "Buttons" - Private Sub BTT_MENU_Click(sender As Object, e As EventArgs) Handles BTT_MENU.Click - DownloadUsers() + Private Sub BTT_MENU_Click(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_MENU.KeyClick + Try + With BTT_MENU + .HideDropDown() + Dim obj As Object = .Owner + Dim r% = 0 + Do While Not obj Is Nothing And r < 5 : obj = TryHide(obj) : r += 1 : Loop + End With + Catch + End Try + ProcessDownloadUsers(e.IncludeInTheFeed) End Sub + Private Function TryHide(ByVal Sender As Object) As Object + Dim retObj As Object = Nothing + Try + If Not Sender Is Nothing Then + If TypeOf Sender Is ToolStripDropDownMenu Then + With DirectCast(Sender, ToolStripDropDownMenu) + retObj = .OwnerItem + .Hide() + End With + ElseIf TypeOf Sender Is ToolStripMenuItem Then + With DirectCast(Sender, ToolStripMenuItem) + retObj = .Owner + .HideDropDown() + End With + End If + End If + Catch + End Try + If Not retObj Is Nothing AndAlso Not (TypeOf retObj Is ToolStripMenuItem Or TypeOf retObj Is ToolStripDropDownMenu) Then retObj = Nothing + Return retObj + End Function Private Sub BTT_EDIT_Click(sender As Object, e As EventArgs) Handles BTT_EDIT.Click Using f As New GroupEditorForm(Me) f.ShowDialog() @@ -121,67 +232,98 @@ Namespace DownloadObjects.Groups End Using End Sub Private Sub BTT_DELETE_Click(sender As Object, e As EventArgs) Handles BTT_DELETE.Click - If MsgBoxE({$"Are you sure you want to delete the [{Name}] group?", "Deleting a group"}, vbExclamation + vbYesNo) = vbYes Then + Delete() + End Sub + Friend Function Delete(Optional ByVal Silent As Boolean = False) As Boolean + Dim msgTitle$ = $"Deleting a {IIf(IsViewFilter, "filter", "group")}" + If Silent OrElse MsgBoxE({$"Are you sure you want to delete the '{Name}' {IIf(IsViewFilter, "filter", "group")}?", msgTitle}, vbExclamation + vbYesNo) = vbYes Then + If Not Settings.Automation Is Nothing AndAlso Settings.Automation.Count > 0 Then + Dim aIncl As New List(Of String) + For Each plan As AutoDownloader In Settings.Automation + If plan.Mode = AutoDownloader.Modes.Groups AndAlso plan.Groups.Count > 0 AndAlso plan.Groups.Contains(Name) Then aIncl.Add(plan.Name) + Next + If aIncl.Count > 0 Then + MsgBoxE({$"The '{Name}' group cannot be deleted because it is included in the following scheduler plans:{vbCr}{vbCr}" & + aIncl.ListToString(vbCr), msgTitle}, vbCritical) + aIncl.Clear() + Return False + End If + End If RaiseEvent Deleted(Me) - MsgBoxE({$"Group [{Name}] deleted", "Deleting a group"}) + If Not Silent Then MsgBoxE({$"{IIf(IsViewFilter, "Filter", "Group")} '{Name}' deleted", msgTitle}) + Return True End If + Return False + End Function + Private Sub BTT_CLONE_ADD_Click(sender As Object, e As EventArgs) Handles BTT_CLONE_ADD.Click + Settings.Groups.CloneAndAdd(Me) End Sub - Private Sub BTT_DOWNLOAD_Click(sender As Object, e As EventArgs) Handles BTT_DOWNLOAD.Click - DownloadUsers() + Private Sub BTT_CLONE_TEMP_Click(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_CLONE_TEMP.KeyClick + Using f As New GroupEditorForm(New DownloadGroup(False).Copy(Me)) With {.IsTemporaryGroup = True} + f.ShowDialog() + If f.DialogResult = DialogResult.OK AndAlso Not f.MyGroup Is Nothing Then + f.MyGroup.Name = String.Empty + f.MyGroup.ProcessDownloadUsers(e.IncludeInTheFeed) + End If + If Not f.MyGroup Is Nothing Then f.MyGroup.Dispose() + End Using End Sub - Private Sub BTT_DOWNLOAD_FULL_Click(sender As Object, e As EventArgs) Handles BTT_DOWNLOAD_FULL.Click - DownloadUsers(, False) + Private Sub BTT_DOWNLOAD_Click(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWNLOAD.KeyClick + ProcessDownloadUsers(e.IncludeInTheFeed) End Sub #End Region #Region "Get users" Friend Overloads Function GetUsers() As IEnumerable(Of IUserData) Return GetUsers(Me) End Function - Friend Overloads Shared Function GetUsers(ByVal Instance As IGroup, Optional ByVal UseReadyOption As Boolean = True, - Optional ByVal IncludeNonExistentUsers As Boolean = False, - Optional ByVal OnlyNonExistentUsers As Boolean = False) As IEnumerable(Of IUserData) + Friend Overloads Shared Function GetUsers(ByVal Instance As IGroup) As IEnumerable(Of IUserData) Try If Settings.Users.Count > 0 Then With Instance + Dim downDate As Date? = Nothing + If .DaysNumber > 0 Then + With Now.AddDays(- .DaysNumber) : downDate = New Date(.Year, .Month, .Day, 0, 0, 0) : End With + End If Dim CheckUserExists As Predicate(Of IUserData) = Function(ByVal user As IUserData) As Boolean - If user.Exists Then - If IncludeNonExistentUsers And OnlyNonExistentUsers Then - Return False - Else - Return True - End If - ElseIf IncludeNonExistentUsers Then - Return True + If Not user.Exists Then + Return .UserDeleted + ElseIf user.Suspended Then + Return .UserSuspended Else - Return False + Return .UserExists End If End Function - Dim CheckParams As Predicate(Of IUserData) = Function(user) _ - (.Temporary = CheckState.Indeterminate Or user.Temporary = CBool(.Temporary)) And - (.Favorite = CheckState.Indeterminate Or (user.Favorite = CBool(.Favorite))) And - (Not UseReadyOption Or .ReadyForDownloadIgnore Or user.ReadyForDownload = .ReadyForDownload) And CheckUserExists.Invoke(user) - Dim CheckSubscription As Predicate(Of IUserData) = Function(ByVal user As IUserData) As Boolean - If .Subscriptions Then - If .SubscriptionsOnly Then - Return user.IsSubscription = True - Else - Return True - End If + Dim CheckUserCategory As Predicate(Of IUserData) = Function(ByVal user As IUserData) As Boolean + If user.Favorite Then + Return .Favorite + ElseIf user.Temporary Then + Return .Temporary Else - Return user.IsSubscription = False + Return .Regular End If End Function + Dim CheckParams As Predicate(Of IUserData) = Function(user) _ + CheckUserCategory.Invoke(user) And + (.ReadyForDownloadIgnore Or user.ReadyForDownload = .ReadyForDownload) And CheckUserExists.Invoke(user) + Dim CheckSubscription As Predicate(Of IUserData) = Function(user) (.DownloadSubscriptions And user.IsSubscription) Or + (.DownloadUsers And Not user.IsSubscription) Dim CheckLabelsExcluded As Predicate(Of IUserData) = Function(ByVal user As IUserData) As Boolean - If .LabelsExcluded.Count = 0 Then - Return True - ElseIf user.Labels.Count = 0 Then - Return True + If Not .LabelsExcludedIgnore Then + If .LabelsExcluded.Count = 0 Then + Return True + ElseIf user.Labels.Count = 0 Then + Return True + Else + Return Not user.Labels.ListContains(.LabelsExcluded) + End If Else - Return Not user.Labels.ListContains(.LabelsExcluded) + Return True End If End Function Dim CheckLabels As Predicate(Of IUserData) = Function(ByVal user As IUserData) As Boolean - If .Labels.Count = 0 Then + If .LabelsNo Then + Return user.Labels.Count = 0 + ElseIf .Labels.Count = 0 Then Return CheckLabelsExcluded.Invoke(user) ElseIf user.Labels.Count = 0 Then Return False @@ -189,19 +331,42 @@ Namespace DownloadObjects.Groups Return user.Labels.ListContains(.Labels) And CheckLabelsExcluded.Invoke(user) End If End Function + Dim CheckDays As Predicate(Of IUserData) = Function(ByVal user As IUserData) As Boolean + If downDate.HasValue Then + Dim ld As Date? = DirectCast(user, UserDataBase).LastUpdated + If .DaysIsDownloaded Then + Return ld.HasValue AndAlso ld.Value >= downDate.Value + Else + Return Not ld.HasValue OrElse ld.Value < downDate.Value + End If + Else + Return True + End If + End Function + Dim CheckDateRange As Predicate(Of IUserData) = + Function(ByVal user As IUserData) As Boolean + If Not .DateMode = ShowingDates.Off Then + Dim ld As Date? = DirectCast(user, UserDataBase).LastUpdated + If ld.HasValue Then + Dim df As Date = If(.DateFrom, Date.MinValue.Date) + Dim dt As Date = If(.DateTo, Date.MaxValue.Date) + Return ld.Value.ValueBetween(df, dt) = (.DateMode = ShowingDates.In) + End If + End If + Return True + End Function Dim CheckSites As Predicate(Of IUserData) = Function(user) _ (.Sites.Count = 0 OrElse .Sites.Contains(user.Site)) AndAlso (.SitesExcluded.Count = 0 OrElse Not .SitesExcluded.Contains(user.Site)) Dim users As IEnumerable(Of IUserData) = Settings.GetUsers(Function(user) CheckLabels.Invoke(user) AndAlso CheckSites.Invoke(user) AndAlso - CheckParams.Invoke(user) AndAlso CheckSubscription.Invoke(user)) - If .UsersCount = 0 Or Not users.ListExists Then - Return users - Else + CheckParams.Invoke(user) AndAlso CheckSubscription.Invoke(user) AndAlso + CheckDays.Invoke(user) AndAlso CheckDateRange.Invoke(user)) + If .UsersCount <> 0 And users.ListExists Then users = users.ListTake(If(.UsersCount > 0, -1, -2), Math.Abs(.UsersCount)) If .UsersCount < 0 Then users = users.ListReverse - Return users End If + Return users End With Else Return Nothing @@ -212,16 +377,14 @@ Namespace DownloadObjects.Groups End Function #End Region #Region "Download users" - Friend Sub DownloadUsers(Optional ByVal IncludeInTheFeed As Boolean = True, Optional ByVal UseReadyOption As Boolean = True, - Optional ByVal IncludeNonExistentUsers As Boolean = False, - Optional ByVal OnlyNonExistentUsers As Boolean = False) + Friend Sub ProcessDownloadUsers(Optional ByVal IncludeInTheFeed As Boolean = True, Optional ByVal ShowNoUsersMessage As Boolean = True) Try If Settings.Users.Count > 0 Then - Dim u As IEnumerable(Of IUserData) = GetUsers(Me, UseReadyOption, IncludeNonExistentUsers, OnlyNonExistentUsers) + Dim u As IEnumerable(Of IUserData) = GetUsers(Me) If u.ListExists Then Downloader.AddRange(u, IncludeInTheFeed) - Else - MsgBoxE({$"No users found for group [{Name}].", "No users found"}, vbExclamation) + ElseIf ShowNoUsersMessage Then + MsgBoxE({$"No users found{If(Not Name.IsEmptyString, $" in group '{Name}'", String.Empty)}!", "No users found"}, vbExclamation) End If End If Catch ex As Exception @@ -249,15 +412,37 @@ Namespace DownloadObjects.Groups Return Export(New EContainer("Group")) End Function #End Region +#Region "IComparable Support" + Private Function CompareTo(ByVal Other As DownloadGroup) As Integer Implements IComparable(Of DownloadGroup).CompareTo + If IsViewFilter Then + Return IIf(Other.IsViewFilter, Name.CompareTo(Other.Name), 1) + ElseIf Other.IsViewFilter Then + Return -1 + Else + Return Index.CompareTo(Other.Index) + End If + End Function +#End Region #Region "IDisposable Support" Protected Overrides Sub Dispose(ByVal disposing As Boolean) - If Not disposedValue And disposing Then - BTT_DELETE.Dispose() - BTT_EDIT.Dispose() - BTT_MENU.Dispose() - SEP_1.Dispose() - BTT_DOWNLOAD.Dispose() - BTT_DOWNLOAD_FULL.Dispose() + If Not disposedValue Then + If disposing Then + BTT_EDIT.DisposeIfReady + BTT_DELETE.DisposeIfReady + BTT_DOWNLOAD.DisposeIfReady + BTT_CLONE_ADD.DisposeIfReady + BTT_CLONE_TEMP.DisposeIfReady + SEP_1.DisposeIfReady + SEP_2.DisposeIfReady + If Not BTT_MENU Is Nothing Then BTT_MENU.DropDownItems.Clear() + BTT_MENU.DisposeIfReady + End If + BTT_EDIT = Nothing + BTT_DELETE = Nothing + BTT_DOWNLOAD = Nothing + BTT_CLONE_ADD = Nothing + BTT_CLONE_TEMP = Nothing + BTT_MENU = Nothing End If MyBase.Dispose(disposing) End Sub diff --git a/SCrawler/Download/Groups/DownloadGroupCollection.vb b/SCrawler/Download/Groups/DownloadGroupCollection.vb index 02a31b0..7f52135 100644 --- a/SCrawler/Download/Groups/DownloadGroupCollection.vb +++ b/SCrawler/Download/Groups/DownloadGroupCollection.vb @@ -10,11 +10,16 @@ Imports PersonalUtilities.Tools Imports PersonalUtilities.Functions.XML Namespace DownloadObjects.Groups Friend Class DownloadGroupCollection : Implements IEnumerable(Of DownloadGroup), IMyEnumerator(Of DownloadGroup) +#Region "Events" Friend Event Deleted As DownloadGroup.GroupEventHandler Friend Event Added As DownloadGroup.GroupEventHandler Friend Event Updated As DownloadGroup.GroupEventHandler +#End Region +#Region "Declarations" Private ReadOnly GroupsList As List(Of DownloadGroup) Private ReadOnly GroupFile As SFile = "Settings\Groups.xml" +#End Region +#Region "Initializer" Friend Sub New() GroupsList = New List(Of DownloadGroup) If GroupFile.Exists Then @@ -34,6 +39,8 @@ Namespace DownloadObjects.Groups End If GroupsList.ListReindex End Sub +#End Region +#Region "Base properties" Default Friend ReadOnly Property Item(ByVal Index As Integer) As DownloadGroup Implements IMyEnumerator(Of DownloadGroup).MyEnumeratorObject Get Return GroupsList(Index) @@ -44,19 +51,43 @@ Namespace DownloadObjects.Groups Return GroupsList.Count End Get End Property +#End Region +#Region "Update, BeginUpdate, EndUpdate" Friend Sub Update() - If Count > 0 Then - Using x As New XmlFile With {.Name = "Groups", .AllowSameNames = True} : x.AddRange(GroupsList) : x.Save(GroupFile) : End Using - Else - GroupFile.Delete() + If Not _UpdateMode Then + If Count > 0 Then + Using x As New XmlFile With {.Name = "Groups", .AllowSameNames = True} : x.AddRange(GroupsList) : x.Save(GroupFile) : End Using + Else + GroupFile.Delete() + End If End If End Sub + Private _UpdateMode As Boolean = False + Friend Sub BeginUpdate() + _UpdateMode = True + End Sub + Friend Sub EndUpdate() + _UpdateMode = False + End Sub +#End Region +#Region "Sort, Reindex" + Friend Sub Sort() + GroupsList.Sort() + End Sub + Friend Sub Reindex() + GroupsList.ListReindex + End Sub +#End Region +#Region "Group handlers" Private _GroupAddInProgress As Boolean = False Private Sub OnGroupUpdated(ByVal Sender As DownloadGroup) - If Not _GroupAddInProgress Then Update() : RaiseEvent Updated(Sender) + If Not _GroupAddInProgress Then + Update() + If Not Sender.IsViewFilter Then RaiseEvent Updated(Sender) + End If End Sub Private Sub OnGroupDeleted(ByVal Sender As DownloadGroup) - RaiseEvent Deleted(Sender) + If Not Sender.IsViewFilter Then RaiseEvent Deleted(Sender) Dim i% = GroupsList.FindIndex(Function(g) g.Key = Sender.Key) If i >= 0 Then GroupsList(i).Dispose() @@ -65,38 +96,77 @@ Namespace DownloadObjects.Groups Update() End If End Sub - Friend Sub Add() - Using f As New GroupEditorForm(Nothing) +#End Region +#Region "Add" + Friend Sub CloneAndAdd(ByVal Group As DownloadGroup) + Using f As New GroupEditorForm(Group.Copy) With {.IsClone = True} f.ShowDialog() - If f.DialogResult = DialogResult.OK Then - _GroupAddInProgress = True - GroupsList.Add(f.MyGroup) - With GroupsList.Last - AddHandler .Deleted, AddressOf OnGroupDeleted - AddHandler .Updated, AddressOf OnGroupUpdated - End With - GroupsList.ListReindex - RaiseEvent Added(GroupsList.Last) - Update() - _GroupAddInProgress = False - End If + If f.DialogResult = DialogResult.OK Then Add(f.MyGroup) End Using End Sub - Friend Function DownloadGroupIfExists(ByVal Index As Integer) As Boolean - If Index.ValueBetween(0, Count - 1) Then Item(Index).DownloadUsers() : Return True Else Return False + Friend Overloads Function Add() As Integer + Using f As New GroupEditorForm(Nothing) + f.ShowDialog() + If f.DialogResult = DialogResult.OK Then Add(f.MyGroup) : Return IndexOf(f.MyGroup.Name) + End Using + Return -1 End Function - Friend Function IndexOf(ByVal Name As String) As Integer + Friend Overloads Sub Add(ByVal Item As DownloadGroup, Optional ByVal IsFilter As Boolean = False, Optional ByVal ReplaceExisting As Boolean = False) + Dim i% = IndexOf(Item.Name, IsFilter) + Dim exists As Boolean = i >= 0 + _GroupAddInProgress = True + + If exists Then + If ReplaceExisting Then + GroupsList(i).Dispose() + GroupsList(i) = Item + Else + i = -1 + End If + Else + GroupsList.Add(Item) + i = Count - 1 + End If + + If i >= 0 Then + With GroupsList(i) + AddHandler .Deleted, AddressOf OnGroupDeleted + AddHandler .Updated, AddressOf OnGroupUpdated + If Not exists Then + GroupsList.ListReindex + GroupsList.Sort() + GroupsList.ListReindex + If Not Item.IsViewFilter And Not _UpdateMode Then RaiseEvent Added(.Self) + Else + If Not Item.IsViewFilter And Not _UpdateMode Then RaiseEvent Updated(.Self) + End If + End With + Update() + End If + _GroupAddInProgress = False + End Sub +#End Region +#Region "DownloadGroupIfExists" + Friend Function DownloadGroupIfExists(ByVal Index As Integer) As Boolean + If Index.ValueBetween(0, Count - 1) Then Item(Index).ProcessDownloadUsers() : Return True Else Return False + End Function +#End Region +#Region "IndexOf" + Friend Function IndexOf(ByVal Name As String, Optional ByVal IsFilter As Boolean = False) As Integer If Count > 0 Then - Return GroupsList.FindIndex(Function(g) g.Name = Name) + Return GroupsList.FindIndex(Function(g) g.Name = Name And g.IsViewFilter = IsFilter) Else Return -1 End If End Function +#End Region +#Region "IEnumerable Support" Private Function GetEnumerator() As IEnumerator(Of DownloadGroup) Implements IEnumerable(Of DownloadGroup).GetEnumerator Return New MyEnumerator(Of DownloadGroup)(Me) End Function Private Function IEnumerable_GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator Return GetEnumerator() End Function +#End Region End Class End Namespace \ No newline at end of file diff --git a/SCrawler/Download/Groups/GroupDefaults.vb b/SCrawler/Download/Groups/GroupDefaults.vb index 75a3c79..9936d35 100644 --- a/SCrawler/Download/Groups/GroupDefaults.vb +++ b/SCrawler/Download/Groups/GroupDefaults.vb @@ -6,33 +6,64 @@ ' ' This program is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY +Imports PersonalUtilities.Forms Imports PersonalUtilities.Forms.Controls Imports PersonalUtilities.Forms.Controls.Base Imports ADB = PersonalUtilities.Forms.Controls.Base.ActionButton.DefaultButtons Namespace DownloadObjects.Groups Public Class GroupDefaults : Inherits TableLayoutPanel - Private ReadOnly TP_1 As TableLayoutPanel - Private ReadOnly TP_2 As TableLayoutPanel - Private ReadOnly TP_3 As TableLayoutPanel +#Region "Constants" + Friend Const CaptionWidthDefault As Integer = 55 +#End Region +#Region "Declarations" + Private ReadOnly TP_1 As TableLayoutPanel 'CH_REGULAR, CH_TEMPORARY, CH_FAV + Private ReadOnly TP_2 As TableLayoutPanel 'CH_READY_FOR_DOWN, CH_READY_FOR_DOWN_IGNORE + Private ReadOnly TP_3 As TableLayoutPanel 'CH_USERS, CH_SUBSCRIPTIONS + Private ReadOnly TP_4 As TableLayoutPanel 'CH_USER_EXISTS, CH_USER_SUSPENDED, CH_USER_DELETED + Private ReadOnly TP_5 As TableLayoutPanel 'CH_LABELS_NO, CH_LABELS_EXCLUDED_IGNORE + Private ReadOnly TP_6 As TableLayoutPanel 'CH_DATE_IN_RANGE, DT_FROM, DT_TO + + Private ReadOnly CH_REGULAR As CheckBox Private ReadOnly CH_TEMPORARY As CheckBox Private ReadOnly CH_FAV As CheckBox + Private ReadOnly CH_READY_FOR_DOWN As CheckBox Private ReadOnly CH_READY_FOR_DOWN_IGNORE As CheckBox + + Private ReadOnly CH_USERS As CheckBox Private ReadOnly CH_SUBSCRIPTIONS As CheckBox - Private ReadOnly CH_SUBSCRIPTIONS_ONLY As CheckBox + + Private ReadOnly CH_USER_EXISTS As CheckBox + Private ReadOnly CH_USER_SUSPENDED As CheckBox + Private ReadOnly CH_USER_DELETED As CheckBox + + Private ReadOnly CH_LABELS_NO As CheckBox + Private ReadOnly CH_LABELS_EXCLUDED_IGNORE As CheckBox + + Private ReadOnly DT_FROM As TextBoxExtended + Private ReadOnly DT_TO As TextBoxExtended + Private ReadOnly CH_DATE_IN_RANGE As CheckBox + Private WithEvents NUM_USERS_COUNT As TextBoxExtended + Private WithEvents NUM_DAYS As TextBoxExtended + Private WithEvents TXT_LABELS As TextBoxExtended Private WithEvents TXT_SITES As TextBoxExtended Friend WithEvents TXT_NAME As TextBoxExtended + Private ReadOnly Labels As List(Of String) Private ReadOnly LabelsExcluded As List(Of String) Private ReadOnly Sites As List(Of String) Private ReadOnly SitesExcluded As List(Of String) + Private ReadOnly TT_MAIN As ToolTip +#End Region +#Region "Initializer" Public Sub New() Labels = New List(Of String) LabelsExcluded = New List(Of String) Sites = New List(Of String) SitesExcluded = New List(Of String) + TT_MAIN = New ToolTip InitTextBox(TXT_LABELS, "Labels", {New ActionButton(ADB.Edit) With {.ToolTipText = "Edit selected labels"}, New ActionButton(ADB.Delete) With {.ToolTipText = "Edit excluded labels"}, ADB.Clear}) @@ -44,19 +75,94 @@ Namespace DownloadObjects.Groups InitTextBox(TXT_NAME, "Name", {ADB.Clear}) - CH_TEMPORARY = New CheckBox With {.Text = "Temporary", .Name = "CH_TEMPORARY", .ThreeState = True, .CheckState = CheckState.Indeterminate, .Dock = DockStyle.Fill} - CH_FAV = New CheckBox With {.Text = "Favorite", .Name = "CH_FAV", .ThreeState = True, .CheckState = CheckState.Indeterminate, .Dock = DockStyle.Fill} - CH_READY_FOR_DOWN = New CheckBox With {.Text = "Ready for download", .Name = "CH_READY_FOR_DOWN", .Checked = True, .Dock = DockStyle.Fill} - CH_READY_FOR_DOWN_IGNORE = New CheckBox With {.Text = "Ignore ready for download", .Name = "CH_READY_FOR_DOWN_IGNORE", .Checked = False, .Dock = DockStyle.Fill} + CH_REGULAR = New CheckBox With {.Text = "Regular", .Name = "CH_REGULAR", .Checked = True, .Dock = DockStyle.Fill} + TT_MAIN.SetToolTip(CH_REGULAR, "Users not marked as temporary or favorite") + CH_TEMPORARY = New CheckBox With {.Text = "Temporary", .Name = "CH_TEMPORARY", .Checked = True, .Dock = DockStyle.Fill} + TT_MAIN.SetToolTip(CH_TEMPORARY, "Users marked as temporary") + CH_FAV = New CheckBox With {.Text = "Favorite", .Name = "CH_FAV", .Checked = True, .Dock = DockStyle.Fill} + TT_MAIN.SetToolTip(CH_FAV, "Users marked as favorite") TP_1 = New TableLayoutPanel With {.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single, .Margin = New Padding(0), .Dock = DockStyle.Fill} - FillTP(TP_1, CH_TEMPORARY, CH_FAV) + FillTP(TP_1, CH_REGULAR, CH_TEMPORARY, CH_FAV) + + CH_READY_FOR_DOWN = New CheckBox With {.Text = "Ready for download", .Name = "CH_READY_FOR_DOWN", .Checked = True, .Dock = DockStyle.Fill} + TT_MAIN.SetToolTip(CH_READY_FOR_DOWN, "Users marked as 'Ready for download'") + CH_READY_FOR_DOWN_IGNORE = New CheckBox With {.Text = "Ignore ready for download", .Name = "CH_READY_FOR_DOWN_IGNORE", .Checked = False, .Dock = DockStyle.Fill} + TT_MAIN.SetToolTip(CH_READY_FOR_DOWN_IGNORE, "Ignore the 'Ready for download' mark") TP_2 = New TableLayoutPanel With {.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single, .Margin = New Padding(0), .Dock = DockStyle.Fill} FillTP(TP_2, CH_READY_FOR_DOWN, CH_READY_FOR_DOWN_IGNORE) + CH_USERS = New CheckBox With {.Text = "Users", .Name = "CH_USERS", .Checked = True, .Dock = DockStyle.Fill} + TT_MAIN.SetToolTip(CH_USERS, "Download/filter users") CH_SUBSCRIPTIONS = New CheckBox With {.Text = "Subscriptions", .Name = "CH_SUBSCRIPTIONS", .Checked = False, .Dock = DockStyle.Fill} - CH_SUBSCRIPTIONS_ONLY = New CheckBox With {.Text = "Subscriptions only", .Name = "CH_SUBSCRIPTIONS_ONLY", .Checked = False, .Dock = DockStyle.Fill} + TT_MAIN.SetToolTip(CH_SUBSCRIPTIONS, "Download/filter subscriptions") TP_3 = New TableLayoutPanel With {.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single, .Margin = New Padding(0), .Dock = DockStyle.Fill} - FillTP(TP_3, CH_SUBSCRIPTIONS, CH_SUBSCRIPTIONS_ONLY) + FillTP(TP_3, CH_USERS, CH_SUBSCRIPTIONS) + + CH_USER_EXISTS = New CheckBox With {.Text = "User exists", .Name = "CH_USER_EXISTS", .Checked = True, .Dock = DockStyle.Fill} + TT_MAIN.SetToolTip(CH_USER_EXISTS, "Include users not marked as 'Suspended' or 'Deleted'") + CH_USER_SUSPENDED = New CheckBox With {.Text = "User suspended", .Name = "CH_USER_SUSPENDED", .Checked = True, .Dock = DockStyle.Fill, + .BackColor = MyColor.EditBack, .ForeColor = MyColor.EditFore} + TT_MAIN.SetToolTip(CH_USER_SUSPENDED, "Include users marked as 'Suspended'") + CH_USER_DELETED = New CheckBox With {.Text = "User deleted", .Name = "CH_USER_DELETED", .Checked = False, .Dock = DockStyle.Fill, + .BackColor = MyColor.DeleteBack, .ForeColor = MyColor.DeleteFore} + TT_MAIN.SetToolTip(CH_USER_DELETED, "Include users marked as 'Deleted'") + TP_4 = New TableLayoutPanel With {.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single, .Margin = New Padding(0), .Dock = DockStyle.Fill} + FillTP(TP_4, CH_USER_EXISTS, CH_USER_SUSPENDED, CH_USER_DELETED) + + CH_LABELS_NO = New CheckBox With {.Text = "No labels", .Name = "CH_LABELS_NO", .Checked = False, .Dock = DockStyle.Fill} + TT_MAIN.SetToolTip(CH_LABELS_NO, "Only users that have no labels at all." & vbCr & "If checked, the list of labels will be ignored!") + CH_LABELS_EXCLUDED_IGNORE = New CheckBox With {.Text = "Ignore excluded labels", .Name = "CH_LABELS_EXCLUDED_IGNORE", .Checked = False, .Dock = DockStyle.Fill} + TT_MAIN.SetToolTip(CH_LABELS_EXCLUDED_IGNORE, "Ignore excluded labels if they exist") + TP_5 = New TableLayoutPanel With {.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single, .Margin = New Padding(0), .Dock = DockStyle.Fill} + FillTP(TP_5, CH_LABELS_NO, CH_LABELS_EXCLUDED_IGNORE) + + Dim initDtTxt As Action(Of TextBoxExtended, String, String) = + Sub(ByVal cnt As TextBoxExtended, ByVal captionText As String, ByVal toolTip As String) + With cnt + .BeginInit() + .CaptionText = captionText + .CaptionToolTipText = toolTip + .CaptionToolTipEnabled = True + .CaptionWidth = 30 + .ControlMode = TextBoxExtended.ControlModes.DateTimePicker + .DateShowCheckBox = True + .DateMin = DateTimePicker.MinimumDateTime + .DateMax = DateTimePicker.MaximumDateTime + .DateChecked = False + .DateShowUpDown = False + .CaptionMargin = New PaddingE(.CaptionMargin).Add(, 1) + .Dock = DockStyle.Fill + .Value = Now.Date + .EndInit() + End With + End Sub + DT_FROM = New TextBoxExtended + initDtTxt.Invoke(DT_FROM, "From", "Minimum date") + DT_TO = New TextBoxExtended + initDtTxt.Invoke(DT_TO, "To", "Maximum date") + CH_DATE_IN_RANGE = New CheckBox With {.Text = "In range", .Name = "CH_DATE_IN_RANGE", .Checked = True, .Dock = DockStyle.Fill} + TT_MAIN.SetToolTip(CH_DATE_IN_RANGE, "Last download date range." & vbCr & + "If checked, filter users whose last download date is within the selected date range." & vbCr & + "If unchecked, filter users whose last download date is outside the selected date range." & vbCr & + "If no dates are checked, this option will be ignored.") + CH_DATE_IN_RANGE.Margin = New PaddingE(CH_DATE_IN_RANGE.Margin).Add(, 2,, -2) + TP_6 = New TableLayoutPanel With {.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single, .Margin = New Padding(0), .Dock = DockStyle.Fill} + + With TP_6 + .ColumnCount = 3 + With .ColumnStyles + .Add(New ColumnStyle(SizeType.Absolute, 80)) + .Add(New ColumnStyle(SizeType.Percent, 50)) + .Add(New ColumnStyle(SizeType.Percent, 50)) + End With + .RowCount = 1 + .RowStyles.Add(New RowStyle(SizeType.Percent, 100)) + With .Controls + .Add(CH_DATE_IN_RANGE, 0, 0) + .Add(DT_FROM, 1, 0) + .Add(DT_TO, 2, 0) + End With + End With NUM_USERS_COUNT = New TextBoxExtended With NUM_USERS_COUNT @@ -67,7 +173,7 @@ Namespace DownloadObjects.Groups "Number greater than 0 = number of users from the beginning to the end of the list." & vbCr & "Number less than 0 = number of users from end to the beginning of the list." .CaptionToolTipEnabled = True - .CaptionWidth = 50 + .CaptionWidth = CaptionWidthDefault .ControlMode = TextBoxExtended.ControlModes.NumericUpDown .NumberMinimum = Integer.MinValue .NumberMaximum = Integer.MaxValue @@ -78,6 +184,30 @@ Namespace DownloadObjects.Groups .Value = 0 .EndInit() End With + NUM_DAYS = New TextBoxExtended + With NUM_DAYS + .BeginInit() + .CaptionText = "Down" + .CaptionToolTipText = "Filter users who have been (not)downloaded in the last x days." & vbCr & + "-1 to disable" & vbCr & + "Checked = downloaded in the last x days" & vbCr & + "Unchecked = NOT downloaded in the last x days" + .CaptionToolTipEnabled = True + .CaptionMode = ICaptionControl.Modes.CheckBox + .CaptionCheckAlign = ContentAlignment.MiddleLeft + .CaptionMargin = New PaddingE(.CaptionMargin).Add(1) + .CaptionWidth = CaptionWidthDefault + .ChangeControlsEnableOnCheckedChange = False + .ControlMode = TextBoxExtended.ControlModes.NumericUpDown + .NumberMinimum = -1 + .NumberMaximum = Integer.MaxValue + .NumberUpDownAlign = LeftRightAlignment.Left + .Dock = DockStyle.Fill + .Buttons.Add(New ActionButton(ADB.Clear) With {.ToolTipText = "Reset value"}) + .ClearTextByButtonClear = False + .Value = -1 + .EndInit() + End With End Sub Private Sub InitTextBox(ByRef TXT As TextBoxExtended, ByVal Caption As String, ByVal Buttons As ActionButton()) TXT = New TextBoxExtended @@ -85,48 +215,21 @@ Namespace DownloadObjects.Groups .BeginInit() .Buttons.AddRange(Buttons) .CaptionText = Caption - .CaptionWidth = 50 + .CaptionWidth = CaptionWidthDefault .Dock = DockStyle.Fill .EndInit() End With End Sub - Private Sub FillTP(ByRef TP As TableLayoutPanel, ByVal CNT1 As Control, ByVal CNT2 As Control) + Private Sub FillTP(ByRef TP As TableLayoutPanel, ByVal ParamArray CNT As Control()) With TP - .ColumnCount = 2 - .ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 50)) - .ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 50)) + Dim i% + .ColumnCount = CNT.Count + For i = 0 To CNT.Count - 1 : .ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 50)) : Next .RowCount = 1 .RowStyles.Add(New RowStyle(SizeType.Percent, 100)) - With .Controls : .Add(CNT1, 0, 0) : .Add(CNT2, 1, 0) : End With - End With - End Sub - Private Sub GroupDefaults_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed - Labels.Clear() - CH_TEMPORARY.Dispose() - CH_FAV.Dispose() - CH_READY_FOR_DOWN.Dispose() - CH_READY_FOR_DOWN_IGNORE.Dispose() - CH_SUBSCRIPTIONS.Dispose() - CH_SUBSCRIPTIONS_ONLY.Dispose() - NUM_USERS_COUNT.Dispose() - TXT_LABELS.Dispose() - With TP_1 - .Controls.Clear() - .RowStyles.Clear() - .ColumnStyles.Clear() - .Dispose() - End With - With TP_2 - .Controls.Clear() - .RowStyles.Clear() - .ColumnStyles.Clear() - .Dispose() - End With - With TP_3 - .Controls.Clear() - .RowStyles.Clear() - .ColumnStyles.Clear() - .Dispose() + With .Controls + For i = 0 To CNT.Count - 1 : .Add(CNT(i), i, 0) : Next + End With End With End Sub Protected Overrides Sub InitLayout() @@ -137,25 +240,81 @@ Namespace DownloadObjects.Groups CellBorderStyle = TableLayoutPanelCellBorderStyle.Single ColumnCount = 1 ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 100)) - RowCount = 9 + RowCount = 13 RowStyles.Add(New RowStyle(SizeType.Absolute, 25)) RowStyles.Add(New RowStyle(SizeType.Absolute, 28)) RowStyles.Add(New RowStyle(SizeType.Absolute, 25)) RowStyles.Add(New RowStyle(SizeType.Absolute, 25)) RowStyles.Add(New RowStyle(SizeType.Absolute, 25)) + RowStyles.Add(New RowStyle(SizeType.Absolute, 25)) + RowStyles.Add(New RowStyle(SizeType.Absolute, 25)) RowStyles.Add(New RowStyle(SizeType.Absolute, 28)) RowStyles.Add(New RowStyle(SizeType.Absolute, 28)) + RowStyles.Add(New RowStyle(SizeType.Absolute, 25)) + RowStyles.Add(New RowStyle(SizeType.Absolute, 28)) RowStyles.Add(New RowStyle(SizeType.Absolute, 28)) RowStyles.Add(New RowStyle(SizeType.Percent, 100)) End If Controls.Add(TXT_NAME, 0, 1) Controls.Add(TP_1, 0, 2) - Controls.Add(TP_2, 0, 3) - Controls.Add(TP_3, 0, 4) - Controls.Add(NUM_USERS_COUNT, 0, 5) - Controls.Add(TXT_LABELS, 0, 6) - Controls.Add(TXT_SITES, 0, 7) + Controls.Add(TP_4, 0, 3) + Controls.Add(TP_2, 0, 4) + Controls.Add(TP_3, 0, 5) + Controls.Add(TP_6, 0, 6) + + Controls.Add(NUM_DAYS, 0, 5) + Controls.Add(NUM_USERS_COUNT, 0, 8) + + Controls.Add(TP_5, 0, 9) + + Controls.Add(TXT_LABELS, 0, 10) + Controls.Add(TXT_SITES, 0, 11) End Sub +#End Region +#Region "Control handlers" + Private Sub GroupDefaults_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed + Labels.Clear() + LabelsExcluded.Clear() + Sites.Clear() + SitesExcluded.Clear() + CH_REGULAR.Dispose() + CH_TEMPORARY.Dispose() + CH_FAV.Dispose() + CH_READY_FOR_DOWN.Dispose() + CH_READY_FOR_DOWN_IGNORE.Dispose() + CH_USERS.Dispose() + CH_SUBSCRIPTIONS.Dispose() + CH_USER_EXISTS.Dispose() + CH_USER_SUSPENDED.Dispose() + CH_USER_DELETED.Dispose() + CH_LABELS_NO.Dispose() + CH_LABELS_EXCLUDED_IGNORE.Dispose() + DT_FROM.Dispose() + DT_TO.Dispose() + CH_DATE_IN_RANGE.Dispose() + NUM_USERS_COUNT.Dispose() + NUM_DAYS.Dispose() + TXT_LABELS.Dispose() + TXT_SITES.Dispose() + TXT_NAME.Dispose() + TT_MAIN.Dispose() + ClearTP(TP_1) + ClearTP(TP_2) + ClearTP(TP_3) + ClearTP(TP_4) + ClearTP(TP_5) + ClearTP(TP_6) + End Sub + Private Sub ClearTP(ByRef TP As TableLayoutPanel) + With TP + .Controls.Clear() + .RowStyles.Clear() + .ColumnStyles.Clear() + .Dispose() + End With + End Sub +#End Region +#Region "Controls" Friend Sub HideName() Controls.Remove(TXT_NAME) RowStyles(1).Height = 0 @@ -163,6 +322,9 @@ Namespace DownloadObjects.Groups Private Sub NUM_USERS_COUNT_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As ActionButtonEventArgs) Handles NUM_USERS_COUNT.ActionOnButtonClick If Sender.DefaultButton = ADB.Clear Then NUM_USERS_COUNT.Value = 0 End Sub + Private Sub NUM_DAYS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As ActionButtonEventArgs) Handles NUM_DAYS.ActionOnButtonClick + If Sender.DefaultButton = ADB.Clear Then NUM_DAYS.Value = -1 + End Sub Private Sub TXT_LABELS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As ActionButtonEventArgs) Handles TXT_LABELS.ActionOnButtonClick Select Case Sender.DefaultButton Case ADB.Edit, ADB.Delete @@ -205,17 +367,41 @@ Namespace DownloadObjects.Groups If Not _JustExcludeOptions Then TXT_SITES.Text = Sites.ListToString If SitesExcluded.Count > 0 Then TXT_SITES.Text.StringAppend($"EXCLUDED: {SitesExcluded.ListToString}", "; ") End Sub +#End Region +#Region "Get/set" Friend Sub [Get](ByRef Instance As IGroup) If Not Instance Is Nothing Then With Instance .Name = TXT_NAME.Text - .Temporary = CH_TEMPORARY.CheckState - .Favorite = CH_FAV.CheckState + .Regular = CH_REGULAR.Checked + .Temporary = CH_TEMPORARY.Checked + .Favorite = CH_FAV.Checked .ReadyForDownload = CH_READY_FOR_DOWN.Checked .ReadyForDownloadIgnore = CH_READY_FOR_DOWN_IGNORE.Checked - .Subscriptions = CH_SUBSCRIPTIONS.Checked - .SubscriptionsOnly = CH_SUBSCRIPTIONS_ONLY.Checked + .DownloadUsers = CH_USERS.Checked + .DownloadSubscriptions = CH_SUBSCRIPTIONS.Checked .UsersCount = NUM_USERS_COUNT.Value + .DaysNumber = NUM_DAYS.Value + .DaysIsDownloaded = NUM_DAYS.Checked + .UserDeleted = CH_USER_DELETED.Checked + .UserSuspended = CH_USER_SUSPENDED.Checked + .UserExists = CH_USER_EXISTS.Checked + + If DT_FROM.DateChecked Then .DateFrom = DT_FROM.Date.Date Else .DateFrom = Nothing + If DT_TO.DateChecked Then + With DT_TO.Date.Date : Instance.DateTo = New Date(.Year, .Month, .Day, 23, 59, 59) : End With + Else + .DateTo = Nothing + End If + If .DateFrom.HasValue Or .DateTo.HasValue Then + .DateMode = If(CH_DATE_IN_RANGE.Checked, ShowingDates.In, ShowingDates.Not) + Else + .DateMode = ShowingDates.Off + End If + + .LabelsNo = CH_LABELS_NO.Checked + .LabelsExcludedIgnore = CH_LABELS_EXCLUDED_IGNORE.Checked + .Labels.Clear() .Labels.ListAddList(Labels) .LabelsExcluded.Clear() @@ -231,13 +417,38 @@ Namespace DownloadObjects.Groups If Not Instance Is Nothing Then With Instance TXT_NAME.Text = .Name - CH_TEMPORARY.CheckState = .Temporary - CH_FAV.CheckState = .Favorite + CH_REGULAR.Checked = .Regular + CH_TEMPORARY.Checked = .Temporary + CH_FAV.Checked = .Favorite CH_READY_FOR_DOWN.Checked = .ReadyForDownload CH_READY_FOR_DOWN_IGNORE.Checked = .ReadyForDownloadIgnore - CH_SUBSCRIPTIONS.Checked = .Subscriptions - CH_SUBSCRIPTIONS_ONLY.Checked = .SubscriptionsOnly + CH_USERS.Checked = .DownloadUsers + CH_SUBSCRIPTIONS.Checked = .DownloadSubscriptions NUM_USERS_COUNT.Value = .UsersCount + NUM_DAYS.Value = .DaysNumber + NUM_DAYS.Checked = .DaysIsDownloaded + CH_USER_DELETED.Checked = .UserDeleted + CH_USER_SUSPENDED.Checked = .UserSuspended + CH_USER_EXISTS.Checked = .UserExists + + If .DateFrom.HasValue Then + DT_FROM.DateChecked = True + DT_FROM.Value = .DateFrom.Value + Else + DT_FROM.DateChecked = False + DT_FROM.Value = Now.Date + End If + If .DateTo.HasValue Then + DT_TO.DateChecked = True + DT_TO.Value = .DateTo.Value + Else + DT_TO.DateChecked = False + DT_TO.Value = Now.Date + End If + CH_DATE_IN_RANGE.Checked = .DateMode = ShowingDates.In + + CH_LABELS_NO.Checked = .LabelsNo + CH_LABELS_EXCLUDED_IGNORE.Checked = .LabelsExcludedIgnore Labels.ListAddList(.Labels) LabelsExcluded.ListAddList(.LabelsExcluded) @@ -249,10 +460,11 @@ Namespace DownloadObjects.Groups End With End If End Sub +#End Region +#Region "Enabled" Private _Enabled As Boolean = True Private _JustExcludeOptions As Boolean = False - Friend Overloads Property Enabled(Optional ByVal LeaveExcludeOptions As Boolean = False, - Optional ByVal LeaveSubscriptionsAndUsersCount As Boolean = False) As Boolean + Friend Overloads Property Enabled() As Boolean Get Return _Enabled End Get @@ -261,29 +473,18 @@ Namespace DownloadObjects.Groups _JustExcludeOptions = False TP_1.Enabled = e TP_2.Enabled = e - TP_3.Enabled = e Or LeaveSubscriptionsAndUsersCount - NUM_USERS_COUNT.Enabled = e Or LeaveSubscriptionsAndUsersCount - If e Then - TXT_LABELS.Enabled = True - TXT_SITES.Enabled = True - ElseIf LeaveExcludeOptions Then - _JustExcludeOptions = True - TXT_LABELS.Enabled = True - TXT_LABELS.Button(ADB.Edit).Enabled = False - TXT_LABELS.Button(ADB.Delete).Enabled = True - TXT_LABELS.Button(ADB.Clear).Enabled = False - - TXT_SITES.Enabled = True - TXT_SITES.Button(ADB.Edit).Enabled = False - TXT_SITES.Button(ADB.Delete).Enabled = True - TXT_SITES.Button(ADB.Clear).Enabled = False - Else - TXT_LABELS.Enabled = False - TXT_SITES.Enabled = False - End If + TP_3.Enabled = e + TP_4.Enabled = e + TP_5.Enabled = e + TP_6.Enabled = e + NUM_USERS_COUNT.Enabled = e + NUM_DAYS.Enabled = e + TXT_LABELS.Enabled = e + TXT_SITES.Enabled = e UpdateLabelsText() UpdateSitesText() End Set End Property +#End Region End Class End Namespace \ No newline at end of file diff --git a/SCrawler/Download/Groups/GroupEditorForm.Designer.vb b/SCrawler/Download/Groups/GroupEditorForm.Designer.vb index a27c27f..d0a524d 100644 --- a/SCrawler/Download/Groups/GroupEditorForm.Designer.vb +++ b/SCrawler/Download/Groups/GroupEditorForm.Designer.vb @@ -35,13 +35,13 @@ Namespace DownloadObjects.Groups 'CONTAINER_MAIN.ContentPanel ' CONTAINER_MAIN.ContentPanel.Controls.Add(Me.DEFS_GROUP) - CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(476, 196) + CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(476, 328) CONTAINER_MAIN.Dock = System.Windows.Forms.DockStyle.Fill CONTAINER_MAIN.LeftToolStripPanelVisible = False CONTAINER_MAIN.Location = New System.Drawing.Point(0, 0) CONTAINER_MAIN.Name = "CONTAINER_MAIN" CONTAINER_MAIN.RightToolStripPanelVisible = False - CONTAINER_MAIN.Size = New System.Drawing.Size(476, 221) + CONTAINER_MAIN.Size = New System.Drawing.Size(476, 328) CONTAINER_MAIN.TabIndex = 0 CONTAINER_MAIN.TopToolStripPanelVisible = False ' @@ -53,32 +53,36 @@ Namespace DownloadObjects.Groups Me.DEFS_GROUP.Dock = System.Windows.Forms.DockStyle.Fill Me.DEFS_GROUP.Location = New System.Drawing.Point(0, 0) Me.DEFS_GROUP.Name = "DEFS_GROUP" - Me.DEFS_GROUP.RowCount = 9 + Me.DEFS_GROUP.RowCount = 13 Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 0!)) Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) + Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) + Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) + Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) + Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) Me.DEFS_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) - Me.DEFS_GROUP.Size = New System.Drawing.Size(476, 196) + Me.DEFS_GROUP.Size = New System.Drawing.Size(476, 328) Me.DEFS_GROUP.TabIndex = 0 ' 'GroupEditorForm ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(476, 221) + Me.ClientSize = New System.Drawing.Size(476, 328) Me.Controls.Add(CONTAINER_MAIN) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.Icon = Global.SCrawler.My.Resources.Resources.GroupByIcon_16 Me.KeyPreview = True Me.MaximizeBox = False - Me.MaximumSize = New System.Drawing.Size(492, 260) + Me.MaximumSize = New System.Drawing.Size(492, 367) Me.MinimizeBox = False - Me.MinimumSize = New System.Drawing.Size(492, 260) + Me.MinimumSize = New System.Drawing.Size(492, 367) Me.Name = "GroupEditorForm" Me.ShowInTaskbar = False Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide diff --git a/SCrawler/Download/Groups/GroupEditorForm.vb b/SCrawler/Download/Groups/GroupEditorForm.vb index 988ce51..61c7c6c 100644 --- a/SCrawler/Download/Groups/GroupEditorForm.vb +++ b/SCrawler/Download/Groups/GroupEditorForm.vb @@ -13,6 +13,8 @@ Namespace DownloadObjects.Groups Friend Property MyGroup As DownloadGroup Friend Property DownloadMode As Boolean = False Friend Property FilterMode As Boolean = False + Friend Property IsTemporaryGroup As Boolean = False + Friend Property IsClone As Boolean Friend Sub New(ByRef g As DownloadGroup) InitializeComponent() MyGroup = g @@ -60,7 +62,7 @@ Namespace DownloadObjects.Groups Text = "New Group" End If .MyFieldsChecker = New FieldsChecker - If DownloadMode Or FilterMode Then + If DownloadMode Or FilterMode Or IsTemporaryGroup Then DEFS_GROUP.HideName() Dim s As Size = Size s.Height -= 31 @@ -71,15 +73,16 @@ Namespace DownloadObjects.Groups MaximumSize = s Else .MyFieldsCheckerE.AddControl(Of String)(DEFS_GROUP.TXT_NAME, DEFS_GROUP.TXT_NAME.CaptionText,, - New NameChecker(If(MyGroup?.Name, String.Empty), Settings.Groups, "Group")) + New NameChecker(If(Not IsClone, If(MyGroup?.Name, String.Empty), String.Empty), Settings.Groups, "Group")) End If .MyFieldsChecker.EndLoaderOperations() .EndLoaderOperations() + .MyOkCancel.EnableOK = True End With End Sub Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick If MyDefs.MyFieldsChecker.AllParamsOK Then - If MyGroup Is Nothing Then MyGroup = New DownloadGroup + If MyGroup Is Nothing Then MyGroup = New DownloadGroup(Not FilterMode) With MyGroup .NameBefore = .Name DEFS_GROUP.Get(MyGroup) diff --git a/SCrawler/Download/Groups/GroupListForm.Designer.vb b/SCrawler/Download/Groups/GroupListForm.Designer.vb new file mode 100644 index 0000000..abc1dbf --- /dev/null +++ b/SCrawler/Download/Groups/GroupListForm.Designer.vb @@ -0,0 +1,78 @@ +' Copyright (C) Andy https://github.com/AAndyProgram +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY +Namespace DownloadObjects.Groups + + Partial Friend Class GroupListForm : Inherits System.Windows.Forms.Form + + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + Private components As System.ComponentModel.IContainer + + Private Sub InitializeComponent() + Me.CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer() + Me.LIST_GROUPS = New System.Windows.Forms.ListBox() + Me.CONTAINER_MAIN.ContentPanel.SuspendLayout() + Me.CONTAINER_MAIN.SuspendLayout() + Me.SuspendLayout() + ' + 'CONTAINER_MAIN + ' + Me.CONTAINER_MAIN.BottomToolStripPanelVisible = False + ' + 'CONTAINER_MAIN.ContentPanel + ' + Me.CONTAINER_MAIN.ContentPanel.Controls.Add(Me.LIST_GROUPS) + Me.CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(284, 236) + Me.CONTAINER_MAIN.Dock = System.Windows.Forms.DockStyle.Fill + Me.CONTAINER_MAIN.LeftToolStripPanelVisible = False + Me.CONTAINER_MAIN.Location = New System.Drawing.Point(0, 0) + Me.CONTAINER_MAIN.Name = "CONTAINER_MAIN" + Me.CONTAINER_MAIN.RightToolStripPanelVisible = False + Me.CONTAINER_MAIN.Size = New System.Drawing.Size(284, 261) + Me.CONTAINER_MAIN.TabIndex = 0 + ' + 'LIST_GROUPS + ' + Me.LIST_GROUPS.Dock = System.Windows.Forms.DockStyle.Fill + Me.LIST_GROUPS.FormattingEnabled = True + Me.LIST_GROUPS.Location = New System.Drawing.Point(0, 0) + Me.LIST_GROUPS.Name = "LIST_GROUPS" + Me.LIST_GROUPS.Size = New System.Drawing.Size(284, 236) + Me.LIST_GROUPS.TabIndex = 0 + ' + 'GroupListForm + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(284, 261) + Me.Controls.Add(Me.CONTAINER_MAIN) + Me.Icon = Global.SCrawler.My.Resources.Resources.GroupByIcon_16 + Me.KeyPreview = True + Me.MinimumSize = New System.Drawing.Size(300, 300) + Me.Name = "GroupListForm" + Me.ShowInTaskbar = False + Me.Text = "Groups" + Me.CONTAINER_MAIN.ContentPanel.ResumeLayout(False) + Me.CONTAINER_MAIN.ResumeLayout(False) + Me.CONTAINER_MAIN.PerformLayout() + Me.ResumeLayout(False) + + End Sub + + Private WithEvents LIST_GROUPS As ListBox + Private WithEvents CONTAINER_MAIN As ToolStripContainer + End Class +End Namespace \ No newline at end of file diff --git a/SCrawler/Download/Groups/GroupListForm.resx b/SCrawler/Download/Groups/GroupListForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SCrawler/Download/Groups/GroupListForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SCrawler/Download/Groups/GroupListForm.vb b/SCrawler/Download/Groups/GroupListForm.vb new file mode 100644 index 0000000..58f6c24 --- /dev/null +++ b/SCrawler/Download/Groups/GroupListForm.vb @@ -0,0 +1,300 @@ +' Copyright (C) Andy https://github.com/AAndyProgram +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY +Imports System.ComponentModel +Imports System.Collections.ObjectModel +Imports PersonalUtilities.Forms +Imports PersonalUtilities.Forms.Toolbars +Imports ECI = PersonalUtilities.Forms.Toolbars.EditToolbar.ControlItem +Namespace DownloadObjects.Groups + Friend Class GroupListForm +#Region "Declarations" + Private WithEvents MyDefs As DefaultFormOptions + Private ReadOnly IsViewFilter As Boolean + Private WithEvents BTT_MOVE_UP As ToolStripButton + Private WithEvents BTT_MOVE_DOWN As ToolStripButton + Private WithEvents BTT_DOWNLOAD As ToolStripKeyMenuItem + Private ReadOnly MyGroups As ObservableCollection(Of String) + Private ReadOnly MyGroupParams As List(Of GroupParameters) + Private _GroupsUpdated As Boolean = False + Friend ReadOnly Property GroupsUpdated As Boolean + Get + Return _GroupsUpdated + End Get + End Property + Private _GroupToDownload As String = String.Empty + Friend ReadOnly Property GroupToDownload As String + Get + Return _GroupToDownload + End Get + End Property + Private _GroupToDownloadIncludeInTheFeed As Boolean = True + Friend ReadOnly Property GroupToDownloadIncludeInTheFeed As Boolean + Get + Return _GroupToDownloadIncludeInTheFeed + End Get + End Property + Private _FilterSelected As GroupParameters = Nothing + Friend ReadOnly Property FilterSelected As GroupParameters + Get + Return _FilterSelected + End Get + End Property +#End Region +#Region "Initializer" + Friend Sub New(ByVal _IsViewFilter As Boolean) + InitializeComponent() + MyDefs = New DefaultFormOptions(Me, Settings.Design) + MyGroups = New ObservableCollection(Of String) + MyGroupParams = New List(Of GroupParameters) + IsViewFilter = _IsViewFilter + If Not IsViewFilter Then + BTT_MOVE_UP = New ToolStripButton With { + .Image = PersonalUtilities.My.Resources.ArrowUpPic_Blue_32, + .Text = String.Empty, + .DisplayStyle = ToolStripItemDisplayStyle.Image, + .ToolTipText = "Move up", + .AutoToolTip = True + } + BTT_MOVE_DOWN = New ToolStripButton With { + .Image = PersonalUtilities.My.Resources.ArrowDownPic_Blue_32, + .Text = String.Empty, + .DisplayStyle = ToolStripItemDisplayStyle.Image, + .ToolTipText = "Move down", + .AutoToolTip = True + } + BTT_DOWNLOAD = New ToolStripKeyMenuItem("Download", My.Resources.StartPic_Green_16) With {.ToolTipText = "Download selected group"} + Else + Text = "Filters" + End If + End Sub +#End Region +#Region "Form handlers" + Private Sub GroupListForm_Load(sender As Object, e As EventArgs) Handles Me.Load + Try + With MyDefs + .MyViewInitialize() + + If Not IsViewFilter Then + .AddEditToolbarPlus({BTT_MOVE_UP, BTT_MOVE_DOWN, ECI.Separator, BTT_DOWNLOAD}) + With Settings.Groups.Where(Function(g) g.IsViewFilter = IsViewFilter) + If .ListExists Then .ListForEach(Sub(g, i) MyGroups.Add(g.Name)) + End With + Else + .AddEditToolbar() + With .MyEditToolbar : .ButtonKey(ECI.Add) = Nothing : .Enabled(ECI.Add) = False : End With + With Settings.Groups.Cast(Of GroupParameters).Concat(Settings.Automation.Cast(Of GroupParameters)).ToList. + ListSort(New FComparer(Of GroupParameters)( + Function(ByVal x As GroupParameters, ByVal y As GroupParameters) As Integer + Dim getVal As Func(Of GroupParameters, Long) = + Function(ByVal g As GroupParameters) As Long + Dim v& = 0 + If TypeOf g Is AutoDownloader Then + v = CLng(Integer.MaxValue) * 1000 + ElseIf TypeOf g Is DownloadGroup Then + If Not g.IsViewFilter Then v = CLng(Integer.MaxValue) * 100 + End If + v += g.ToStringViewFilters.GetHashCode + Return v + End Function + Return getVal(x).CompareTo(getVal(y)) + End Function)) + If .ListExists Then .ListForEach(Sub(ByVal g As GroupParameters, ByVal __indx As Integer) + MyGroups.Add(g.Name) + MyGroupParams.Add(g) + End Sub) + End With + CONTAINER_MAIN.BottomToolStripPanel.Visible = True + .AddOkCancelToolbar() + .MyOkCancel.ToolTipOk = "Apply selected filter" + End If + + RefillList() + If Not IsViewFilter Then Settings.Groups.BeginUpdate() + + .DelegateClosingChecker = False + + .EndLoaderOperations() + End With + Catch ex As Exception + MyDefs.InvokeLoaderError(ex) + End Try + End Sub + Private Sub GroupListForm_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing + If Not IsViewFilter And GroupsUpdated And MyGroups.Count > 0 Then + With Settings.Groups + Dim myIndx%, grIndx% + For myIndx = 0 To MyGroups.Count - 1 + grIndx = .IndexOf(MyGroups(myIndx)) + If grIndx >= 0 Then .Item(grIndx).Index = myIndx + Next + .Sort() + .Reindex() + .Sort() + End With + End If + MyGroups.Clear() + MyGroupParams.Clear() + Settings.Groups.EndUpdate() + If GroupsUpdated Then Settings.Groups.Update() + End Sub + Private Sub GroupListForm_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown + If e.KeyCode = Keys.Escape Then Close() + End Sub +#End Region +#Region "Refill" + Private Sub RefillList(Optional ByVal OffsetIndex As Integer? = Nothing) + Try + With LIST_GROUPS + .BeginUpdate() + With .Items + .Clear() + If IsViewFilter Then + If MyGroupParams.Count > 0 Then .AddRange(MyGroupParams.Select(Function(g) g.ToStringViewFilters).Cast(Of Object).ToArray) + Else + If MyGroups.Count > 0 Then .AddRange(MyGroups.Cast(Of Object).ToArray) + End If + End With + .EndUpdate() + If OffsetIndex.HasValue Then + Dim newIndx% = _LatestSelected + OffsetIndex.Value + If newIndx.ValueBetween(0, .Items.Count - 1) Then .SelectedIndex = newIndx : _LatestSelected = newIndx + ElseIf .Items.Count > 0 Then + If _LatestSelected.ValueBetween(0, .Items.Count - 1) Then + .SelectedIndex = _LatestSelected + ElseIf (_LatestSelected - 1).ValueBetween(0, .Items.Count - 1) Then + _LatestSelected -= 1 + .SelectedIndex = _LatestSelected + ElseIf (_LatestSelected + 1).ValueBetween(0, .Items.Count - 1) Then + _LatestSelected += 1 + .SelectedIndex = _LatestSelected + End If + End If + End With + Catch ex As Exception + ErrorsDescriber.Execute(EDP.SendToLog, ex, "[GroupListForm.RefillList]") + End Try + End Sub +#End Region +#Region "Ok Cancel" + Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick + If _LatestSelected.ValueBetween(0, MyGroupParams.Count - 1) Then + _FilterSelected = MyGroupParams(_LatestSelected) + MyDefs.CloseForm() + Else + MsgBoxE({"You haven't selected a filter", "Apply filter"}, vbCritical) + End If + End Sub +#End Region +#Region "Toolbar buttons" + Private Sub MyDefs_ButtonAddClick(ByVal Sender As Object, ByVal e As EditToolbarEventArgs) Handles MyDefs.ButtonAddClick + If Not IsViewFilter Then + Dim i% = Settings.Groups.Add + If i >= 0 Then + MyGroups.Add(Settings.Groups(i).Name) + _LatestSelected = MyGroups.Count - 1 + _GroupsUpdated = True + RefillList() + End If + End If + End Sub + Private Sub MyDefs_ButtonEditClick(ByVal Sender As Object, ByVal e As EditToolbarEventArgs) Handles MyDefs.ButtonEditClick + EditItem() + End Sub + Private Function ItemEditDeleteReady(ByVal Operation As String) As DialogResult + If IsViewFilter Then + If _LatestSelected.ValueBetween(0, MyGroupParams.Count - 1) Then + With MyGroupParams(_LatestSelected) + If TypeOf .Self Is AutoDownloader Then + MsgBoxE({$"You cannot {Operation} the scheduler plan through this form", $"{Operation.ToUpperFirstChar} filter"}, vbCritical) + Return DialogResult.Abort + ElseIf TypeOf .Self Is DownloadGroup AndAlso Not DirectCast(.Self, DownloadGroup).IsViewFilter Then + MsgBoxE({$"You cannot {Operation} the group through this form", $"{Operation.ToUpperFirstChar} filter"}, vbCritical) + Return DialogResult.Abort + End If + End With + End If + End If + Return DialogResult.OK + End Function + Private Sub EditItem() + If _LatestSelected.ValueBetween(0, MyGroups.Count - 1) AndAlso ItemEditDeleteReady("edit") = DialogResult.OK Then + Dim i% = Settings.Groups.IndexOf(MyGroups(_LatestSelected), IsViewFilter) + If i >= 0 Then + Using f As New GroupEditorForm(Settings.Groups(i)) + f.ShowDialog() + If f.DialogResult = DialogResult.OK Then + If IsViewFilter Then + MyGroups(_LatestSelected) = Settings.Groups(i).ToStringViewFilters + Settings.Groups.Update() + Else + MyGroups(_LatestSelected) = Settings.Groups(i).Name + _GroupsUpdated = True + End If + RefillList() + End If + End Using + End If + End If + End Sub + Private Sub MyDefs_ButtonDeleteClickEdit(ByVal Sender As Object, ByVal e As EditToolbarEventArgs) Handles MyDefs.ButtonDeleteClickE + Try + If _LatestSelected.ValueBetween(0, MyGroups.Count - 1) AndAlso ItemEditDeleteReady("delete") = DialogResult.OK Then + Dim i% = Settings.Groups.IndexOf(MyGroups(_LatestSelected), IsViewFilter) + If i >= 0 Then + Dim n$ = Settings.Groups(i).Name + If Settings.Groups(i).Delete Then + If _LatestSelected.ValueBetween(0, MyGroupParams.Count - 1) Then MyGroupParams.RemoveAt(_LatestSelected) + MyGroups.Remove(n) + RefillList() + If IsViewFilter Then + Settings.Groups.Update() + Else + _GroupsUpdated = True + End If + End If + End If + End If + Catch ex As Exception + ErrorsDescriber.Execute(EDP.SendToLog, ex, "[GroupListForm.Delete]") + End Try + End Sub + Private Sub BTT_MOVE_UP_DOWN_Click(sender As Object, e As EventArgs) Handles BTT_MOVE_UP.Click, BTT_MOVE_DOWN.Click + Try + Dim offset% = IIf(sender Is BTT_MOVE_UP, -1, 1) + If _LatestSelected.ValueBetween(0, MyGroups.Count - 1) And (_LatestSelected + offset).ValueBetween(0, MyGroups.Count - 1) Then + MyGroups.Move(_LatestSelected, _LatestSelected + offset) + RefillList(offset) + _GroupsUpdated = True + End If + Catch ex As Exception + ErrorsDescriber.Execute(EDP.SendToLog, ex, "[GroupListForm.Move]") + End Try + End Sub + Private Sub BTT_DOWNLOAD_KeyClick(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWNLOAD.KeyClick + If Not IsViewFilter AndAlso _LatestSelected.ValueBetween(0, MyGroups.Count - 1) Then + Dim i% = Settings.Groups.IndexOf(MyGroups(_LatestSelected)) + If i >= 0 Then _GroupToDownload = Settings.Groups(i).Name : _GroupToDownloadIncludeInTheFeed = e.IncludeInTheFeed : Close() + End If + End Sub +#End Region +#Region "List handlers" + Private _LatestSelected As Integer = -1 + Private Sub LIST_GROUPS_Click(sender As Object, e As EventArgs) Handles LIST_GROUPS.Click + _LatestSelected = LIST_GROUPS.SelectedIndex + End Sub + Private Sub LIST_GROUPS_DoubleClick(sender As Object, e As EventArgs) Handles LIST_GROUPS.DoubleClick + If IsViewFilter Then + MyDefs.MyOkCancel.BTT_OK.PerformClick() + Else + EditItem() + End If + End Sub +#End Region + End Class +End Namespace \ No newline at end of file diff --git a/SCrawler/Download/Groups/GroupParameters.vb b/SCrawler/Download/Groups/GroupParameters.vb index 0efa957..cd5f733 100644 --- a/SCrawler/Download/Groups/GroupParameters.vb +++ b/SCrawler/Download/Groups/GroupParameters.vb @@ -10,49 +10,104 @@ Imports PersonalUtilities.Functions.XML Namespace DownloadObjects.Groups Friend Interface IGroup Property Name As String + Property LabelsNo As Boolean ReadOnly Property Labels As List(Of String) ReadOnly Property LabelsExcluded As List(Of String) + Property LabelsExcludedIgnore As Boolean ReadOnly Property Sites As List(Of String) ReadOnly Property SitesExcluded As List(Of String) - Property Temporary As CheckState - Property Favorite As CheckState + Property Regular As Boolean + Property Temporary As Boolean + Property Favorite As Boolean Property ReadyForDownload As Boolean Property ReadyForDownloadIgnore As Boolean - Property Subscriptions As Boolean - Property SubscriptionsOnly As Boolean + Property DownloadUsers As Boolean + Property DownloadSubscriptions As Boolean Property UsersCount As Integer + Property DaysNumber As Integer + Property DaysIsDownloaded As Boolean + Property UserDeleted As Boolean + Property UserSuspended As Boolean + Property UserExists As Boolean + Property DateFrom As Date? + Property DateTo As Date? + Property DateMode As ShowingDates End Interface Friend Class GroupParameters : Implements IGroup, IDisposable, ICopier +#Region "XML names" +#Region "Old" + Protected Const Name_Subscriptions As String = "Subscriptions" + Protected Const Name_SubscriptionsOnly As String = "SubscriptionsOnly" +#End Region Protected Const Name_Name As String = "Name" + Protected Const Name_Regular As String = "Regular" Protected Const Name_Temporary As String = "Temporary" Protected Const Name_Favorite As String = "Favorite" Protected Const Name_ReadyForDownload As String = "RFD" Protected Const Name_ReadyForDownloadIgnore As String = "RFDI" - Protected Const Name_Subscriptions As String = "Subscriptions" - Protected Const Name_SubscriptionsOnly As String = "SubscriptionsOnly" + + Protected Const Name_DownloadUsers As String = "DownloadUsers" + Protected Const Name_DownloadSubscriptions As String = "DownloadSubscriptions" + Protected Const Name_UsersCount As String = "UsersCount" + Protected Const Name_LabelsNo As String = "LabelsNo" Protected Const Name_Labels As String = "Labels" Protected Const Name_Labels_Excluded As String = "LabelsExcluded" + Protected Const Name_LabelsExcludedIgnore As String = "LabelsExcludedIgnore" Protected Const Name_Sites As String = "Sites" Protected Const Name_Sites_Excluded As String = "SitesExcluded" - Friend Property Name As String Implements IGroup.Name + Protected Const Name_DaysNumber As String = "DaysNumber" + Protected Const Name_DaysIsDownloaded As String = "DaysIsDownloaded" + Protected Const Name_UserDeleted As String = "UserDeleted" + Protected Const Name_UserSuspended As String = "UserSuspended" + Protected Const Name_UserExists As String = "UserExists" + Protected Const Name_DateFrom As String = "DateFrom" + Protected Const Name_DateTo As String = "DateTo" + Protected Const Name_DateMode As String = "DateMode" + Protected Const Name_IsViewFilter As String = "IsViewFilter" +#End Region +#Region "Declarations" + Friend Overridable Property Name As String Implements IGroup.Name + Friend Property LabelsNo As Boolean = False Implements IGroup.LabelsNo Friend ReadOnly Property Labels As List(Of String) Implements IGroup.Labels Friend ReadOnly Property LabelsExcluded As List(Of String) Implements IGroup.LabelsExcluded + Friend Property LabelsExcludedIgnore As Boolean = False Implements IGroup.LabelsExcludedIgnore Friend ReadOnly Property Sites As List(Of String) Implements IGroup.Sites Friend ReadOnly Property SitesExcluded As List(Of String) Implements IGroup.SitesExcluded - Friend Property Temporary As CheckState = CheckState.Indeterminate Implements IGroup.Temporary - Friend Property Favorite As CheckState = CheckState.Indeterminate Implements IGroup.Favorite + Friend Property Regular As Boolean = True Implements IGroup.Regular + Friend Property Temporary As Boolean = True Implements IGroup.Temporary + Friend Property Favorite As Boolean = True Implements IGroup.Favorite Friend Property ReadyForDownload As Boolean = True Implements IGroup.ReadyForDownload Friend Property ReadyForDownloadIgnore As Boolean = False Implements IGroup.ReadyForDownloadIgnore - Friend Property Subscriptions As Boolean = False Implements IGroup.Subscriptions - Friend Property SubscriptionsOnly As Boolean = False Implements IGroup.SubscriptionsOnly + Friend Property DownloadUsers As Boolean = True Implements IGroup.DownloadUsers + Friend Property DownloadSubscriptions As Boolean = True Implements IGroup.DownloadSubscriptions Friend Property UsersCount As Integer = 0 Implements IGroup.UsersCount + Friend Property DaysNumber As Integer = -1 Implements IGroup.DaysNumber + Friend Property DaysIsDownloaded As Boolean = False Implements IGroup.DaysIsDownloaded + Friend Property UserDeleted As Boolean = False Implements IGroup.UserDeleted + Friend Property UserSuspended As Boolean = True Implements IGroup.UserSuspended + Friend Property UserExists As Boolean = True Implements IGroup.UserExists + Friend Property DateFrom As Date? = Nothing Implements IGroup.DateFrom + Friend Property DateTo As Date? = Nothing Implements IGroup.DateTo + Friend Property DateMode As ShowingDates = ShowingDates.Off Implements IGroup.DateMode + Friend Property IsViewFilter As Boolean = False +#End Region +#Region "Initializer" Friend Sub New() Labels = New List(Of String) LabelsExcluded = New List(Of String) Sites = New List(Of String) SitesExcluded = New List(Of String) End Sub +#End Region +#Region "Base functions" + Public Overrides Function ToString() As String + Return Name + End Function + Friend Overridable Function ToStringViewFilters() As String + Return ToString() + End Function +#End Region #Region "ICopier Support" Friend Overridable Overloads Function Copy() As Object Implements ICopier.Copy Return (New GroupParameters).Copy(Me) @@ -60,52 +115,101 @@ Namespace DownloadObjects.Groups Friend Overridable Overloads Function Copy(ByVal Source As Object) As Object Implements ICopier.Copy With DirectCast(Source, GroupParameters) Name = .Name + LabelsNo = .LabelsNo Labels.ListAddList(.Labels, LAP.ClearBeforeAdd) LabelsExcluded.ListAddList(.LabelsExcluded, LAP.ClearBeforeAdd) + LabelsExcludedIgnore = .LabelsExcludedIgnore Sites.ListAddList(.Sites, LAP.ClearBeforeAdd) SitesExcluded.ListAddList(.SitesExcluded, LAP.ClearBeforeAdd) + Regular = .Regular Temporary = .Temporary Favorite = .Favorite ReadyForDownload = .ReadyForDownload ReadyForDownloadIgnore = .ReadyForDownloadIgnore - Subscriptions = .Subscriptions - SubscriptionsOnly = .SubscriptionsOnly + DownloadUsers = .DownloadUsers + DownloadSubscriptions = .DownloadSubscriptions UsersCount = .UsersCount + DaysNumber = .DaysNumber + DaysIsDownloaded = .DaysIsDownloaded + UserDeleted = .UserDeleted + UserSuspended = .UserSuspended + UserExists = .UserExists + DateFrom = .DateFrom + DateTo = .DateTo + DateMode = .DateMode + IsViewFilter = .IsViewFilter End With - Return Source + Return Me End Function #End Region - Protected Sub Import(ByVal e As EContainer) +#Region "Import/Export" + Protected Overridable Sub Import(ByVal e As EContainer) Name = e.Value(Name_Name) - Temporary = e.Value(Name_Temporary).FromXML(Of Integer)(CInt(CheckState.Indeterminate)) - Favorite = e.Value(Name_Favorite).FromXML(Of Integer)(CInt(CheckState.Indeterminate)) - ReadyForDownload = e.Value(Name_ReadyForDownload).FromXML(Of Boolean)(True) - ReadyForDownloadIgnore = e.Value(Name_ReadyForDownloadIgnore).FromXML(Of Boolean)(False) - Subscriptions = e.Value(Name_Subscriptions).FromXML(Of Boolean)(False) - SubscriptionsOnly = e.Value(Name_SubscriptionsOnly).FromXML(Of Boolean)(False) - UsersCount = e.Value(Name_UsersCount).FromXML(Of Integer)(0) Dim l As New ListAddParams(LAP.NotContainsOnly) + LabelsNo = e.Value(Name_LabelsNo).FromXML(Of Boolean)(False) If Not e.Value(Name_Labels).IsEmptyString Then Labels.ListAddList(e.Value(Name_Labels).Split("|"), l) If Not e.Value(Name_Labels_Excluded).IsEmptyString Then LabelsExcluded.ListAddList(e.Value(Name_Labels_Excluded).Split("|"), l) + LabelsExcludedIgnore = e.Value(Name_LabelsExcludedIgnore).FromXML(Of Boolean)(False) If Not e.Value(Name_Sites).IsEmptyString Then Sites.ListAddList(e.Value(Name_Sites).Split("|"), l) If Not e.Value(Name_Sites_Excluded).IsEmptyString Then SitesExcluded.ListAddList(e.Value(Name_Sites_Excluded).Split("|"), l) + + Regular = e.Value(Name_Regular).FromXML(Of Boolean)(True) + Temporary = e.Value(Name_Temporary).FromXML(Of Boolean)(True) + Favorite = e.Value(Name_Favorite).FromXML(Of Boolean)(True) + ReadyForDownload = e.Value(Name_ReadyForDownload).FromXML(Of Boolean)(True) + ReadyForDownloadIgnore = e.Value(Name_ReadyForDownloadIgnore).FromXML(Of Boolean)(False) + + If e.Contains(Name_SubscriptionsOnly) Then + DownloadUsers = Not e.Value(Name_SubscriptionsOnly).FromXML(Of Boolean)(False) + Else + DownloadUsers = e.Value(Name_DownloadUsers).FromXML(Of Boolean)(True) + End If + If e.Contains(Name_Subscriptions) Then + DownloadSubscriptions = e.Value(Name_Subscriptions).FromXML(Of Boolean)(False) + Else + DownloadSubscriptions = e.Value(Name_DownloadSubscriptions).FromXML(Of Boolean)(False) + End If + + UsersCount = e.Value(Name_UsersCount).FromXML(Of Integer)(0) + DaysNumber = e.Value(Name_DaysNumber).FromXML(Of Integer)(-1) + DaysIsDownloaded = e.Value(Name_DaysIsDownloaded).FromXML(Of Boolean)(False) + UserDeleted = e.Value(Name_UserDeleted).FromXML(Of Boolean)(False) + UserSuspended = e.Value(Name_UserSuspended).FromXML(Of Boolean)(True) + UserExists = e.Value(Name_UserExists).FromXML(Of Boolean)(True) + DateFrom = AConvert(Of Date)(e.Value(Name_DateFrom), DateTimeDefaultProvider, Nothing) + DateTo = AConvert(Of Date)(e.Value(Name_DateTo), DateTimeDefaultProvider, Nothing) + DateMode = e.Value(Name_DateMode).FromXML(Of Integer)(ShowingDates.Off) + IsViewFilter = e.Value(Name_IsViewFilter).FromXML(Of Boolean)(False) End Sub - Protected Function Export(ByVal e As EContainer) As EContainer + Protected Overridable Function Export(ByVal e As EContainer) As EContainer e.AddRange({New EContainer(Name_Name, Name), - New EContainer(Name_Temporary, CInt(Temporary)), - New EContainer(Name_Favorite, CInt(Favorite)), - New EContainer(Name_ReadyForDownload, ReadyForDownload.BoolToInteger), - New EContainer(Name_ReadyForDownloadIgnore, ReadyForDownloadIgnore.BoolToInteger), - New EContainer(Name_Subscriptions, Subscriptions.BoolToInteger), - New EContainer(Name_SubscriptionsOnly, SubscriptionsOnly.BoolToInteger), - New EContainer(Name_UsersCount, UsersCount), + New EContainer(Name_LabelsNo, LabelsNo.BoolToInteger), New EContainer(Name_Labels, Labels.ListToString("|")), New EContainer(Name_Labels_Excluded, LabelsExcluded.ListToString("|")), + New EContainer(Name_LabelsExcludedIgnore, LabelsExcludedIgnore.BoolToInteger), New EContainer(Name_Sites, Sites.ListToString("|")), - New EContainer(Name_Sites_Excluded, SitesExcluded.ListToString("|"))}) + New EContainer(Name_Sites_Excluded, SitesExcluded.ListToString("|")), + New EContainer(Name_Regular, Regular.BoolToInteger), + New EContainer(Name_Temporary, Temporary.BoolToInteger), + New EContainer(Name_Favorite, Favorite.BoolToInteger), + New EContainer(Name_ReadyForDownload, ReadyForDownload.BoolToInteger), + New EContainer(Name_ReadyForDownloadIgnore, ReadyForDownloadIgnore.BoolToInteger), + New EContainer(Name_DownloadUsers, DownloadUsers.BoolToInteger), + New EContainer(Name_DownloadSubscriptions, DownloadSubscriptions.BoolToInteger), + New EContainer(Name_UsersCount, UsersCount), + New EContainer(Name_DaysNumber, DaysNumber), + New EContainer(Name_DaysIsDownloaded, DaysIsDownloaded.BoolToInteger), + New EContainer(Name_UserDeleted, UserDeleted.BoolToInteger), + New EContainer(Name_UserSuspended, UserSuspended.BoolToInteger), + New EContainer(Name_UserExists, UserExists.BoolToInteger), + New EContainer(Name_DateFrom, AConvert(Of String)(DateFrom, DateTimeDefaultProvider, String.Empty)), + New EContainer(Name_DateTo, AConvert(Of String)(DateTo, DateTimeDefaultProvider, String.Empty)), + New EContainer(Name_DateMode, CInt(DateMode)), + New EContainer(Name_IsViewFilter, IsViewFilter.BoolToInteger)}) Return e End Function +#End Region #Region "IDisposable Support" Protected disposedValue As Boolean = False Protected Overridable Overloads Sub Dispose(ByVal disposing As Boolean) diff --git a/SCrawler/Editors/GlobalSettingsForm.Designer.vb b/SCrawler/Editors/GlobalSettingsForm.Designer.vb index 08aafe2..3677708 100644 --- a/SCrawler/Editors/GlobalSettingsForm.Designer.vb +++ b/SCrawler/Editors/GlobalSettingsForm.Designer.vb @@ -50,6 +50,7 @@ Namespace Editors Dim ActionButton10 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton() Dim TP_OPEN_INFO As System.Windows.Forms.TableLayoutPanel Dim TP_OPEN_PROGRESS As System.Windows.Forms.TableLayoutPanel + Dim TP_BEHAVIOR_F6 As System.Windows.Forms.TableLayoutPanel Dim TAB_DOWN As System.Windows.Forms.TabPage Dim TP_DOWNLOADING As System.Windows.Forms.TableLayoutPanel Dim ActionButton11 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton() @@ -140,6 +141,8 @@ Namespace Editors Me.CH_USE_DEF_ACC = New System.Windows.Forms.CheckBox() Me.CH_NOTIFY_LOG = New System.Windows.Forms.CheckBox() Me.CH_FEED_UP_FILE_LOC_MOVE = New System.Windows.Forms.CheckBox() + Me.CH_DOWN_ALL_F6_NOTIFY = New System.Windows.Forms.CheckBox() + Me.CH_DOWN_ALL_NOTIFY = New System.Windows.Forms.CheckBox() Me.TXT_CHANNELS_ROWS = New PersonalUtilities.Forms.Controls.TextBoxExtended() Me.TXT_CHANNELS_COLUMNS = New PersonalUtilities.Forms.Controls.TextBoxExtended() Me.CH_DOWN_IMAGES_NATIVE = New System.Windows.Forms.CheckBox() @@ -151,6 +154,7 @@ Namespace Editors Me.CH_DOWN_OPEN_INFO = New System.Windows.Forms.CheckBox() Me.CH_RECYCLE_DEL = New System.Windows.Forms.CheckBox() Me.CH_DOWN_OPEN_PROGRESS = New System.Windows.Forms.CheckBox() + Me.CH_DOWN_ALL_F6_USE = New System.Windows.Forms.CheckBox() Me.TXT_SCRIPT = New PersonalUtilities.Forms.Controls.TextBoxExtended() Me.TXT_DOWN_COMPLETE_SCRIPT = New PersonalUtilities.Forms.Controls.TextBoxExtended() Me.CH_UNAME_UP = New System.Windows.Forms.CheckBox() @@ -190,6 +194,7 @@ Namespace Editors Me.TAB_MAIN = New System.Windows.Forms.TabControl() Me.TAB_ENVIR = New System.Windows.Forms.TabPage() Me.CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer() + Me.CH_CHANNELS_USERS_READY_MARK = New System.Windows.Forms.CheckBox() TP_BASIS = New System.Windows.Forms.TableLayoutPanel() TP_IMAGES = New System.Windows.Forms.TableLayoutPanel() TP_FILE_NAME = New System.Windows.Forms.TableLayoutPanel() @@ -206,6 +211,7 @@ Namespace Editors TP_BEHAVIOR = New System.Windows.Forms.TableLayoutPanel() TP_OPEN_INFO = New System.Windows.Forms.TableLayoutPanel() TP_OPEN_PROGRESS = New System.Windows.Forms.TableLayoutPanel() + TP_BEHAVIOR_F6 = New System.Windows.Forms.TableLayoutPanel() TAB_DOWN = New System.Windows.Forms.TabPage() TP_DOWNLOADING = New System.Windows.Forms.TableLayoutPanel() TP_MISSING_DATA = New System.Windows.Forms.TableLayoutPanel() @@ -248,6 +254,7 @@ Namespace Editors CType(Me.TXT_CLOSE_SCRIPT, System.ComponentModel.ISupportInitialize).BeginInit() TP_OPEN_INFO.SuspendLayout() TP_OPEN_PROGRESS.SuspendLayout() + TP_BEHAVIOR_F6.SuspendLayout() TAB_DOWN.SuspendLayout() TP_DOWNLOADING.SuspendLayout() CType(Me.TXT_SCRIPT, System.ComponentModel.ISupportInitialize).BeginInit() @@ -1050,6 +1057,30 @@ Namespace Editors TT_MAIN.SetToolTip(Me.CH_FEED_UP_FILE_LOC_MOVE, "The file location will be updated in the session data and in the feeds data") Me.CH_FEED_UP_FILE_LOC_MOVE.UseVisualStyleBackColor = True ' + 'CH_DOWN_ALL_F6_NOTIFY + ' + Me.CH_DOWN_ALL_F6_NOTIFY.AutoSize = True + Me.CH_DOWN_ALL_F6_NOTIFY.Dock = System.Windows.Forms.DockStyle.Fill + Me.CH_DOWN_ALL_F6_NOTIFY.Location = New System.Drawing.Point(210, 4) + Me.CH_DOWN_ALL_F6_NOTIFY.Name = "CH_DOWN_ALL_F6_NOTIFY" + Me.CH_DOWN_ALL_F6_NOTIFY.Size = New System.Drawing.Size(199, 17) + Me.CH_DOWN_ALL_F6_NOTIFY.TabIndex = 1 + Me.CH_DOWN_ALL_F6_NOTIFY.Text = "'F6' confirmation" + TT_MAIN.SetToolTip(Me.CH_DOWN_ALL_F6_NOTIFY, "Request confirmation to download all users when pressing 'F6'") + Me.CH_DOWN_ALL_F6_NOTIFY.UseVisualStyleBackColor = True + ' + 'CH_DOWN_ALL_NOTIFY + ' + Me.CH_DOWN_ALL_NOTIFY.AutoSize = True + Me.CH_DOWN_ALL_NOTIFY.Dock = System.Windows.Forms.DockStyle.Fill + Me.CH_DOWN_ALL_NOTIFY.Location = New System.Drawing.Point(416, 4) + Me.CH_DOWN_ALL_NOTIFY.Name = "CH_DOWN_ALL_NOTIFY" + Me.CH_DOWN_ALL_NOTIFY.Size = New System.Drawing.Size(199, 17) + Me.CH_DOWN_ALL_NOTIFY.TabIndex = 2 + Me.CH_DOWN_ALL_NOTIFY.Text = "Confirmation of downloading all" + TT_MAIN.SetToolTip(Me.CH_DOWN_ALL_NOTIFY, "Request confirmation to download all users anyway") + Me.CH_DOWN_ALL_NOTIFY.UseVisualStyleBackColor = True + ' 'TP_CHANNELS_IMGS ' TP_CHANNELS_IMGS.ColumnCount = 2 @@ -1171,15 +1202,17 @@ Namespace Editors TP_CHANNELS.Controls.Add(Me.CH_COPY_CHANNEL_USER_IMAGE, 0, 2) TP_CHANNELS.Controls.Add(Me.CH_CHANNELS_USERS_TEMP, 0, 4) TP_CHANNELS.Controls.Add(Me.CH_COPY_CHANNEL_USER_IMAGE_ALL, 0, 3) + TP_CHANNELS.Controls.Add(Me.CH_CHANNELS_USERS_READY_MARK, 0, 5) TP_CHANNELS.Dock = System.Windows.Forms.DockStyle.Fill TP_CHANNELS.Location = New System.Drawing.Point(3, 3) TP_CHANNELS.Name = "TP_CHANNELS" - TP_CHANNELS.RowCount = 6 + TP_CHANNELS.RowCount = 7 TP_CHANNELS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) TP_CHANNELS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) TP_CHANNELS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) TP_CHANNELS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) TP_CHANNELS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) + TP_CHANNELS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) TP_CHANNELS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) TP_CHANNELS.Size = New System.Drawing.Size(615, 393) TP_CHANNELS.TabIndex = 0 @@ -1226,10 +1259,11 @@ Namespace Editors TP_BEHAVIOR.Controls.Add(TP_OPEN_INFO, 0, 4) TP_BEHAVIOR.Controls.Add(Me.CH_RECYCLE_DEL, 0, 3) TP_BEHAVIOR.Controls.Add(TP_OPEN_PROGRESS, 0, 5) + TP_BEHAVIOR.Controls.Add(TP_BEHAVIOR_F6, 0, 8) TP_BEHAVIOR.Dock = System.Windows.Forms.DockStyle.Fill TP_BEHAVIOR.Location = New System.Drawing.Point(0, 0) TP_BEHAVIOR.Name = "TP_BEHAVIOR" - TP_BEHAVIOR.RowCount = 9 + TP_BEHAVIOR.RowCount = 10 TP_BEHAVIOR.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) TP_BEHAVIOR.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) TP_BEHAVIOR.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) @@ -1238,8 +1272,10 @@ Namespace Editors TP_BEHAVIOR.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) TP_BEHAVIOR.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) TP_BEHAVIOR.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) + TP_BEHAVIOR.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) TP_BEHAVIOR.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) TP_BEHAVIOR.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!)) + TP_BEHAVIOR.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!)) TP_BEHAVIOR.Size = New System.Drawing.Size(621, 399) TP_BEHAVIOR.TabIndex = 0 ' @@ -1376,6 +1412,36 @@ Namespace Editors Me.CH_DOWN_OPEN_PROGRESS.Text = "Open the 'Progress' form when the download starts" Me.CH_DOWN_OPEN_PROGRESS.UseVisualStyleBackColor = True ' + 'TP_BEHAVIOR_F6 + ' + TP_BEHAVIOR_F6.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.[Single] + TP_BEHAVIOR_F6.ColumnCount = 3 + TP_BEHAVIOR_F6.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333!)) + TP_BEHAVIOR_F6.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333!)) + TP_BEHAVIOR_F6.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333!)) + TP_BEHAVIOR_F6.Controls.Add(Me.CH_DOWN_ALL_F6_USE, 0, 0) + TP_BEHAVIOR_F6.Controls.Add(Me.CH_DOWN_ALL_F6_NOTIFY, 1, 0) + TP_BEHAVIOR_F6.Controls.Add(Me.CH_DOWN_ALL_NOTIFY, 2, 0) + TP_BEHAVIOR_F6.Dock = System.Windows.Forms.DockStyle.Fill + TP_BEHAVIOR_F6.Location = New System.Drawing.Point(1, 215) + TP_BEHAVIOR_F6.Margin = New System.Windows.Forms.Padding(0) + TP_BEHAVIOR_F6.Name = "TP_BEHAVIOR_F6" + TP_BEHAVIOR_F6.RowCount = 1 + TP_BEHAVIOR_F6.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) + TP_BEHAVIOR_F6.Size = New System.Drawing.Size(619, 25) + TP_BEHAVIOR_F6.TabIndex = 8 + ' + 'CH_DOWN_ALL_F6_USE + ' + Me.CH_DOWN_ALL_F6_USE.AutoSize = True + Me.CH_DOWN_ALL_F6_USE.Dock = System.Windows.Forms.DockStyle.Fill + Me.CH_DOWN_ALL_F6_USE.Location = New System.Drawing.Point(4, 4) + Me.CH_DOWN_ALL_F6_USE.Name = "CH_DOWN_ALL_F6_USE" + Me.CH_DOWN_ALL_F6_USE.Size = New System.Drawing.Size(199, 17) + Me.CH_DOWN_ALL_F6_USE.TabIndex = 0 + Me.CH_DOWN_ALL_F6_USE.Text = "Use 'F6' to download all users" + Me.CH_DOWN_ALL_F6_USE.UseVisualStyleBackColor = True + ' 'TAB_DOWN ' TAB_DOWN.Controls.Add(TP_DOWNLOADING) @@ -2273,6 +2339,17 @@ Namespace Editors Me.CONTAINER_MAIN.TabIndex = 0 Me.CONTAINER_MAIN.TopToolStripPanelVisible = False ' + 'CH_CHANNELS_USERS_READY_MARK + ' + Me.CH_CHANNELS_USERS_READY_MARK.AutoSize = True + Me.CH_CHANNELS_USERS_READY_MARK.Dock = System.Windows.Forms.DockStyle.Fill + Me.CH_CHANNELS_USERS_READY_MARK.Location = New System.Drawing.Point(4, 140) + Me.CH_CHANNELS_USERS_READY_MARK.Name = "CH_CHANNELS_USERS_READY_MARK" + Me.CH_CHANNELS_USERS_READY_MARK.Size = New System.Drawing.Size(607, 19) + Me.CH_CHANNELS_USERS_READY_MARK.TabIndex = 5 + Me.CH_CHANNELS_USERS_READY_MARK.Text = "Set the user's mark 'Ready for download' when add from channels" + Me.CH_CHANNELS_USERS_READY_MARK.UseVisualStyleBackColor = True + ' 'GlobalSettingsForm ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -2325,6 +2402,8 @@ Namespace Editors TP_OPEN_INFO.PerformLayout() TP_OPEN_PROGRESS.ResumeLayout(False) TP_OPEN_PROGRESS.PerformLayout() + TP_BEHAVIOR_F6.ResumeLayout(False) + TP_BEHAVIOR_F6.PerformLayout() TAB_DOWN.ResumeLayout(False) TP_DOWNLOADING.ResumeLayout(False) TP_DOWNLOADING.PerformLayout() @@ -2475,5 +2554,9 @@ Namespace Editors Private WithEvents TXT_H_DEF_sec_ch_ua_full_version_list As PersonalUtilities.Forms.Controls.TextBoxExtended Private WithEvents TXT_H_DEF_sec_ch_ua_platform As PersonalUtilities.Forms.Controls.TextBoxExtended Private WithEvents TXT_H_DEF_sec_ch_ua_platform_version As PersonalUtilities.Forms.Controls.TextBoxExtended + Private WithEvents CH_DOWN_ALL_F6_USE As CheckBox + Private WithEvents CH_DOWN_ALL_F6_NOTIFY As CheckBox + Private WithEvents CH_DOWN_ALL_NOTIFY As CheckBox + Private WithEvents CH_CHANNELS_USERS_READY_MARK As CheckBox End Class End Namespace \ No newline at end of file diff --git a/SCrawler/Editors/GlobalSettingsForm.resx b/SCrawler/Editors/GlobalSettingsForm.resx index a8fd728..7060d2a 100644 --- a/SCrawler/Editors/GlobalSettingsForm.resx +++ b/SCrawler/Editors/GlobalSettingsForm.resx @@ -291,6 +291,9 @@ You can find more detailed information about the missing posts in the form that False + + False + False diff --git a/SCrawler/Editors/GlobalSettingsForm.vb b/SCrawler/Editors/GlobalSettingsForm.vb index f95dcdf..7b83470 100644 --- a/SCrawler/Editors/GlobalSettingsForm.vb +++ b/SCrawler/Editors/GlobalSettingsForm.vb @@ -72,6 +72,9 @@ Namespace Editors TXT_FOLDER_CMD.Checked = .OpenFolderInOtherProgram.Attribute TXT_CLOSE_SCRIPT.Text = .ClosingCommand TXT_CLOSE_SCRIPT.Checked = .ClosingCommand.Attribute + CH_DOWN_ALL_F6_USE.Checked = .DownloadAll_UseF6 + CH_DOWN_ALL_F6_NOTIFY.Checked = .DownloadAll_UseF6_Confirm + CH_DOWN_ALL_NOTIFY.Checked = .DownloadAll_Confirm 'Notifications CH_NOTIFY_SILENT.Checked = .NotificationsSilentMode CH_NOTIFY_SHOW_BASE.Checked = .ShowNotifications @@ -108,7 +111,7 @@ Namespace Editors CH_STD_YT_CREATE_URL.Checked = .STDownloader_CreateUrlFiles 'Downloading CH_UDESCR_UP.Checked = .UpdateUserDescriptionEveryTime - CH_UNAME_UP.Checked = .UserSiteNameUpdateEveryTime + CH_UNAME_UP.Checked = .UpdateUserSiteNameEveryTime CH_UICON_UP.Checked = .UpdateUserIconBannerEveryTime TXT_SCRIPT.Checked = .ScriptData.Attribute TXT_SCRIPT.Text = .ScriptData.Value @@ -135,6 +138,7 @@ Namespace Editors CH_COPY_CHANNEL_USER_IMAGE_ALL.Checked = .ChannelsAddUserImagesFromAllChannels CH_COPY_CHANNEL_USER_IMAGE_ALL.Enabled = CH_COPY_CHANNEL_USER_IMAGE.Checked CH_CHANNELS_USERS_TEMP.Checked = .ChannelsDefaultTemporary + CH_CHANNELS_USERS_READY_MARK.Checked = .ChannelsDefaultReadyForDownload 'Feed TXT_FEED_ROWS.Value = .FeedDataRows.Value TXT_FEED_COLUMNS.Value = .FeedDataColumns.Value @@ -256,6 +260,9 @@ Namespace Editors .OpenFolderInOtherProgram.Attribute.Value = TXT_FOLDER_CMD.Checked .ClosingCommand.Value = TXT_CLOSE_SCRIPT.Text .ClosingCommand.Attribute.Value = TXT_CLOSE_SCRIPT.Checked + .DownloadAll_UseF6.Value = CH_DOWN_ALL_F6_USE.Checked + .DownloadAll_UseF6_Confirm.Value = CH_DOWN_ALL_F6_NOTIFY.Checked + .DownloadAll_Confirm.Value = CH_DOWN_ALL_NOTIFY.Checked 'Notifications .NotificationsSilentMode = CH_NOTIFY_SILENT.Checked .ShowNotifications.Value = CH_NOTIFY_SHOW_BASE.Checked @@ -289,7 +296,7 @@ Namespace Editors .STDownloader_CreateUrlFiles.Value = CH_STD_YT_CREATE_URL.Checked 'Downloading .UpdateUserDescriptionEveryTime.Value = CH_UDESCR_UP.Checked - .UserSiteNameUpdateEveryTime.Value = CH_UNAME_UP.Checked + .UpdateUserSiteNameEveryTime.Value = CH_UNAME_UP.Checked .UpdateUserIconBannerEveryTime.Value = CH_UICON_UP.Checked .ScriptData.Value = TXT_SCRIPT.Text .ScriptData.Attribute.Value = TXT_SCRIPT.Checked @@ -320,6 +327,7 @@ Namespace Editors .FromChannelCopyImageToUser.Value = CH_COPY_CHANNEL_USER_IMAGE.Checked .ChannelsAddUserImagesFromAllChannels.Value = CH_COPY_CHANNEL_USER_IMAGE_ALL.Checked .ChannelsDefaultTemporary.Value = CH_CHANNELS_USERS_TEMP.Checked + .ChannelsDefaultReadyForDownload.Value = CH_CHANNELS_USERS_READY_MARK.Checked 'Feed .FeedDataRows.Value = CInt(TXT_FEED_ROWS.Value) .FeedDataColumns.Value = CInt(TXT_FEED_COLUMNS.Value) diff --git a/SCrawler/LabelsKeeper.vb b/SCrawler/LabelsKeeper.vb index 08387f1..00b0c8a 100644 --- a/SCrawler/LabelsKeeper.vb +++ b/SCrawler/LabelsKeeper.vb @@ -22,19 +22,22 @@ Friend Class LabelsKeeper : Implements ICollection(Of String), IMyEnumerator(Of Return NewLabels.Count > 0 End Get End Property - Friend ReadOnly Property Current As XMLValuesCollection(Of String) - Friend ReadOnly Property Excluded As XMLValuesCollection(Of String) - Friend ReadOnly Property ExcludedIgnore As XMLValue(Of Boolean) + 'URGENT: remove these properties (2024.03) + Friend ReadOnly Property Current As XMLValuesCollection(Of String) + Friend ReadOnly Property Excluded As XMLValuesCollection(Of String) + Friend ReadOnly Property ExcludedIgnore As XMLValue(Of Boolean) Friend Sub New(ByRef x As XmlFile) LabelsList = New List(Of String) NewLabels = New List(Of String) If LabelsFile.Exists Then LabelsList.ListAddList(IO.File.ReadAllLines(LabelsFile), LAP.NotContainsOnly) +#Disable Warning BC40008 Current = New XMLValuesCollection(Of String)(IXMLValuesCollection.Modes.String, "LatestSelectedLabels",, x) With {.ListAddParameters = LAP.NotContainsOnly} Excluded = New XMLValuesCollection(Of String)(IXMLValuesCollection.Modes.String, "LatestExcludedLabels",, x) With {.ListAddParameters = LAP.NotContainsOnly} ExcludedIgnore = New XMLValue(Of Boolean)("LatestExcludedLabelsIgnore", False, x) Dim lp As New ListAddParams(LAP.NotContainsOnly + LAP.IgnoreICopier) If Current.Count > 0 Then LabelsList.ListAddList(Current, lp) If Excluded.Count > 0 Then LabelsList.ListAddList(Excluded, lp) +#Enable Warning End Sub Friend ReadOnly Property ToList As List(Of String) Get @@ -109,7 +112,9 @@ Friend Class LabelsKeeper : Implements ICollection(Of String), IMyEnumerator(Of Private disposedValue As Boolean = False Protected Overridable Overloads Sub Dispose(ByVal disposing As Boolean) If Not disposedValue Then +#Disable Warning BC40008 If disposing Then Clear() : Current.Dispose() : Excluded.Dispose() +#Enable Warning disposedValue = True End If End Sub diff --git a/SCrawler/ListImagesLoader.vb b/SCrawler/ListImagesLoader.vb index debb380..fc5e5dc 100644 --- a/SCrawler/ListImagesLoader.vb +++ b/SCrawler/ListImagesLoader.vb @@ -11,6 +11,14 @@ Imports SCrawler.API Imports SCrawler.API.Base Friend Class ListImagesLoader Private ReadOnly Property MyList As ListView + Private Class AdvDistinctComparer : Implements IEqualityComparer(Of IUserData) + Private Overloads Function Equals(ByVal x As IUserData, ByVal y As IUserData) As Boolean Implements IEqualityComparer(Of IUserData).Equals + Return DirectCast(x, UserDataBase).LVIKey.CompareTo(DirectCast(y, UserDataBase).LVIKey) + End Function + Private Overloads Function GetHashCode(ByVal Obj As IUserData) As Integer Implements IEqualityComparer(Of IUserData).GetHashCode + Return DirectCast(Obj, UserDataBase).GetHashCode + End Function + End Class Private Structure UserOption : Implements IComparable(Of UserOption) Friend ReadOnly User As IUserData Friend ReadOnly LVI As ListViewItem @@ -110,10 +118,10 @@ Friend Class ListImagesLoader If Settings.FastProfilesLoading Then Settings.Users.ListReindex - If Settings.ShowingMode.Value = ShowingModes.AdvancedFilter Then + If Not Settings.ShowAllUsers Then UserDataList = GetAdvancedFilteredUsers(Of UserOption)() Else - UserDataList = (From u As IUserData In Settings.Users Where u.FitToAddParams Select New UserOption(u, MyList)).ListIfNothing + UserDataList = Settings.Users.Select(Function(u) New UserOption(u, MyList)).ToList End If If UserDataList.ListExists Then UserDataList.Sort() @@ -134,18 +142,16 @@ Friend Class ListImagesLoader Dim t As New List(Of Task) Dim advUsers As List(Of IUserData) = Nothing Dim isAdv As Boolean = False - If Settings.ShowingMode.Value = ShowingModes.AdvancedFilter Then + If Not Settings.ShowAllUsers Then isAdv = True advUsers = GetAdvancedFilteredUsers(Of IUserData)() If Not advUsers.ListExists Then UpdateInProgress = False : MyList.EndUpdate() : Exit Sub End If For Each User As IUserData In If(isAdv, advUsers, Settings.Users) - If User.FitToAddParams Then - If Settings.ViewModeIsPicture Then - t.Add(Task.Run(Sub() UpdateUser(User, True))) - Else - UpdateUser(User, True) - End If + If Settings.ViewModeIsPicture Then + t.Add(Task.Run(Sub() UpdateUser(User, True))) + Else + UpdateUser(User, True) End If Next If t.Count > 0 Then Task.WhenAll(t.ToArray) : t.Clear() @@ -168,7 +174,11 @@ Friend Class ListImagesLoader With Settings.AdvancedFilter.GetUsers If .ListExists Then With ListAddList(Nothing, .Select(Function(u) Settings.GetUser(u, True)), LAP.NotContainsOnly, LAP.IgnoreICopier) - If .ListExists Then Return If(GetType(T) Is GetType(UserOption), .Select(Function(u) New UserOption(u, MyList)).ToList, .Self) + If .ListExists Then + With .Distinct(New AdvDistinctComparer) + Return If(GetType(T) Is GetType(UserOption), .Select(Function(u) New UserOption(u, MyList)).ToList, .Self.ToList) + End With + End If End With End If End With diff --git a/SCrawler/MainFrame.Designer.vb b/SCrawler/MainFrame.Designer.vb index fdc7a28..52c206a 100644 --- a/SCrawler/MainFrame.Designer.vb +++ b/SCrawler/MainFrame.Designer.vb @@ -33,8 +33,6 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form Dim CONTEXT_SEP_5 As System.Windows.Forms.ToolStripSeparator Dim SEP_4 As System.Windows.Forms.ToolStripSeparator Dim MENU_VIEW_SEP_2 As System.Windows.Forms.ToolStripSeparator - Dim MENU_VIEW_SEP_4 As System.Windows.Forms.ToolStripSeparator - Dim MENU_VIEW_SEP_3 As System.Windows.Forms.ToolStripSeparator Dim TRAY_SEP_1 As System.Windows.Forms.ToolStripSeparator Dim MENU_DOWN_ALL_SEP_1 As System.Windows.Forms.ToolStripSeparator Dim TRAY_SEP_2 As System.Windows.Forms.ToolStripSeparator @@ -43,7 +41,6 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form Dim MENU_DOWN_ALL_SEP_4 As System.Windows.Forms.ToolStripSeparator Dim MENU_INFO As System.Windows.Forms.ToolStripDropDownButton Dim MENU_VIEW_SEP_1 As System.Windows.Forms.ToolStripSeparator - Dim MENU_VIEW_SEP_5 As System.Windows.Forms.ToolStripSeparator Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(MainFrame)) Me.MENU_INFO_SHOW_INFO = New System.Windows.Forms.ToolStripMenuItem() Me.MENU_INFO_SHOW_QUEUE = New System.Windows.Forms.ToolStripMenuItem() @@ -61,16 +58,8 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form Me.BTT_DOWN_SAVED = New System.Windows.Forms.ToolStripButton() Me.MENU_DOWN_ALL = New System.Windows.Forms.ToolStripDropDownButton() Me.BTT_DOWN_SELECTED = New SCrawler.ToolStripKeyMenuItem() - Me.MENU_D_DOWN_ALL = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_DOWN_ALL = New SCrawler.ToolStripKeyMenuItem() - Me.BTT_DOWN_ALL_SUBSCR = New SCrawler.ToolStripKeyMenuItem() - Me.BTT_DOWN_SITE = New SCrawler.ToolStripKeyMenuItem() - Me.BTT_DOWN_SITE_SUBSCR = New SCrawler.ToolStripKeyMenuItem() - Me.MENU_D_DOWN_ALL_SITE = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_DOWN_ALL_FULL = New SCrawler.ToolStripKeyMenuItem() - Me.BTT_DOWN_ALL_FULL_SUBSCR = New SCrawler.ToolStripKeyMenuItem() - Me.BTT_DOWN_SITE_FULL = New SCrawler.ToolStripKeyMenuItem() - Me.BTT_DOWN_SITE_FULL_SUBSCR = New SCrawler.ToolStripKeyMenuItem() Me.BTT_DOWN_SPEC = New SCrawler.ToolStripKeyMenuItem() Me.BTT_DOWN_VIDEO = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_ADD_NEW_GROUP = New System.Windows.Forms.ToolStripMenuItem() @@ -83,26 +72,12 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form Me.BTT_VIEW_SMALL = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_VIEW_LIST = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_VIEW_DETAILS = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_MODE_SHOW_USERS = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_MODE_SHOW_SUBSCRIPTIONS = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SITE_ALL = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SITE_SPECIFIC = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_SHOW_ALL = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SHOW_REGULAR = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SHOW_TEMP = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SHOW_FAV = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SHOW_DELETED = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SHOW_SUSPENDED = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SHOW_LABELS = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SHOW_NO_LABELS = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SHOW_EXCLUDED_LABELS = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SHOW_EXCLUDED_LABELS_IGNORE = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_SHOW_SHOW_GROUPS = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_SHOW_GROUP_USERS = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_SHOW_FILTER_ADV = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SHOW_LIMIT_DATES_NOT = New System.Windows.Forms.ToolStripMenuItem() - Me.BTT_SHOW_LIMIT_DATES_IN = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_VIEW_FILTER_SAVE = New System.Windows.Forms.ToolStripMenuItem() + Me.BTT_VIEW_FILTER_SAVE_AS_GROUP = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_VIEW_FILTER_LOAD = New System.Windows.Forms.ToolStripMenuItem() Me.BTT_LOG = New System.Windows.Forms.ToolStripButton() Me.BTT_VERSION_INFO = New System.Windows.Forms.ToolStripButton() @@ -158,8 +133,6 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form CONTEXT_SEP_5 = New System.Windows.Forms.ToolStripSeparator() SEP_4 = New System.Windows.Forms.ToolStripSeparator() MENU_VIEW_SEP_2 = New System.Windows.Forms.ToolStripSeparator() - MENU_VIEW_SEP_4 = New System.Windows.Forms.ToolStripSeparator() - MENU_VIEW_SEP_3 = New System.Windows.Forms.ToolStripSeparator() TRAY_SEP_1 = New System.Windows.Forms.ToolStripSeparator() MENU_DOWN_ALL_SEP_1 = New System.Windows.Forms.ToolStripSeparator() TRAY_SEP_2 = New System.Windows.Forms.ToolStripSeparator() @@ -168,7 +141,6 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form MENU_DOWN_ALL_SEP_4 = New System.Windows.Forms.ToolStripSeparator() MENU_INFO = New System.Windows.Forms.ToolStripDropDownButton() MENU_VIEW_SEP_1 = New System.Windows.Forms.ToolStripSeparator() - MENU_VIEW_SEP_5 = New System.Windows.Forms.ToolStripSeparator() Me.Toolbar_TOP.SuspendLayout() Me.Toolbar_BOTTOM.SuspendLayout() Me.USER_CONTEXT.SuspendLayout() @@ -228,17 +200,7 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form 'MENU_VIEW_SEP_2 ' MENU_VIEW_SEP_2.Name = "MENU_VIEW_SEP_2" - MENU_VIEW_SEP_2.Size = New System.Drawing.Size(228, 6) - ' - 'MENU_VIEW_SEP_4 - ' - MENU_VIEW_SEP_4.Name = "MENU_VIEW_SEP_4" - MENU_VIEW_SEP_4.Size = New System.Drawing.Size(228, 6) - ' - 'MENU_VIEW_SEP_3 - ' - MENU_VIEW_SEP_3.Name = "MENU_VIEW_SEP_3" - MENU_VIEW_SEP_3.Size = New System.Drawing.Size(228, 6) + MENU_VIEW_SEP_2.Size = New System.Drawing.Size(268, 6) ' 'TRAY_SEP_1 ' @@ -319,12 +281,7 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form 'MENU_VIEW_SEP_1 ' MENU_VIEW_SEP_1.Name = "MENU_VIEW_SEP_1" - MENU_VIEW_SEP_1.Size = New System.Drawing.Size(228, 6) - ' - 'MENU_VIEW_SEP_5 - ' - MENU_VIEW_SEP_5.Name = "MENU_VIEW_SEP_5" - MENU_VIEW_SEP_5.Size = New System.Drawing.Size(228, 6) + MENU_VIEW_SEP_1.Size = New System.Drawing.Size(268, 6) ' 'MENU_SETTINGS ' @@ -419,7 +376,7 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form 'MENU_DOWN_ALL ' Me.MENU_DOWN_ALL.AutoToolTip = False - Me.MENU_DOWN_ALL.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_DOWN_SELECTED, Me.MENU_D_DOWN_ALL, Me.MENU_D_DOWN_ALL_SITE, Me.BTT_DOWN_SPEC, MENU_DOWN_ALL_SEP_1, Me.BTT_DOWN_VIDEO, MENU_DOWN_ALL_SEP_2, Me.BTT_ADD_NEW_GROUP, MENU_DOWN_ALL_SEP_3, Me.BTT_SILENT_MODE, MENU_DOWN_ALL_SEP_4, Me.BTT_DOWN_AUTOMATION, Me.BTT_DOWN_AUTOMATION_PAUSE}) + Me.MENU_DOWN_ALL.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_DOWN_SELECTED, Me.BTT_DOWN_ALL, Me.BTT_DOWN_ALL_FULL, Me.BTT_DOWN_SPEC, MENU_DOWN_ALL_SEP_1, Me.BTT_DOWN_VIDEO, MENU_DOWN_ALL_SEP_2, Me.BTT_ADD_NEW_GROUP, MENU_DOWN_ALL_SEP_3, Me.BTT_SILENT_MODE, MENU_DOWN_ALL_SEP_4, Me.BTT_DOWN_AUTOMATION, Me.BTT_DOWN_AUTOMATION_PAUSE}) Me.MENU_DOWN_ALL.Image = Global.SCrawler.My.Resources.Resources.StartPic_Green_16 Me.MENU_DOWN_ALL.ImageTransparentColor = System.Drawing.Color.Magenta Me.MENU_DOWN_ALL.Name = "MENU_DOWN_ALL" @@ -436,96 +393,25 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form Me.BTT_DOWN_SELECTED.Text = "Download selected (F5)" Me.BTT_DOWN_SELECTED.ToolTipText = "Download selected user." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "F5: download, include in the feed." ' - 'MENU_D_DOWN_ALL - ' - Me.MENU_D_DOWN_ALL.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_DOWN_ALL, Me.BTT_DOWN_ALL_SUBSCR, Me.BTT_DOWN_SITE, Me.BTT_DOWN_SITE_SUBSCR}) - Me.MENU_D_DOWN_ALL.Image = Global.SCrawler.My.Resources.Resources.StartPic_Green_16 - Me.MENU_D_DOWN_ALL.Name = "MENU_D_DOWN_ALL" - Me.MENU_D_DOWN_ALL.Size = New System.Drawing.Size(221, 22) - Me.MENU_D_DOWN_ALL.Text = "Download all (F6)" - ' 'BTT_DOWN_ALL ' Me.BTT_DOWN_ALL.AutoToolTip = True Me.BTT_DOWN_ALL.Image = Global.SCrawler.My.Resources.Resources.StartPic_Green_16 Me.BTT_DOWN_ALL.Name = "BTT_DOWN_ALL" - Me.BTT_DOWN_ALL.Size = New System.Drawing.Size(237, 22) + Me.BTT_DOWN_ALL.Size = New System.Drawing.Size(221, 22) Me.BTT_DOWN_ALL.Text = "Download all (F6)" Me.BTT_DOWN_ALL.ToolTipText = "Download all users marked 'Ready for download' from all sites." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "F6: download, inc" & "lude in the feed." - ' - 'BTT_DOWN_ALL_SUBSCR - ' - Me.BTT_DOWN_ALL_SUBSCR.AutoToolTip = True - Me.BTT_DOWN_ALL_SUBSCR.Image = Global.SCrawler.My.Resources.Resources.StartPic_Green_16 - Me.BTT_DOWN_ALL_SUBSCR.Name = "BTT_DOWN_ALL_SUBSCR" - Me.BTT_DOWN_ALL_SUBSCR.Size = New System.Drawing.Size(237, 22) - Me.BTT_DOWN_ALL_SUBSCR.Text = "Download all subscriptions" - Me.BTT_DOWN_ALL_SUBSCR.ToolTipText = "Download all subscriptions marked 'Ready for download' from all sites." - ' - 'BTT_DOWN_SITE - ' - Me.BTT_DOWN_SITE.AutoToolTip = True - Me.BTT_DOWN_SITE.Image = Global.SCrawler.My.Resources.Resources.StartPic_Green_16 - Me.BTT_DOWN_SITE.Name = "BTT_DOWN_SITE" - Me.BTT_DOWN_SITE.Size = New System.Drawing.Size(237, 22) - Me.BTT_DOWN_SITE.Text = "Download all site users" - Me.BTT_DOWN_SITE.ToolTipText = "Download all users marked 'Ready for download' from specific sites." - ' - 'BTT_DOWN_SITE_SUBSCR - ' - Me.BTT_DOWN_SITE_SUBSCR.AutoToolTip = True - Me.BTT_DOWN_SITE_SUBSCR.Image = Global.SCrawler.My.Resources.Resources.StartPic_Green_16 - Me.BTT_DOWN_SITE_SUBSCR.Name = "BTT_DOWN_SITE_SUBSCR" - Me.BTT_DOWN_SITE_SUBSCR.Size = New System.Drawing.Size(237, 22) - Me.BTT_DOWN_SITE_SUBSCR.Text = "Download all site subscriptions" - Me.BTT_DOWN_SITE_SUBSCR.ToolTipText = "Download all subscriptions marked 'Ready for download' from specific sites." - ' - 'MENU_D_DOWN_ALL_SITE - ' - Me.MENU_D_DOWN_ALL_SITE.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_DOWN_ALL_FULL, Me.BTT_DOWN_ALL_FULL_SUBSCR, Me.BTT_DOWN_SITE_FULL, Me.BTT_DOWN_SITE_FULL_SUBSCR}) - Me.MENU_D_DOWN_ALL_SITE.Image = Global.SCrawler.My.Resources.Resources.StartPic_Green_16 - Me.MENU_D_DOWN_ALL_SITE.Name = "MENU_D_DOWN_ALL_SITE" - Me.MENU_D_DOWN_ALL_SITE.Size = New System.Drawing.Size(221, 22) - Me.MENU_D_DOWN_ALL_SITE.Text = "Download all [FULL]" ' 'BTT_DOWN_ALL_FULL ' Me.BTT_DOWN_ALL_FULL.AutoToolTip = True Me.BTT_DOWN_ALL_FULL.Image = Global.SCrawler.My.Resources.Resources.StartPic_Green_16 Me.BTT_DOWN_ALL_FULL.Name = "BTT_DOWN_ALL_FULL" - Me.BTT_DOWN_ALL_FULL.Size = New System.Drawing.Size(274, 22) + Me.BTT_DOWN_ALL_FULL.Size = New System.Drawing.Size(221, 22) Me.BTT_DOWN_ALL_FULL.Text = "Download all [FULL]" Me.BTT_DOWN_ALL_FULL.ToolTipText = "Download all users from all sites. The 'Ready for download' option will be ignore" & "d." - ' - 'BTT_DOWN_ALL_FULL_SUBSCR - ' - Me.BTT_DOWN_ALL_FULL_SUBSCR.AutoToolTip = True - Me.BTT_DOWN_ALL_FULL_SUBSCR.Image = Global.SCrawler.My.Resources.Resources.StartPic_Green_16 - Me.BTT_DOWN_ALL_FULL_SUBSCR.Name = "BTT_DOWN_ALL_FULL_SUBSCR" - Me.BTT_DOWN_ALL_FULL_SUBSCR.Size = New System.Drawing.Size(274, 22) - Me.BTT_DOWN_ALL_FULL_SUBSCR.Text = "Download all subscriptions [FULL]" - Me.BTT_DOWN_ALL_FULL_SUBSCR.ToolTipText = "Download all subscriptions from all sites. The 'Ready for download' option will b" & - "e ignored." - ' - 'BTT_DOWN_SITE_FULL - ' - Me.BTT_DOWN_SITE_FULL.AutoToolTip = True - Me.BTT_DOWN_SITE_FULL.Image = Global.SCrawler.My.Resources.Resources.StartPic_Green_16 - Me.BTT_DOWN_SITE_FULL.Name = "BTT_DOWN_SITE_FULL" - Me.BTT_DOWN_SITE_FULL.Size = New System.Drawing.Size(274, 22) - Me.BTT_DOWN_SITE_FULL.Text = "Download all site users [FULL]" - Me.BTT_DOWN_SITE_FULL.ToolTipText = resources.GetString("BTT_DOWN_SITE_FULL.ToolTipText") - ' - 'BTT_DOWN_SITE_FULL_SUBSCR - ' - Me.BTT_DOWN_SITE_FULL_SUBSCR.AutoToolTip = True - Me.BTT_DOWN_SITE_FULL_SUBSCR.Image = Global.SCrawler.My.Resources.Resources.StartPic_Green_16 - Me.BTT_DOWN_SITE_FULL_SUBSCR.Name = "BTT_DOWN_SITE_FULL_SUBSCR" - Me.BTT_DOWN_SITE_FULL_SUBSCR.Size = New System.Drawing.Size(274, 22) - Me.BTT_DOWN_SITE_FULL_SUBSCR.Text = "Download all site subscriptions [FULL]" - Me.BTT_DOWN_SITE_FULL_SUBSCR.ToolTipText = resources.GetString("BTT_DOWN_SITE_FULL_SUBSCR.ToolTipText") ' 'BTT_DOWN_SPEC ' @@ -592,7 +478,7 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form 'MENU_VIEW ' Me.MENU_VIEW.AutoToolTip = False - Me.MENU_VIEW.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_VIEW_LARGE, Me.BTT_VIEW_SMALL, Me.BTT_VIEW_LIST, Me.BTT_VIEW_DETAILS, MENU_VIEW_SEP_1, Me.BTT_MODE_SHOW_USERS, Me.BTT_MODE_SHOW_SUBSCRIPTIONS, MENU_VIEW_SEP_2, Me.BTT_SITE_ALL, Me.BTT_SITE_SPECIFIC, MENU_VIEW_SEP_3, Me.BTT_SHOW_ALL, Me.BTT_SHOW_REGULAR, Me.BTT_SHOW_TEMP, Me.BTT_SHOW_FAV, Me.BTT_SHOW_DELETED, Me.BTT_SHOW_SUSPENDED, Me.BTT_SHOW_LABELS, Me.BTT_SHOW_NO_LABELS, Me.BTT_SHOW_EXCLUDED_LABELS, Me.BTT_SHOW_EXCLUDED_LABELS_IGNORE, Me.BTT_SHOW_SHOW_GROUPS, Me.BTT_SHOW_GROUP_USERS, Me.BTT_SHOW_FILTER_ADV, MENU_VIEW_SEP_4, Me.BTT_SHOW_LIMIT_DATES_NOT, Me.BTT_SHOW_LIMIT_DATES_IN, MENU_VIEW_SEP_5, Me.BTT_VIEW_FILTER_SAVE, Me.BTT_VIEW_FILTER_LOAD}) + Me.MENU_VIEW.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_VIEW_LARGE, Me.BTT_VIEW_SMALL, Me.BTT_VIEW_LIST, Me.BTT_VIEW_DETAILS, MENU_VIEW_SEP_1, Me.BTT_SHOW_ALL, Me.BTT_SHOW_SHOW_GROUPS, Me.BTT_SHOW_GROUP_USERS, Me.BTT_SHOW_FILTER_ADV, MENU_VIEW_SEP_2, Me.BTT_VIEW_FILTER_SAVE, Me.BTT_VIEW_FILTER_SAVE_AS_GROUP, Me.BTT_VIEW_FILTER_LOAD}) Me.MENU_VIEW.Image = CType(resources.GetObject("MENU_VIEW.Image"), System.Drawing.Image) Me.MENU_VIEW.ImageTransparentColor = System.Drawing.Color.Magenta Me.MENU_VIEW.Name = "MENU_VIEW" @@ -602,128 +488,44 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form 'BTT_VIEW_LARGE ' Me.BTT_VIEW_LARGE.Name = "BTT_VIEW_LARGE" - Me.BTT_VIEW_LARGE.Size = New System.Drawing.Size(231, 22) + Me.BTT_VIEW_LARGE.Size = New System.Drawing.Size(271, 22) Me.BTT_VIEW_LARGE.Text = "Large images" ' 'BTT_VIEW_SMALL ' Me.BTT_VIEW_SMALL.Name = "BTT_VIEW_SMALL" - Me.BTT_VIEW_SMALL.Size = New System.Drawing.Size(231, 22) + Me.BTT_VIEW_SMALL.Size = New System.Drawing.Size(271, 22) Me.BTT_VIEW_SMALL.Text = "Small images" ' 'BTT_VIEW_LIST ' Me.BTT_VIEW_LIST.Name = "BTT_VIEW_LIST" - Me.BTT_VIEW_LIST.Size = New System.Drawing.Size(231, 22) + Me.BTT_VIEW_LIST.Size = New System.Drawing.Size(271, 22) Me.BTT_VIEW_LIST.Text = "List" ' 'BTT_VIEW_DETAILS ' Me.BTT_VIEW_DETAILS.Name = "BTT_VIEW_DETAILS" - Me.BTT_VIEW_DETAILS.Size = New System.Drawing.Size(231, 22) + Me.BTT_VIEW_DETAILS.Size = New System.Drawing.Size(271, 22) Me.BTT_VIEW_DETAILS.Text = "Details" ' - 'BTT_MODE_SHOW_USERS - ' - Me.BTT_MODE_SHOW_USERS.CheckOnClick = True - Me.BTT_MODE_SHOW_USERS.Name = "BTT_MODE_SHOW_USERS" - Me.BTT_MODE_SHOW_USERS.Size = New System.Drawing.Size(231, 22) - Me.BTT_MODE_SHOW_USERS.Text = "Show users" - ' - 'BTT_MODE_SHOW_SUBSCRIPTIONS - ' - Me.BTT_MODE_SHOW_SUBSCRIPTIONS.CheckOnClick = True - Me.BTT_MODE_SHOW_SUBSCRIPTIONS.Name = "BTT_MODE_SHOW_SUBSCRIPTIONS" - Me.BTT_MODE_SHOW_SUBSCRIPTIONS.Size = New System.Drawing.Size(231, 22) - Me.BTT_MODE_SHOW_SUBSCRIPTIONS.Text = "Show subscriptions" - ' - 'BTT_SITE_ALL - ' - Me.BTT_SITE_ALL.Name = "BTT_SITE_ALL" - Me.BTT_SITE_ALL.Size = New System.Drawing.Size(231, 22) - Me.BTT_SITE_ALL.Text = "All" - ' - 'BTT_SITE_SPECIFIC - ' - Me.BTT_SITE_SPECIFIC.Name = "BTT_SITE_SPECIFIC" - Me.BTT_SITE_SPECIFIC.Size = New System.Drawing.Size(231, 22) - Me.BTT_SITE_SPECIFIC.Text = "Specific sites" - ' 'BTT_SHOW_ALL ' Me.BTT_SHOW_ALL.Name = "BTT_SHOW_ALL" - Me.BTT_SHOW_ALL.Size = New System.Drawing.Size(231, 22) + Me.BTT_SHOW_ALL.Size = New System.Drawing.Size(271, 22) Me.BTT_SHOW_ALL.Text = "All" ' - 'BTT_SHOW_REGULAR - ' - Me.BTT_SHOW_REGULAR.Name = "BTT_SHOW_REGULAR" - Me.BTT_SHOW_REGULAR.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_REGULAR.Text = "Regular" - ' - 'BTT_SHOW_TEMP - ' - Me.BTT_SHOW_TEMP.Name = "BTT_SHOW_TEMP" - Me.BTT_SHOW_TEMP.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_TEMP.Text = "Temporary" - ' - 'BTT_SHOW_FAV - ' - Me.BTT_SHOW_FAV.Name = "BTT_SHOW_FAV" - Me.BTT_SHOW_FAV.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_FAV.Text = "Favorites" - ' - 'BTT_SHOW_DELETED - ' - Me.BTT_SHOW_DELETED.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.BTT_SHOW_DELETED.ForeColor = System.Drawing.Color.Maroon - Me.BTT_SHOW_DELETED.Name = "BTT_SHOW_DELETED" - Me.BTT_SHOW_DELETED.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_DELETED.Text = "Deleted" - ' - 'BTT_SHOW_SUSPENDED - ' - Me.BTT_SHOW_SUSPENDED.BackColor = System.Drawing.Color.PapayaWhip - Me.BTT_SHOW_SUSPENDED.ForeColor = System.Drawing.Color.SaddleBrown - Me.BTT_SHOW_SUSPENDED.Name = "BTT_SHOW_SUSPENDED" - Me.BTT_SHOW_SUSPENDED.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_SUSPENDED.Text = "Suspended" - ' - 'BTT_SHOW_LABELS - ' - Me.BTT_SHOW_LABELS.Name = "BTT_SHOW_LABELS" - Me.BTT_SHOW_LABELS.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_LABELS.Text = "Labels" - ' - 'BTT_SHOW_NO_LABELS - ' - Me.BTT_SHOW_NO_LABELS.Name = "BTT_SHOW_NO_LABELS" - Me.BTT_SHOW_NO_LABELS.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_NO_LABELS.Text = "No labels" - ' - 'BTT_SHOW_EXCLUDED_LABELS - ' - Me.BTT_SHOW_EXCLUDED_LABELS.Name = "BTT_SHOW_EXCLUDED_LABELS" - Me.BTT_SHOW_EXCLUDED_LABELS.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_EXCLUDED_LABELS.Text = "Excluded labels" - ' - 'BTT_SHOW_EXCLUDED_LABELS_IGNORE - ' - Me.BTT_SHOW_EXCLUDED_LABELS_IGNORE.Name = "BTT_SHOW_EXCLUDED_LABELS_IGNORE" - Me.BTT_SHOW_EXCLUDED_LABELS_IGNORE.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_EXCLUDED_LABELS_IGNORE.Text = "Ignore excluded labels" - ' 'BTT_SHOW_SHOW_GROUPS ' Me.BTT_SHOW_SHOW_GROUPS.Name = "BTT_SHOW_SHOW_GROUPS" - Me.BTT_SHOW_SHOW_GROUPS.Size = New System.Drawing.Size(231, 22) + Me.BTT_SHOW_SHOW_GROUPS.Size = New System.Drawing.Size(271, 22) Me.BTT_SHOW_SHOW_GROUPS.Text = "Show groups instead of labels" ' 'BTT_SHOW_GROUP_USERS ' Me.BTT_SHOW_GROUP_USERS.AutoToolTip = True Me.BTT_SHOW_GROUP_USERS.Name = "BTT_SHOW_GROUP_USERS" - Me.BTT_SHOW_GROUP_USERS.Size = New System.Drawing.Size(231, 22) + Me.BTT_SHOW_GROUP_USERS.Size = New System.Drawing.Size(271, 22) Me.BTT_SHOW_GROUP_USERS.Text = "Group users" Me.BTT_SHOW_GROUP_USERS.ToolTipText = "Group users by site or labels" ' @@ -731,37 +533,27 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form ' Me.BTT_SHOW_FILTER_ADV.AutoToolTip = True Me.BTT_SHOW_FILTER_ADV.Name = "BTT_SHOW_FILTER_ADV" - Me.BTT_SHOW_FILTER_ADV.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_FILTER_ADV.Text = "Advanced filter" - Me.BTT_SHOW_FILTER_ADV.ToolTipText = "Advanced filter of users you want to display" - ' - 'BTT_SHOW_LIMIT_DATES_NOT - ' - Me.BTT_SHOW_LIMIT_DATES_NOT.AutoToolTip = True - Me.BTT_SHOW_LIMIT_DATES_NOT.Name = "BTT_SHOW_LIMIT_DATES_NOT" - Me.BTT_SHOW_LIMIT_DATES_NOT.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_LIMIT_DATES_NOT.Text = "Limit dates (not in range)" - Me.BTT_SHOW_LIMIT_DATES_NOT.ToolTipText = "Filter users whose last download date is not in the selected date range" - ' - 'BTT_SHOW_LIMIT_DATES_IN - ' - Me.BTT_SHOW_LIMIT_DATES_IN.AutoToolTip = True - Me.BTT_SHOW_LIMIT_DATES_IN.Name = "BTT_SHOW_LIMIT_DATES_IN" - Me.BTT_SHOW_LIMIT_DATES_IN.Size = New System.Drawing.Size(231, 22) - Me.BTT_SHOW_LIMIT_DATES_IN.Text = "Limit dates (in range)" - Me.BTT_SHOW_LIMIT_DATES_IN.ToolTipText = "Filter users whose last download date is in the selected date range" + Me.BTT_SHOW_FILTER_ADV.Size = New System.Drawing.Size(271, 22) + Me.BTT_SHOW_FILTER_ADV.Text = "Filter" + Me.BTT_SHOW_FILTER_ADV.ToolTipText = "Filter of users you want to display" ' 'BTT_VIEW_FILTER_SAVE ' Me.BTT_VIEW_FILTER_SAVE.Name = "BTT_VIEW_FILTER_SAVE" - Me.BTT_VIEW_FILTER_SAVE.Size = New System.Drawing.Size(231, 22) + Me.BTT_VIEW_FILTER_SAVE.Size = New System.Drawing.Size(271, 22) Me.BTT_VIEW_FILTER_SAVE.Text = "Save current view" ' + 'BTT_VIEW_FILTER_SAVE_AS_GROUP + ' + Me.BTT_VIEW_FILTER_SAVE_AS_GROUP.Name = "BTT_VIEW_FILTER_SAVE_AS_GROUP" + Me.BTT_VIEW_FILTER_SAVE_AS_GROUP.Size = New System.Drawing.Size(271, 22) + Me.BTT_VIEW_FILTER_SAVE_AS_GROUP.Text = "Save current view as download group" + ' 'BTT_VIEW_FILTER_LOAD ' Me.BTT_VIEW_FILTER_LOAD.AutoToolTip = True Me.BTT_VIEW_FILTER_LOAD.Name = "BTT_VIEW_FILTER_LOAD" - Me.BTT_VIEW_FILTER_LOAD.Size = New System.Drawing.Size(231, 22) + Me.BTT_VIEW_FILTER_LOAD.Size = New System.Drawing.Size(271, 22) Me.BTT_VIEW_FILTER_LOAD.Text = "Load view (from saved)" Me.BTT_VIEW_FILTER_LOAD.ToolTipText = "Load one of your previously saved views" ' @@ -1154,39 +946,23 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form Private WithEvents BTT_CONTEXT_ADD_TO_COL As ToolStripMenuItem Private WithEvents BTT_REFRESH As ToolStripButton Private WithEvents BTT_SHOW_ALL As ToolStripMenuItem - Private WithEvents BTT_SHOW_REGULAR As ToolStripMenuItem - Private WithEvents BTT_SHOW_TEMP As ToolStripMenuItem - Private WithEvents BTT_SHOW_FAV As ToolStripMenuItem - Private WithEvents BTT_SHOW_LABELS As ToolStripMenuItem - Private WithEvents BTT_SHOW_NO_LABELS As ToolStripMenuItem Private WithEvents BTT_EDIT_USER As ToolStripButton Private WithEvents BTT_CONTEXT_GROUPS As PersonalUtilities.Forms.Controls.KeyClick.ToolStripMenuItemKeyClick Private WithEvents BTT_VERSION_INFO As ToolStripButton Private WithEvents BTT_CONTEXT_DOWN_LIMITED As ToolStripKeyMenuItem Private WithEvents BTT_CONTEXT_READY As ToolStripMenuItem - Private WithEvents BTT_SITE_ALL As ToolStripMenuItem - Private WithEvents BTT_SITE_SPECIFIC As ToolStripMenuItem Private WithEvents BTT_CONTEXT_CHANGE_FOLDER As ToolStripMenuItem Private WithEvents BTT_DOWN_SAVED As ToolStripButton Friend WithEvents TrayIcon As NotifyIcon Private WithEvents BTT_TRAY_SHOW_HIDE As ToolStripMenuItem Private WithEvents BTT_TRAY_CLOSE As ToolStripMenuItem Private WithEvents BTT_DONATE As ToolStripButton - Private WithEvents BTT_SHOW_DELETED As ToolStripMenuItem - Private WithEvents BTT_SHOW_SUSPENDED As ToolStripMenuItem - Private WithEvents BTT_SHOW_LIMIT_DATES_NOT As ToolStripMenuItem Private WithEvents BTT_VIEW_DETAILS As ToolStripMenuItem Private WithEvents COL_DEF As ColumnHeader Private WithEvents MENU_SETTINGS As ToolStripDropDownButton Private WithEvents BTT_PR_INFO As ToolStripStatusLabel Private WithEvents BTT_CONTEXT_DOWN_DATE_LIMIT As ToolStripKeyMenuItem - Private WithEvents BTT_DOWN_ALL As ToolStripKeyMenuItem - Private WithEvents BTT_DOWN_SITE As ToolStripKeyMenuItem - Private WithEvents BTT_DOWN_ALL_FULL As ToolStripKeyMenuItem - Private WithEvents BTT_DOWN_SITE_FULL As ToolStripKeyMenuItem Private WithEvents BTT_CONTEXT_SCRIPT As ToolStripMenuItem - Private WithEvents BTT_SHOW_EXCLUDED_LABELS As ToolStripMenuItem - Private WithEvents BTT_SHOW_EXCLUDED_LABELS_IGNORE As ToolStripMenuItem Private WithEvents BTT_SHOW_SHOW_GROUPS As ToolStripMenuItem Private WithEvents BTT_ADD_NEW_GROUP As ToolStripMenuItem Friend WithEvents BTT_TRAY_CLOSE_NO_SCRIPT As ToolStripMenuItem @@ -1195,7 +971,6 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form Friend WithEvents BTT_LOG As ToolStripButton Friend WithEvents Toolbar_TOP As ToolStrip Private WithEvents BTT_FEED As ToolStripButton - Private WithEvents BTT_SHOW_LIMIT_DATES_IN As ToolStripMenuItem Private WithEvents BTT_CONTEXT_COPY_TO_FOLDER As ToolStripMenuItem Private WithEvents BTT_TRAY_SILENT_MODE As ToolStripMenuItem Friend WithEvents BTT_TRAY_PAUSE_AUTOMATION As ToolStripMenuItem @@ -1209,14 +984,8 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form Private WithEvents BTT_CONTEXT_ERASE As ToolStripMenuItem Private WithEvents MENU_INFO_SHOW_MISSING As ToolStripMenuItem Private WithEvents MENU_INFO_SHOW_USER_METRICS As ToolStripMenuItem - Private WithEvents BTT_MODE_SHOW_USERS As ToolStripMenuItem - Private WithEvents BTT_MODE_SHOW_SUBSCRIPTIONS As ToolStripMenuItem - Private WithEvents MENU_D_DOWN_ALL As ToolStripMenuItem - Private WithEvents MENU_D_DOWN_ALL_SITE As ToolStripMenuItem - Private WithEvents BTT_DOWN_ALL_SUBSCR As ToolStripKeyMenuItem - Private WithEvents BTT_DOWN_SITE_SUBSCR As ToolStripKeyMenuItem - Private WithEvents BTT_DOWN_ALL_FULL_SUBSCR As ToolStripKeyMenuItem - Private WithEvents BTT_DOWN_SITE_FULL_SUBSCR As ToolStripKeyMenuItem + Private WithEvents BTT_DOWN_ALL As ToolStripKeyMenuItem + Private WithEvents BTT_DOWN_ALL_FULL As ToolStripKeyMenuItem Private WithEvents BTT_BUG_REPORT As ToolStripButton Private WithEvents MENU_INFO_SHOW_QUEUE As ToolStripMenuItem Private WithEvents BTT_DOWN_SPEC As ToolStripKeyMenuItem @@ -1225,4 +994,5 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form Private WithEvents BTT_SHOW_GROUP_USERS As ToolStripMenuItem Private WithEvents BTT_VIEW_FILTER_SAVE As ToolStripMenuItem Private WithEvents BTT_VIEW_FILTER_LOAD As ToolStripMenuItem + Private WithEvents BTT_VIEW_FILTER_SAVE_AS_GROUP As ToolStripMenuItem End Class \ No newline at end of file diff --git a/SCrawler/MainFrame.resx b/SCrawler/MainFrame.resx index 5e2fed1..e814de1 100644 --- a/SCrawler/MainFrame.resx +++ b/SCrawler/MainFrame.resx @@ -150,12 +150,6 @@ False - - False - - - False - False @@ -180,9 +174,6 @@ False - - False - 132, 17 @@ -221,16 +212,6 @@ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D TgDQASA1MVpwzwAAAABJRU5ErkJggg== - - - Download all users from specific sites. The 'Ready for download' option will be ignored. -Shift+Click to download, including non-existent users. -Ctrl+Shift+Click to download, excluding from the feed, including non-existent users. - - - Download all subscriptions from specific sites. The 'Ready for download' option will be ignored. -Shift+Click to download, including non-existent users. -Ctrl+Shift+Click to download, excluding from the feed, including non-existent users. 239, 17 diff --git a/SCrawler/MainFrame.vb b/SCrawler/MainFrame.vb index 1339876..d453fd1 100644 --- a/SCrawler/MainFrame.vb +++ b/SCrawler/MainFrame.vb @@ -15,6 +15,7 @@ Imports SCrawler.API Imports SCrawler.API.Base Imports SCrawler.Editors Imports SCrawler.DownloadObjects +Imports SCrawler.DownloadObjects.Groups Imports SCrawler.Plugin.Hosts Imports PauseModes = SCrawler.DownloadObjects.AutoDownloader.PauseModes Public Class MainFrame @@ -23,6 +24,9 @@ Public Class MainFrame Private WithEvents MyActivator As FormActivator Private WithEvents BTT_IMPORT_USERS As ToolStripMenuItem Private WithEvents BTT_NEW_PROFILE As ToolStripMenuItem + Private BTT_SHOW_ALL_GROUPS_ADDED As Boolean = False + Private WithEvents BTT_SHOW_ALL_GROUPS As ToolStripMenuItem + Private WithEvents BTT_GROUPS_OTHER As ToolStripMenuItem Friend MyChannels As ChannelViewForm Friend MySavedPosts As DownloadSavedPostsForm Private MyMissingPosts As MissingPostsForm @@ -50,6 +54,8 @@ Public Class MainFrame MENU_SETTINGS.DropDownItems.Insert(MENU_SETTINGS.DropDownItems.Count - 2, BTT_NEW_PROFILE) MENU_SETTINGS.DropDownItems.AddRange({New ToolStripSeparator, BTT_IMPORT_USERS}) BTT_BUG_REPORT.Image = My.Resources.MailPic_16 + BTT_GROUPS_OTHER = New ToolStripMenuItem("Other groups", DownloadGroup.GroupImage) + BTT_SHOW_ALL_GROUPS = New ToolStripMenuItem("Show all groups", DownloadGroup.GroupImage) End Sub #End Region #Region "Form handlers" @@ -105,15 +111,15 @@ Public Class MainFrame UserListLoader = New ListImagesLoader(LIST_PROFILES) RefillList() UpdateLabelsGroups() - SetShowButtonsCheckers(.ShowingMode.Value) + SetShowButtonsCheckers(.ShowAllUsers) CheckVersion(False) - ApplyView_Users_Sites_Dates() + UpdateUserGroupControls() With .Groups AddHandler .Added, AddressOf GROUPS_Added AddHandler .Deleted, AddressOf GROUPS_Deleted AddHandler .Updated, AddressOf GROUPS_Updated If .Count > 0 Then - For Each ugroup As Groups.DownloadGroup In Settings.Groups : GROUPS_Added(ugroup) : Next + For Each ugroup As DownloadGroup In Settings.Groups : GROUPS_Added(ugroup) : Next End If End With .Automation = New Scheduler @@ -229,7 +235,7 @@ CloseResume: Case Keys.F1 : BTT_VERSION_INFO.PerformClick() Case Keys.F3 : EditSelectedUser() Case Keys.F5 : DownloadSelectedUser(DownUserLimits.None, New MyKeyEventArgs(e).IncludeInTheFeed) - Case Keys.F6 : BTT_DOWN_ALL_FULL_KeyClick(Nothing, New MyKeyEventArgs(e)) + Case Keys.F6 : BTT_DOWN_ALL_KeyClick(Nothing, New MyKeyEventArgs(e)) Case Else : b = NumGroup(e) End Select @@ -502,77 +508,122 @@ CloseResume: Private Sub BTT_DOWN_SELECTED_KeyClick(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWN_SELECTED.KeyClick DownloadSelectedUser(DownUserLimits.None, e.IncludeInTheFeed) End Sub -#Region "Down all" Private Sub BTT_DOWN_ALL_KeyClick(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWN_ALL.KeyClick - Downloader.AddRange(Settings.GetUsers(Function(u) u.ReadyForDownload And UserExistsNonSubscriptionsPredicate.Invoke(u)), e.IncludeInTheFeed) + Dim ask As Boolean = False + With Settings + If e.KeyCode = Keys.F6 Then + If .DownloadAll_UseF6 Then + ask = .DownloadAll_UseF6_Confirm + Else + Exit Sub + End If + Else + ask = .DownloadAll_Confirm + End If + End With + If ask AndAlso MsgBoxE({"Are you sure you want to download all users?", "Download ALL"}, vbExclamation,,, {"Process", "Cancel"}) = 1 Then Exit Sub + Using group As New DownloadGroup(False) With {.DownloadSubscriptions = e.IncludeInTheFeed} : group.ProcessDownloadUsers(e.IncludeInTheFeed, False) : End Using End Sub - Private Sub BTT_DOWN_ALL_SUBSCR_KeyClick(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWN_ALL_SUBSCR.KeyClick - Downloader.AddRange(Settings.GetUsers(Function(u) u.ReadyForDownload And UserExistsSubscriptionsPredicate.Invoke(u)), e.IncludeInTheFeed) - End Sub - Private Sub BTT_DOWN_SITE_KeyClick(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWN_SITE.KeyClick - DownloadSiteFull(True, e.IncludeInTheFeed, False) - End Sub - Private Sub BTT_DOWN_SITE_SUBSCR_KeyClick(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWN_SITE_SUBSCR.KeyClick - DownloadSiteFull(True, e.IncludeInTheFeed, True) - End Sub -#End Region -#Region "Down full" Private Sub BTT_DOWN_ALL_FULL_KeyClick(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWN_ALL_FULL.KeyClick - Downloader.AddRange(Settings.GetUsers(UserExistsNonSubscriptionsPredicate), e.IncludeInTheFeed) + Using group As New DownloadGroup(False) With {.DownloadSubscriptions = e.IncludeInTheFeed, .ReadyForDownloadIgnore = True} : group.ProcessDownloadUsers(e.IncludeInTheFeed, False) : End Using End Sub - Private Sub BTT_DOWN_ALL_FULL_SUBSCR_KeyClick(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWN_ALL_FULL_SUBSCR.KeyClick - Downloader.AddRange(Settings.GetUsers(UserExistsSubscriptionsPredicate), e.IncludeInTheFeed) - End Sub - Private Sub BTT_DOWN_SITE_FULL_KeyClick(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWN_SITE_FULL.KeyClick - DownloadSiteFull(False, e.IncludeInTheFeed, False, e.Shift) - End Sub - Private Sub BTT_DOWN_SITE_FULL_SUBSCR_KeyClick(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWN_SITE_FULL_SUBSCR.KeyClick - DownloadSiteFull(False, e.IncludeInTheFeed, True, e.Shift) - End Sub -#End Region Private Sub BTT_DOWN_SPEC_KeyClick(ByVal Sender As Object, ByVal e As MyKeyEventArgs) Handles BTT_DOWN_SPEC.KeyClick - Dim group As Groups.DownloadGroup = Nothing - Using f As New Groups.GroupEditorForm(Nothing) With {.DownloadMode = True} + Dim group As DownloadGroup = Nothing + Using f As New GroupEditorForm(Nothing) With {.DownloadMode = True} f.ShowDialog() If f.DialogResult = DialogResult.OK AndAlso Not f.MyGroup Is Nothing Then group = f.MyGroup End Using - If Not group Is Nothing Then group.DownloadUsers(e.IncludeInTheFeed,, e.Shift) : group.Dispose() - End Sub - Private Sub DownloadSiteFull(ByVal ReadyForDownloadOnly As Boolean, ByVal IncludeInTheFeed As Boolean, - ByVal Subscription As Boolean, Optional ByVal IgnoreExists As Boolean = False) - Using f As New SiteSelectionForm(Settings.LatestDownloadedSites.ValuesList) - f.ShowDialog() - If f.DialogResult = DialogResult.OK AndAlso f.SelectedSites.Count > 0 Then - Settings.LatestDownloadedSites.Clear() - Settings.LatestDownloadedSites.AddRange(f.SelectedSites) - Settings.LatestDownloadedSites.Update() - Using g As New Groups.DownloadGroup - g.Sites.AddRange(f.SelectedSites) - g.ReadyForDownload = True - g.ReadyForDownloadIgnore = Not ReadyForDownloadOnly - If Subscription Then - g.Subscriptions = True - g.SubscriptionsOnly = True - End If - g.DownloadUsers(IncludeInTheFeed, ReadyForDownloadOnly, IgnoreExists) - End Using - End If - End Using + If Not group Is Nothing Then group.ProcessDownloadUsers(e.IncludeInTheFeed, False) : group.Dispose() End Sub #Region "Download groups" + Private Sub GROUPS_AddRemoveAllGroupsButton(Optional ByVal DValue As Integer = 0) + Try + If Settings.Groups.LongCount(Function(g) Not g.IsViewFilter) - DValue > 0 Then + If Not BTT_SHOW_ALL_GROUPS_ADDED Then + Dim i% = GetGroupIndex() + If i >= 0 Then + BTT_SHOW_ALL_GROUPS_ADDED = True + ControlInvoke(Toolbar_TOP, MENU_DOWN_ALL, Sub() MENU_DOWN_ALL.DropDownItems.Insert(i, BTT_SHOW_ALL_GROUPS)) + End If + End If + ElseIf BTT_SHOW_ALL_GROUPS_ADDED Then + ControlInvoke(Toolbar_TOP, MENU_DOWN_ALL, Sub() MENU_DOWN_ALL.DropDownItems.Remove(BTT_SHOW_ALL_GROUPS)) + BTT_SHOW_ALL_GROUPS_ADDED = False + End If + Catch + End Try + End Sub + Private Function GetGroupIndex() As Integer + If BTT_SHOW_ALL_GROUPS_ADDED Then + Return MENU_DOWN_ALL.DropDownItems.IndexOf(BTT_SHOW_ALL_GROUPS) + Else + Return MENU_DOWN_ALL.DropDownItems.IndexOf(BTT_ADD_NEW_GROUP) + End If + End Function Private Sub BTT_ADD_NEW_GROUP_Click(sender As Object, e As EventArgs) Handles BTT_ADD_NEW_GROUP.Click Settings.Groups.Add() End Sub - Private Sub GROUPS_Added(ByVal Sender As Groups.DownloadGroup) - Dim i% = MENU_DOWN_ALL.DropDownItems.IndexOf(BTT_ADD_NEW_GROUP) - ControlInvoke(Toolbar_TOP, MENU_DOWN_ALL, Sub() MENU_DOWN_ALL.DropDownItems.Insert(i, Sender.GetControl)) + Private Sub GROUPS_Added(ByVal Sender As DownloadGroup) + If Not Sender.IsViewFilter Then + Dim i% + If Sender.Index > 8 Then + If MENU_DOWN_ALL.DropDownItems.IndexOf(BTT_GROUPS_OTHER) = -1 Then + i = GetGroupIndex() + If i >= 0 Then MENU_DOWN_ALL.DropDownItems.Insert(i, BTT_GROUPS_OTHER) + End If + ControlInvoke(Toolbar_TOP, BTT_GROUPS_OTHER, Sub() BTT_GROUPS_OTHER.DropDownItems.Add(Sender.GetControl)) + Else + i = GetGroupIndex() + ControlInvoke(Toolbar_TOP, MENU_DOWN_ALL, Sub() MENU_DOWN_ALL.DropDownItems.Insert(i, Sender.GetControl)) + End If + GROUPS_AddRemoveAllGroupsButton() + End If End Sub - Private Sub GROUPS_Updated(ByVal Sender As Groups.DownloadGroup) - Dim i% = MENU_DOWN_ALL.DropDownItems.IndexOf(Sender.GetControl) - If i >= 0 Then ControlInvoke(Toolbar_TOP, MENU_DOWN_ALL, Sub() MENU_DOWN_ALL.DropDownItems(i).Text = Sender.ToString) + Private Sub GROUPS_Updated(ByVal Sender As DownloadGroup) + If Not Sender.IsViewFilter Then + Dim i% = BTT_GROUPS_OTHER.DropDownItems.IndexOf(Sender.GetControl) + If i >= 0 Then + ControlInvoke(Toolbar_TOP, BTT_GROUPS_OTHER, Sub() BTT_GROUPS_OTHER.DropDownItems(i).Text = Sender.ToString) + Else + i = MENU_DOWN_ALL.DropDownItems.IndexOf(Sender.GetControl) + If i >= 0 Then ControlInvoke(Toolbar_TOP, MENU_DOWN_ALL, Sub() MENU_DOWN_ALL.DropDownItems(i).Text = Sender.ToString) + End If + End If End Sub - Private Sub GROUPS_Deleted(ByVal Sender As Groups.DownloadGroup) - MENU_DOWN_ALL.DropDownItems.Remove(Sender.GetControl) + Private Sub GROUPS_Deleted(ByVal Sender As DownloadGroup) + If Not Sender.IsViewFilter Then + MENU_DOWN_ALL.DropDownItems.Remove(Sender.GetControl) + BTT_GROUPS_OTHER.DropDownItems.Remove(Sender.GetControl) + If BTT_GROUPS_OTHER.DropDownItems.Count = 0 Then MENU_DOWN_ALL.DropDownItems.Remove(BTT_GROUPS_OTHER) + GROUPS_AddRemoveAllGroupsButton(1) + End If + End Sub + Private Sub BTT_SHOW_ALL_GROUPS_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_ALL_GROUPS.Click + Try + Using f As New GroupListForm(False) + f.ShowDialog() + Dim g As DownloadGroup + With Settings.Groups + If .Count > 0 Then + If f.GroupsUpdated Then + For Each g In .Self + If Not g.IsViewFilter Then GROUPS_Deleted(g) + Next + For Each g In .Self + If Not g.IsViewFilter Then GROUPS_Added(g) + Next + End If + If Not f.GroupToDownload.IsEmptyString Then + Dim i% = .IndexOf(f.GroupToDownload) + If i >= 0 Then .Item(i).ProcessDownloadUsers(f.GroupToDownloadIncludeInTheFeed) + End If + End If + End With + End Using + Catch ex As Exception + ErrorsDescriber.Execute(EDP.SendToLog, ex, "[MainFrame.ShowGroups]") + MainFrameObj.UpdateLogButton() + End Try End Sub #End Region Private Sub BTT_SILENT_MODE_Click(sender As Object, e As EventArgs) Handles BTT_SILENT_MODE.Click, BTT_TRAY_SILENT_MODE.Click @@ -654,125 +705,30 @@ CloseResume: End If End Sub #End Region -#Region "2 - view mode users" - Private Sub BTT_MODE_SHOW_USERS_Click(sender As Object, e As EventArgs) Handles BTT_MODE_SHOW_USERS.Click - Settings.MainFrameUsersShowDefaults.Value = BTT_MODE_SHOW_USERS.Checked - RefillList() - End Sub - Private Sub BTT_MODE_SHOW_SUBSCRIPTIONS_Click(sender As Object, e As EventArgs) Handles BTT_MODE_SHOW_SUBSCRIPTIONS.Click - Settings.MainFrameUsersShowSubscriptions.Value = BTT_MODE_SHOW_SUBSCRIPTIONS.Checked - RefillList() - End Sub -#End Region -#Region "3 - view site" - Private Sub BTT_SITE_ALL_Click(sender As Object, e As EventArgs) Handles BTT_SITE_ALL.Click - Settings.SelectedSites.Clear() - Settings.SelectedSites.Update() - If Not BTT_SITE_ALL.Checked Then RefillList() - BTT_SITE_ALL.Checked = True - BTT_SITE_SPECIFIC.Checked = False - End Sub - Private Sub BTT_SITE_SPECIFIC_Click(sender As Object, e As EventArgs) Handles BTT_SITE_SPECIFIC.Click - Using f As New SiteSelectionForm(Settings.SelectedSites.ValuesList) - f.ShowDialog() - If f.DialogResult = DialogResult.OK Then - Settings.SelectedSites.Clear() - Settings.SelectedSites.AddRange(f.SelectedSites) - Settings.SelectedSites.Update() - BTT_SITE_SPECIFIC.Checked = Settings.SelectedSites.Count > 0 - BTT_SITE_ALL.Checked = Settings.SelectedSites.Count = 0 - RefillList() - End If - End Using - End Sub -#End Region -#Region "4 - view filters" +#Region "2 - view filters" Private Sub BTT_SHOW_ALL_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_ALL.Click - SetShowButtonsCheckers(ShowingModes.All) - End Sub - Private Sub BTT_SHOW_REGULAR_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_REGULAR.Click - SetShowButtonsCheckers(ShowingModes.Regular) - End Sub - Private Sub BTT_SHOW_TEMP_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_TEMP.Click - SetShowButtonsCheckers(ShowingModes.Temporary) - End Sub - Private Sub BTT_SHOW_FAV_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_FAV.Click - SetShowButtonsCheckers(ShowingModes.Favorite) - End Sub - Private Sub BTT_SHOW_DELETED_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_DELETED.Click - SetShowButtonsCheckers(ShowingModes.Deleted) - End Sub - Private Sub BTT_SHOW_SUSPENDED_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_SUSPENDED.Click - SetShowButtonsCheckers(ShowingModes.Suspended) - End Sub - Private Sub BTT_SHOW_LABELS_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_LABELS.Click - Dim b As Boolean = OpenLabelsForm(Settings.Labels.Current) - Dim m As ShowingModes - If Settings.Labels.Current.Count = 0 Then - m = Settings.ShowingMode.Value - If m = ShowingModes.Labels Then m = ShowingModes.All - Else - m = ShowingModes.Labels - End If - SetShowButtonsCheckers(m, Settings.ShowingMode.Value = ShowingModes.Labels And m = ShowingModes.Labels And b) - End Sub - Private Sub BTT_SHOW_NO_LABELS_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_NO_LABELS.Click - SetShowButtonsCheckers(ShowingModes.NoLabels) - End Sub - Private Sub BTT_SHOW_EXCLUDED_LABELS_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_EXCLUDED_LABELS.Click - Dim b As Boolean = OpenLabelsForm(Settings.Labels.Excluded) - SetExcludedButtonChecker() - If b Then RefillList() - End Sub - Private Sub BTT_SHOW_EXCLUDED_LABELS_IGNORE_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_EXCLUDED_LABELS_IGNORE.Click - Settings.Labels.ExcludedIgnore.Value = Not Settings.Labels.ExcludedIgnore.Value - If Settings.Labels.Excluded.Count > 0 Then RefillList() - SetExcludedButtonChecker() + SetShowButtonsCheckers(True) End Sub Private Sub BTT_SHOW_SHOW_GROUPS_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_SHOW_GROUPS.Click Settings.ShowGroupsInsteadLabels.Value = Not Settings.ShowGroupsInsteadLabels.Value - If Settings.ShowingMode.Value = ShowingModes.Labels Then RefillList() - SetShowButtonsCheckers(Settings.ShowingMode.Value) + SetShowButtonsCheckers(Settings.ShowAllUsers,, True) + RefillList() End Sub - Private Sub SetShowButtonsCheckers(ByVal m As ShowingModes, Optional ByVal ForceRefill As Boolean = False, Optional ByVal OnlyButtons As Boolean = False) - BTT_SHOW_ALL.Checked = m = ShowingModes.All - BTT_SHOW_REGULAR.Checked = m = ShowingModes.Regular - BTT_SHOW_TEMP.Checked = m = ShowingModes.Temporary - BTT_SHOW_FAV.Checked = m = ShowingModes.Favorite - BTT_SHOW_DELETED.Checked = m = ShowingModes.Deleted - BTT_SHOW_SUSPENDED.Checked = m = ShowingModes.Suspended - BTT_SHOW_LABELS.Checked = m = ShowingModes.Labels - BTT_SHOW_NO_LABELS.Checked = m = ShowingModes.NoLabels + Private Sub SetShowButtonsCheckers(ByVal ShowAll As Boolean, Optional ByVal ForceRefill As Boolean = False, Optional ByVal OnlyButtons As Boolean = False) + BTT_SHOW_ALL.Checked = ShowAll BTT_SHOW_SHOW_GROUPS.Checked = Settings.ShowGroupsInsteadLabels - BTT_SHOW_FILTER_ADV.Checked = m = ShowingModes.AdvancedFilter - SetExcludedButtonChecker() + BTT_SHOW_FILTER_ADV.Checked = Not ShowAll If Not OnlyButtons Then With Settings - If Not m = ShowingModes.Labels Then .Labels.Current.Clear() : .Labels.Current.Update() - If Not .ShowingMode.Value = m Or ForceRefill Then - .ShowingMode.Value = m + If Not .ShowAllUsers = ShowAll Or ForceRefill Then + .ShowAllUsers.Value = ShowAll RefillList() Else - .ShowingMode.Value = m + .ShowAllUsers.Value = ShowAll End If End With End If End Sub - Private Sub SetExcludedButtonChecker() - BTT_SHOW_EXCLUDED_LABELS.Checked = Settings.Labels.Excluded.Count > 0 - BTT_SHOW_EXCLUDED_LABELS_IGNORE.Checked = Settings.Labels.ExcludedIgnore - End Sub - Private Function OpenLabelsForm(ByRef ll As XML.Objects.XMLValuesCollection(Of String)) As Boolean - Using f As New LabelsForm(ll) With {.WithDeleteButton = True} - f.ShowDialog() - If f.DialogResult = DialogResult.OK Then - With ll : .Clear() : .AddRange(f.LabelsList) : .Update() : End With - Return True - Else - Return False - End If - End Using - End Function Private Sub BTT_SHOW_GROUP_USERS_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_GROUP_USERS.Click With Settings.GroupUsers .Value = Not .Value @@ -783,11 +739,11 @@ CloseResume: End Sub Private Sub BTT_SHOW_FILTER_ADV_Click(sender As Object, e As EventArgs) Handles BTT_SHOW_FILTER_ADV.Click Try - Using g As New Groups.GroupEditorForm(Settings.AdvancedFilter) With {.FilterMode = True} + Using g As New GroupEditorForm(Settings.AdvancedFilter) With {.FilterMode = True} g.ShowDialog() If g.DialogResult = DialogResult.OK Then Settings.AdvancedFilter.UpdateFile() - SetShowButtonsCheckers(ShowingModes.AdvancedFilter, True) + SetShowButtonsCheckers(False, True) End If End Using Catch ex As Exception @@ -795,57 +751,17 @@ CloseResume: End Try End Sub #End Region -#Region "5 - view dates" - Private Sub BTT_SHOW_LIMIT_DATES_NOT_IN_Click(ByVal Sender As ToolStripMenuItem, ByVal e As EventArgs) Handles BTT_SHOW_LIMIT_DATES_NOT.Click, - BTT_SHOW_LIMIT_DATES_IN.Click - Dim r As Boolean = False - Dim UpSettings As Action(Of Date?, Date?, ShowingDates) = Sub(ByVal _from As Date?, ByVal _to As Date?, ByVal Mode As ShowingDates) - With Settings - .BeginUpdate() - If Not .ViewDateMode.Value = CInt(Mode) Then r = True - .ViewDateMode.Value = CInt(Mode) - If Not Mode = ShowingDates.Off Then - If .ViewDateFrom.HasValue And _from.HasValue Then - If Not .ViewDateFrom.Value.Date = _from.Value.Date Then r = True - Else - r = True - End If - .ViewDateFrom = _from - If .ViewDateTo.HasValue And _to.HasValue Then - If Not .ViewDateTo.Value.Date = _to.Value.Date Then r = True - Else - r = True - End If - .ViewDateTo = _to - End If - .EndUpdate() - End With - End Sub - Using f As New DateTimeSelectionForm(DateTimeSelectionForm.ModesAllDate, Settings.Design) With { - .MyDateStart = Settings.ViewDateFrom, - .MyDateEnd = Settings.ViewDateTo, - .UseDeleteButton = True - } - f.ShowDialog() - Select Case f.DialogResult - Case DialogResult.Abort : UpSettings(f.MyDateStart, f.MyDateEnd, ShowingDates.Off) - Case DialogResult.OK : UpSettings(f.MyDateStart, f.MyDateEnd, Sender.Tag) - End Select - End Using - BTT_SHOW_LIMIT_DATES_NOT.Checked = Settings.ViewDateMode.Value = ShowingDates.Not - BTT_SHOW_LIMIT_DATES_IN.Checked = Settings.ViewDateMode.Value = ShowingDates.In - If r Then RefillList() - End Sub -#End Region -#Region "6 - saved filters" - Private Sub BTT_VIEW_FILTER_SAVE_Click(sender As Object, e As EventArgs) Handles BTT_VIEW_FILTER_SAVE.Click +#Region "3 - saved filters" + Private Sub BTT_VIEW_FILTER_SAVE_Click(sender As Object, e As EventArgs) Handles BTT_VIEW_FILTER_SAVE.Click, BTT_VIEW_FILTER_SAVE_AS_GROUP.Click Dim fName$ = String.Empty + Dim isFilter As Boolean = sender Is BTT_VIEW_FILTER_SAVE Dim __process As Boolean = False Do - fName = InputBoxE("Enter a new name for the view:", "Filter name", fName) + fName = InputBoxE($"Enter a new name for the {IIf(isFilter, "view", "group")}:", $"{IIf(isFilter, "Filter", "Group")} name", fName) If Not fName.IsEmptyString Then - If Settings.SavedFilters.IndexOf(fName) >= 0 Then - Select Case MsgBoxE({$"The '{fName}' filter already exists!", "Save filter"}, vbExclamation,,, {"Try again", "Replace", "Cancel"}).Index + If Settings.Groups.IndexOf(fName, isFilter) >= 0 Then + Select Case MsgBoxE({$"The '{fName}' {IIf(isFilter, "filter", "group")} already exists!", $"Save {IIf(isFilter, "filter", "group")}"}, + vbExclamation,,, {"Try again", "Replace", "Cancel"}).Index Case 1 : __process = True Case 2 : Exit Sub End Select @@ -857,49 +773,76 @@ CloseResume: End If Loop While Not __process If __process Then - Settings.SavedFilters.Add(ViewFilter.FromCurrent(fName)) - MsgBoxE({$"The '{fName}' filter has been saved", "Save filter"}) + Dim f As New DownloadGroup(Not isFilter) + f.Copy(Settings.AdvancedFilter) + f.IsViewFilter = isFilter + f.FilterViewMode = Settings.ViewMode + f.FilterGroupUsers = Settings.GroupUsers + f.FilterShowGroupsInsteadLabels = Settings.ShowGroupsInsteadLabels + f.Name = fName + Settings.Groups.Add(f, isFilter, True) + MsgBoxE({$"The '{fName}' {IIf(isFilter, "filter", "group")} has been saved", $"Save {IIf(isFilter, "filter", "group")}"}) End If End Sub Private Sub BTT_VIEW_FILTER_LOAD_Click(sender As Object, e As EventArgs) Handles BTT_VIEW_FILTER_LOAD.Click + Const msgTitle$ = "Load filter" Try - If Settings.SavedFilters.Count = 0 Then + If Settings.Groups.Count + Settings.Automation.Count = 0 Then MsgBoxE({"There are no saved filters", "Load filter"}, vbExclamation) Else - Using f As New SimpleListForm(Of ViewFilter)(Settings.SavedFilters, Settings.Design) With { - .DesignXMLNodeName = "SavedFiletrsForm", - .FormText = "Filters", - .Mode = SimpleListFormModes.SelectedItems, - .MultiSelect = False - } - If f.ShowDialog = DialogResult.OK Then - Dim filter As ViewFilter = f.DataResult.FirstOrDefault - If Not filter.Name.IsEmptyString Then - filter.Populate() - ApplyViewPattern(Settings.ViewMode.Value, True) - SetShowButtonsCheckers(Settings.ShowingMode.Value,, True) - ApplyView_Users_Sites_Dates() + Using f As New GroupListForm(True) + f.ShowDialog() + If f.DialogResult = DialogResult.OK Then + Dim filter As GroupParameters = f.FilterSelected + If Not filter Is Nothing AndAlso TypeOf filter Is AutoDownloader Then + With DirectCast(filter, AutoDownloader) + If .Mode = AutoDownloader.Modes.Groups Then + If .Groups.Count = 0 Then + MsgBoxE({"The scheduler plan you select doesn't contain any group!", msgTitle}, vbCritical) + Exit Sub + ElseIf .Groups.Count > 1 Then + MsgBoxE({"The scheduler plan you select contains more than one group." & vbCr & + "You need to choose a plan with one group or without groups!", msgTitle}, vbCritical) + Exit Sub + Else + Dim i% = Settings.Groups.IndexOf(.Groups(0)) + If i >= 0 Then + filter = Settings.Groups(i).Copy + Else + MsgBoxE({$"A group named '{ .Groups(0)}' cannot be found in existing groups.", msgTitle}, vbCritical) + filter = Nothing + Exit Sub + End If + End If + End If + End With + End If + If Not filter Is Nothing Then + If filter.IsViewFilter Then + With DirectCast(filter, DownloadGroup) + Settings.ViewMode.Value = .FilterViewMode + Settings.GroupUsers.Value = .FilterGroupUsers + Settings.ShowGroupsInsteadLabels.Value = .FilterShowGroupsInsteadLabels + End With + ApplyViewPattern(Settings.ViewMode.Value, True) + End If + Settings.AdvancedFilter.Copy(filter) + Settings.AdvancedFilter.UpdateFile() + SetShowButtonsCheckers(Settings.ShowAllUsers,, True) + UpdateUserGroupControls() RefillList() End If End If End Using End If Catch ex As Exception - ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Load filter") + ErrorsDescriber.Execute(EDP.LogMessageValue, ex, msgTitle) End Try End Sub - Private Sub ApplyView_Users_Sites_Dates() + Private Sub UpdateUserGroupControls() With Settings BTT_SHOW_GROUP_USERS.Checked = Settings.GroupUsers LIST_PROFILES.ShowGroups = Settings.GroupUsers - BTT_MODE_SHOW_USERS.Checked = .MainFrameUsersShowDefaults - BTT_MODE_SHOW_SUBSCRIPTIONS.Checked = .MainFrameUsersShowSubscriptions - BTT_SITE_ALL.Checked = .SelectedSites.Count = 0 - BTT_SITE_SPECIFIC.Checked = .SelectedSites.Count > 0 - BTT_SHOW_LIMIT_DATES_NOT.Tag = ShowingDates.Not - BTT_SHOW_LIMIT_DATES_NOT.Checked = .ViewDateMode.Value = ShowingDates.Not - BTT_SHOW_LIMIT_DATES_IN.Tag = ShowingDates.In - BTT_SHOW_LIMIT_DATES_IN.Checked = .ViewDateMode.Value = ShowingDates.In End With End Sub #End Region diff --git a/SCrawler/MainFrameObjects.vb b/SCrawler/MainFrameObjects.vb index 39e19ac..6a2c501 100644 --- a/SCrawler/MainFrameObjects.vb +++ b/SCrawler/MainFrameObjects.vb @@ -124,7 +124,11 @@ Friend Class MainFrameObjects : Implements INotificator #Region "LOG events support" Private _LogNotificationsEnabled As Boolean = True Private Sub ProgramLog_TextAdded(ByVal Sender As Object, ByVal e As EventArgs) - If _LogNotificationsEnabled Then _LogNotificationsEnabled = False : ShowNotification(NotifyObj.LOG, "There is new data in the log") + If _LogNotificationsEnabled Then + _LogNotificationsEnabled = False + ShowNotification(NotifyObj.LOG, "There is new data in the log") + Try : ControlInvokeFast(MF.Toolbar_TOP, MF.BTT_LOG, AddressOf UpdateLogButton, EDP.None) : Catch : End Try + End If End Sub Private Sub ProgramLog_TextCleared(ByVal Sender As Object, ByVal e As EventArgs) _LogNotificationsEnabled = True diff --git a/SCrawler/MainMod.vb b/SCrawler/MainMod.vb index 60ebfb3..aedd8fb 100644 --- a/SCrawler/MainMod.vb +++ b/SCrawler/MainMod.vb @@ -46,17 +46,6 @@ Friend Module MainMod List = View.Tile Details = View.Details End Enum - Friend Enum ShowingModes As Integer - All = 0 - Regular = 20 - Temporary = 50 - Favorite = 100 - Labels = 500 - NoLabels = 1000 - Deleted = 10000 - Suspended = 12000 - AdvancedFilter = 100000 - End Enum Friend Enum ShowingDates As Integer [Off] = 0 [Not] = 1 @@ -88,9 +77,6 @@ Friend Module MainMod Friend ReadOnly DateTimeDefaultProvider As New ADateTime(ADateTime.Formats.BaseDateTime) Friend ReadOnly SessionDateTimeProvider As New ADateTime("yyyyMMdd_HHmmss") Friend ReadOnly FeedVideoLengthProvider As New ADateTime("hh\:mm\:ss") With {.TimeParseMode = ADateTime.TimeModes.TimeSpan} - Friend ReadOnly UserExistsPredicate As New FPredicate(Of IUserData)(Function(u) u.Exists) - Friend ReadOnly UserExistsSubscriptionsPredicate As New FPredicate(Of IUserData)(Function(u) u.Exists And u.IsSubscription) - Friend ReadOnly UserExistsNonSubscriptionsPredicate As New FPredicate(Of IUserData)(Function(u) u.Exists And Not u.IsSubscription) Friend ReadOnly LogConnector As New LogHost Friend DefaultUserAgent As String = String.Empty #Region "NonExistingUsersLog" diff --git a/SCrawler/SCrawler.vbproj b/SCrawler/SCrawler.vbproj index 1a14eb3..ed9faff 100644 --- a/SCrawler/SCrawler.vbproj +++ b/SCrawler/SCrawler.vbproj @@ -301,6 +301,12 @@ Form + + GroupListForm.vb + + + Form + MissingPostsForm.vb @@ -505,7 +511,6 @@ Form - @@ -552,6 +557,9 @@ GroupEditorForm.vb + + GroupListForm.vb + MissingPostsForm.vb diff --git a/SCrawler/SettingsCLS.vb b/SCrawler/SettingsCLS.vb index 3639ab0..2a80fcc 100644 --- a/SCrawler/SettingsCLS.vb +++ b/SCrawler/SettingsCLS.vb @@ -20,6 +20,7 @@ Imports SCrawler.DownloadObjects Imports IDownloaderSettings = SCrawler.DownloadObjects.STDownloader.IDownloaderSettings Imports DoubleClickBehavior = SCrawler.DownloadObjects.STDownloader.DoubleClickBehavior Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable +#Region "Constants: defaults" Friend Const DefaultMaxDownloadingTasks As Integer = 5 Friend Const TaskStackNamePornSite As String = "Porn sites" Friend Const Name_Node_Sites As String = "Sites" @@ -29,15 +30,18 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable Friend Const CollectionsFolderName As String = "Collections" Private Const PermanentCacheSnapshotsPath As String = "_CacheSnapshots\" Friend Const DefaultCmdEncoding As Integer = BatchExecutor.UnicodeEncoding -#Region "CONSTANTS" +#End Region +#Region "Constants: headers" Friend Const HEADER_DEF_sec_ch_ua As String = "sec-ch-ua" Friend Const HEADER_DEF_sec_ch_ua_full_version_list As String = "sec-ch-ua-full-version-list" Friend Const HEADER_DEF_sec_ch_ua_platform As String = "sec-ch-ua-platform" Friend Const HEADER_DEF_sec_ch_ua_platform_version As String = "sec-ch-ua-platform-version" Friend Const HEADER_DEF_UserAgent As String = "UserAgent" #End Region +#Region "XML files" Friend ReadOnly Design As XmlFile Private ReadOnly MyXML As XmlFile +#End Region #Region "Media environment" Friend Class ProgramFile Private ReadOnly XML As XMLValue(Of SFile) @@ -116,6 +120,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable End Get End Property #End Region +#Region "Declarations" Friend ReadOnly Property Cache As CacheKeeper Private _CacheSnapshots As CacheKeeper = Nothing Friend ReadOnly Property CacheSnapshots(ByVal Permanent As Boolean) As CacheKeeper @@ -145,10 +150,11 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable Friend ReadOnly Property Feeds As FeedSpecialCollection Friend ReadOnly Property BlackList As List(Of UserBan) Friend ReadOnly Property Colors As Editors.DataColorCollection - Friend ReadOnly Property SavedFilters As ViewFilterCollection Friend Property FeedViews As FeedViewCollection Private ReadOnly BlackListFile As SFile = $"{SettingsFolderName}\BlackList.txt" Private ReadOnly UsersSettingsFile As SFile = $"{SettingsFolderName}\Users.xml" +#End Region +#Region "Initializer" Friend Sub New() CheckNewReleaseFolder() @@ -167,10 +173,20 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable GlobalLocations.Load(True,, $"{SettingsFolderName}\GlobalLocations.xml") Feeds = New FeedSpecialCollection Colors = New Editors.DataColorCollection - SavedFilters = New ViewFilterCollection - Dim n() As String = {"MediaEnvironment"} + AutomationFile = New XMLValue(Of String)("AutomationFile",, MyXML) + Dim n() As String + Dim n_old() As String 'URGENT: remove this line + Dim rn As Boolean = Not MyXML.File.Exists + SettingsReoranized = New XMLValue(Of Boolean)("SettingsReoranized", rn, MyXML) 'URGENT: remove this line + SettingsReoranized2 = New XMLValue(Of Boolean)("SettingsReoranized2", rn, MyXML) 'URGENT: remove this line + Dim forceSaveXML As Boolean = Not SettingsReoranized 'URGENT: remove this line + Dim forceSaveXML2 As Boolean = Not SettingsReoranized OrElse Not SettingsReoranized2 'URGENT: remove this line + +#Region "Properties: environment" + 'Environment + n = {"MediaEnvironment"} EnvironmentPath.CSFileP.Exists(SFO.Path, True) FfmpegFile = New ProgramFile("ffmpeg", MyXML, n, "ffmpeg.exe") FFMPEGNotification = New XMLValue(Of Boolean)("FFMPEGNotification", True, MyXML, n) @@ -184,18 +200,44 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable YtdlpFile = New ProgramFile("ytdlp", MyXML, n, "yt-dlp.exe") GalleryDLFile = New ProgramFile("gallerydl", MyXML, n, "gallery-dl.exe") CurlFile = New ProgramFile("curl", MyXML, n, "curl.exe", "cURL") - - GlobalPath = New XMLValue(Of SFile)("GlobalPath", New SFile($"{SFile.GetPath(Application.StartupPath).PathWithSeparator}Data\"), MyXML,, - New XMLToFilePathProvider) - LastCopyPath = New XMLValue(Of SFile)("LastCopyPath",, MyXML,, New XMLToFilePathProvider) - - SeparateVideoFolder = New XMLValue(Of Boolean)("SeparateVideoFolder", True, MyXML) - CollectionsPath = New XMLValue(Of String)("CollectionsPath", CollectionsFolderName, MyXML) - AutomationFile = New XMLValue(Of String)("AutomationFile",, MyXML) - - UserAgent = New XMLValue(Of String)("UserAgent",, MyXML) + CMDEncoding = New XMLValue(Of Integer)("CMDEncoding", DefaultCmdEncoding, MyXML, n) +#End Region +#Region "Properties" + 'Basis + n = {"Basis"} + GlobalPath = New XMLValue(Of SFile)("GlobalPath", "Data\".CSFileP, MyXML, n, New XMLToFilePathProvider) + MaxLargeImageHeight = New XMLValue(Of Integer)("MaxLargeImageHeight", 150, MyXML, n) + MaxSmallImageHeight = New XMLValue(Of Integer)("MaxSmallImageHeight", 15, MyXML, n) + CollectionsPath = New XMLValue(Of String)("CollectionsPath", CollectionsFolderName, MyXML, n) + MaxUsersJobsCount = New XMLValue(Of Integer)("MaxJobsCount", DefaultMaxDownloadingTasks, MyXML, n) + UserAgent = New XMLValue(Of String)("UserAgent",, MyXML, n) + If Not SettingsReoranized Then UserAgent.Value = New XMLValue(Of String)("UserAgent",, MyXML).Value 'URGENT: remove this line If Not UserAgent.IsEmptyString Then DefaultUserAgent = UserAgent + ImgurClientID = New XMLValue(Of String)("ImgurClientID", String.Empty, MyXML, {Name_Node_Sites}) + 'Basis: new version + n = {"ProgramVersion"} + CheckUpdatesAtStart = New XMLValue(Of Boolean)("CheckUpdatesAtStart", True, MyXML, n) + ShowNewVersionNotification = New XMLValue(Of Boolean)("ShowNewVersionNotification", True, MyXML, n) + LatestVersion = New XMLValue(Of String)("LatestVersion", String.Empty, MyXML, n) + + 'Design + n = {"Design"} + ProgramText = New XMLValue(Of String)("ProgramText",, MyXML, n) + ProgramDescription = New XMLValue(Of String)("ProgramDescription",, MyXML, n) + UserListImage = New XMLValue(Of SFile)("UserListImage",, MyXML, n) + UserListBackColor = New XMLValue(Of Color) + UserListBackColor.SetExtended("UserListBackColor",, MyXML, n) + UserListForeColor = New XMLValue(Of Color) + UserListForeColor.SetExtended("UserListForeColor",, MyXML, n) + MainFrameUsersSubscriptionsColorBack = New XMLValue(Of Color)("UsersSubscriptionsColorBack", MyColor.OkBack, MyXML, n) + MainFrameUsersSubscriptionsColorFore = New XMLValue(Of Color)("UsersSubscriptionsColorFore", MyColor.OkFore, MyXML, n) + MainFrameUsersSubscriptionsColorBack_USERS = New XMLValue(Of Color) + MainFrameUsersSubscriptionsColorBack_USERS.SetExtended("UsersSubscriptionsColorBack_USERS",, MyXML, n) + MainFrameUsersSubscriptionsColorFore_USERS = New XMLValue(Of Color) + MainFrameUsersSubscriptionsColorFore_USERS.SetExtended("UsersSubscriptionsColorFore_USERS",, MyXML, n) + + 'Default headers n = {"DefaultHeaders"} HEADER_sec_ch_ua = New XMLValue(Of String)("sec_ch_ua",, MyXML, n) HEADER_sec_ch_ua_full_version_list = New XMLValue(Of String)("sec_ch_ua_full_version_list",, MyXML, n) @@ -203,29 +245,171 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable HEADER_sec_ch_ua_platform_version = New XMLValue(Of String)("sec_ch_ua_platform_version",, MyXML, n) HEADER_UserAgent = New XMLValue(Of String)("UserAgent",, MyXML, n) + 'Behavior + n = {"Behavior"} + ExitConfirm = New XMLValue(Of Boolean)("ExitConfirm", True, MyXML, n) + CloseToTray = New XMLValue(Of Boolean)("CloseToTray", True, MyXML, n) + FastProfilesLoading = New XMLValue(Of Boolean)("FastProfilesLoading", True, MyXML, n) + DeleteToRecycleBin = New XMLValue(Of Boolean)("DeleteToRecycleBin", True, MyXML, n) + OpenFolderInOtherProgram = New XMLValueUse(Of String)("OpenFolderInOtherProgram",,, MyXML, n) + DownloadOpenInfo = New XMLValueAttribute(Of Boolean, Boolean)("DownloadOpenInfo", "OpenAgain", False, False, MyXML, n) + DownloadOpenProgress = New XMLValueAttribute(Of Boolean, Boolean)("DownloadOpenProgress", "OpenAgain", False, False, MyXML, n) + ClosingCommand = New XMLValueAttribute(Of String, Boolean)("ClosingCommand", "Use",,, MyXML, n) + 'URGENT: remove these lines + If Not SettingsReoranized Then + With New XMLValueAttribute(Of String, Boolean)("ClosingCommand", "Use",,, MyXML) + ClosingCommand.Value = .Value + ClosingCommand.AttributeValue = .AttributeValue + End With + End If + AddHandler ClosingCommand.ValueChanged, Sub(s, ev) MainFrameObj?.ChangeCloseVisible() + DownloadAll_UseF6 = New XMLValue(Of Boolean)("DownloadAll_UseF6", True, MyXML, n) + DownloadAll_UseF6_Confirm = New XMLValue(Of Boolean)("DownloadAll_UseF6_Confirm", False, MyXML, n) + DownloadAll_Confirm = New XMLValue(Of Boolean)("DownloadAll_Confirm", False, MyXML, n) + + 'Notifications + n = {"Notifications"} + ShowNotifications = New XMLValue(Of Boolean)("ShowNotifications", True, MyXML, n) + ShowNotificationsDownProfiles = New XMLValue(Of Boolean)("Profiles", True, MyXML, n) + ShowNotificationsDownAutoDownloader = New XMLValue(Of Boolean)("AutoDownloader", True, MyXML, n) + ShowNotificationsDownChannels = New XMLValue(Of Boolean)("Channels", True, MyXML, n) + ShowNotificationsDownSavedPosts = New XMLValue(Of Boolean)("SavedPosts", True, MyXML, n) + ShowNotificationsSTDownloader = New XMLValue(Of Boolean)("STDownloader", True, MyXML, n) + ShowNotificationsSTDownloaderEveryDownload = New XMLValue(Of Boolean)("STDownloaderEveryDownload", True, MyXML, n) + ShowNotificationsLOG = New XMLValue(Of Boolean)("LOG", True, MyXML, n) + + 'Defaults + n = {"Defaults"} + SeparateVideoFolder = New XMLValue(Of Boolean)("SeparateVideoFolder", True, MyXML, n) + DefaultTemporary = New XMLValue(Of Boolean)("Temporary", False, MyXML, n) + DefaultDownloadImages = New XMLValue(Of Boolean)("DownloadImages", True, MyXML, n) + DefaultDownloadVideos = New XMLValue(Of Boolean)("DownloadVideos", True, MyXML, n) + DownloadNativeImageFormat = New XMLValue(Of Boolean)("DownloadNativeImageFormat", True, MyXML, n) + UserSiteNameAsFriendly = New XMLValue(Of Boolean)("UserSiteNameAsFriendly", False, MyXML, n) + + 'STDownloader + n = {"Downloader"} + STDownloader_UpdateYouTubeOutputPath = New XMLValue(Of Boolean)("UpdateYouTubeOutputPath", False, MyXML, n) + STDownloader_MaxJobsCount = New XMLValue(Of Integer)("MaxJobsCount", 1, MyXML, n) + STDownloader_DownloadAutomatically = New XMLValue(Of Boolean)("DownloadAutomatically", True, MyXML, n) + STDownloader_RemoveDownloadedAutomatically = New XMLValue(Of Boolean)("RemoveDownloadedAutomatically", False, MyXML, n) + STDownloader_OnItemDoubleClick = New XMLValue(Of DoubleClickBehavior)("OnItemDoubleClick", DoubleClickBehavior.Folder, MyXML, n) + STDownloader_TakeSnapshot = New XMLValue(Of Boolean)("TakeSnapshot", True, MyXML, n) + STDownloader_SnapshotsKeepWithFiles = New XMLValue(Of Boolean)("SnapshotsKeepWithFiles", True, MyXML, n) + STDownloader_SnapshotsKeepWithFiles_ThumbAlong = New XMLValue(Of Boolean)("SnapshotsKeepWithFiles_ThumbAlong", False, MyXML, n) + STDownloader_SnapShotsCachePermamnent = New XMLValue(Of Boolean)("SnapShotsCachePermamnent", False, MyXML, n) + STDownloader_RemoveYTVideosOnClear = New XMLValue(Of Boolean)("RemoveYouTubeVideosOnClear", False, MyXML, n) + STDownloader_LoadYTVideos = New XMLValue(Of Boolean)("LoadYouTubeVideos", False, MyXML, n) + STDownloader_OutputPathUseYT = New XMLValue(Of Boolean)("OutputPathUseYT", False, MyXML, n) + STDownloader_OutputPathAskForName = New XMLValue(Of Boolean)("OutputPathAskForName", True, MyXML, n) + STDownloader_OutputPathAutoAddPaths = New XMLValue(Of Boolean)("OutputPathAutoAddPaths", True, MyXML, n) + STDownloader_CreateUrlFiles = New XMLValue(Of Boolean)("CreateUrlFiles", False, MyXML, n) + DownloadLocations = New STDownloader.DownloadLocationsCollection + DownloadLocations.Load(False, STDownloader_OutputPathUseYT) + + 'Downloading + n = {"Downloading"} + UpdateUserDescriptionEveryTime = New XMLValue(Of Boolean)("UpdateUserDescriptionEveryTime", True, MyXML, n) + UpdateUserSiteNameEveryTime = New XMLValue(Of Boolean)("UpdateUserSiteNameEveryTime", False, MyXML, n) + UpdateUserIconBannerEveryTime = New XMLValue(Of Boolean)("UpdateUserIconBannerEveryTime", True, MyXML, n) + AddMissingToLog = New XMLValue(Of Boolean)("AddMissingToLog", True, MyXML, n) + AddMissingErrorsToLog = New XMLValue(Of Boolean)("AddMissingErrorsToLog", False, MyXML, n) + DownloadsCompleteCommand = New XMLValueAttribute(Of String, Boolean)("DownloadsCompleteCommand", "Use",,, MyXML, n) + ReparseMissingInTheRoutine = New XMLValue(Of Boolean)("ReparseMissingInTheRoutine", False, MyXML, n) + UseDefaultAccountIfMissing = New XMLValue(Of Boolean)("UseDefaultAccountIfMissing", True, MyXML, n) + + 'Downloading: file naming + n_old = {"Users", "FileName"} + n = {"Downloading", "FileName"} + FileAddDateToFileName = New XMLValue(Of Boolean)("FileAddDateToFileName", False, MyXML, n) + If Not SettingsReoranized Then FileAddDateToFileName.Value = New XMLValue(Of Boolean)("FileAddDateToFileName", False, MyXML, n_old).Value 'URGENT: remove this line + AddHandler FileAddDateToFileName.ValueChanged, AddressOf ChangeDateProvider + FileAddTimeToFileName = New XMLValue(Of Boolean)("FileAddTimeToFileName", False, MyXML, n) + If Not SettingsReoranized Then FileAddTimeToFileName.Value = New XMLValue(Of Boolean)("FileAddTimeToFileName", False, MyXML, n_old).Value 'URGENT: remove this line + AddHandler FileAddTimeToFileName.ValueChanged, AddressOf ChangeDateProvider + FileDateTimePositionEnd = New XMLValue(Of Boolean)("FileDateTimePositionEnd", True, MyXML, n) + If Not SettingsReoranized Then FileDateTimePositionEnd.Value = New XMLValue(Of Boolean)("FileDateTimePositionEnd", True, MyXML, n_old).Value 'URGENT: remove this line + AddHandler FileDateTimePositionEnd.ValueChanged, AddressOf ChangeDateProvider + FileReplaceNameByDate = New XMLValue(Of Integer)("FileReplaceNameByDate", FileNameReplaceMode.None, MyXML, n) + If Not SettingsReoranized Then FileReplaceNameByDate.Value = New XMLValue(Of Integer)("FileReplaceNameByDate", FileNameReplaceMode.None, MyXML, n_old).Value 'URGENT: remove this line + + 'Downloading: script + n = {"Downloading", "Script"} + ScriptData = New XMLValueAttribute(Of String, Boolean)("ScriptData", "Use",,, MyXML, n) + + 'Channels + n = {Name_Node_Sites, "Channels"} + ChannelsImagesRows = New XMLValue(Of Integer)("ImagesRows", 2, MyXML, n) + ChannelsImagesColumns = New XMLValue(Of Integer)("ImagesColumns", 5, MyXML, n) + ChannelsAddUserImagesFromAllChannels = New XMLValue(Of Boolean)("AddUserImagesFromAllChannels", True, MyXML, n) + ChannelsDefaultReadyForDownload = New XMLValue(Of Boolean)("ChannelsDefaultReadyForDownload", False, MyXML, n) + ChannelsDefaultTemporary = New XMLValue(Of Boolean)("ChannelsDefaultTemporary", True, MyXML, n) + ChannelsHideExistsUser = New XMLValue(Of Boolean)("HideExistsUser", True, MyXML, n) + ChannelsMaxJobsCount = New XMLValue(Of Integer)("MaxJobsCount", DefaultMaxDownloadingTasks, MyXML, n) + n = {Name_Node_Sites, "Channels", "Users"} + FromChannelDownloadTop = New XMLValue(Of Integer)("FromChannelDownloadTop", 10, MyXML, n) + FromChannelDownloadTopUse = New XMLValue(Of Boolean)("FromChannelDownloadTopUse", False, MyXML, n) + FromChannelCopyImageToUser = New XMLValue(Of Boolean)("FromChannelCopyImageToUser", True, MyXML, n) + + 'Feed + n = {"Feed"} + FeedDataRows = New XMLValue(Of Integer)("DataRows", 10, MyXML, n) + FeedDataColumns = New XMLValue(Of Integer)("DataColumns", 1, MyXML, n) + FeedCenterImage = New XMLValueUse(Of Integer)("FeedCenterImage", 1,, MyXML, n) + FeedBackColor = New XMLValue(Of Color) + FeedBackColor.SetExtended("FeedColorBack",, MyXML, n) + FeedForeColor = New XMLValue(Of Color) + FeedForeColor.SetExtended("FeedColorFore",, MyXML, n) + FeedEndless = New XMLValue(Of Boolean)("Endless", True, MyXML, n) + FeedAddSessionToCaption = New XMLValue(Of Boolean)("AddSessionToCaption", False, MyXML, n) + FeedAddDateToCaption = New XMLValue(Of Boolean)("AddDateToCaption", True, MyXML, n) + FeedStoreSessionsData = New XMLValue(Of Boolean)("StoreSessionsData", True, MyXML, n) + FeedStoredSessionsNumber = New XMLValue(Of Integer)("StoredSessionsNumber", 20, MyXML, n) + FeedOpenLastMode = New XMLValue(Of Boolean)("OpenLastMode", False, MyXML, n) + FeedLastModeSubscriptions = New XMLValue(Of Boolean)("LastModeSubscriptions", False, MyXML, n) + FeedShowFriendlyNames = New XMLValue(Of Boolean)("ShowFriendlyNames", True, MyXML, n) + FeedShowSpecialFeedsMediaItem = New XMLValue(Of Boolean)("ShowSpecialFeedsMediaItem", False, MyXML, n) + n = {"Feed", "MoveCopy"} + FeedMoveCopyLastLocation = New XMLValue(Of SFile)("LastLocation",, MyXML, n) + FeedMoveCopyUpdateFileLocationOnMove = New XMLValue(Of Boolean)("UpdateFileLocationOnMove", True, MyXML, n) + FeedMoveCopyIsProfileChecked = New XMLValue(Of Boolean)("IsProfileChecked", True, MyXML, n) + FeedMoveCopySeparateVideo = New XMLValue(Of Boolean)("SeparateVideo",, MyXML, n) + FeedMoveCopyReplaceUserProfile = New XMLValue(Of Boolean)("ReplaceUserProfile",, MyXML, n) + FeedMoveCopyCreatePathProfile = New XMLValue(Of Boolean)("CreatePathProfile",, MyXML, n) + + 'View (filters) + n = {"Filter"} + ViewMode = New XMLValue(Of Integer)("ViewMode", ViewModes.IconLarge, MyXML, n) + ShowAllUsers = New XMLValue(Of Boolean)("ShowAllUsers", True, MyXML, n) + GroupUsers = New XMLValue(Of Boolean)("GroupUsers", True, MyXML, n) + ShowGroupsInsteadLabels = New XMLValue(Of Boolean)("ShowGroupsInsteadLabels", False, MyXML, n) + + 'Info form + n = {"InfoForm"} + InfoViewMode = New XMLValue(Of Integer)("ViewMode", DownloadedInfoForm.ViewModes.Session, MyXML, n) + InfoViewDefault = New XMLValue(Of Boolean)("ViewDefault", True, MyXML, n) + + 'Search form n = {"Search"} SearchInName = New XMLValue(Of Boolean)("SearchInName", True, MyXML, n) SearchInDescription = New XMLValue(Of Boolean)("SearchInDescription", False, MyXML, n) SearchInLabel = New XMLValue(Of Boolean)("SearchInLabel", False, MyXML, n) + 'User metrics form n = {"Metrics"} UMetrics_What = New XMLValue(Of Integer)("What", -1, MyXML, n) UMetrics_Order = New XMLValue(Of Integer)("Order", SortOrder.Descending, MyXML, n) UMetrics_ShowDrives = New XMLValue(Of Boolean)("ShowDrives", True, MyXML, n) UMetrics_ShowCollections = New XMLValue(Of Boolean)("ShowCollections", True, MyXML, n) - n = {"Defaults"} - DefaultTemporary = New XMLValue(Of Boolean)("Temporary", False, MyXML, n) - DefaultDownloadImages = New XMLValue(Of Boolean)("DownloadImages", True, MyXML, n) - DefaultDownloadVideos = New XMLValue(Of Boolean)("DownloadVideos", True, MyXML, n) - ChangeReadyForDownOnTempChange = New XMLValue(Of Boolean)("ChangeReadyForDownOnTempChange", True, MyXML, n) - DownloadNativeImageFormat = New XMLValue(Of Boolean)("DownloadNativeImageFormat", True, MyXML, n) - ReparseMissingInTheRoutine = New XMLValue(Of Boolean)("ReparseMissingInTheRoutine", False, MyXML, n) - UserSiteNameAsFriendly = New XMLValue(Of Boolean)("UserSiteNameAsFriendly", False, MyXML, n) - UserSiteNameUpdateEveryTime = New XMLValue(Of Boolean)("UserSiteNameUpdateEveryTime", False, MyXML, n) - CMDEncoding = New XMLValue(Of Integer)("CMDEncoding", DefaultCmdEncoding, MyXML, n) - UseDefaultAccountIfMissing = New XMLValue(Of Boolean)("UseDefaultAccountIfMissing", True, MyXML, n) - + 'Latest values + n = {"LastValues"} + LastCopyPath = New XMLValue(Of SFile)("LastCopyPath",, MyXML, n, New XMLToFilePathProvider) + LatestSavingPath = New XMLValue(Of SFile)("LatestSavingPath", Nothing, MyXML, n, New XMLToFilePathProvider) + LatestSelectedChannel = New XMLValue(Of String)("LatestSelectedChannel",, MyXML, n) +#End Region + ReorganizeSettingsFile() +#Region "Loading plugins" Plugins.AddRange(PluginHost.GetMyHosts(MyXML, GlobalPath.Value, DefaultTemporary, DefaultDownloadImages, DefaultDownloadVideos)) Dim tmpPluginList As IEnumerable(Of PluginHost) = PluginHost.GetPluginsHosts(MyXML, GlobalPath.Value, DefaultTemporary, DefaultDownloadImages, DefaultDownloadVideos) @@ -244,158 +428,71 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable Next Plugins.AddRange(tmpPluginList) End If - - MainFrameUsersShowDefaults = New XMLValue(Of Boolean)("UsersShowDefaults", True, MyXML) - MainFrameUsersShowSubscriptions = New XMLValue(Of Boolean)("UsersShowSubscriptions", True, MyXML) - - MainFrameUsersSubscriptionsColorBack = New XMLValue(Of Color)("UsersSubscriptionsColorBack", MyColor.OkBack, MyXML) - MainFrameUsersSubscriptionsColorFore = New XMLValue(Of Color)("UsersSubscriptionsColorFore", MyColor.OkFore, MyXML) - MainFrameUsersSubscriptionsColorBack_USERS = New XMLValue(Of Color) - MainFrameUsersSubscriptionsColorBack_USERS.SetExtended("UsersSubscriptionsColorBack_USERS",, MyXML) - MainFrameUsersSubscriptionsColorFore_USERS = New XMLValue(Of Color) - MainFrameUsersSubscriptionsColorFore_USERS.SetExtended("UsersSubscriptionsColorFore_USERS",, MyXML) - - FastProfilesLoading = New XMLValue(Of Boolean)("FastProfilesLoading", True, MyXML) - MaxLargeImageHeight = New XMLValue(Of Integer)("MaxLargeImageHeight", 150, MyXML) - MaxSmallImageHeight = New XMLValue(Of Integer)("MaxSmallImageHeight", 15, MyXML) - UserListBackColor = New XMLValue(Of Color) - UserListBackColor.SetExtended("UserListBackColor",, MyXML) - UserListForeColor = New XMLValue(Of Color) - UserListForeColor.SetExtended("UserListForeColor",, MyXML) - UserListImage = New XMLValue(Of SFile)("UserListImage",, MyXML) - DownloadOpenInfo = New XMLValueAttribute(Of Boolean, Boolean)("DownloadOpenInfo", "OpenAgain", False, False, MyXML) - DownloadOpenProgress = New XMLValueAttribute(Of Boolean, Boolean)("DownloadOpenProgress", "OpenAgain", False, False, MyXML) - DownloadsCompleteCommand = New XMLValueAttribute(Of String, Boolean)("DownloadsCompleteCommand", "Use",,, MyXML) - ClosingCommand = New XMLValueAttribute(Of String, Boolean)("ClosingCommand", "Use",,, MyXML) - AddHandler ClosingCommand.ValueChanged, Sub(s, ev) MainFrameObj?.ChangeCloseVisible() - InfoViewMode = New XMLValue(Of Integer)("InfoViewMode", DownloadedInfoForm.ViewModes.Session, MyXML) - InfoViewDefault = New XMLValue(Of Boolean)("InfoViewDefault", True, MyXML) - ViewMode = New XMLValue(Of Integer)("ViewMode", ViewModes.IconLarge, MyXML) - ShowingMode = New XMLValue(Of Integer)("ShowingMode", ShowingModes.All, MyXML) - ShowGroupsInsteadLabels = New XMLValue(Of Boolean)("ShowGroupsInsteadLabels", False, MyXML) - GroupUsers = New XMLValue(Of Boolean)("UseGrouping", True, MyXML) - - AddMissingToLog = New XMLValue(Of Boolean)("AddMissingToLog", True, MyXML) - AddMissingErrorsToLog = New XMLValue(Of Boolean)("AddMissingErrorsToLog", False, MyXML) - - LatestSavingPath = New XMLValue(Of SFile)("LatestSavingPath", Nothing, MyXML,, New XMLToFilePathProvider) - LatestSelectedChannel = New XMLValue(Of String)("LatestSelectedChannel",, MyXML) - - _ViewDateFrom = New XMLValue(Of Date) - _ViewDateFrom.SetExtended("ViewDateFrom",, MyXML) - _ViewDateTo = New XMLValue(Of Date) - _ViewDateTo.SetExtended("ViewDateTo",, MyXML) - ViewDateMode = New XMLValue(Of Integer)("ViewDateMode", ShowingDates.Off, MyXML) - - LatestDownloadedSites = New XMLValuesCollection(Of String)(IXMLValuesCollection.Modes.String, "LatestDownloadedSites",, MyXML) - - SelectedSites = New XMLValuesCollection(Of String)(IXMLValuesCollection.Modes.String, "SelectedSites",, MyXML, {Name_Node_Sites}) - - ImgurClientID = New XMLValue(Of String)("ImgurClientID", String.Empty, MyXML, {Name_Node_Sites}) - - n = {Name_Node_Sites, "Channels"} - ChannelsDefaultReadyForDownload = New XMLValue(Of Boolean)("ChannelsDefaultReadyForDownload", False, MyXML, n) - ChannelsDefaultTemporary = New XMLValue(Of Boolean)("ChannelsDefaultTemporary", True, MyXML, n) - ChannelsRegularCheckMD5 = New XMLValue(Of Boolean)("ChannelsRegularCheckMD5", False, MyXML, n) - ChannelsImagesRows = New XMLValue(Of Integer)("ImagesRows", 2, MyXML, n) - ChannelsImagesColumns = New XMLValue(Of Integer)("ImagesColumns", 5, MyXML, n) - ChannelsHideExistsUser = New XMLValue(Of Boolean)("HideExistsUser", True, MyXML, n) - ChannelsMaxJobsCount = New XMLValue(Of Integer)("MaxJobsCount", DefaultMaxDownloadingTasks, MyXML, n) - ChannelsAddUserImagesFromAllChannels = New XMLValue(Of Boolean)("AddUserImagesFromAllChannels", True, MyXML, n) - STDownloader_UpdateYouTubeOutputPath = New XMLValue(Of Boolean)("UpdateYouTubeOutputPath", False, MyXML, n) - - n = {"Downloader"} - STDownloader_MaxJobsCount = New XMLValue(Of Integer)("MaxJobsCount", 1, MyXML, n) - STDownloader_DownloadAutomatically = New XMLValue(Of Boolean)("DownloadAutomatically", True, MyXML, n) - STDownloader_RemoveDownloadedAutomatically = New XMLValue(Of Boolean)("RemoveDownloadedAutomatically", False, MyXML, n) - STDownloader_OnItemDoubleClick = New XMLValue(Of DoubleClickBehavior)("OnItemDoubleClick", DoubleClickBehavior.Folder, MyXML, n) - STDownloader_TakeSnapshot = New XMLValue(Of Boolean)("TakeSnapshot", True, MyXML, n) - STDownloader_SnapshotsKeepWithFiles = New XMLValue(Of Boolean)("SnapshotsKeepWithFiles", True, MyXML, n) - STDownloader_SnapshotsKeepWithFiles_ThumbAlong = New XMLValue(Of Boolean)("SnapshotsKeepWithFiles_ThumbAlong", False, MyXML, n) - STDownloader_SnapShotsCachePermamnent = New XMLValue(Of Boolean)("SnapShotsCachePermamnent", False, MyXML, n) - STDownloader_RemoveYTVideosOnClear = New XMLValue(Of Boolean)("RemoveYouTubeVideosOnClear", False, MyXML, n) - STDownloader_LoadYTVideos = New XMLValue(Of Boolean)("LoadYouTubeVideos", False, MyXML, n) - STDownloader_OutputPathUseYT = New XMLValue(Of Boolean)("OutputPathUseYT", False, MyXML, n) - STDownloader_OutputPathAskForName = New XMLValue(Of Boolean)("OutputPathAskForName", True, MyXML, n) - STDownloader_OutputPathAutoAddPaths = New XMLValue(Of Boolean)("OutputPathAutoAddPaths", True, MyXML, n) - STDownloader_CreateUrlFiles = New XMLValue(Of Boolean)("CreateUrlFiles", False, MyXML, n) - DownloadLocations = New STDownloader.DownloadLocationsCollection - DownloadLocations.Load(False, STDownloader_OutputPathUseYT) - - n = {"Feed"} - FeedDataColumns = New XMLValue(Of Integer)("DataColumns", 1, MyXML, n) - FeedDataRows = New XMLValue(Of Integer)("DataRows", 10, MyXML, n) - FeedCenterImage = New XMLValueUse(Of Integer)("FeedCenterImage", 1,, MyXML, n) - FeedEndless = New XMLValue(Of Boolean)("Endless", True, MyXML, n) - FeedAddDateToCaption = New XMLValue(Of Boolean)("AddDateToCaption", True, MyXML, n) - FeedAddSessionToCaption = New XMLValue(Of Boolean)("AddSessionToCaption", False, MyXML, n) - FeedStoreSessionsData = New XMLValue(Of Boolean)("StoreSessionsData", True, MyXML, n) - FeedStoredSessionsNumber = New XMLValue(Of Integer)("StoredSessionsNumber", 20, MyXML, n) - FeedBackColor = New XMLValue(Of Color) - FeedBackColor.SetExtended("FeedColorBack",, MyXML, n) - FeedForeColor = New XMLValue(Of Color) - FeedForeColor.SetExtended("FeedColorFore",, MyXML, n) - FeedOpenLastMode = New XMLValue(Of Boolean)("OpenLastMode", False, MyXML, n) - FeedLastModeSubscriptions = New XMLValue(Of Boolean)("LastModeSubscriptions", False, MyXML, n) - FeedShowFriendlyNames = New XMLValue(Of Boolean)("ShowFriendlyNames", True, MyXML, n) - FeedShowSpecialFeedsMediaItem = New XMLValue(Of Boolean)("ShowSpecialFeedsMediaItem", False, MyXML, n) - n = {"Feed", "MoveCopy"} - FeedMoveCopyLastLocation = New XMLValue(Of SFile)("LastLocation",, MyXML, n) - FeedMoveCopyUpdateFileLocationOnMove = New XMLValue(Of Boolean)("UpdateFileLocationOnMove", True, MyXML, n) - FeedMoveCopyIsProfileChecked = New XMLValue(Of Boolean)("IsProfileChecked", True, MyXML, n) - FeedMoveCopySeparateVideo = New XMLValue(Of Boolean)("SeparateVideo",, MyXML, n) - FeedMoveCopyReplaceUserProfile = New XMLValue(Of Boolean)("ReplaceUserProfile",, MyXML, n) - FeedMoveCopyCreatePathProfile = New XMLValue(Of Boolean)("CreatePathProfile",, MyXML, n) - - n = {"Users"} - FromChannelDownloadTop = New XMLValue(Of Integer)("FromChannelDownloadTop", 10, MyXML, n) - FromChannelDownloadTopUse = New XMLValue(Of Boolean)("FromChannelDownloadTopUse", False, MyXML, n) - FromChannelCopyImageToUser = New XMLValue(Of Boolean)("FromChannelCopyImageToUser", True, MyXML, n) - UpdateUserDescriptionEveryTime = New XMLValue(Of Boolean)("UpdateUserDescriptionEveryTime", True, MyXML, n) - UpdateUserIconBannerEveryTime = New XMLValue(Of Boolean)("UpdateUserIconBannerEveryTime", True, MyXML, n) - ScriptData = New XMLValueAttribute(Of String, Boolean)("ScriptData", "Use",,, MyXML, n) - - n = {"Users", "FileName"} - MaxUsersJobsCount = New XMLValue(Of Integer)("MaxJobsCount", DefaultMaxDownloadingTasks, MyXML, n) - FileAddDateToFileName = New XMLValue(Of Boolean)("FileAddDateToFileName", False, MyXML, n) - AddHandler FileAddDateToFileName.ValueChanged, AddressOf ChangeDateProvider - FileAddTimeToFileName = New XMLValue(Of Boolean)("FileAddTimeToFileName", False, MyXML, n) - AddHandler FileAddTimeToFileName.ValueChanged, AddressOf ChangeDateProvider - FileDateTimePositionEnd = New XMLValue(Of Boolean)("FileDateTimePositionEnd", True, MyXML, n) - AddHandler FileDateTimePositionEnd.ValueChanged, AddressOf ChangeDateProvider - FileReplaceNameByDate = New XMLValue(Of Integer)("FileReplaceNameByDate", FileNameReplaceMode.None, MyXML, n) - - CheckUpdatesAtStart = New XMLValue(Of Boolean)("CheckUpdatesAtStart", True, MyXML) - ShowNewVersionNotification = New XMLValue(Of Boolean)("ShowNewVersionNotification", True, MyXML) - LatestVersion = New XMLValue(Of String)("LatestVersion", String.Empty, MyXML) - - n = {"Notifications"} - ShowNotifications = New XMLValue(Of Boolean)("ShowNotifications", True, MyXML, n) - ShowNotificationsDownProfiles = New XMLValue(Of Boolean)("Profiles", True, MyXML, n) - ShowNotificationsDownAutoDownloader = New XMLValue(Of Boolean)("AutoDownloader", True, MyXML, n) - ShowNotificationsDownChannels = New XMLValue(Of Boolean)("Channels", True, MyXML, n) - ShowNotificationsDownSavedPosts = New XMLValue(Of Boolean)("SavedPosts", True, MyXML, n) - ShowNotificationsSTDownloader = New XMLValue(Of Boolean)("STDownloader", True, MyXML, n) - ShowNotificationsSTDownloaderEveryDownload = New XMLValue(Of Boolean)("STDownloaderEveryDownload", True, MyXML, n) - ShowNotificationsLOG = New XMLValue(Of Boolean)("LOG", True, MyXML, n) - - ProgramText = New XMLValue(Of String)("ProgramText",, MyXML) - ProgramDescription = New XMLValue(Of String)("ProgramDescription",, MyXML) - ExitConfirm = New XMLValue(Of Boolean)("ExitConfirm", True, MyXML) - CloseToTray = New XMLValue(Of Boolean)("CloseToTray", True, MyXML) - OpenFolderInOtherProgram = New XMLValueUse(Of String)("OpenFolderInOtherProgram",,, MyXML) - DeleteToRecycleBin = New XMLValue(Of Boolean)("DeleteToRecycleBin", True, MyXML) +#End Region Labels = New LabelsKeeper(MyXML) Groups = New Groups.DownloadGroupCollection Labels.AddRange(Groups.GetGroupsLabels, False) - AdvancedFilter = New Groups.DownloadGroup + AdvancedFilter = New Groups.DownloadGroup(False) With {.IsViewFilter = True} AdvancedFilter.LoadFromFile($"{SettingsFolderName}\AdvancedFilter.xml") + AdvancedFilter.IsViewFilter = True Labels.AddRange({AdvancedFilter}.GetGroupsLabels, False) - Labels.AddRange(SavedFilters.GetAllLabels, False) + 'URGENT: remove this code (2024.03) +#Region "To delete" + 'delete this property: + ViewReorganized = New XMLValue(Of Boolean)("ViewReorganized", rn, MyXML) + If Not ViewReorganized.Value Then + ViewReorganized.Value = True + Dim oldShowMode% = MyXML.Value("ShowingMode").FromXML(Of Integer)(0) + Dim MainFrameUsersShowDefaults As Boolean = MyXML.Value("UsersShowDefaults").FromXML(Of Boolean)(True) + Dim MainFrameUsersShowSubscriptions As Boolean = MyXML.Value("UsersShowSubscriptions").FromXML(Of Boolean)(True) + ShowAllUsers.Value = oldShowMode = 0 And MainFrameUsersShowDefaults And MainFrameUsersShowSubscriptions + Dim ViewDateMode As New XMLValue(Of Integer)("ViewDateMode", ShowingDates.Off, MyXML) + Dim SelectedSites As New XMLValuesCollection(Of String)(IXMLValuesCollection.Modes.String, "SelectedSites",, MyXML, {Name_Node_Sites}) + If Not ShowAllUsers Or SelectedSites.Count > 0 Or Not ViewDateMode.Value = ShowingDates.Off Then + ShowAllUsers.Value = False + With AdvancedFilter + .DownloadUsers = MainFrameUsersShowDefaults + .DownloadSubscriptions = MainFrameUsersShowSubscriptions + If SelectedSites.Count > 0 Then .Sites.AddRange(SelectedSites) +#Disable Warning BC40008 + Select Case oldShowMode + Case 20 : .Regular = True : .Temporary = False : .Favorite = False + Case 50 : .Regular = False : .Temporary = True : .Favorite = False + Case 100 : .Regular = False : .Temporary = False : .Favorite = True + Case 500 : If Labels.Current.Count > 0 Then .Labels.Clear() : .Labels.AddRange(Labels.Current) + Case 1000 : .LabelsNo = True + Case 10000 : .UserExists = False : .UserDeleted = True : .UserSuspended = False + Case 12000 : .UserExists = False : .UserDeleted = False : .UserSuspended = True + End Select + If Labels.Excluded.Count > 0 Then .LabelsExcluded.AddRange(Labels.Excluded) + .LabelsExcludedIgnore = Labels.ExcludedIgnore +#Enable Warning + + Dim _ViewDateFrom As New XMLValue(Of Date) + _ViewDateFrom.SetExtended("ViewDateFrom",, MyXML) + Dim _ViewDateTo As New XMLValue(Of Date) + _ViewDateTo.SetExtended("ViewDateTo",, MyXML) + + If Not ViewDateMode.Value = ShowingDates.Off Then + .DateMode = ViewDateMode + If _ViewDateFrom.Exists Then .DateFrom = _ViewDateFrom.Value Else .DateFrom = Nothing + If _ViewDateTo.Exists Then .DateTo = _ViewDateTo.Value Else .DateTo = Nothing + End If + _ViewDateFrom.Dispose() + _ViewDateTo.Dispose() + .UpdateFile() + End With + End If + ViewDateMode.Dispose() + SelectedSites.Dispose() + End If +#End Region + + If Not forceSaveXML And forceSaveXML2 Then SettingsReoranized2.Value = True MyXML.EndUpdate() - If MyXML.ChangesDetected Then MyXML.Sort() : MyXML.UpdateData() + If MyXML.ChangesDetected Or forceSaveXML Or forceSaveXML2 Then MyXML.Sort() : MyXML.UpdateData() If BlackListFile.Exists Then BlackList.ListAddList(IO.File.ReadAllLines(BlackListFile), LAP.NotContainsOnly) @@ -404,29 +501,109 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable _UpdatesSuspended = False ChangeDateProvider(Nothing, Nothing) End Sub - Private Sub ChangeDateProvider(ByVal Sender As Object, ByVal e As EventArgs) - If Not _UpdatesSuspended Then - Dim p$ = String.Empty - If FileAddDateToFileName Then p = "yyyyMMdd" - If FileAddTimeToFileName Then p.StringAppend("HHmmss", "_") - If Not p.IsEmptyString Then FileDateAppenderProvider = New ADateTime(p) Else FileDateAppenderProvider = New ADateTime("yyyyMMdd_HHmmss") - If FileReplaceNameByDate.Value = FileNameReplaceMode.Replace Then - FileDateAppenderPattern = "{1}" - Else - If FileDateTimePositionEnd Then FileDateAppenderPattern = "{0}_{1}" Else FileDateAppenderPattern = "{1}_{0}" - End If - End If - End Sub -#Region "Script" - Friend Shared Sub ScriptTextBoxButtonClick(ByRef TXT As TextBoxExtended, ByVal Sender As ActionButton) - If Sender.DefaultButton = ActionButton.DefaultButtons.Open Then - Dim f As SFile = SFile.SelectFiles(TXT.Text, False, "Select script file").FirstOrDefault - If Not f.IsEmptyString Then TXT.Text = f.ToString & " ""{0}""" - End If - End Sub - Friend ReadOnly Property ScriptData As XMLValueAttribute(Of String, Boolean) #End Region -#Region "USERS" + 'URGENT: remove 'Reorganize' code (2024.03) +#Region "Reorganize" + Private Property SettingsReoranized As XMLValue(Of Boolean) + Private Property SettingsReoranized2 As XMLValue(Of Boolean) + Private Sub ReorganizeSettingsFile() + If Not SettingsReoranized Then + SettingsReoranized.Value = True + + Dim n$() + + GlobalPath.Value = New XMLValue(Of SFile)("GlobalPath", "Data\".CSFileP, MyXML,, New XMLToFilePathProvider).Value + MaxLargeImageHeight.Value = New XMLValue(Of Integer)("MaxLargeImageHeight", 150, MyXML).Value + MaxSmallImageHeight.Value = New XMLValue(Of Integer)("MaxSmallImageHeight", 15, MyXML).Value + CollectionsPath.Value = New XMLValue(Of String)("CollectionsPath", CollectionsFolderName, MyXML).Value + MaxUsersJobsCount.Value = New XMLValue(Of Integer)("MaxJobsCount", DefaultMaxDownloadingTasks, MyXML, {"Users", "FileName"}).Value + + CheckUpdatesAtStart.Value = New XMLValue(Of Boolean)("CheckUpdatesAtStart", True, MyXML).Value + ShowNewVersionNotification.Value = New XMLValue(Of Boolean)("ShowNewVersionNotification", True, MyXML).Value + LatestVersion.Value = New XMLValue(Of String)("LatestVersion", String.Empty, MyXML).Value + + ProgramText.Value = New XMLValue(Of String)("ProgramText",, MyXML).Value + ProgramDescription.Value = New XMLValue(Of String)("ProgramDescription",, MyXML).Value + + UserListImage.Value = New XMLValue(Of SFile)("UserListImage",, MyXML).Value + + Dim __UserListBackColor As New XMLValue(Of Color) + __UserListBackColor.SetExtended("UserListBackColor",, MyXML) + UserListBackColor.ValueF = __UserListBackColor.ValueF + Dim __UserListForeColor As New XMLValue(Of Color) + __UserListForeColor.SetExtended("UserListForeColor",, MyXML) + UserListForeColor.ValueF = __UserListForeColor.ValueF + + MainFrameUsersSubscriptionsColorBack.Value = New XMLValue(Of Color)("UsersSubscriptionsColorBack", MyColor.OkBack, MyXML).Value + MainFrameUsersSubscriptionsColorFore.Value = New XMLValue(Of Color)("UsersSubscriptionsColorFore", MyColor.OkFore, MyXML).Value + Dim __MainFrameUsersSubscriptionsColorBack_USERS As New XMLValue(Of Color) + __MainFrameUsersSubscriptionsColorBack_USERS.SetExtended("UsersSubscriptionsColorBack_USERS",, MyXML) + MainFrameUsersSubscriptionsColorBack_USERS.ValueF = __MainFrameUsersSubscriptionsColorBack_USERS.ValueF + Dim __MainFrameUsersSubscriptionsColorFore_USERS As New XMLValue(Of Color) + __MainFrameUsersSubscriptionsColorFore_USERS.SetExtended("UsersSubscriptionsColorFore_USERS",, MyXML) + MainFrameUsersSubscriptionsColorFore_USERS.ValueF = __MainFrameUsersSubscriptionsColorFore_USERS.ValueF + + CMDEncoding.Value = New XMLValue(Of Integer)("CMDEncoding", DefaultCmdEncoding, MyXML, {"Defaults"}).Value + + ExitConfirm.Value = New XMLValue(Of Boolean)("ExitConfirm", True, MyXML).Value + CloseToTray.Value = New XMLValue(Of Boolean)("CloseToTray", True, MyXML).Value + With New XMLValueUse(Of String)("OpenFolderInOtherProgram",,, MyXML) + OpenFolderInOtherProgram.Value = .Value + OpenFolderInOtherProgram.Use = .Use + End With + DeleteToRecycleBin.Value = New XMLValue(Of Boolean)("DeleteToRecycleBin", True, MyXML).Value + FastProfilesLoading.Value = New XMLValue(Of Boolean)("FastProfilesLoading", True, MyXML).Value + With New XMLValueAttribute(Of Boolean, Boolean)("DownloadOpenInfo", "OpenAgain", False, False, MyXML) + DownloadOpenInfo.Value = .Value + DownloadOpenInfo.AttributeValue = .AttributeValue + End With + With New XMLValueAttribute(Of Boolean, Boolean)("DownloadOpenProgress", "OpenAgain", False, False, MyXML) + DownloadOpenProgress.Value = .Value + DownloadOpenProgress.AttributeValue = .AttributeValue + End With + + SeparateVideoFolder.Value = New XMLValue(Of Boolean)("SeparateVideoFolder", True, MyXML).Value + + AddMissingToLog.Value = New XMLValue(Of Boolean)("AddMissingToLog", True, MyXML).Value + AddMissingErrorsToLog.Value = New XMLValue(Of Boolean)("AddMissingErrorsToLog", False, MyXML).Value + With New XMLValueAttribute(Of String, Boolean)("DownloadsCompleteCommand", "Use",,, MyXML) + DownloadsCompleteCommand.Value = .Value + DownloadsCompleteCommand.AttributeValue = .AttributeValue + End With + + n = {"Users"} + UpdateUserDescriptionEveryTime.Value = New XMLValue(Of Boolean)("UpdateUserDescriptionEveryTime", True, MyXML, n).Value + UpdateUserIconBannerEveryTime.Value = New XMLValue(Of Boolean)("UpdateUserIconBannerEveryTime", True, MyXML, n).Value + + n = {"Defaults"} + UpdateUserSiteNameEveryTime.Value = New XMLValue(Of Boolean)("UserSiteNameUpdateEveryTime", False, MyXML, n).Value + ReparseMissingInTheRoutine.Value = New XMLValue(Of Boolean)("ReparseMissingInTheRoutine", False, MyXML, n).Value + UseDefaultAccountIfMissing.Value = New XMLValue(Of Boolean)("UseDefaultAccountIfMissing", True, MyXML, n).Value + + n = {"Users"} + FromChannelDownloadTop.Value = New XMLValue(Of Integer)("FromChannelDownloadTop", 10, MyXML, n).Value + FromChannelDownloadTopUse.Value = New XMLValue(Of Boolean)("FromChannelDownloadTopUse", False, MyXML, n).Value + FromChannelCopyImageToUser.Value = New XMLValue(Of Boolean)("FromChannelCopyImageToUser", True, MyXML, n).Value + + With New XMLValueAttribute(Of String, Boolean)("ScriptData", "Use",,, MyXML, n) + ScriptData.Value = .Value + ScriptData.AttributeValue = .AttributeValue + End With + + ViewMode.Value = New XMLValue(Of Integer)("ViewMode", ViewModes.IconLarge, MyXML).Value + GroupUsers.Value = New XMLValue(Of Boolean)("UseGrouping", True, MyXML).Value + ShowGroupsInsteadLabels.Value = New XMLValue(Of Boolean)("ShowGroupsInsteadLabels", False, MyXML).Value + + InfoViewMode.Value = New XMLValue(Of Integer)("InfoViewMode", DownloadObjects.DownloadedInfoForm.ViewModes.Session, MyXML).Value + InfoViewDefault.Value = New XMLValue(Of Boolean)("InfoViewDefault", True, MyXML).Value + + LatestSavingPath.Value = New XMLValue(Of SFile)("LatestSavingPath", Nothing, MyXML,, New XMLToFilePathProvider).Value + LatestSelectedChannel.Value = New XMLValue(Of String)("LatestSelectedChannel",, MyXML).Value + LastCopyPath.Value = New XMLValue(Of SFile)("LastCopyPath",, MyXML,, New XMLToFilePathProvider).Value + End If + End Sub +#End Region +#Region "Users" Friend Sub LoadUsers() Try Users.ListClearDispose @@ -705,24 +882,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable Return New IUserData() {} End Function #End Region - Friend Sub UpdateBlackList() - If BlackList.Count > 0 Then - TextSaver.SaveTextToFile(BlackList.ListToString(vbNewLine), BlackListFile, True, False, EDP.None) - Else - BlackListFile.Delete(, Settings.DeleteMode) - End If - End Sub - Friend Sub DeleteCachePath() - Reddit.ChannelsCollection.ChannelsPathCache.Delete(SFO.Path, SFODelete.None, EDP.None) - End Sub - Private Sub DeleteCachePathPermanent() - Try - Dim f As New SFile(PermanentCacheSnapshotsPath) - If f.Exists(SFO.Path, False) AndAlso Not SFile.GetFiles(f,, IO.SearchOption.AllDirectories, EDP.ReturnValue).ListExists Then _ - f.Delete(SFO.Path, SFODelete.DeletePermanently, EDP.None) - Catch - End Try - End Sub +#Region "User exists" Friend Overloads Function UserExists(ByVal UserSite As String, ByVal UserID As String) As Boolean Dim UserFinderBase As Predicate(Of IUserData) = Function(user) user.Site = UserSite And user.Name = UserID Dim UserFinder As Predicate(Of IUserData) = Function(ByVal user As IUserData) As Boolean @@ -742,6 +902,21 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable Friend Overloads Function UserExists(ByVal _User As UserInfo) As Boolean Return UserExists(_User.Site, _User.Name) End Function +#End Region +#Region "Cache" + Friend Sub DeleteCachePath() + Reddit.ChannelsCollection.ChannelsPathCache.Delete(SFO.Path, SFODelete.None, EDP.None) + End Sub + Private Sub DeleteCachePathPermanent() + Try + Dim f As New SFile(PermanentCacheSnapshotsPath) + If f.Exists(SFO.Path, False) AndAlso Not SFile.GetFiles(f,, IO.SearchOption.AllDirectories, EDP.ReturnValue).ListExists Then _ + f.Delete(SFO.Path, SFODelete.DeletePermanently, EDP.None) + Catch + End Try + End Sub +#End Region +#Region "Update" Private _UpdatesSuspended As Boolean = True Friend Sub BeginUpdate() MyXML.BeginUpdate() @@ -755,6 +930,17 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable _UpdatesSuspended = False ChangeDateProvider(Nothing, Nothing) End Sub +#End Region +#Region "Update black list" + Friend Sub UpdateBlackList() + If BlackList.Count > 0 Then + TextSaver.SaveTextToFile(BlackList.ListToString(vbNewLine), BlackListFile, True, False, EDP.None) + Else + BlackListFile.Delete(, Settings.DeleteMode) + End If + End Sub +#End Region +#Region "Site (plugins)" Default Friend Overloads ReadOnly Property Site(ByVal PluginKey As String) As SettingsHostCollection Get Dim i% = Plugins.FindIndex(Function(p) p.Key = PluginKey) @@ -767,9 +953,11 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable If i >= 0 Then Return Plugins(i).Settings(AccountName) Else Return Nothing End Get End Property +#End Region +#Region "Basis" Friend ReadOnly Property GlobalPath As XMLValue(Of SFile) - Friend ReadOnly Property LastCopyPath As XMLValue(Of SFile) - Friend ReadOnly Property SeparateVideoFolder As XMLValue(Of Boolean) + Friend ReadOnly Property MaxLargeImageHeight As XMLValue(Of Integer) + Friend ReadOnly Property MaxSmallImageHeight As XMLValue(Of Integer) Friend ReadOnly Property CollectionsPath As XMLValue(Of String) Friend ReadOnly Property CollectionsPathF As SFile Get @@ -781,10 +969,38 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable End Get End Property Friend ReadOnly Property MaxUsersJobsCount As XMLValue(Of Integer) - Friend ReadOnly Property ImgurClientID As XMLValue(Of String) - Friend ReadOnly Property AddMissingToLog As XMLValue(Of Boolean) - Friend ReadOnly Property AddMissingErrorsToLog As XMLValue(Of Boolean) Friend ReadOnly Property UserAgent As XMLValue(Of String) + Friend ReadOnly Property ImgurClientID As XMLValue(Of String) +#End Region +#Region "Basis: new version" + Friend ReadOnly Property CheckUpdatesAtStart As XMLValue(Of Boolean) + Friend ReadOnly Property ShowNewVersionNotification As XMLValue(Of Boolean) + Friend ReadOnly Property LatestVersion As XMLValue(Of String) +#End Region +#Region "Design" + Friend ReadOnly Property ProgramText As XMLValue(Of String) + Friend ReadOnly Property ProgramDescription As XMLValue(Of String) + Friend ReadOnly Property UserListImage As XMLValue(Of SFile) + Friend ReadOnly Property UserListBackColor As XMLValue(Of Color) + Friend ReadOnly Property UserListBackColorF As Color + Get + Return If(UserListBackColor.Exists, UserListBackColor.Value, SystemColors.Window) + End Get + End Property + Friend ReadOnly Property UserListForeColor As XMLValue(Of Color) + Friend ReadOnly Property UserListForeColorF As Color + Get + Return If(UserListForeColor.Exists, UserListForeColor.Value, SystemColors.WindowText) + End Get + End Property + Friend ReadOnly Property MainFrameUsersSubscriptionsColorBack As XMLValue(Of Color) + Friend ReadOnly Property MainFrameUsersSubscriptionsColorFore As XMLValue(Of Color) + Friend ReadOnly Property MainFrameUsersSubscriptionsColorBack_USERS As XMLValue(Of Color) + Friend ReadOnly Property MainFrameUsersSubscriptionsColorFore_USERS As XMLValue(Of Color) +#End Region +#Region "Environment" + Friend ReadOnly Property CMDEncoding As XMLValue(Of Integer) +#End Region #Region "Default headers" Friend ReadOnly Property HEADER_sec_ch_ua As XMLValue(Of String) Friend ReadOnly Property HEADER_sec_ch_ua_full_version_list As XMLValue(Of String) @@ -792,22 +1008,79 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable Friend ReadOnly Property HEADER_sec_ch_ua_platform_version As XMLValue(Of String) Friend ReadOnly Property HEADER_UserAgent As XMLValue(Of String) #End Region -#Region "Search" - Friend ReadOnly Property SearchInName As XMLValue(Of Boolean) - Friend ReadOnly Property SearchInDescription As XMLValue(Of Boolean) - Friend ReadOnly Property SearchInLabel As XMLValue(Of Boolean) +#Region "Behavior" + Friend ReadOnly Property ExitConfirm As XMLValue(Of Boolean) + Friend ReadOnly Property CloseToTray As XMLValue(Of Boolean) + Friend ReadOnly Property FastProfilesLoading As XMLValue(Of Boolean) + Friend ReadOnly Property DeleteToRecycleBin As XMLValue(Of Boolean) + Friend ReadOnly Property DeleteMode As SFODelete + Get + Return If(DeleteToRecycleBin, SFODelete.DeleteToRecycleBin, SFODelete.None) + End Get + End Property + Friend ReadOnly Property OpenFolderInOtherProgram As XMLValueUse(Of String) + Private ReadOnly Property IDownloaderSettings_OpenFolderInOtherProgram As Boolean Implements IDownloaderSettings.OpenFolderInOtherProgram + Get + Return OpenFolderInOtherProgram.Use + End Get + End Property + Private ReadOnly Property IDownloaderSettings_OpenFolderInOtherProgram_Command As String Implements IDownloaderSettings.OpenFolderInOtherProgram_Command + Get + Return OpenFolderInOtherProgram + End Get + End Property + Friend ReadOnly Property DownloadOpenInfo As XMLValueAttribute(Of Boolean, Boolean) + Friend ReadOnly Property DownloadOpenProgress As XMLValueAttribute(Of Boolean, Boolean) + Friend ReadOnly Property ClosingCommand As XMLValueAttribute(Of String, Boolean) + Friend ReadOnly Property DownloadAll_UseF6 As XMLValue(Of Boolean) + Friend ReadOnly Property DownloadAll_UseF6_Confirm As XMLValue(Of Boolean) + Friend ReadOnly Property DownloadAll_Confirm As XMLValue(Of Boolean) +#End Region +#Region "Notifications" + Friend Enum NotificationObjects + All + Profiles + AutoDownloader + Channels + SavedPosts + STDownloader + LOG + End Enum + Friend ReadOnly Property ProcessNotification(ByVal Sender As NotificationObjects) As Boolean + Get + If Not NotificationsSilentMode And ShowNotifications Then + Select Case Sender + Case NotificationObjects.All : Return ShowNotifications + Case NotificationObjects.Profiles : Return ShowNotificationsDownProfiles + Case NotificationObjects.AutoDownloader : Return ShowNotificationsDownAutoDownloader + Case NotificationObjects.Channels : Return ShowNotificationsDownChannels + Case NotificationObjects.SavedPosts : Return ShowNotificationsDownSavedPosts + Case NotificationObjects.STDownloader : Return ShowNotificationsSTDownloader + Case NotificationObjects.LOG : Return ShowNotificationsLOG + Case Else : Return True + End Select + Else + Return False + End If + End Get + End Property + Friend Property NotificationsSilentMode As Boolean = False + Friend ReadOnly Property ShowNotifications As XMLValue(Of Boolean) + Friend ReadOnly Property ShowNotificationsDownProfiles As XMLValue(Of Boolean) + Friend ReadOnly Property ShowNotificationsDownAutoDownloader As XMLValue(Of Boolean) + Friend ReadOnly Property ShowNotificationsDownChannels As XMLValue(Of Boolean) + Friend ReadOnly Property ShowNotificationsDownSavedPosts As XMLValue(Of Boolean) + Friend ReadOnly Property ShowNotificationsSTDownloader As XMLValue(Of Boolean) + Friend ReadOnly Property ShowNotificationsSTDownloaderEveryDownload As XMLValue(Of Boolean) + Friend ReadOnly Property ShowNotificationsLOG As XMLValue(Of Boolean) #End Region #Region "Defaults" + Friend ReadOnly Property SeparateVideoFolder As XMLValue(Of Boolean) Friend ReadOnly Property DefaultTemporary As XMLValue(Of Boolean) Friend ReadOnly Property DefaultDownloadImages As XMLValue(Of Boolean) Friend ReadOnly Property DefaultDownloadVideos As XMLValue(Of Boolean) - Friend ReadOnly Property ChangeReadyForDownOnTempChange As XMLValue(Of Boolean) Friend ReadOnly Property DownloadNativeImageFormat As XMLValue(Of Boolean) - Friend ReadOnly Property ReparseMissingInTheRoutine As XMLValue(Of Boolean) Friend ReadOnly Property UserSiteNameAsFriendly As XMLValue(Of Boolean) - Friend ReadOnly Property UserSiteNameUpdateEveryTime As XMLValue(Of Boolean) - Friend ReadOnly Property CMDEncoding As XMLValue(Of Integer) - Friend ReadOnly Property UseDefaultAccountIfMissing As XMLValue(Of Boolean) #End Region #Region "STDownloader" Friend ReadOnly Property STDownloader_UpdateYouTubeOutputPath As XMLValue(Of Boolean) @@ -875,115 +1148,71 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable End Get End Property #End Region -#Region "User metrics" - Friend ReadOnly Property UMetrics_What As XMLValue(Of Integer) - Friend ReadOnly Property UMetrics_Order As XMLValue(Of Integer) - Friend ReadOnly Property UMetrics_ShowDrives As XMLValue(Of Boolean) - Friend ReadOnly Property UMetrics_ShowCollections As XMLValue(Of Boolean) -#End Region -#Region "User data" - Friend ReadOnly Property FromChannelDownloadTop As XMLValue(Of Integer) - Friend ReadOnly Property FromChannelDownloadTopUse As XMLValue(Of Boolean) - Friend ReadOnly Property FromChannelCopyImageToUser As XMLValue(Of Boolean) +#Region "Downloading" Friend ReadOnly Property UpdateUserDescriptionEveryTime As XMLValue(Of Boolean) + Friend ReadOnly Property UpdateUserSiteNameEveryTime As XMLValue(Of Boolean) Friend ReadOnly Property UpdateUserIconBannerEveryTime As XMLValue(Of Boolean) -#Region "File naming" + Friend ReadOnly Property AddMissingToLog As XMLValue(Of Boolean) + Friend ReadOnly Property AddMissingErrorsToLog As XMLValue(Of Boolean) + Friend ReadOnly Property DownloadsCompleteCommand As XMLValueAttribute(Of String, Boolean) + Friend ReadOnly Property ReparseMissingInTheRoutine As XMLValue(Of Boolean) + Friend ReadOnly Property UseDefaultAccountIfMissing As XMLValue(Of Boolean) +#End Region +#Region "Downloading: file naming" Friend ReadOnly Property FileAddDateToFileName As XMLValue(Of Boolean) Friend ReadOnly Property FileAddTimeToFileName As XMLValue(Of Boolean) Friend ReadOnly Property FileDateTimePositionEnd As XMLValue(Of Boolean) Friend ReadOnly Property FileReplaceNameByDate As XMLValue(Of Integer) #End Region +#Region "Downloading: file naming: PROVIDER" + Private Sub ChangeDateProvider(ByVal Sender As Object, ByVal e As EventArgs) + If Not _UpdatesSuspended Then + Dim p$ = String.Empty + If FileAddDateToFileName Then p = "yyyyMMdd" + If FileAddTimeToFileName Then p.StringAppend("HHmmss", "_") + If Not p.IsEmptyString Then FileDateAppenderProvider = New ADateTime(p) Else FileDateAppenderProvider = New ADateTime("yyyyMMdd_HHmmss") + If FileReplaceNameByDate.Value = FileNameReplaceMode.Replace Then + FileDateAppenderPattern = "{1}" + Else + If FileDateTimePositionEnd Then FileDateAppenderPattern = "{0}_{1}" Else FileDateAppenderPattern = "{1}_{0}" + End If + End If + End Sub #End Region -#Region "View" - Friend ReadOnly Property MainFrameUsersShowDefaults As XMLValue(Of Boolean) - Friend ReadOnly Property MainFrameUsersShowSubscriptions As XMLValue(Of Boolean) - Friend ReadOnly Property MainFrameUsersSubscriptionsColorBack As XMLValue(Of Color) - Friend ReadOnly Property MainFrameUsersSubscriptionsColorFore As XMLValue(Of Color) - Friend ReadOnly Property MainFrameUsersSubscriptionsColorBack_USERS As XMLValue(Of Color) - Friend ReadOnly Property MainFrameUsersSubscriptionsColorFore_USERS As XMLValue(Of Color) - Friend ReadOnly Property FastProfilesLoading As XMLValue(Of Boolean) - Friend ReadOnly Property MaxLargeImageHeight As XMLValue(Of Integer) - Friend ReadOnly Property MaxSmallImageHeight As XMLValue(Of Integer) - Friend ReadOnly Property UserListBackColor As XMLValue(Of Color) - Friend ReadOnly Property UserListBackColorF As Color - Get - Return If(UserListBackColor.Exists, UserListBackColor.Value, SystemColors.Window) - End Get - End Property - Friend ReadOnly Property UserListForeColor As XMLValue(Of Color) - Friend ReadOnly Property UserListForeColorF As Color - Get - Return If(UserListForeColor.Exists, UserListForeColor.Value, SystemColors.WindowText) - End Get - End Property - Friend ReadOnly Property UserListImage As XMLValue(Of SFile) - Friend ReadOnly Property DownloadOpenInfo As XMLValueAttribute(Of Boolean, Boolean) - Friend ReadOnly Property DownloadOpenProgress As XMLValueAttribute(Of Boolean, Boolean) - Friend ReadOnly Property DownloadsCompleteCommand As XMLValueAttribute(Of String, Boolean) - Friend ReadOnly Property ClosingCommand As XMLValueAttribute(Of String, Boolean) - Friend ReadOnly Property InfoViewMode As XMLValue(Of Integer) - Friend ReadOnly Property InfoViewDefault As XMLValue(Of Boolean) - Friend ReadOnly Property ViewMode As XMLValue(Of Integer) - Friend ReadOnly Property ViewModeIsPicture As Boolean - Get - Select Case ViewMode.Value - Case View.LargeIcon, View.SmallIcon : Return True - Case Else : Return False - End Select - End Get - End Property - Friend ReadOnly Property ShowingMode As XMLValue(Of Integer) - Friend ReadOnly Property GroupUsers As XMLValue(Of Boolean) - Friend ReadOnly Property ShowGroupsInsteadLabels As XMLValue(Of Boolean) - Friend ReadOnly Property SelectedSites As XMLValuesCollection(Of String) -#Region "View dates" - Private ReadOnly _ViewDateFrom As XMLValue(Of Date) - Friend Property ViewDateFrom As Date? - Get - If _ViewDateFrom.ValueF.Exists Then Return _ViewDateFrom.Value Else Return Nothing - End Get - Set(ByVal d As Date?) - If Not d.HasValue Then _ViewDateFrom.ValueF = Nothing Else _ViewDateFrom.Value = d.Value.Date - End Set - End Property - Private ReadOnly _ViewDateTo As XMLValue(Of Date) - Friend Property ViewDateTo As Date? - Get - If _ViewDateTo.ValueF.Exists Then Return _ViewDateTo.Value Else Return Nothing - End Get - Set(ByVal d As Date?) - If Not d.HasValue Then _ViewDateTo.ValueF = Nothing Else _ViewDateTo.Value = d.Value.Date - End Set - End Property - Friend ReadOnly Property ViewDateMode As XMLValue(Of Integer) +#Region "Downloading: script" + Friend Shared Sub ScriptTextBoxButtonClick(ByRef TXT As TextBoxExtended, ByVal Sender As ActionButton) + If Sender.DefaultButton = ActionButton.DefaultButtons.Open Then + Dim f As SFile = SFile.SelectFiles(TXT.Text, False, "Select script file").FirstOrDefault + If Not f.IsEmptyString Then TXT.Text = f.ToString & " ""{0}""" + End If + End Sub + Friend ReadOnly Property ScriptData As XMLValueAttribute(Of String, Boolean) #End Region -#End Region -#Region "Latest values" - Friend ReadOnly Property LatestSavingPath As XMLValue(Of SFile) - Friend ReadOnly Property LatestSelectedChannel As XMLValue(Of String) - Friend ReadOnly Property LatestDownloadedSites As XMLValuesCollection(Of String) -#End Region -#Region "Channels properties" - Friend ReadOnly Property ChannelsDefaultReadyForDownload As XMLValue(Of Boolean) - Friend ReadOnly Property ChannelsDefaultTemporary As XMLValue(Of Boolean) - Friend ReadOnly Property ChannelsRegularCheckMD5 As XMLValue(Of Boolean) +#Region "Channels" Friend ReadOnly Property ChannelsImagesRows As XMLValue(Of Integer) Friend ReadOnly Property ChannelsImagesColumns As XMLValue(Of Integer) +#Region "Channels: user" + Friend ReadOnly Property FromChannelDownloadTop As XMLValue(Of Integer) + Friend ReadOnly Property FromChannelDownloadTopUse As XMLValue(Of Boolean) + Friend ReadOnly Property FromChannelCopyImageToUser As XMLValue(Of Boolean) +#End Region + Friend ReadOnly Property ChannelsAddUserImagesFromAllChannels As XMLValue(Of Boolean) + Friend ReadOnly Property ChannelsDefaultReadyForDownload As XMLValue(Of Boolean) + Friend ReadOnly Property ChannelsDefaultTemporary As XMLValue(Of Boolean) Friend ReadOnly Property ChannelsHideExistsUser As XMLValue(Of Boolean) Friend ReadOnly Property ChannelsMaxJobsCount As XMLValue(Of Integer) - Friend ReadOnly Property ChannelsAddUserImagesFromAllChannels As XMLValue(Of Boolean) #End Region -#Region "Feed properties" - Friend ReadOnly Property FeedDataColumns As XMLValue(Of Integer) +#Region "Feed" Friend ReadOnly Property FeedDataRows As XMLValue(Of Integer) + Friend ReadOnly Property FeedDataColumns As XMLValue(Of Integer) Friend ReadOnly Property FeedCenterImage As XMLValueUse(Of Integer) - Friend ReadOnly Property FeedEndless As XMLValue(Of Boolean) - Friend ReadOnly Property FeedAddDateToCaption As XMLValue(Of Boolean) - Friend ReadOnly Property FeedAddSessionToCaption As XMLValue(Of Boolean) - Friend ReadOnly Property FeedStoreSessionsData As XMLValue(Of Boolean) - Friend ReadOnly Property FeedStoredSessionsNumber As XMLValue(Of Integer) Friend ReadOnly Property FeedBackColor As XMLValue(Of Color) Friend ReadOnly Property FeedForeColor As XMLValue(Of Color) + Friend ReadOnly Property FeedEndless As XMLValue(Of Boolean) + Friend ReadOnly Property FeedAddSessionToCaption As XMLValue(Of Boolean) + Friend ReadOnly Property FeedAddDateToCaption As XMLValue(Of Boolean) + Friend ReadOnly Property FeedStoreSessionsData As XMLValue(Of Boolean) + Friend ReadOnly Property FeedStoredSessionsNumber As XMLValue(Of Integer) Friend ReadOnly Property FeedOpenLastMode As XMLValue(Of Boolean) Friend ReadOnly Property FeedLastModeSubscriptions As XMLValue(Of Boolean) Friend ReadOnly Property FeedShowFriendlyNames As XMLValue(Of Boolean) @@ -997,71 +1226,40 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable Friend ReadOnly Property FeedMoveCopyCreatePathProfile As XMLValue(Of Boolean) #End Region #End Region -#Region "New version properties" - Friend ReadOnly Property CheckUpdatesAtStart As XMLValue(Of Boolean) - Friend ReadOnly Property ShowNewVersionNotification As XMLValue(Of Boolean) - Friend ReadOnly Property LatestVersion As XMLValue(Of String) +#Region "View (filters)" + Friend ReadOnly Property ViewMode As XMLValue(Of Integer) + Friend ReadOnly Property ViewModeIsPicture As Boolean + Get + Select Case ViewMode.Value + Case View.LargeIcon, View.SmallIcon : Return True + Case Else : Return False + End Select + End Get + End Property + Friend ReadOnly Property ShowAllUsers As XMLValue(Of Boolean) + Private ReadOnly Property ViewReorganized As XMLValue(Of Boolean) + Friend ReadOnly Property GroupUsers As XMLValue(Of Boolean) + Friend ReadOnly Property ShowGroupsInsteadLabels As XMLValue(Of Boolean) #End Region -#Region "Notifications" - Friend Enum NotificationObjects - All - Profiles - AutoDownloader - Channels - SavedPosts - STDownloader - LOG - End Enum - Friend ReadOnly Property ProcessNotification(ByVal Sender As NotificationObjects) As Boolean - Get - If Not NotificationsSilentMode And ShowNotifications Then - Select Case Sender - Case NotificationObjects.All : Return ShowNotifications - Case NotificationObjects.Profiles : Return ShowNotificationsDownProfiles - Case NotificationObjects.AutoDownloader : Return ShowNotificationsDownAutoDownloader - Case NotificationObjects.Channels : Return ShowNotificationsDownChannels - Case NotificationObjects.SavedPosts : Return ShowNotificationsDownSavedPosts - Case NotificationObjects.STDownloader : Return ShowNotificationsSTDownloader - Case NotificationObjects.LOG : Return ShowNotificationsLOG - Case Else : Return True - End Select - Else - Return False - End If - End Get - End Property - Friend Property NotificationsSilentMode As Boolean = False - Friend ReadOnly Property ShowNotifications As XMLValue(Of Boolean) - Friend ReadOnly Property ShowNotificationsDownProfiles As XMLValue(Of Boolean) - Friend ReadOnly Property ShowNotificationsDownAutoDownloader As XMLValue(Of Boolean) - Friend ReadOnly Property ShowNotificationsDownChannels As XMLValue(Of Boolean) - Friend ReadOnly Property ShowNotificationsDownSavedPosts As XMLValue(Of Boolean) - Friend ReadOnly Property ShowNotificationsSTDownloader As XMLValue(Of Boolean) - Friend ReadOnly Property ShowNotificationsSTDownloaderEveryDownload As XMLValue(Of Boolean) - Friend ReadOnly Property ShowNotificationsLOG As XMLValue(Of Boolean) +#Region "Info form" + Friend ReadOnly Property InfoViewMode As XMLValue(Of Integer) + Friend ReadOnly Property InfoViewDefault As XMLValue(Of Boolean) #End Region -#Region "Other program properties" - Friend ReadOnly Property ProgramText As XMLValue(Of String) - Friend ReadOnly Property ProgramDescription As XMLValue(Of String) - Friend ReadOnly Property ExitConfirm As XMLValue(Of Boolean) - Friend ReadOnly Property CloseToTray As XMLValue(Of Boolean) - Friend ReadOnly Property OpenFolderInOtherProgram As XMLValueUse(Of String) - Private ReadOnly Property IDownloaderSettings_OpenFolderInOtherProgram As Boolean Implements IDownloaderSettings.OpenFolderInOtherProgram - Get - Return OpenFolderInOtherProgram.Use - End Get - End Property - Private ReadOnly Property IDownloaderSettings_OpenFolderInOtherProgram_Command As String Implements IDownloaderSettings.OpenFolderInOtherProgram_Command - Get - Return OpenFolderInOtherProgram - End Get - End Property - Friend ReadOnly Property DeleteToRecycleBin As XMLValue(Of Boolean) - Friend ReadOnly Property DeleteMode As SFODelete - Get - Return If(DeleteToRecycleBin, SFODelete.DeleteToRecycleBin, SFODelete.None) - End Get - End Property +#Region "Search form" + Friend ReadOnly Property SearchInName As XMLValue(Of Boolean) + Friend ReadOnly Property SearchInDescription As XMLValue(Of Boolean) + Friend ReadOnly Property SearchInLabel As XMLValue(Of Boolean) +#End Region +#Region "User metrics form" + Friend ReadOnly Property UMetrics_What As XMLValue(Of Integer) + Friend ReadOnly Property UMetrics_Order As XMLValue(Of Integer) + Friend ReadOnly Property UMetrics_ShowDrives As XMLValue(Of Boolean) + Friend ReadOnly Property UMetrics_ShowCollections As XMLValue(Of Boolean) +#End Region +#Region "Latest values" + Friend ReadOnly Property LastCopyPath As XMLValue(Of SFile) + Friend ReadOnly Property LatestSavingPath As XMLValue(Of SFile) + Friend ReadOnly Property LatestSelectedChannel As XMLValue(Of String) #End Region #Region "IDisposable Support" Private disposedValue As Boolean = False @@ -1081,7 +1279,6 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable LastCollections.Clear() Users.ListClearDispose UsersList.Clear() - SelectedSites.Dispose() Design.Dispose() MyXML.Dispose() End If diff --git a/SCrawler/ViewFilter.vb b/SCrawler/ViewFilter.vb deleted file mode 100644 index 05b3da8..0000000 --- a/SCrawler/ViewFilter.vb +++ /dev/null @@ -1,263 +0,0 @@ -' Copyright (C) Andy https://github.com/AAndyProgram -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY -Imports PersonalUtilities.Tools -Imports PersonalUtilities.Functions.XML -Imports PersonalUtilities.Functions.XML.Base -Friend Structure ViewFilter : Implements IEContainerProvider, IComparable(Of ViewFilter) -#Region "Names" - Private Const Name_Name As String = "Name" - Private Const Name_ViewMode As String = "ViewMode" - Private Const Name_GroupUsers As String = "GroupUsers" - Private Const Name_ShowUsers As String = "ShowUsers" - Private Const Name_ShowSubscriptions As String = "ShowSubscriptions" - Private Const Name_Sites As String = "Sites" - Private Const Name_ShowingMode As String = "ShowingMode" - Private Const Name_Labels As String = "Labels" - Private Const Name_ExcludedLabels As String = "ExcludedLabels" - Private Const Name_IgnoreExcludedLabels As String = "IgnoreExcludedLabels" - Private Const Name_ShowGroupsInsteadLabels As String = "ShowGroupsInsteadLabels" - Private Const Name_FilterADV As String = "FilterADV" - Private Const Name_DateFrom As String = "DateFrom" - Private Const Name_DateTo As String = "DateTo" - Private Const Name_DateMode As String = "DateMode" -#End Region -#Region "Declarations" - Friend Name As String - - Friend ViewMode As ViewModes - - Friend GroupUsers As Boolean - - Friend ShowUsers As Boolean - Friend ShowSubscriptions As Boolean - - Friend Sites As IEnumerable(Of String) - - Friend ShowingMode As ShowingModes - - Friend Labels As IEnumerable(Of String) - - Friend ExcludedLabels As IEnumerable(Of String) - Friend IgnoreExcludedLabels As Boolean - Friend ShowGroupsInsteadLabels As Boolean - - Friend FilterADV As DownloadObjects.Groups.DownloadGroup - - Friend DateFrom As Date? - Friend DateTo As Date? - Friend DateMode As ShowingDates - Friend ReadOnly Property LimitDates As Boolean - Get - Return (DateFrom.HasValue Or DateTo.HasValue) And Not DateMode = ShowingDates.Off - End Get - End Property - Friend Function GetAllLabels() As IEnumerable(Of String) - Return ListAddList(Nothing, Labels).ListAddList(ExcludedLabels).ListAddList({FilterADV}.GetGroupsLabels).ListIfNothing - End Function -#End Region -#Region "Initializers" - Friend Sub New(ByVal e As EContainer) - With e - Name = .Value(Name_Name) - ViewMode = .Value(Name_ViewMode).FromXML(Of Integer)(ViewModes.IconLarge) - GroupUsers = .Value(Name_GroupUsers).FromXML(Of Boolean)(True) - ShowUsers = .Value(Name_ShowUsers).FromXML(Of Boolean)(True) - ShowSubscriptions = .Value(Name_ShowSubscriptions).FromXML(Of Boolean)(True) - Sites = .Value(Name_Sites).StringToList(Of String)("|") - ShowingMode = .Value(Name_ShowingMode).FromXML(Of Integer)(ShowingModes.All) - Labels = .Value(Name_Labels).StringToList(Of String)("|") - ExcludedLabels = .Value(Name_ExcludedLabels).StringToList(Of String)("|") - IgnoreExcludedLabels = .Value(Name_IgnoreExcludedLabels).FromXML(Of Boolean)(False) - ShowGroupsInsteadLabels = .Value(Name_ShowGroupsInsteadLabels).FromXML(Of Boolean)(True) - With .Item(Name_FilterADV) - If If(?.Count, 0) > 0 Then - FilterADV = New DownloadObjects.Groups.DownloadGroup(.Item(0)) - Else - FilterADV = New DownloadObjects.Groups.DownloadGroup - End If - End With - DateFrom = AConvert(Of Date)(.Value(Name_DateFrom), DateTimeDefaultProvider, Nothing) - DateTo = AConvert(Of Date)(.Value(Name_DateTo), DateTimeDefaultProvider, Nothing) - DateMode = .Value(Name_DateMode).FromXML(Of Integer)(ShowingDates.Off) - End With - End Sub - Friend Shared Function FromCurrent(Optional ByVal Name As String = "") As ViewFilter - Dim f As New ViewFilter - With Settings - f.Name = Name - - f.ViewMode = .ViewMode - - f.GroupUsers = .GroupUsers - - f.ShowUsers = .MainFrameUsersShowDefaults - f.ShowSubscriptions = .MainFrameUsersShowSubscriptions - - If .SelectedSites.Count > 0 Then f.Sites = .SelectedSites - - f.ShowingMode = .ShowingMode - - If .Labels.Current.Count > 0 Then f.Labels = .Labels.Current - - If .Labels.Excluded.Count > 0 Then f.ExcludedLabels = .Labels.Excluded - f.IgnoreExcludedLabels = .Labels.ExcludedIgnore - f.ShowGroupsInsteadLabels = .ShowGroupsInsteadLabels - - f.FilterADV = .AdvancedFilter.Copy - - f.DateFrom = .ViewDateFrom - f.DateTo = .ViewDateTo - f.DateMode = .ViewDateMode - End With - Return f - End Function -#End Region - Friend Sub Populate() - With Settings - .BeginUpdate() - - .ViewMode.Value = ViewMode - - .GroupUsers.Value = GroupUsers - - .MainFrameUsersShowDefaults.Value = ShowUsers - .MainFrameUsersShowSubscriptions.Value = ShowSubscriptions - - With .SelectedSites - .Clear() - If Sites.ListExists Then .AddRange(Sites) - .Update() - End With - - .ShowingMode.Value = ShowingMode - With .Labels - With .Current - .Clear() - If Labels.ListExists Then .AddRange(Labels) - .Update() - End With - - With .Excluded - .Clear() - If ExcludedLabels.ListExists Then .AddRange(ExcludedLabels) - .Update() - End With - - .ExcludedIgnore.Value = IgnoreExcludedLabels - End With - .ShowGroupsInsteadLabels.Value = ShowGroupsInsteadLabels - - .AdvancedFilter.Copy(FilterADV) - .AdvancedFilter.UpdateFile() - - .ViewDateFrom = DateFrom - .ViewDateTo = DateTo - .ViewDateMode.Value = DateMode - - .EndUpdate() - End With - End Sub - Public Overrides Function ToString() As String - Return Name - End Function - Public Overrides Function Equals(ByVal Obj As Object) As Boolean - Return Name.StringToLower = DirectCast(Obj, ViewFilter).Name - End Function - Private Function CompareTo(ByVal Other As ViewFilter) As Integer Implements IComparable(Of ViewFilter).CompareTo - Return Name.CompareTo(Other.Name) - End Function - Friend Function ToEContainer(Optional ByVal e As ErrorsDescriber = Nothing) As EContainer Implements IEContainerProvider.ToEContainer - Return New EContainer("Filter") From { - New EContainer(Name_Name, Name), - New EContainer(Name_ViewMode, CInt(ViewMode)), - New EContainer(Name_GroupUsers, GroupUsers.BoolToInteger), - New EContainer(Name_ShowUsers, ShowUsers.BoolToInteger), - New EContainer(Name_ShowSubscriptions, ShowSubscriptions.BoolToInteger), - New EContainer(Name_Sites, Sites.ListToString("|")), - New EContainer(Name_ShowingMode, CInt(ShowingMode)), - New EContainer(Name_Labels, Labels.ListToString("|")), - New EContainer(Name_ExcludedLabels, ExcludedLabels.ListToString("|")), - New EContainer(Name_IgnoreExcludedLabels, IgnoreExcludedLabels.BoolToInteger), - New EContainer(Name_ShowGroupsInsteadLabels, ShowGroupsInsteadLabels.BoolToInteger), - New EContainer(Name_FilterADV) From {FilterADV.ToEContainer}, - New EContainer(Name_DateFrom, AConvert(Of String)(DateFrom, DateTimeDefaultProvider, String.Empty)), - New EContainer(Name_DateTo, AConvert(Of String)(DateTo, DateTimeDefaultProvider, String.Empty)), - New EContainer(Name_DateMode, CInt(DateMode)) - } - End Function -End Structure -Friend Class ViewFilterCollection : Implements IEnumerable(Of ViewFilter), IMyEnumerator(Of ViewFilter) - Private ReadOnly Filters As List(Of ViewFilter) - Private ReadOnly File As SFile = $"{SettingsFolderName}\SavedFilters.xml" - Friend Sub New() - Filters = New List(Of ViewFilter) - If File.Exists Then - Using x As New XmlFile(File, Protector.Modes.All, False) With {.AllowSameNames = True} - x.LoadData() - If x.Count > 0 Then Filters.ListAddList(x, LAP.IgnoreICopier) - End Using - End If - If Filters.Count > 0 Then Filters.Sort() - End Sub - Default Friend ReadOnly Property Item(ByVal Index As Integer) As ViewFilter Implements IMyEnumerator(Of ViewFilter).MyEnumeratorObject - Get - Return Filters(Index) - End Get - End Property - Friend ReadOnly Property Count As Integer Implements IMyEnumerator(Of ViewFilter).MyEnumeratorCount - Get - Return Filters.Count - End Get - End Property - Friend Function GetAllLabels() As IEnumerable(Of String) - If Count = 0 Then - Return New String() {} - Else - Return ListAddList(Nothing, Filters.SelectMany(Function(f) f.GetAllLabels), LAP.NotContainsOnly) - End If - End Function - Friend Sub Update() - If Count > 0 Then - Filters.Sort() - Using x As New XmlFile With {.AllowSameNames = True} - x.AddRange(Filters) - x.Name = "Filters" - x.Save(File, EDP.LogMessageValue) - End Using - Else - If File.Exists Then File.Delete() - End If - End Sub - Friend Sub Add(ByVal Item As ViewFilter, Optional ByVal AutoUpdate As Boolean = True) - Dim i% = IndexOf(Item) - If i >= 0 Then - Filters(i) = Item - Else - Filters.Add(Item) - End If - Filters.Sort() - If AutoUpdate Then Update() - End Sub - Friend Overloads Function IndexOf(ByVal Item As ViewFilter) As Integer - If Count > 0 Then - Return Filters.IndexOf(Item) - Else - Return -1 - End If - End Function - Friend Overloads Function IndexOf(ByVal Name As String) As Integer - Return IndexOf(New ViewFilter With {.Name = Name}) - End Function - Private Function GetEnumerator() As IEnumerator(Of ViewFilter) Implements IEnumerable(Of ViewFilter).GetEnumerator - Return New MyEnumerator(Of ViewFilter)(Me) - End Function - Private Function IEnumerable_GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator - Return GetEnumerator() - End Function -End Class \ No newline at end of file