2024.3.26.0

API.Instagram: extract image from video
API.Reddit: add 'TryImage' bypass
Feed: add hotkeys: 'Home', 'End', 'Up', 'Page Up', 'Down', 'Page Down'; fix form deactivating; add ability to save/load view
MainFrame: update the background picture if it has changed
This commit is contained in:
Andy
2024-03-26 04:22:41 +03:00
parent 34cd510507
commit b252d32a7e
11 changed files with 367 additions and 22 deletions

View File

@@ -912,7 +912,8 @@ Namespace API.Instagram
Protected Sub ObtainMedia(ByVal n As EContainer, ByVal PostID As String, Optional ByVal SpecialFolder As String = Nothing,
Optional ByVal DateObj As String = Nothing, Optional ByVal InitialType As Integer = -1,
Optional ByVal PostOriginUrl As String = Nothing,
Optional ByVal State As UStates = UStates.Unknown, Optional ByVal Attempts As Integer = 0)
Optional ByVal State As UStates = UStates.Unknown, Optional ByVal Attempts As Integer = 0,
Optional ByVal TryExtractImage As Boolean = False)
Try
Dim maxSize As Func(Of EContainer, Integer) = Function(ByVal _ss As EContainer) As Integer
Dim w% = AConvert(Of Integer)(_ss.Value("width"), 0)
@@ -956,7 +957,10 @@ Namespace API.Instagram
'2 - one video
'1 - one picture
t = n.Value("media_type").FromXML(Of Integer)(-1)
If t = -1 And InitialType = 8 And ObtainMedia_AllowAbstract Then
If TryExtractImage Then
t = 1
abstractDecision = True
ElseIf t = -1 And InitialType = 8 And ObtainMedia_AllowAbstract Then
If n.Contains(vid) Then
t = 2
abstractDecision = True
@@ -967,7 +971,7 @@ Namespace API.Instagram
End If
If t >= 0 Then
Select Case t
Case 1
Case 1 'one picture
If n.Contains(img) Then
If Not abstractDecision Then t = n.Value("media_type").FromXML(Of Integer)(-1)
DateObj = mDate(n)
@@ -986,7 +990,7 @@ Namespace API.Instagram
End With
End If
End If
Case 2
Case 2 'one video
If n.Contains(vid) Then
DateObj = mDate(n)
With n.ItemF({vid}).XmlIfNothing
@@ -1002,7 +1006,8 @@ Namespace API.Instagram
End If
End With
End If
Case 8
If Not TryExtractImage Then ObtainMedia(n, PostID, SpecialFolder, DateObj, InitialType, PostOriginUrl, State, Attempts, True)
Case 8 'gallery
DateObj = mDate(n)
With n("carousel_media").XmlIfNothing
If .Count > 0 Then

View File

@@ -60,6 +60,10 @@ Namespace API.Reddit
#Region "Other"
<PropertyOption(ControlText:="Use M3U8", ControlToolTip:="Use M3U8 or mp4 for Reddit videos", IsAuth:=False), PXML, PClonable>
Friend ReadOnly Property UseM3U8 As PropertyValue
<PropertyOption(ControlText:="Check image", ControlToolTip:="Check the image if it exists before downloading (it makes downloading very slow)", IsAuth:=False), PXML, PClonable>
Friend ReadOnly Property CheckImage As PropertyValue
<PropertyOption(ControlText:="Check image: get original", ControlToolTip:="Get the original image if it exists", IsAuth:=False), PXML, PClonable>
Friend ReadOnly Property CheckImageReturnOrig As PropertyValue
#End Region
#End Region
#Region "Initializer"
@@ -87,6 +91,8 @@ Namespace API.Reddit
SavedPostsUserName = New PropertyValue(String.Empty, GetType(String))
UseM3U8 = New PropertyValue(True)
CheckImage = New PropertyValue(False)
CheckImageReturnOrig = New PropertyValue(True)
UrlPatternUser = "https://www.reddit.com/{0}/{1}/"
ImageVideoContains = "reddit.com"

View File

@@ -681,6 +681,9 @@ Namespace API.Reddit
End Function
Private Function TryImage(ByVal URL As String) As Boolean
Try
If Not CBool(MySiteSettings.CheckImage.Value) Then
Return MySiteSettings.CheckImageReturnOrig.Value
Else
Dim img As Image = GetImage(SFile.GetBytesFromNet(URL, EDP.ThrowException), EDP.ThrowException)
If Not img Is Nothing Then
img.Dispose()
@@ -688,6 +691,7 @@ Namespace API.Reddit
Else
Return False
End If
End If
Catch
Return False
End Try

View File

@@ -34,6 +34,7 @@ Namespace DownloadObjects
Dim MENU_LOAD_SEP_6 As System.Windows.Forms.ToolStripSeparator
Dim MENU_LOAD_SEP_7 As System.Windows.Forms.ToolStripSeparator
Dim MENU_LOAD_SEP_0 As System.Windows.Forms.ToolStripSeparator
Dim MENU_LOAD_SEP_8 As System.Windows.Forms.ToolStripSeparator
Me.OPT_DEFAULT = New System.Windows.Forms.ToolStripMenuItem()
Me.OPT_SUBSCRIPTIONS = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolbarTOP = New System.Windows.Forms.ToolStrip()
@@ -67,6 +68,8 @@ Namespace DownloadObjects
Me.BTT_DOWN_SELECTED = New System.Windows.Forms.ToolStripMenuItem()
Me.BTT_REFRESH = New System.Windows.Forms.ToolStripButton()
Me.TP_DATA = New System.Windows.Forms.TableLayoutPanel()
Me.BTT_VIEW_SAVE = New System.Windows.Forms.ToolStripMenuItem()
Me.BTT_VIEW_LOAD = New System.Windows.Forms.ToolStripMenuItem()
SEP_1 = New System.Windows.Forms.ToolStripSeparator()
SEP_2 = New System.Windows.Forms.ToolStripSeparator()
MENU_VIEW = New System.Windows.Forms.ToolStripDropDownButton()
@@ -78,6 +81,7 @@ Namespace DownloadObjects
MENU_LOAD_SEP_6 = New System.Windows.Forms.ToolStripSeparator()
MENU_LOAD_SEP_7 = New System.Windows.Forms.ToolStripSeparator()
MENU_LOAD_SEP_0 = New System.Windows.Forms.ToolStripSeparator()
MENU_LOAD_SEP_8 = New System.Windows.Forms.ToolStripSeparator()
Me.ToolbarTOP.SuspendLayout()
Me.SuspendLayout()
'
@@ -166,7 +170,7 @@ Namespace DownloadObjects
'
Me.MENU_LOAD_SESSION.AutoToolTip = False
Me.MENU_LOAD_SESSION.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.MENU_LOAD_SESSION.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_LOAD_SESSION_CURRENT, Me.BTT_LOAD_SESSION_LAST, Me.BTT_LOAD_SESSION_CHOOSE, MENU_LOAD_SEP_0, Me.BTT_COPY_TO, Me.BTT_MOVE_TO, MENU_LOAD_SEP_1, Me.BTT_LOAD_FAV, Me.BTT_LOAD_SPEC, MENU_LOAD_SEP_2, Me.BTT_FEED_ADD_FAV, Me.BTT_FEED_ADD_FAV_REMOVE, Me.BTT_FEED_REMOVE_FAV, MENU_LOAD_SEP_3, Me.BTT_FEED_ADD_SPEC, Me.BTT_FEED_ADD_SPEC_REMOVE, Me.BTT_FEED_REMOVE_SPEC, MENU_LOAD_SEP_4, Me.BTT_FEED_CLEAR_FAV, Me.BTT_FEED_CLEAR_SPEC, Me.BTT_FEED_DELETE_SPEC, Me.BTT_FEED_DELETE_DAILY_LIST, Me.BTT_FEED_DELETE_DAILY_DATE, MENU_LOAD_SEP_5, Me.BTT_MERGE_SESSIONS, Me.BTT_CLEAR_DAILY, MENU_LOAD_SEP_6, Me.BTT_MERGE_FEEDS, MENU_LOAD_SEP_7, Me.BTT_CHECK_ALL, Me.BTT_CHECK_NONE})
Me.MENU_LOAD_SESSION.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_LOAD_SESSION_CURRENT, Me.BTT_LOAD_SESSION_LAST, Me.BTT_LOAD_SESSION_CHOOSE, MENU_LOAD_SEP_0, Me.BTT_COPY_TO, Me.BTT_MOVE_TO, MENU_LOAD_SEP_1, Me.BTT_LOAD_FAV, Me.BTT_LOAD_SPEC, MENU_LOAD_SEP_2, Me.BTT_FEED_ADD_FAV, Me.BTT_FEED_ADD_FAV_REMOVE, Me.BTT_FEED_REMOVE_FAV, MENU_LOAD_SEP_3, Me.BTT_FEED_ADD_SPEC, Me.BTT_FEED_ADD_SPEC_REMOVE, Me.BTT_FEED_REMOVE_SPEC, MENU_LOAD_SEP_4, Me.BTT_FEED_CLEAR_FAV, Me.BTT_FEED_CLEAR_SPEC, Me.BTT_FEED_DELETE_SPEC, Me.BTT_FEED_DELETE_DAILY_LIST, Me.BTT_FEED_DELETE_DAILY_DATE, MENU_LOAD_SEP_5, Me.BTT_MERGE_SESSIONS, Me.BTT_CLEAR_DAILY, MENU_LOAD_SEP_6, Me.BTT_MERGE_FEEDS, MENU_LOAD_SEP_7, Me.BTT_CHECK_ALL, Me.BTT_CHECK_NONE, MENU_LOAD_SEP_8, Me.BTT_VIEW_SAVE, Me.BTT_VIEW_LOAD})
Me.MENU_LOAD_SESSION.Image = Global.SCrawler.My.Resources.Resources.ArrowDownPic_Blue_24
Me.MENU_LOAD_SESSION.ImageTransparentColor = System.Drawing.Color.Magenta
Me.MENU_LOAD_SESSION.Name = "MENU_LOAD_SESSION"
@@ -405,6 +409,25 @@ Namespace DownloadObjects
Me.TP_DATA.Size = New System.Drawing.Size(484, 436)
Me.TP_DATA.TabIndex = 1
'
'MENU_LOAD_SEP_8
'
MENU_LOAD_SEP_8.Name = "MENU_LOAD_SEP_8"
MENU_LOAD_SEP_8.Size = New System.Drawing.Size(349, 6)
'
'BTT_VIEW_SAVE
'
Me.BTT_VIEW_SAVE.Name = "BTT_VIEW_SAVE"
Me.BTT_VIEW_SAVE.Size = New System.Drawing.Size(352, 22)
Me.BTT_VIEW_SAVE.Text = "Save current view"
'
'BTT_VIEW_LOAD
'
Me.BTT_VIEW_LOAD.AutoToolTip = True
Me.BTT_VIEW_LOAD.Name = "BTT_VIEW_LOAD"
Me.BTT_VIEW_LOAD.Size = New System.Drawing.Size(352, 22)
Me.BTT_VIEW_LOAD.Text = "Load view (from saved)"
Me.BTT_VIEW_LOAD.ToolTipText = "Load one of your previously saved views"
'
'DownloadFeedForm
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -458,5 +481,7 @@ Namespace DownloadObjects
Private WithEvents BTT_CHECK_NONE As ToolStripMenuItem
Private WithEvents BTT_COPY_TO As ToolStripMenuItem
Private WithEvents BTT_MOVE_TO As ToolStripMenuItem
Private WithEvents BTT_VIEW_SAVE As ToolStripMenuItem
Private WithEvents BTT_VIEW_LOAD As ToolStripMenuItem
End Class
End Namespace

View File

@@ -162,4 +162,7 @@
<metadata name="ToolbarTOP.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="MENU_LOAD_SEP_8.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View File

@@ -21,13 +21,14 @@ Namespace DownloadObjects
#End Region
#Region "Declarations"
Private Const FeedTitleDefault As String = "Feed"
Private WithEvents MyDefs As DefaultFormOptions
Friend WithEvents MyDefs As DefaultFormOptions
Private WithEvents MyRange As RangeSwitcherToolbar(Of UserMediaD)
Private ReadOnly DataList As List(Of UserMediaD)
Private WithEvents BTT_DELETE_SELECTED As ToolStripButton
Private DataRows As Integer = 10
Private DataColumns As Integer = 1
Private FeedEndless As Boolean = False
Private ReadOnly GoToButton As New ButtonKey(Keys.G, True)
Private ReadOnly FilterSubscriptions As New FPredicate(Of UserMediaD)(Function(d) If(d.User?.IsSubscription, False))
Private ReadOnly FilterUsers As New FPredicate(Of UserMediaD)(Function(d) Not FilterSubscriptions.Invoke(d))
Private ReadOnly FileNotExist As New FPredicate(Of UserMediaD)(Function(d) Not d.Data.File.Exists And Not FilterSubscriptions.Invoke(d))
@@ -133,9 +134,14 @@ Namespace DownloadObjects
With MyRange
.AutoToolTip = True
.Buttons = {RCI.First, RCI.Previous, RCI.Label, RCI.Next, RCI.Last, RCI.Separator, RCI.GoTo}
.ButtonKey(RCI.Previous) = Keys.F3
.ButtonKey(RCI.Next) = Keys.F4
.ButtonKey(RCI.GoTo) = New ButtonKey(Keys.G, True)
'.ButtonKey(RCI.Previous) = Keys.F3
'.ButtonKey(RCI.Next) = Keys.F4
'.ButtonKey(RCI.GoTo) = GoToButton
.ToolTip(RCI.First) = "Go to first page (Home)"
.ToolTip(RCI.Last) = "Go to last page (End)"
.ToolTip(RCI.Previous) = "Previous (F3, Up, Page Up)"
.ToolTip(RCI.Next) = "Next (F4, Down, Page Down)"
.ToolTip(RCI.GoTo) = "GoTo (Ctrl+G)"
.AddThisToolbar()
End With
ToolbarTOP.Items.AddRange({New ToolStripSeparator, BTT_DELETE_SELECTED})
@@ -183,7 +189,35 @@ Namespace DownloadObjects
DataList.Clear()
End Sub
Private Sub DownloadFeedForm_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.F5 Then RefillList() : e.Handled = True
'If e.KeyCode = Keys.F5 Then RefillList() : e.Handled = True
If Not e.Handled Then
Dim b As Boolean = False
If e = GoToButton Then
b = True
MyRange.GoToF()
Else
Dim changePage%? = Nothing
Dim gotoHome As Boolean? = Nothing
Select Case e.KeyCode
Case Keys.F5 : RefillList() : b = True
Case Keys.F3 : changePage = -1
Case Keys.F4 : changePage = 1
Case Keys.Up, Keys.Left, Keys.PageUp : changePage = -1
Case Keys.Down, Keys.Right, Keys.PageDown : changePage = 1
Case Keys.Home : gotoHome = True
Case Keys.End : gotoHome = False
End Select
If changePage.HasValue Then
b = True
If MyRange.TryMove(changePage.Value) Then MyRange.Move(changePage.Value)
ElseIf gotoHome.HasValue Then
b = True
Dim indx% = IIf(gotoHome.Value, 0, MyRange.Count - 1)
If MyRange.CurrentIndex <> indx Then MyRange.GoTo(indx)
End If
End If
If b Then e.Handled = True
End If
End Sub
#End Region
#Region "Feeds handlers"
@@ -1010,6 +1044,59 @@ Namespace DownloadObjects
End Sub, EDP.None)
If __refill Then RefillList()
End Sub
#End Region
#Region "View changer"
Private Sub BTT_VIEW_SAVE_Click(sender As Object, e As EventArgs) Handles BTT_VIEW_SAVE.Click
Dim fName$ = String.Empty
Dim __process As Boolean = False
If Settings.FeedViews Is Nothing Then Settings.FeedViews = New FeedViewCollection
Do
fName = InputBoxE("Enter a new name for the view:", "Feed view name", fName)
If Not fName.IsEmptyString Then
If Settings.FeedViews.IndexOf(fName) >= 0 Then
Select Case MsgBoxE({$"The '{fName}' feed view already exists!", "Save view"}, 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.FeedViews.Add(FeedView.FromCurrent(fName))
MsgBoxE({$"The '{fName}' feed view has been saved", "Save view"})
End If
End Sub
Private Sub BTT_VIEW_LOAD_Click(sender As Object, e As EventArgs) Handles BTT_VIEW_LOAD.Click
Try
If Settings.FeedViews Is Nothing Then Settings.FeedViews = New FeedViewCollection
If Settings.FeedViews.Count = 0 Then
MsgBoxE({"There are no saved feed views", "Load feed view"}, vbExclamation)
Else
Using f As New SimpleListForm(Of FeedView)(Settings.FeedViews, Settings.Design) With {
.DesignXMLNodeName = "SavedFeedViewsForm",
.FormText = "Feed view",
.Mode = SimpleListFormModes.SelectedItems,
.MultiSelect = False
}
If f.ShowDialog = DialogResult.OK Then
Dim v As FeedView = f.DataResult.FirstOrDefault
If Not v.Name.IsEmptyString Then
ControlInvokeFast(Me, Sub() WindowState = FormWindowState.Normal)
v.Populate()
ControlInvokeFast(Me, Sub() MyDefs.MyView.SetFormSize())
UpdateSettings()
End If
End If
End Using
End If
Catch ex As Exception
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Load feed view")
End Try
End Sub
#End Region
Friend Sub Downloader_FilesChanged(ByVal Added As Boolean)
ControlInvokeFast(ToolbarTOP, BTT_REFRESH, Sub() BTT_REFRESH.ToolTipText = If(Added, "New files found", "Some files have been removed"))
@@ -1287,6 +1374,10 @@ Namespace DownloadObjects
DataPopulated = True
IndexChanged = True
End If
ControlInvokeFast(Me, Sub()
Activate()
Focus()
End Sub, EDP.None)
End Try
End Sub
#End Region

View File

@@ -0,0 +1,203 @@
' 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.Forms
Imports PersonalUtilities.Tools
Imports PersonalUtilities.Functions.XML
Imports PersonalUtilities.Functions.XML.Base
Namespace DownloadObjects
Friend Structure FeedView : Implements IEContainerProvider, IComparable(Of FeedView)
#Region "Names"
Private Const Name_Name As String = "Name"
Private Const Name_Rows As String = "Rows"
Private Const Name_Columns As String = "Columns"
Private Const Name_CenterImage As String = "CenterImage"
Private Const Name_CenterImageUse As String = "CenterImageUse"
Private Const Name_Endless As String = "Endless"
Private Const Name_BackColor As String = "BackColor"
Private Const Name_ForeColor As String = "ForeColor"
Private Const Name_View As String = "View"
#End Region
#Region "Declarations"
Friend Name As String
Friend Rows As Integer
Friend Columns As Integer
Friend CenterImage As Integer
Friend CenterImageUse As Boolean
Friend Endless As Boolean
Friend BackColor As Color?
Friend ForeColor As Color?
Friend View As FormView
#End Region
#Region "Initializers"
Friend Sub New(ByVal e As EContainer)
With e
Name = .Value(Name_Name)
Rows = .Value(Name_Rows).FromXML(Of Integer)(10)
Columns = .Value(Name_Columns).FromXML(Of Integer)(1)
CenterImage = .Value(Name_CenterImage).FromXML(Of Integer)(1)
CenterImageUse = .Value(Name_CenterImageUse).FromXML(Of Boolean)(False)
Endless = .Value(Name_Endless).FromXML(Of Boolean)(True)
BackColor = AConvert(Of Color)(.Value(Name_BackColor), AModes.Var, Nothing)
ForeColor = AConvert(Of Color)(.Value(Name_ForeColor), AModes.Var, Nothing)
View = New FormView
View.Import(e, {Name_View})
End With
End Sub
Friend Shared Function FromCurrent(Optional ByVal Name As String = "") As FeedView
Dim v As New FeedView
With Settings
v.Name = Name
v.Rows = .FeedDataRows
v.Columns = .FeedDataColumns
v.Endless = .FeedEndless
v.CenterImage = .FeedCenterImage
v.CenterImageUse = .FeedCenterImage.Use
If .FeedBackColor.Exists Then
v.BackColor = .FeedBackColor
Else
v.BackColor = Nothing
End If
If .FeedForeColor.Exists Then
v.ForeColor = .FeedForeColor
Else
v.ForeColor = Nothing
End If
v.View = New FormView
With MainFrameObj.MF.MyFeed.MyDefs.MyView
v.View.Location = .Location
v.View.LocationOnly = .LocationOnly
v.View.Size = .Size
v.View.WindowState = .WindowState
End With
End With
Return v
End Function
#End Region
Friend Sub Populate()
With Settings
.BeginUpdate()
.FeedDataRows.Value = Rows
.FeedDataColumns.Value = Columns
.FeedEndless.Value = Endless
.FeedCenterImage.Value = CenterImage
.FeedCenterImage.Use = CenterImageUse
If BackColor.HasValue Then
.FeedBackColor.Value = BackColor.Value
Else
.FeedBackColor.ValueF = Nothing
End If
If ForeColor.HasValue Then
.FeedForeColor.Value = ForeColor.Value
Else
.FeedForeColor.ValueF = Nothing
End If
If Not View Is Nothing Then
With MainFrameObj.MF.MyFeed.MyDefs.MyView
.Location = View.Location
.LocationOnly = View.LocationOnly
.Size = View.Size
.WindowState = View.WindowState
End With
End If
.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
If Not IsNothing(Obj) AndAlso TypeOf Obj Is FeedView Then
Return Name.StringToLower = DirectCast(Obj, FeedView).Name.StringToLower
Else
Return False
End If
End Function
Private Function CompareTo(ByVal Other As FeedView) As Integer Implements IComparable(Of FeedView).CompareTo
Return Name.CompareTo(Other.Name)
End Function
Private Function ToEContainer(Optional ByVal e As ErrorsDescriber = Nothing) As EContainer Implements IEContainerProvider.ToEContainer
Dim container As New EContainer("FeedView") From {
New EContainer(Name_Name, Name),
New EContainer(Name_Rows, Rows),
New EContainer(Name_Columns, Columns),
New EContainer(Name_CenterImage, CenterImage),
New EContainer(Name_CenterImageUse, CenterImageUse.BoolToInteger),
New EContainer(Name_Endless, Endless.BoolToInteger),
New EContainer(Name_BackColor, AConvert(Of String)(BackColor, AModes.Var, String.Empty)),
New EContainer(Name_ForeColor, AConvert(Of String)(ForeColor, AModes.Var, String.Empty))
}
View.Export(container, {Name_View})
Return container
End Function
End Structure
Friend Class FeedViewCollection : Implements IEnumerable(Of FeedView), IMyEnumerator(Of FeedView)
Private ReadOnly Views As List(Of FeedView)
Private ReadOnly File As SFile = $"{SettingsFolderName}\FeedView.xml"
Friend Sub New()
Views = New List(Of FeedView)
If File.Exists Then
Using x As New XmlFile(File, Protector.Modes.All, False) With {.AllowSameNames = True}
x.LoadData()
If x.Count > 0 Then Views.ListAddList(x, LAP.IgnoreICopier)
End Using
End If
If Views.Count > 0 Then Views.Sort()
End Sub
Default Friend ReadOnly Property Item(ByVal Index As Integer) As FeedView Implements IMyEnumerator(Of FeedView).MyEnumeratorObject
Get
Return Views(Index)
End Get
End Property
Friend ReadOnly Property Count As Integer Implements IMyEnumerator(Of FeedView).MyEnumeratorCount
Get
Return Views.Count
End Get
End Property
Friend Sub Update()
If Count > 0 Then
Views.Sort()
Using x As New XmlFile With {.AllowSameNames = True}
x.AddRange(Views)
x.Name = "FeedViews"
x.Save(File, EDP.LogMessageValue)
End Using
Else
If File.Exists Then File.Delete()
End If
End Sub
Friend Sub Add(ByVal Item As FeedView, Optional ByVal AutoUpdate As Boolean = True)
Dim i% = IndexOf(Item)
If i >= 0 Then
Views(i) = Item
Else
Views.Add(Item)
End If
Views.Sort()
If AutoUpdate Then Update()
End Sub
Friend Overloads Function IndexOf(ByVal Item As FeedView) As Integer
If Count > 0 Then
Return Views.IndexOf(Item)
Else
Return -1
End If
End Function
Friend Overloads Function IndexOf(ByVal Name As String) As Integer
Return IndexOf(New FeedView With {.Name = Name})
End Function
Private Function GetEnumerator() As IEnumerator(Of FeedView) Implements IEnumerable(Of FeedView).GetEnumerator
Return New MyEnumerator(Of FeedView)(Me)
End Function
Private Function IEnumerable_GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
Return GetEnumerator()
End Function
End Class
End Namespace

View File

@@ -17,6 +17,7 @@ Namespace Editors
Private WithEvents MyDefs As DefaultFormOptions
Friend Property FeedParametersChanged As Boolean = False
Friend Property HeadersChanged As Boolean = False
Friend Property PictureChanged As Boolean = False
Friend Sub New()
InitializeComponent()
MyDefs = New DefaultFormOptions(Me, Settings.Design)
@@ -224,6 +225,7 @@ Namespace Editors
.ProgramText.Value = TXT_PRG_TITLE.Text
.ProgramDescription.Value = TXT_PRG_DESCR.Text
.UserListImage.Value = TXT_USER_LIST_IMAGE.Text
PictureChanged = .UserListImage.ChangesDetected
COLORS_USERLIST.ColorsGet(.UserListBackColor, .UserListForeColor)
COLORS_SUBSCRIPTIONS.ColorsGet(.MainFrameUsersSubscriptionsColorBack, .MainFrameUsersSubscriptionsColorFore)
COLORS_SUBSCRIPTIONS_USERS.ColorsGet(.MainFrameUsersSubscriptionsColorBack_USERS, .MainFrameUsersSubscriptionsColorFore_USERS)

View File

@@ -27,7 +27,7 @@ Public Class MainFrame
Friend MySavedPosts As DownloadSavedPostsForm
Private MyMissingPosts As MissingPostsForm
Private DownloadQueue As UserDownloadQueueForm
Private MyFeed As DownloadFeedForm
Friend MyFeed As DownloadFeedForm
Private MySearch As UserSearchForm
Private MyUserMetrics As UsersInfoForm = Nothing
Private _UFinit As Boolean = True
@@ -199,10 +199,10 @@ CloseResume:
If Not _UFinit Then UpdateImageColor()
End Sub
Private ListImageLastWidth As Integer = -1
Private Sub UpdateImageColor(Optional ByVal UpdateOnlyImage As Boolean = False)
Private Sub UpdateImageColor(Optional ByVal UpdateOnlyImage As Boolean = False, Optional ByVal ForceImageUpdate As Boolean = False)
Try
If Settings.UserListImage.Value.Exists Then
If Not ListImageLastWidth = LIST_PROFILES.Width Or LIST_PROFILES.BackgroundImage Is Nothing Then
If ForceImageUpdate Or Not ListImageLastWidth = LIST_PROFILES.Width Or LIST_PROFILES.BackgroundImage Is Nothing Then
ListImageLastWidth = LIST_PROFILES.Width
Using ir As New ImageRenderer(Settings.UserListImage) : LIST_PROFILES.BackgroundImage = ir.FitToWidth(LIST_PROFILES.Width) : End Using
End If
@@ -292,8 +292,8 @@ CloseResume:
End Function
#End Region
#Region "List refill, update"
Friend Sub RefillList()
UpdateImageColor(True)
Friend Sub RefillList(Optional ByVal ForceImageUpdate As Boolean = False)
UpdateImageColor(True, ForceImageUpdate)
UserListLoader.Update()
End Sub
Private Sub UserListUpdate(ByVal User As IUserData, ByVal Add As Boolean)
@@ -310,7 +310,11 @@ CloseResume:
f.ShowDialog()
If f.DialogResult = DialogResult.OK Then
UpdateYouTubeSettings()
If (Not .MaxLargeImageHeight = mhl Or Not .MaxSmallImageHeight = mhs) And .ViewModeIsPicture Then RefillList()
If (Not .MaxLargeImageHeight = mhl Or Not .MaxSmallImageHeight = mhs) And .ViewModeIsPicture Then
RefillList(f.PictureChanged)
ElseIf f.PictureChanged Then
UpdateImageColor(True, True)
End If
TrayIcon.Visible = .CloseToTray
If f.FeedParametersChanged And Not MyFeed Is Nothing Then MyFeed.UpdateSettings()
If f.HeadersChanged Then

View File

@@ -288,6 +288,7 @@
<Compile Include="Download\Feed\FeedVideo.vb">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Download\Feed\FeedView.vb" />
<Compile Include="Download\Groups\DownloadGroup.vb" />
<Compile Include="Download\DownloadProgress.vb" />
<Compile Include="Download\Groups\DownloadGroupCollection.vb" />

View File

@@ -146,6 +146,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
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"
Friend Sub New()