2024.3.24.0

YT
YouTubeMediaContainerBase: add item index to playlist row only if it is > 0

SCrawler
API.Instagram: handle 'JsonNull' for saved posts
GlobalSettingsForm: move the 'GroupUser' option to MainFrame
MainFrame: add 'GroupUser' option and 'ViewFilter' options
SettingsHostCollection: update the 'Silent' parameter for single instance
This commit is contained in:
Andy
2024-03-24 02:56:08 +03:00
parent f5dd791941
commit 34cd510507
15 changed files with 431 additions and 95 deletions

View File

@@ -805,7 +805,7 @@ Namespace API.YouTube.Objects
With Element
Dim f As SFile = __file.IfNullOrEmpty(.File)
Dim fName$ = .Title.IfNullOrEmpty(f.Name)
If MyYouTubeSettings.MusicPlaylistCreate_M3U8_AppendNumber Then fName = $"{ .PlaylistIndex}. {fName}"
If MyYouTubeSettings.MusicPlaylistCreate_M3U8_AppendNumber And .PlaylistIndex > 0 Then fName = $"{ .PlaylistIndex}. {fName}"
If Not .UserTitle.IsEmptyString Then
fName = $"{ .UserTitle} - {fName}"
If MyYouTubeSettings.MusicPlaylistCreate_M3U8_AppendArtist Then fName = $"{ .UserTitle} - {fName}"

View File

@@ -868,7 +868,7 @@ BlockNullPicture:
If Settings.Labels.Current.Contains(Labels(i)) Then Return Destination.Groups.Item(Labels(i))
Next
End If
ElseIf Settings.ShowGroups Then
ElseIf Settings.GroupUsers Then
Return Destination.Groups.Item(GetLviGroupName(HOST, Temporary, Favorite, IsCollection))
End If
Return Destination.Groups.Item(LabelsKeeper.NoLabeledName)

View File

@@ -610,7 +610,8 @@ Namespace API.Instagram
End If
dValue = 0
If HasNextPage And Not EndCursor.IsEmptyString Then DownloadData(EndCursor, Section, Token)
Catch jsonNull As JsonDocumentException When jsonNull.State = WebDocumentEventArgs.States.Error And Section = Sections.Reels
Catch jsonNull As JsonDocumentException When jsonNull.State = WebDocumentEventArgs.States.Error And
(Section = Sections.Reels Or Section = Sections.SavedPosts)
Throw jsonNull
Catch eex As ExitException
Throw eex
@@ -618,7 +619,9 @@ Namespace API.Instagram
dValue = ProcessException(ex, Token, $"data downloading error [{URL}]",, Section, False)
End Try
Loop
Catch jsonNull2 As JsonDocumentException When jsonNull2.State = WebDocumentEventArgs.States.Error And Section = Sections.Reels
Catch jsonNull2 As JsonDocumentException When jsonNull2.State = WebDocumentEventArgs.States.Error And
(Section = Sections.Reels Or Section = Sections.SavedPosts)
If Section = Sections.SavedPosts Then DisableSection(Section)
Catch eex2 As ExitException
If eex2.Is560 Then
Throw New Plugin.ExitException With {.Silent = True}
@@ -1216,10 +1219,9 @@ Namespace API.Instagram
If Not IsNothing(Section) AndAlso TypeOf Section Is Sections Then
Dim s As Sections = DirectCast(Section, Sections)
Select Case s
Case Sections.Timeline : MySiteSettings.DownloadTimeline.Value = False
Case Sections.Reels : MySiteSettings.DownloadReels.Value = False
Case Sections.Tagged : MySiteSettings.DownloadTagged.Value = False
Case Sections.Stories, Sections.UserStories
Case Sections.Timeline, Sections.Stories, Sections.UserStories, Sections.SavedPosts
MySiteSettings.DownloadTimeline.Value = False
MySiteSettings.DownloadStories.Value = False
MySiteSettings.DownloadStoriesUser.Value = False

View File

@@ -245,7 +245,7 @@ Namespace DownloadObjects.Groups
End Sub
#End Region
#Region "IEContainerProvider Support"
Private Function ToEContainer(Optional ByVal e As ErrorsDescriber = Nothing) As EContainer Implements IEContainerProvider.ToEContainer
Friend Function ToEContainer(Optional ByVal e As ErrorsDescriber = Nothing) As EContainer Implements IEContainerProvider.ToEContainer
Return Export(New EContainer("Group"))
End Function
#End Region

View File

@@ -59,6 +59,7 @@ Namespace Editors
If x.Count > 0 Then Colors.ListAddList(x, LAP.IgnoreICopier)
End Using
End If
If Colors.Count > 0 Then Colors.Sort()
End Sub
Friend ReadOnly Property Item(ByVal Index As Integer) As DataColor Implements IMyEnumerator(Of DataColor).MyEnumeratorObject
Get
@@ -72,6 +73,7 @@ Namespace Editors
End Property
Friend Sub Update()
If Count > 0 Then
Colors.Sort()
Using x As New XmlFile With {.AllowSameNames = True}
x.AddRange(Colors)
x.Name = "Colors"

View File

@@ -97,8 +97,6 @@ Namespace Editors
Me.TXT_MAX_JOBS_CHANNELS = New PersonalUtilities.Forms.Controls.TextBoxExtended()
Me.CH_CHECK_VER_START = New System.Windows.Forms.CheckBox()
Me.TXT_IMGUR_CLIENT_ID = New PersonalUtilities.Forms.Controls.TextBoxExtended()
Me.CH_SHOW_GROUPS = New System.Windows.Forms.CheckBox()
Me.CH_USERS_GROUPING = New System.Windows.Forms.CheckBox()
Me.TXT_USER_AGENT = New PersonalUtilities.Forms.Controls.TextBoxExtended()
Me.OPT_FILE_NAME_REPLACE = New System.Windows.Forms.RadioButton()
Me.OPT_FILE_NAME_ADD_DATE = New System.Windows.Forms.RadioButton()
@@ -304,13 +302,11 @@ Namespace Editors
TP_BASIS.Controls.Add(Me.TXT_MAX_JOBS_CHANNELS, 0, 4)
TP_BASIS.Controls.Add(Me.CH_CHECK_VER_START, 0, 5)
TP_BASIS.Controls.Add(Me.TXT_IMGUR_CLIENT_ID, 0, 7)
TP_BASIS.Controls.Add(Me.CH_SHOW_GROUPS, 0, 8)
TP_BASIS.Controls.Add(Me.CH_USERS_GROUPING, 0, 9)
TP_BASIS.Controls.Add(Me.TXT_USER_AGENT, 0, 6)
TP_BASIS.Dock = System.Windows.Forms.DockStyle.Fill
TP_BASIS.Location = New System.Drawing.Point(3, 3)
TP_BASIS.Name = "TP_BASIS"
TP_BASIS.RowCount = 11
TP_BASIS.RowCount = 9
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
@@ -319,14 +315,9 @@ Namespace Editors
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!))
TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!))
TP_BASIS.Size = New System.Drawing.Size(615, 393)
TP_BASIS.TabIndex = 0
'
@@ -471,30 +462,6 @@ Namespace Editors
Me.TXT_IMGUR_CLIENT_ID.Size = New System.Drawing.Size(607, 22)
Me.TXT_IMGUR_CLIENT_ID.TabIndex = 7
'
'CH_SHOW_GROUPS
'
Me.CH_SHOW_GROUPS.AutoSize = True
Me.CH_SHOW_GROUPS.Dock = System.Windows.Forms.DockStyle.Fill
Me.CH_SHOW_GROUPS.Location = New System.Drawing.Point(4, 233)
Me.CH_SHOW_GROUPS.Name = "CH_SHOW_GROUPS"
Me.CH_SHOW_GROUPS.Size = New System.Drawing.Size(607, 19)
Me.CH_SHOW_GROUPS.TabIndex = 8
Me.CH_SHOW_GROUPS.Text = "Show groups"
TT_MAIN.SetToolTip(Me.CH_SHOW_GROUPS, "Grouping users by site")
Me.CH_SHOW_GROUPS.UseVisualStyleBackColor = True
'
'CH_USERS_GROUPING
'
Me.CH_USERS_GROUPING.AutoSize = True
Me.CH_USERS_GROUPING.Dock = System.Windows.Forms.DockStyle.Fill
Me.CH_USERS_GROUPING.Location = New System.Drawing.Point(4, 259)
Me.CH_USERS_GROUPING.Name = "CH_USERS_GROUPING"
Me.CH_USERS_GROUPING.Size = New System.Drawing.Size(607, 19)
Me.CH_USERS_GROUPING.TabIndex = 9
Me.CH_USERS_GROUPING.Text = "Use user grouping"
TT_MAIN.SetToolTip(Me.CH_USERS_GROUPING, "Group users by groups and/or labels")
Me.CH_USERS_GROUPING.UseVisualStyleBackColor = True
'
'TXT_USER_AGENT
'
ActionButton7.BackgroundImage = CType(resources.GetObject("ActionButton7.BackgroundImage"), System.Drawing.Image)
@@ -2442,8 +2409,6 @@ Namespace Editors
Private WithEvents TXT_FOLDER_CMD As PersonalUtilities.Forms.Controls.TextBoxExtended
Private WithEvents CH_RECYCLE_DEL As CheckBox
Private WithEvents TXT_SCRIPT As PersonalUtilities.Forms.Controls.TextBoxExtended
Private WithEvents CH_SHOW_GROUPS As CheckBox
Private WithEvents CH_USERS_GROUPING As CheckBox
Private WithEvents CH_DOWN_OPEN_INFO As CheckBox
Private WithEvents CH_DOWN_OPEN_PROGRESS As CheckBox
Private WithEvents TXT_CLOSE_SCRIPT As PersonalUtilities.Forms.Controls.TextBoxExtended

View File

@@ -191,12 +191,6 @@
AFuc5QFgn6ClHh5iOQVAKNixyucB8NY0vG9JOzzyhrdq5IRgAAAAAElFTkSuQmCC
</value>
</data>
<metadata name="TT_MAIN.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="TT_MAIN.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="ActionButton7.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6
@@ -230,6 +224,12 @@
<metadata name="LBL_DATE_POS.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="TT_MAIN.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="TT_MAIN.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="CH_SEPARATE_VIDEO_FOLDER.ToolTip" xml:space="preserve">
<value>This is a global setting for newly added users only.
This parameter specifies how the video will be stored in the users' download path.

View File

@@ -37,8 +37,6 @@ Namespace Editors
CH_CHECK_VER_START.Checked = .CheckUpdatesAtStart
TXT_USER_AGENT.Text = .UserAgent
TXT_IMGUR_CLIENT_ID.Text = .ImgurClientID
CH_SHOW_GROUPS.Checked = .ShowGroups
CH_USERS_GROUPING.Checked = .UseGrouping
'Design
TXT_PRG_TITLE.Text = .ProgramText
TXT_PRG_DESCR.Text = .ProgramDescription
@@ -222,8 +220,6 @@ Namespace Editors
.UserAgent.Value = TXT_USER_AGENT.Text
DefaultUserAgent = TXT_USER_AGENT.Text
.ImgurClientID.Value = TXT_IMGUR_CLIENT_ID.Text
.ShowGroups.Value = CH_SHOW_GROUPS.Checked
.UseGrouping.Value = CH_USERS_GROUPING.Checked
'Design
.ProgramText.Value = TXT_PRG_TITLE.Text
.ProgramDescription.Value = TXT_PRG_DESCR.Text

View File

@@ -43,6 +43,7 @@ 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()
@@ -97,9 +98,12 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
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_LOAD = New System.Windows.Forms.ToolStripMenuItem()
Me.BTT_LOG = New System.Windows.Forms.ToolStripButton()
Me.BTT_VERSION_INFO = New System.Windows.Forms.ToolStripButton()
Me.BTT_DONATE = New System.Windows.Forms.ToolStripButton()
@@ -164,6 +168,7 @@ 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()
@@ -316,6 +321,11 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
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_SETTINGS
'
Me.MENU_SETTINGS.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
@@ -582,7 +592,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_FILTER_ADV, MENU_VIEW_SEP_4, Me.BTT_SHOW_LIMIT_DATES_NOT, Me.BTT_SHOW_LIMIT_DATES_IN})
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.Image = CType(resources.GetObject("MENU_VIEW.Image"), System.Drawing.Image)
Me.MENU_VIEW.ImageTransparentColor = System.Drawing.Color.Magenta
Me.MENU_VIEW.Name = "MENU_VIEW"
@@ -709,6 +719,14 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
Me.BTT_SHOW_SHOW_GROUPS.Size = New System.Drawing.Size(231, 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.Text = "Group users"
Me.BTT_SHOW_GROUP_USERS.ToolTipText = "Group users by site or labels"
'
'BTT_SHOW_FILTER_ADV
'
Me.BTT_SHOW_FILTER_ADV.AutoToolTip = True
@@ -733,6 +751,20 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
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"
'
'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.Text = "Save current view"
'
'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.Text = "Load view (from saved)"
Me.BTT_VIEW_FILTER_LOAD.ToolTipText = "Load one of your previously saved views"
'
'BTT_LOG
'
Me.BTT_LOG.Image = CType(resources.GetObject("BTT_LOG.Image"), System.Drawing.Image)
@@ -1190,4 +1222,7 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
Private WithEvents BTT_DOWN_SPEC As ToolStripKeyMenuItem
Private WithEvents BTT_SHOW_FILTER_ADV As ToolStripMenuItem
Private WithEvents BTT_TRAY_SCHEDULER As ToolStripMenuItem
Private WithEvents BTT_SHOW_GROUP_USERS As ToolStripMenuItem
Private WithEvents BTT_VIEW_FILTER_SAVE As ToolStripMenuItem
Private WithEvents BTT_VIEW_FILTER_LOAD As ToolStripMenuItem
End Class

View File

@@ -180,19 +180,12 @@
<metadata name="MENU_VIEW_SEP_1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="MENU_VIEW_SEP_5.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="Toolbar_TOP.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<data name="BTT_DOWN_SITE_FULL.ToolTipText" xml:space="preserve">
<value>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.</value>
</data>
<data name="BTT_DOWN_SITE_FULL_SUBSCR.ToolTipText" xml:space="preserve">
<value>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.</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="MENU_VIEW.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@@ -228,6 +221,16 @@ Ctrl+Shift+Click to download, excluding from the feed, including non-existent us
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="BTT_DOWN_SITE_FULL.ToolTipText" xml:space="preserve">
<value>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.</value>
</data>
<data name="BTT_DOWN_SITE_FULL_SUBSCR.ToolTipText" xml:space="preserve">
<value>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.</value>
</data>
<metadata name="Toolbar_BOTTOM.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>239, 17</value>

View File

@@ -98,7 +98,7 @@ Public Class MainFrame
End With
With Settings
LIST_PROFILES.View = .ViewMode
LIST_PROFILES.ShowGroups = .UseGrouping
LIST_PROFILES.ShowGroups = .GroupUsers
ApplyViewPattern(.ViewMode.Value)
AddHandler .Labels.NewLabelAdded, AddressOf UpdateLabelsGroups
UpdateImageColor()
@@ -107,14 +107,7 @@ Public Class MainFrame
UpdateLabelsGroups()
SetShowButtonsCheckers(.ShowingMode.Value)
CheckVersion(False)
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
ApplyView_Users_Sites_Dates()
With .Groups
AddHandler .Added, AddressOf GROUPS_Added
AddHandler .Deleted, AddressOf GROUPS_Deleted
@@ -313,15 +306,12 @@ CloseResume:
With Settings
Dim mhl% = .MaxLargeImageHeight.Value
Dim mhs% = .MaxSmallImageHeight.Value
Dim sg As Boolean = .ShowGroups
Using f As New GlobalSettingsForm
f.ShowDialog()
If f.DialogResult = DialogResult.OK Then
UpdateYouTubeSettings()
If ((Not .MaxLargeImageHeight = mhl Or Not .MaxSmallImageHeight = mhs) And .ViewModeIsPicture) Or
(Not sg = Settings.ShowGroups And .UseGrouping) Then RefillList()
If (Not .MaxLargeImageHeight = mhl Or Not .MaxSmallImageHeight = mhs) And .ViewModeIsPicture Then RefillList()
TrayIcon.Visible = .CloseToTray
LIST_PROFILES.ShowGroups = .UseGrouping
If f.FeedParametersChanged And Not MyFeed Is Nothing Then MyFeed.UpdateSettings()
If f.HeadersChanged Then
Settings.BeginUpdate()
@@ -636,10 +626,10 @@ CloseResume:
Private Sub BTT_VIEW_DETAILS_Click(sender As Object, e As EventArgs) Handles BTT_VIEW_DETAILS.Click
ApplyViewPattern(ViewModes.Details)
End Sub
Private Sub ApplyViewPattern(ByVal v As ViewModes)
Private Sub ApplyViewPattern(ByVal v As ViewModes, Optional ByVal OnlyButtons As Boolean = False)
LIST_PROFILES.View = v
Dim b As Boolean = Not (Settings.ViewMode.Value = v)
Settings.ViewMode.Value = v
If Not OnlyButtons Then Settings.ViewMode.Value = v
BTT_VIEW_LARGE.Checked = v = ViewModes.IconLarge
BTT_VIEW_SMALL.Checked = v = ViewModes.IconSmall
@@ -656,7 +646,7 @@ CloseResume:
If Settings.ViewModeIsPicture Then
With LIST_PROFILES : .LargeImageList.Images.Clear() : .SmallImageList.Images.Clear() : End With
End If
RefillList()
If Not OnlyButtons Then RefillList()
End If
End Sub
#End Region
@@ -740,7 +730,7 @@ CloseResume:
If Settings.ShowingMode.Value = ShowingModes.Labels Then RefillList()
SetShowButtonsCheckers(Settings.ShowingMode.Value)
End Sub
Private Sub SetShowButtonsCheckers(ByVal m As ShowingModes, Optional ByVal ForceRefill As Boolean = False)
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
@@ -752,6 +742,7 @@ CloseResume:
BTT_SHOW_SHOW_GROUPS.Checked = Settings.ShowGroupsInsteadLabels
BTT_SHOW_FILTER_ADV.Checked = m = ShowingModes.AdvancedFilter
SetExcludedButtonChecker()
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
@@ -761,6 +752,7 @@ CloseResume:
.ShowingMode.Value = m
End If
End With
End If
End Sub
Private Sub SetExcludedButtonChecker()
BTT_SHOW_EXCLUDED_LABELS.Checked = Settings.Labels.Excluded.Count > 0
@@ -777,6 +769,14 @@ CloseResume:
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
BTT_SHOW_GROUP_USERS.Checked = .Value
LIST_PROFILES.ShowGroups = .Value
End With
RefillList()
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}
@@ -833,6 +833,72 @@ CloseResume:
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
Dim fName$ = String.Empty
Dim __process As Boolean = False
Do
fName = InputBoxE("Enter a new name for the view:", "Filter 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
Case 1 : __process = True
Case 2 : Exit Sub
End Select
Else
__process = True
End If
Else
Exit Sub
End If
Loop While Not __process
If __process Then
Settings.SavedFilters.Add(ViewFilter.FromCurrent(fName))
MsgBoxE({$"The '{fName}' filter has been saved", "Save filter"})
End If
End Sub
Private Sub BTT_VIEW_FILTER_LOAD_Click(sender As Object, e As EventArgs) Handles BTT_VIEW_FILTER_LOAD.Click
Try
If Settings.SavedFilters.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()
RefillList()
End If
End If
End Using
End If
Catch ex As Exception
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Load filter")
End Try
End Sub
Private Sub ApplyView_Users_Sites_Dates()
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
#End Region
Private Sub BTT_LOG_Click(sender As Object, e As EventArgs) Handles BTT_LOG.Click
MainFrameObj.ShowLog()

View File

@@ -327,7 +327,10 @@ Namespace Plugin.Hosts
Optional ByVal HostNames As IEnumerable(Of String) = Nothing,
Optional ByVal HostNamesPassed As Boolean = False) As Boolean
If FillIndexes Then HostsUnavailableIndexes.Clear()
Dim hnExists As Boolean = HostNames.ListExists
If Count = 1 Then
If Not Silent AndAlso HostNamesPassed AndAlso
(Not hnExists OrElse Not HostNames.Contains([Default].AccountName.IfNullOrEmpty(SettingsHost.NameAccountNameDefault))) Then Silent = True
If [Default].Available(What, Silent) Then
Return True
Else
@@ -338,7 +341,6 @@ Namespace Plugin.Hosts
Dim a As Boolean = False, n As Boolean = False
Dim t$ = String.Empty
Dim tExists As Boolean = False
Dim hnExists As Boolean = HostNames.ListExists
Dim singleHost As Boolean = hnExists AndAlso HostNames.Count = 1
Dim m As New MMessage("", "Some of the hosts are unavailable",, vbExclamation)
For i% = 0 To Count - 1

View File

@@ -504,6 +504,7 @@
<Compile Include="UserSearchForm.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="ViewFilter.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="API\BaseObjects\InternalSettingsForm.resx">

View File

@@ -145,6 +145,7 @@ 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
Private ReadOnly BlackListFile As SFile = $"{SettingsFolderName}\BlackList.txt"
Private ReadOnly UsersSettingsFile As SFile = $"{SettingsFolderName}\Users.xml"
Friend Sub New()
@@ -165,6 +166,7 @@ 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"}
@@ -270,8 +272,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
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)
ShowGroups = New XMLValue(Of Boolean)("ShowGroups", True, MyXML)
UseGrouping = New XMLValue(Of Boolean)("UseGrouping", True, 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)
@@ -390,6 +391,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
AdvancedFilter = New Groups.DownloadGroup
AdvancedFilter.LoadFromFile($"{SettingsFolderName}\AdvancedFilter.xml")
Labels.AddRange({AdvancedFilter}.GetGroupsLabels, False)
Labels.AddRange(SavedFilters.GetAllLabels, False)
MyXML.EndUpdate()
If MyXML.ChangesDetected Then MyXML.Sort() : MyXML.UpdateData()
@@ -930,8 +932,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
End Get
End Property
Friend ReadOnly Property ShowingMode As XMLValue(Of Integer)
Friend ReadOnly Property ShowGroups As XMLValue(Of Boolean)
Friend ReadOnly Property UseGrouping As XMLValue(Of Boolean)
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"

263
SCrawler/ViewFilter.vb Normal file
View File

@@ -0,0 +1,263 @@
' 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