2023.11.13.0

API.JFF: update UserAgent start value
ActiveDownloadingProgress: fix unnecessary focus of inactive form
FeedMedia: add additional buttons to the context menu
FeedSpecialCollection: 'Favorite' feed does not appear in the feeds list if it is created manually
UserCreatorForm: disable account selection when opening an empty form
MainFrame: fix background image resizing on form state changes
SettingsHost: inherit path when cloning an instance
SettingsHostCollection: Extract user path change function to static
This commit is contained in:
Andy
2023-11-13 03:30:05 +03:00
parent 95cbb6aeb1
commit f08a5f9259
12 changed files with 257 additions and 96 deletions

View File

@@ -43,7 +43,7 @@ Namespace API.JustForFans
UserID = New PropertyValue(String.Empty, GetType(String))
UserHash4 = New PropertyValue(String.Empty, GetType(String))
HeaderAccept = New PropertyValue(Responser.Accept.Value, GetType(String), Sub(v) UpdateHeader(NameOf(HeaderAccept), v))
UserAgent = New PropertyValue(Responser.UserAgent, GetType(String), Sub(v) UpdateHeader(NameOf(UserAgent), v))
UserAgent = New PropertyValue(If(Responser.UserAgentExists, Responser.UserAgent, String.Empty), GetType(String), Sub(v) UpdateHeader(NameOf(UserAgent), v))
_AllowUserAgentUpdate = False
UserRegex = RParams.DMS("https://justfor.fans/([^/\?]+)", 1, EDP.ReturnValue)

View File

@@ -11,6 +11,8 @@ Imports PersonalUtilities.Forms
Namespace DownloadObjects
Friend Class ActiveDownloadingProgress
Private Const MinWidth As Integer = 450
Private Const TP_RowHeight As Integer = 30
Private Const TP_LowestValue As Integer = 39
Private MyView As FormView
Private Opened As Boolean = False
Friend ReadOnly Property ReadyToOpen As Boolean
@@ -40,9 +42,26 @@ Namespace DownloadObjects
Private Sub ActiveDownloadingProgress_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
MyView.DisposeIfReady()
End Sub
Private Sub ActiveDownloadingProgress_VisibleChanged(sender As Object, e As EventArgs) Handles Me.VisibleChanged
Try
If Visible Then
ControlInvokeFast(Me, Sub()
Dim s As Size = Size
Dim ss As Size = Screen.PrimaryScreen.WorkingArea.Size
Dim c% = TP_MAIN.RowStyles.Count - 1
s.Height = c * TP_RowHeight + TP_LowestValue + (PaddingE.GetOf({TP_MAIN}).Vertical(c) / c).RoundDown
If s.Height > ss.Height Then s.Height = ss.Height
MinimumSize = Nothing
Size = s
MinimumSize = New Size(MinWidth, s.Height)
End Sub)
End If
Catch ex As Exception
ErrorsDescriber.Execute(EDP.SendToLog, ex, "Change 'ActiveDownloadingProgress' size")
MainFrameObj.UpdateLogButton()
End Try
End Sub
Private Sub Downloader_Reconfigured()
Const RowHeight% = 30
Const LowestValue% = 39
Dim a As Action = Sub()
With TP_MAIN
If .Controls.Count > 0 Then
@@ -59,7 +78,7 @@ Namespace DownloadObjects
If .Pool.Count > 0 Then
For Each j As TDownloader.Job In .Pool
With TP_MAIN
.RowStyles.Add(New RowStyle(SizeType.Absolute, RowHeight))
.RowStyles.Add(New RowStyle(SizeType.Absolute, TP_RowHeight))
.RowCount += 1
JobsList.Add(New DownloadProgress(j))
AddHandler JobsList.Last.ProgressChanged, AddressOf Jobs_ProgressChanged
@@ -69,14 +88,14 @@ Namespace DownloadObjects
TP_MAIN.RowStyles.Add(New RowStyle(SizeType.AutoSize))
TP_MAIN.RowCount += 1
Dim s As Size = Size
Dim ss As Size = Screen.PrimaryScreen.WorkingArea.Size
Dim c% = TP_MAIN.RowStyles.Count - 1
s.Height = c * RowHeight + LowestValue + (PaddingE.GetOf({TP_MAIN}).Vertical(c) / c).RoundDown
If s.Height > ss.Height Then s.Height = ss.Height
MinimumSize = Nothing
Size = s
MinimumSize = New Size(MinWidth, s.Height)
'Dim s As Size = Size
'Dim ss As Size = Screen.PrimaryScreen.WorkingArea.Size
'Dim c% = TP_MAIN.RowStyles.Count - 1
's.Height = c * TP_RowHeight + TP_LowestValue + (PaddingE.GetOf({TP_MAIN}).Vertical(c) / c).RoundDown
'If s.Height > ss.Height Then s.Height = ss.Height
'MinimumSize = Nothing
'Size = s
'MinimumSize = New Size(MinWidth, s.Height)
End If
End With
TP_MAIN.Refresh()

View File

@@ -113,18 +113,24 @@ Namespace DownloadObjects
End Sub
#End Region
#Region "Feeds handlers"
Private Sub AddNewFeedItem(ByVal Destination As ToolStripMenuItem, ByVal Feed As FeedSpecial, ByVal Image As Image, ByVal Handler As EventHandler,
Optional ByVal Insert As Boolean = False)
Dim item As New ToolStripMenuItem(Feed.Name, Image) With {.Tag = Feed}
AddHandler item.Click, Handler
ControlInvokeFast(ToolbarTOP, Destination, Sub()
If Destination.DropDownItems.Count > 0 And Insert Then
Destination.DropDownItems.Insert(0, item)
Else
Destination.DropDownItems.Add(item)
End If
End Sub, EDP.None)
Private Overloads Sub AddNewFeedItem(ByVal Destination As ToolStripMenuItem, ByVal Feed As FeedSpecial, ByVal Image As Image,
ByVal Handler As EventHandler, Optional ByVal Insert As Boolean = False)
AddNewFeedItem(Destination, ToolbarTOP, Feed, Image, Handler, Insert)
End Sub
Friend Overloads Shared Function AddNewFeedItem(ByVal Destination As ToolStripMenuItem, ByVal Toolbar As ToolStrip,
ByVal Feed As FeedSpecial, ByVal Image As Image,
ByVal Handler As EventHandler, Optional ByVal Insert As Boolean = False) As ToolStripMenuItem
Dim item As New ToolStripMenuItem(Feed.Name, Image) With {.Tag = Feed}
If Not Handler Is Nothing Then AddHandler item.Click, Handler
ControlInvokeFast(Toolbar, Destination, Sub()
If Destination.DropDownItems.Count > 0 And Insert Then
Destination.DropDownItems.Insert(0, item)
Else
Destination.DropDownItems.Add(item)
End If
End Sub, EDP.None)
Return item
End Function
Private Sub Feed_FeedAdded(ByVal Source As FeedSpecialCollection, ByVal Feed As FeedSpecial)
AddNewFeedItem(BTT_LOAD_SPEC, Feed, My.Resources.RSSPic_512, AddressOf Feed_SPEC_LOAD, True)
AddNewFeedItem(BTT_FEED_ADD_SPEC, Feed, My.Resources.RSSPic_512, AddressOf Feed_SPEC_ADD, True)
@@ -140,9 +146,12 @@ Namespace DownloadObjects
Feed_FeedRemoved(BTT_FEED_CLEAR_SPEC, Feed)
End Sub
Private Overloads Sub Feed_FeedRemoved(ByVal Destination As ToolStripMenuItem, ByVal Feed As FeedSpecial)
Feed_FeedRemoved(Destination, ToolbarTOP, Feed)
End Sub
Friend Overloads Shared Sub Feed_FeedRemoved(ByVal Destination As ToolStripMenuItem, ByVal Toolbar As ToolStrip, ByVal Feed As FeedSpecial)
Try
With Destination
ControlInvokeFast(ToolbarTOP, .Self,
ControlInvokeFast(Toolbar, .Self,
Sub()
If .DropDownItems.Count > 0 Then
Dim item As Object
@@ -895,6 +904,9 @@ Namespace DownloadObjects
If TP_DATA.Controls.Count > 0 Then
For Each cnt As Control In TP_DATA.Controls : cnt.Dispose() : Next
TP_DATA.Controls.Clear()
GC.Collect()
GC.WaitForPendingFinalizers()
GC.WaitForFullGCComplete()
End If
End Sub)
End Sub

View File

@@ -299,7 +299,22 @@ Namespace DownloadObjects
Else
Throw New ArgumentNullException With {.HelpLink = 1}
End If
If Settings.Feeds.Favorite.Contains(Media) Then BTT_FEED_ADD_FAV.ControlChangeColor(True, False)
If Settings.Feeds.FavoriteExists AndAlso Settings.Feeds.Favorite.Contains(Media) Then BTT_FEED_ADD_FAV.ControlChangeColor(True, False)
If Settings.FeedShowSpecialFeedsMediaItem Then
With Settings.Feeds
AddHandler .FeedAdded, AddressOf Feed_FeedAdded
AddHandler .FeedRemoved, AddressOf Feed_FeedRemoved
If .Count > 0 Then
For Each fItem As FeedSpecial In .Self
If Not fItem.IsFavorite Then
DownloadFeedForm.AddNewFeedItem(BTT_FEED_ADD_SPEC, CONTEXT_DATA, fItem, Nothing, AddressOf Feed_SPEC_ADD)
DownloadFeedForm.AddNewFeedItem(BTT_FEED_REMOVE_SPEC, CONTEXT_DATA, fItem, Nothing, AddressOf Feed_SPEC_REMOVE)
End If
Next
End If
End With
End If
Catch aex As ArgumentNullException When aex.HelpLink = 1
HasError = True
Catch tex As Threading.ThreadStateException
@@ -310,11 +325,38 @@ Namespace DownloadObjects
End Try
End Sub
#End Region
#Region "Feed handlers"
Private Sub Feed_FeedAdded(ByVal Source As FeedSpecialCollection, ByVal Feed As FeedSpecial)
DownloadFeedForm.AddNewFeedItem(BTT_FEED_ADD_SPEC, CONTEXT_DATA, Feed, My.Resources.RSSPic_512, AddressOf Feed_SPEC_ADD, True)
DownloadFeedForm.AddNewFeedItem(BTT_FEED_REMOVE_SPEC, CONTEXT_DATA, Feed, My.Resources.RSSPic_512, AddressOf Feed_SPEC_REMOVE, True)
End Sub
Private Sub Feed_FeedRemoved(ByVal Source As FeedSpecialCollection, ByVal Feed As FeedSpecial)
DownloadFeedForm.Feed_FeedRemoved(BTT_FEED_ADD_SPEC, CONTEXT_DATA, Feed)
DownloadFeedForm.Feed_FeedRemoved(BTT_FEED_REMOVE_SPEC, CONTEXT_DATA, Feed)
End Sub
Private Sub Feed_SPEC_ADD(ByVal Source As ToolStripMenuItem, ByVal e As EventArgs)
Dim f As FeedSpecial = Source.Tag
If Not f Is Nothing AndAlso Not f.Disposed Then f.Add(Media)
End Sub
Private Sub Feed_SPEC_REMOVE(ByVal Source As ToolStripMenuItem, ByVal e As EventArgs)
Dim f As FeedSpecial = Source.Tag
If Not f Is Nothing AndAlso Not f.Disposed Then f.Remove(Media)
End Sub
#End Region
#Region "Dispose"
Private Sub FeedImage_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
If Not MyImage Is Nothing Then MyImage.Dispose()
If Not MyPicture Is Nothing Then MyPicture.Dispose()
If Not MyPicture Is Nothing Then MyPicture.Dispose() : MyPicture = Nothing
If Not MyVideo Is Nothing Then MyVideo.Dispose()
Try
If Settings.FeedShowSpecialFeedsMediaItem Then
With Settings.Feeds
RemoveHandler .FeedAdded, AddressOf Feed_FeedAdded
RemoveHandler .FeedRemoved, AddressOf Feed_FeedRemoved
End With
End If
Catch
End Try
End Sub
#End Region
#Region "LBL"

View File

@@ -12,8 +12,44 @@ Namespace DownloadObjects
Friend Class FeedSpecialCollection : Implements IEnumerable(Of FeedSpecial), IMyEnumerator(Of FeedSpecial)
#Region "Events"
Friend Delegate Sub FeedActionEventHandler(ByVal Source As FeedSpecialCollection, ByVal Feed As FeedSpecial)
Friend Event FeedAdded As FeedActionEventHandler
Friend Event FeedRemoved As FeedActionEventHandler
Private ReadOnly FeedAddedEventHandlers As List(Of FeedActionEventHandler)
Friend Custom Event FeedAdded As FeedActionEventHandler
AddHandler(ByVal h As FeedActionEventHandler)
If Not FeedAddedEventHandlers.Contains(h) Then FeedAddedEventHandlers.Add(h)
End AddHandler
RemoveHandler(ByVal h As FeedActionEventHandler)
FeedAddedEventHandlers.Remove(h)
End RemoveHandler
RaiseEvent(ByVal Source As FeedSpecialCollection, ByVal Feed As FeedSpecial)
If FeedAddedEventHandlers.Count > 0 Then
Try
For i% = 0 To FeedAddedEventHandlers.Count - 1
Try : FeedAddedEventHandlers(i).Invoke(Source, Feed) : Catch : End Try
Next
Catch
End Try
End If
End RaiseEvent
End Event
Private ReadOnly FeedRemovedEventHandlers As List(Of FeedActionEventHandler)
Friend Custom Event FeedRemoved As FeedActionEventHandler
AddHandler(ByVal h As FeedActionEventHandler)
If Not FeedRemovedEventHandlers.Contains(h) Then FeedRemovedEventHandlers.Add(h)
End AddHandler
RemoveHandler(ByVal h As FeedActionEventHandler)
FeedRemovedEventHandlers.Remove(h)
End RemoveHandler
RaiseEvent(ByVal Source As FeedSpecialCollection, ByVal Feed As FeedSpecial)
If FeedRemovedEventHandlers.Count > 0 Then
Try
For i% = 0 To FeedRemovedEventHandlers.Count - 1
Try : FeedRemovedEventHandlers(i).Invoke(Source, Feed) : Catch : End Try
Next
Catch
End Try
End If
End RaiseEvent
End Event
#End Region
#Region "FeedsComparer"
Private Class FeedsComparer : Implements IComparer(Of FeedSpecial)
@@ -31,10 +67,20 @@ Namespace DownloadObjects
Private _Favorite As FeedSpecial = Nothing
Friend ReadOnly Property Favorite As FeedSpecial
Get
If _Favorite Is Nothing Then _Favorite = FeedSpecial.CreateFavorite : _Favorite.Load()
If _Favorite Is Nothing Then
_Favorite = FeedSpecial.CreateFavorite
_Favorite.Load()
Feeds.Add(_Favorite)
Feeds.Sort(ComparerFeeds)
End If
Return _Favorite
End Get
End Property
Friend ReadOnly Property FavoriteExists As Boolean
Get
Return Not _Favorite Is Nothing
End Get
End Property
Private _Loaded As Boolean = False
Friend ReadOnly Property Comparer As New FeedSpecial.SEComparer
Private ReadOnly Property ComparerFeeds As New FeedsComparer
@@ -42,6 +88,8 @@ Namespace DownloadObjects
#End Region
#Region "Initializer, loader, feeds handlers"
Friend Sub New()
FeedAddedEventHandlers = New List(Of FeedActionEventHandler)
FeedRemovedEventHandlers = New List(Of FeedActionEventHandler)
Feeds = New List(Of FeedSpecial)
End Sub
Friend Sub Load()
@@ -49,7 +97,7 @@ Namespace DownloadObjects
If Not _Loaded Then
_Loaded = True
Dim files As List(Of SFile) = SFile.GetFiles(TDownloader.SessionsPath, $"{FeedSpecial.FavoriteName}.xml|{FeedSpecial.SpecialName}_*.xml",, EDP.ReturnValue)
If files.ListExists Then files.ForEach(Sub(f)
If files.ListExists Then files.ForEach(Sub(ByVal f As SFile)
Feeds.Add(New FeedSpecial(f))
With Feeds.Last
If .IsFavorite Then _Favorite = .Self

View File

@@ -132,6 +132,7 @@ Namespace Editors
Me.CH_STD_SNAP_KEEP_WITH_FILES = New System.Windows.Forms.CheckBox()
Me.CH_STD_SNAP_CACHE_PERMANENT = New System.Windows.Forms.CheckBox()
Me.CH_STD_YT_CREATE_URL = New System.Windows.Forms.CheckBox()
Me.CH_USE_DEF_ACC = 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()
@@ -176,7 +177,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_USE_DEF_ACC = New System.Windows.Forms.CheckBox()
Me.CH_FEED_SHOW_SPEC_MEDIAITEM = 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()
@@ -1023,6 +1024,18 @@ Namespace Editors
TT_MAIN.SetToolTip(Me.CH_STD_YT_CREATE_URL, "Create local URL files to link to the original page")
Me.CH_STD_YT_CREATE_URL.UseVisualStyleBackColor = True
'
'CH_USE_DEF_ACC
'
Me.CH_USE_DEF_ACC.AutoSize = True
Me.CH_USE_DEF_ACC.Dock = System.Windows.Forms.DockStyle.Fill
Me.CH_USE_DEF_ACC.Location = New System.Drawing.Point(4, 254)
Me.CH_USE_DEF_ACC.Name = "CH_USE_DEF_ACC"
Me.CH_USE_DEF_ACC.Size = New System.Drawing.Size(568, 19)
Me.CH_USE_DEF_ACC.TabIndex = 9
Me.CH_USE_DEF_ACC.Text = "Use the default account if the selected account does not exist"
TT_MAIN.SetToolTip(Me.CH_USE_DEF_ACC, "Use the default account if you deleted an account that you used for some users")
Me.CH_USE_DEF_ACC.UseVisualStyleBackColor = True
'
'TP_CHANNELS_IMGS
'
TP_CHANNELS_IMGS.ColumnCount = 2
@@ -1492,10 +1505,11 @@ Namespace Editors
TP_FEED.Controls.Add(Me.COLORS_FEED, 0, 2)
TP_FEED.Controls.Add(Me.CH_FEED_OPEN_LAST_MODE, 0, 7)
TP_FEED.Controls.Add(Me.CH_FEED_SHOW_FRIENDLY, 0, 8)
TP_FEED.Controls.Add(Me.CH_FEED_SHOW_SPEC_MEDIAITEM, 0, 9)
TP_FEED.Dock = System.Windows.Forms.DockStyle.Fill
TP_FEED.Location = New System.Drawing.Point(0, 0)
TP_FEED.Name = "TP_FEED"
TP_FEED.RowCount = 10
TP_FEED.RowCount = 11
TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!))
@@ -1505,6 +1519,7 @@ Namespace Editors
TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!))
TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!))
TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!))
TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
TP_FEED.Size = New System.Drawing.Size(576, 399)
TP_FEED.TabIndex = 0
@@ -2125,17 +2140,16 @@ Namespace Editors
Me.CONTAINER_MAIN.TabIndex = 0
Me.CONTAINER_MAIN.TopToolStripPanelVisible = False
'
'CH_USE_DEF_ACC
'CH_FEED_SHOW_SPEC_MEDIAITEM
'
Me.CH_USE_DEF_ACC.AutoSize = True
Me.CH_USE_DEF_ACC.Dock = System.Windows.Forms.DockStyle.Fill
Me.CH_USE_DEF_ACC.Location = New System.Drawing.Point(4, 254)
Me.CH_USE_DEF_ACC.Name = "CH_USE_DEF_ACC"
Me.CH_USE_DEF_ACC.Size = New System.Drawing.Size(568, 19)
Me.CH_USE_DEF_ACC.TabIndex = 9
Me.CH_USE_DEF_ACC.Text = "Use the default account if the selected account does not exist"
TT_MAIN.SetToolTip(Me.CH_USE_DEF_ACC, "Use the default account if you deleted an account that you used for some users")
Me.CH_USE_DEF_ACC.UseVisualStyleBackColor = True
Me.CH_FEED_SHOW_SPEC_MEDIAITEM.AutoSize = True
Me.CH_FEED_SHOW_SPEC_MEDIAITEM.Dock = System.Windows.Forms.DockStyle.Fill
Me.CH_FEED_SHOW_SPEC_MEDIAITEM.Location = New System.Drawing.Point(4, 247)
Me.CH_FEED_SHOW_SPEC_MEDIAITEM.Name = "CH_FEED_SHOW_SPEC_MEDIAITEM"
Me.CH_FEED_SHOW_SPEC_MEDIAITEM.Size = New System.Drawing.Size(568, 19)
Me.CH_FEED_SHOW_SPEC_MEDIAITEM.TabIndex = 9
Me.CH_FEED_SHOW_SPEC_MEDIAITEM.Text = "Show special feeds in media items"
Me.CH_FEED_SHOW_SPEC_MEDIAITEM.UseVisualStyleBackColor = True
'
'GlobalSettingsForm
'
@@ -2326,5 +2340,6 @@ Namespace Editors
Private WithEvents COLORS_SUBSCRIPTIONS_USERS As ColorPicker
Private WithEvents CH_STD_YT_CREATE_URL As CheckBox
Private WithEvents CH_USE_DEF_ACC As CheckBox
Private WithEvents CH_FEED_SHOW_SPEC_MEDIAITEM As CheckBox
End Class
End Namespace

View File

@@ -141,6 +141,7 @@ Namespace Editors
NUM_FEED_STORE_SESSION_DATA.Value = .FeedStoredSessionsNumber.Value
CH_FEED_OPEN_LAST_MODE.Checked = .FeedOpenLastMode
CH_FEED_SHOW_FRIENDLY.Checked = .FeedShowFriendlyNames
CH_FEED_SHOW_SPEC_MEDIAITEM.Checked = .FeedShowSpecialFeedsMediaItem
End With
.MyFieldsChecker = New FieldsChecker
With .MyFieldsCheckerE
@@ -312,6 +313,7 @@ Namespace Editors
.FeedStoredSessionsNumber.Value = NUM_FEED_STORE_SESSION_DATA.Value
.FeedOpenLastMode.Value = CH_FEED_OPEN_LAST_MODE.Checked
.FeedShowFriendlyNames.Value = CH_FEED_SHOW_FRIENDLY.Checked
.FeedShowSpecialFeedsMediaItem.Value = CH_FEED_SHOW_SPEC_MEDIAITEM.Checked
FeedParametersChanged = .FeedDataRows.ChangesDetected Or .FeedDataColumns.ChangesDetected Or
.FeedEndless.ChangesDetected Or .FeedStoreSessionsData.ChangesDetected Or
.FeedBackColor.ChangesDetected Or .FeedForeColor.ChangesDetected Or

View File

@@ -175,6 +175,7 @@ Namespace Editors
End With
Dim NameFieldProvider As IFormatProvider = Nothing
RefillAccounts(Nothing)
If UserIsCollection Then
CMB_SITE.CaptionEnabled = False
@@ -401,6 +402,7 @@ Namespace Editors
Else
COLOR_USER.ColorsGetUser(_UserBackColor, _UserForeColor)
Dim tmpUser As UserInfo = User
Dim accOld$ = tmpUser.AccountName
With tmpUser
.Name = TXT_USER.Text
.Site = s.Name
@@ -411,6 +413,8 @@ Namespace Editors
If Not sp.IsEmptyString AndAlso Not SpecialPathHandler Is Nothing And UserInstance Is Nothing Then _
sp = SpecialPathHandler.Invoke(.Self, sp)
.SpecialPath = sp
If Not UserInstance Is Nothing Then _
SettingsHostCollection.UpdateUserAccount(tmpUser, Settings(.Plugin)(accOld), Settings(.Plugin)(.AccountName), False)
.UpdateUserFile()
End With
User = tmpUser
@@ -808,14 +812,13 @@ CloseForm:
End Sub
Private Sub RefillAccounts(ByVal sc As SettingsHostCollection)
Try
If Not sc Is Nothing And Not UserIsCollection Then
_AccountsRefilling = True
CMB_ACCOUNT.BeginUpdate()
_AccountsRefilling = True
With CMB_ACCOUNT
.BeginUpdate()
.Text = String.Empty
.Items.Clear()
With CMB_ACCOUNT
.BeginUpdate()
.Text = String.Empty
.Items.Clear()
If Not sc Is Nothing And Not UserIsCollection Then
If sc.Count = 1 Then
.Text = SettingsHost.NameAccountNameDefault
.LeaveDefaultButtons = False
@@ -824,16 +827,20 @@ CloseForm:
.LeaveDefaultButtons = True
.Items.AddRange(sc.Select(Function(s) New ListItem(s.AccountName.IfNullOrEmpty(SettingsHost.NameAccountNameDefault))))
End If
.Buttons.UpdateButtonsPositions(True)
.EndUpdate(True)
If .Items.Count > 0 Then
.Enabled = True
.SelectedIndex = 0
Else
.Enabled = False
End If
End With
End If
Else
.LeaveDefaultButtons = False
.Buttons.Clear()
End If
.Buttons.UpdateButtonsPositions(True)
.EndUpdate(True)
If .Items.Count > 0 Then
.Enabled = True
.SelectedIndex = 0
Else
.Enabled = False
End If
End With
Catch ex As Exception
ErrorsDescriber.Execute(EDP.SendToLog, ex, "[UserCreatorForm.RefillAccounts]")
Finally

View File

@@ -205,19 +205,25 @@ CloseResume:
Private Sub MainFrame_ResizeEnd(sender As Object, e As EventArgs) Handles Me.ResizeEnd
If Not _UFinit Then UpdateImageColor()
End Sub
Private Sub UpdateImageColor()
Private ListImageLastWidth As Integer = -1
Private Sub UpdateImageColor(Optional ByVal UpdateOnlyImage As Boolean = False)
Try
If Settings.UserListImage.Value.Exists Then
Using ir As New ImageRenderer(Settings.UserListImage) : LIST_PROFILES.BackgroundImage = ir.FitToWidth(LIST_PROFILES.Width) : End Using
If 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
Else
LIST_PROFILES.BackgroundImage = Nothing
End If
With Settings
If Not .UserListBackColorF = LIST_PROFILES.BackColor Or Not .UserListForeColorF = LIST_PROFILES.ForeColor Then
LIST_PROFILES.BackColor = .UserListBackColorF
LIST_PROFILES.ForeColor = .UserListForeColorF
End If
End With
If Not UpdateOnlyImage Then
With Settings
If Not .UserListBackColorF = LIST_PROFILES.BackColor Or Not .UserListForeColorF = LIST_PROFILES.ForeColor Then
LIST_PROFILES.BackColor = .UserListBackColorF
LIST_PROFILES.ForeColor = .UserListForeColorF
End If
End With
End If
Catch ex As Exception
End Try
End Sub
@@ -281,6 +287,7 @@ CloseResume:
#End Region
#Region "List refill, update"
Friend Sub RefillList()
UpdateImageColor(True)
UserListLoader.Update()
End Sub
Private Sub UserListUpdate(ByVal User As IUserData, ByVal Add As Boolean)
@@ -449,6 +456,7 @@ CloseResume:
DownloadQueue.FormShow(EDP.LogMessageValue)
Catch ex As Exception
If Round = 0 Then
ErrorsDescriber.Execute(EDP.SendToLog, ex, "ShowDownloadQueueForm_0")
If Not DownloadQueue Is Nothing Then DownloadQueue.Dispose() : DownloadQueue = Nothing
ShowDownloadQueueForm(Round + 1)
Else

View File

@@ -392,7 +392,7 @@ Namespace Plugin.Hosts
Return newHost
End Function
Friend Function Clone() As SettingsHost
Return New SettingsHost(Source.Clone(False), Path, Temporary, DownloadImages, DownloadVideos) With {.SavedPostsPath = SavedPostsPath}
Return New SettingsHost(Source.Clone(False), Path, Temporary, DownloadImages, DownloadVideos) With {.SavedPostsPath = SavedPostsPath, .Path = Path}
End Function
#Region "Forks"
Friend Function IsMyUser(ByVal UserURL As String) As ExchangeOptions

View File

@@ -230,35 +230,13 @@ Namespace Plugin.Hosts
Dim tUser As UserInfo
Dim tUserIndx%
Dim tUserBase As UserDataBase
Dim samePath As Boolean = Obj.Path(False) = Hosts(selectedAcc).Path(False)
Dim processUserPath As Boolean
For Each tUser In users
tUserIndx = .UsersList.IndexOf(tUser)
If tUserIndx = -1 Then
Throw New KeyNotFoundException("User not found in the collection")
Else
tUserBase = .GetUser(tUser)
With tUser
If Not samePath AndAlso .SpecialPath.IsEmptyString AndAlso .SpecialCollectionPath.IsEmptyString Then
processUserPath = False
If .IncludedInCollection Then
If Not .IsVirtual Then
.SpecialCollectionPath = .GetCollectionRootPath
Else
processUserPath = True
End If
End If
If Not .IncludedInCollection Or processUserPath Then .SpecialPath = .File.CutPath.PathWithSeparator
End If
End With
tUser.AccountName = Hosts(selectedAcc).AccountName
tUser.UpdateUserFile()
.UsersList(tUserIndx) = tUser
tUserBase.AccountName = String.Empty
tUserBase.User = tUser
tUserBase.UpdateUserInformation()
changedUsers.Add(tUserBase.ToStringForLog)
End If
UpdateUserAccount(tUser, Obj, Hosts(selectedAcc), True, tUserIndx)
tUserBase = .GetUser(tUser)
tUserBase.AccountName = String.Empty
tUserBase.User = tUser
tUserBase.UpdateUserInformation()
changedUsers.Add(tUserBase.ToStringForLog)
Next
.UpdateUsersList()
End If
@@ -281,6 +259,34 @@ Namespace Plugin.Hosts
If p <> np Then Settings.Automation.Pause = p
End Try
End Function
Friend Shared Sub UpdateUserAccount(ByRef ChangingUser As UserInfo, ByVal HostOld As SettingsHost, ByVal HostNew As SettingsHost,
ByVal UpdateUserInTheList As Boolean, Optional ByRef UserIndex As Integer = -1)
With Settings
UserIndex = .UsersList.IndexOf(ChangingUser)
If UserIndex = -1 Then
Throw New KeyNotFoundException("User not found in the collection")
Else
Dim processUserPath As Boolean
Dim samePath As Boolean = HostOld.Path(False) = HostNew.Path(False)
With ChangingUser
If Not samePath AndAlso .SpecialPath.IsEmptyString AndAlso .SpecialCollectionPath.IsEmptyString Then
processUserPath = False
If .IncludedInCollection Then
If Not .IsVirtual Then
.SpecialCollectionPath = .GetCollectionRootPath
Else
processUserPath = True
End If
End If
If Not .IncludedInCollection Or processUserPath Then .SpecialPath = .File.CutPath.PathWithSeparator
End If
End With
ChangingUser.AccountName = HostNew.AccountName
ChangingUser.UpdateUserFile()
If UpdateUserInTheList Then .UsersList(UserIndex) = ChangingUser
End If
End With
End Sub
#End Region
#Region "Count, Item"
Friend ReadOnly Property Count As Integer Implements IMyEnumerator(Of SettingsHost).MyEnumeratorCount

View File

@@ -299,6 +299,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
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 = {"Users"}
FromChannelDownloadTop = New XMLValue(Of Integer)("FromChannelDownloadTop", 10, MyXML, n)
@@ -923,6 +924,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
Friend ReadOnly Property FeedOpenLastMode As XMLValue(Of Boolean)
Friend ReadOnly Property FeedLastModeSubscriptions As XMLValue(Of Boolean)
Friend ReadOnly Property FeedShowFriendlyNames As XMLValue(Of Boolean)
Friend ReadOnly Property FeedShowSpecialFeedsMediaItem As XMLValue(Of Boolean)
#End Region
#Region "New version properties"
Friend ReadOnly Property CheckUpdatesAtStart As XMLValue(Of Boolean)