2024.3.15.0

PluginProvider
Add 'Checked' property
Add 'PropertyValueEventArgs'

SCrawler
Add default headers
Add predefined colors to the color picker
API.Instagram: automatically reset download options after updating credentials
This commit is contained in:
Andy
2024-03-15 21:38:55 +03:00
parent d1eacc2db2
commit 7a68067d77
24 changed files with 1177 additions and 231 deletions

View File

@@ -38,6 +38,8 @@ Namespace Plugin.Attributes
Public Property LabelTextAlign As Drawing.ContentAlignment = Drawing.ContentAlignment.TopCenter Public Property LabelTextAlign As Drawing.ContentAlignment = Drawing.ContentAlignment.TopCenter
''' <summary>This is an authorization property</summary> ''' <summary>This is an authorization property</summary>
Public Property IsAuth As Boolean = False Public Property IsAuth As Boolean = False
Public Property Category As String = Nothing
Public Property InheritanceName As String = Nothing
''' <summary>Initialize a new property option attribute</summary> ''' <summary>Initialize a new property option attribute</summary>
''' <param name="PropertyName">Property name</param> ''' <param name="PropertyName">Property name</param>
Public Sub New(<CallerMemberName()> Optional ByVal PropertyName As String = Nothing) Public Sub New(<CallerMemberName()> Optional ByVal PropertyName As String = Nothing)
@@ -57,6 +59,7 @@ Namespace Plugin.Attributes
''' <summary>Store property value in settings XML file</summary> ''' <summary>Store property value in settings XML file</summary>
<AttributeUsage(AttributeTargets.Property, AllowMultiple:=False, Inherited:=False)> Public NotInheritable Class PXML : Inherits Attribute <AttributeUsage(AttributeTargets.Property, AllowMultiple:=False, Inherited:=False)> Public NotInheritable Class PXML : Inherits Attribute
Public ReadOnly ElementName As String Public ReadOnly ElementName As String
Public Property OnlyForChecked As Boolean = False
''' <summary>Initialize a new XML attribute</summary> ''' <summary>Initialize a new XML attribute</summary>
''' <param name="XMLElementName">XML element name</param> ''' <param name="XMLElementName">XML element name</param>
Public Sub New(<CallerMemberName()> Optional ByVal XMLElementName As String = Nothing) Public Sub New(<CallerMemberName()> Optional ByVal XMLElementName As String = Nothing)

View File

@@ -9,8 +9,23 @@
Namespace Plugin Namespace Plugin
Public NotInheritable Class PropertyValue : Implements IPropertyValue Public NotInheritable Class PropertyValue : Implements IPropertyValue
Public Event ValueChanged As IPropertyValue.ValueChangedEventHandler Implements IPropertyValue.ValueChanged Public Event ValueChanged As IPropertyValue.ValueChangedEventHandler Implements IPropertyValue.ValueChanged
Public Event CheckedChanged As IPropertyValue.ValueChangedEventHandler
Public Property [Type] As Type Implements IPropertyValue.Type Public Property [Type] As Type Implements IPropertyValue.Type
Public Property OnChangeFunction As IPropertyValue.ValueChangedEventHandler Public Property OnChangeFunction As IPropertyValue.ValueChangedEventHandler
Public Property OnCheckboxCheckedChange As EventHandler(Of PropertyValueEventArgs)
Private _Checked As Boolean = False
Public Property Checked As Boolean
Get
Return _Checked
End Get
Set(ByVal IsChecked As Boolean)
_Checked = IsChecked
If Not _Initialization Then
If Not OnCheckboxCheckedChange Is Nothing Then OnCheckboxCheckedChange.Invoke(Me, EventArgs.Empty)
RaiseEvent CheckedChanged(_Checked)
End If
End Set
End Property
Private _Initialization As Boolean = False Private _Initialization As Boolean = False
''' <inheritdoc cref="PropertyValue.New(Object, Type, ByRef IPropertyValue.ValueChangedEventHandler)"/> ''' <inheritdoc cref="PropertyValue.New(Object, Type, ByRef IPropertyValue.ValueChangedEventHandler)"/>
''' <exception cref="ArgumentNullException"></exception> ''' <exception cref="ArgumentNullException"></exception>
@@ -59,6 +74,7 @@ Namespace Plugin
Type = Source.Type Type = Source.Type
OnChangeFunction = Source.OnChangeFunction OnChangeFunction = Source.OnChangeFunction
_Value = Source._Value _Value = Source._Value
_Checked = Source._Checked
_Initialization = False _Initialization = False
End Sub End Sub
End Class End Class
@@ -71,4 +87,8 @@ Namespace Plugin
''' <summary>Property value</summary> ''' <summary>Property value</summary>
Property Value As Object Property Value As Object
End Interface End Interface
Public Class PropertyValueEventArgs : Inherits EventArgs
Public Property Checked As Boolean = False
Public Property ControlEnabled As Boolean = True
End Class
End Namespace End Namespace

View File

@@ -29,8 +29,6 @@ Namespace API.Facebook
Return __HH_CSRF_TOKEN Return __HH_CSRF_TOKEN
End Get End Get
End Property End Property
<PropertyOption(ControlText:="sec-ch-ua-platform-ver", ControlToolTip:="sec-ch-ua-platform-version", IsAuth:=True, LeftOffset:=120), ControlNumber(51), PXML, PClonable>
Friend ReadOnly Property HH_PLATFORM_VER As PropertyValue
#End Region #End Region
#Region "Defaults" #Region "Defaults"
<PropertyOption(ControlText:="Download photos", IsAuth:=False), PXML, PClonable> <PropertyOption(ControlText:="Download photos", IsAuth:=False), PXML, PClonable>
@@ -51,7 +49,6 @@ Namespace API.Facebook
.Remove(DeclaredNames.Header_FB_FRIENDLY_NAME) .Remove(DeclaredNames.Header_FB_FRIENDLY_NAME)
End With End With
Header_Accept = New PropertyValue(String.Empty, GetType(String)) Header_Accept = New PropertyValue(String.Empty, GetType(String))
HH_PLATFORM_VER = New PropertyValue(String.Empty, GetType(String))
ParsePhotoBlock = New PropertyValue(True) ParsePhotoBlock = New PropertyValue(True)
ParseVideoBlock = New PropertyValue(True) ParseVideoBlock = New PropertyValue(True)
ParseStoriesBlock = New PropertyValue(True) ParseStoriesBlock = New PropertyValue(True)

View File

@@ -560,10 +560,10 @@ Namespace API.Facebook
If Not h.IsEmptyString Then .Add(IG.Header_Browser, h) If Not h.IsEmptyString Then .Add(IG.Header_Browser, h)
h = Responser.Headers.Value(IG.Header_BrowserExt) h = Responser.Headers.Value(IG.Header_BrowserExt)
If Not h.IsEmptyString Then .Add(IG.Header_BrowserExt, h) If Not h.IsEmptyString Then .Add(IG.Header_BrowserExt, h)
h = .Value(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.SecChUaPlatform)) h = Responser.Headers.Value(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.SecChUaPlatform))
If Not h.IsEmptyString Then .Add(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.SecChUaPlatform, h)) If Not h.IsEmptyString Then .Add(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.SecChUaPlatform, h))
If ACheck(MySettings.HH_PLATFORM_VER.Value) Then _ h = Responser.Headers.Value(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.SecChUaPlatformVersion))
.Add(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.SecChUaPlatformVersion, MySettings.HH_PLATFORM_VER.Value)) If Not h.IsEmptyString Then .Add(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.SecChUaPlatformVersion, h))
.Add(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.SecChUaMobile, "?0")) .Add(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.SecChUaMobile, "?0"))
.Add("Sec-Ch-Ua-Model", "") .Add("Sec-Ch-Ua-Model", "")
End With End With

View File

@@ -62,7 +62,7 @@ Namespace API.Instagram
Friend Const Header_ASBD_ID As String = "X-Asbd-Id" Friend Const Header_ASBD_ID As String = "X-Asbd-Id"
Friend Const Header_Browser As String = "Sec-Ch-Ua" Friend Const Header_Browser As String = "Sec-Ch-Ua"
Friend Const Header_BrowserExt As String = "Sec-Ch-Ua-Full-Version-List" Friend Const Header_BrowserExt As String = "Sec-Ch-Ua-Full-Version-List"
Friend Const Header_Platform As String = "Sec-Ch-Ua-Platform-Version" Friend Const Header_Platform_Verion As String = "Sec-Ch-Ua-Platform-Version"
<PropertyOption(ControlText:="x-csrftoken", ControlToolTip:="Can be automatically extracted from cookies", IsAuth:=True, AllowNull:=True), ControlNumber(2), PClonable(Clone:=False)> <PropertyOption(ControlText:="x-csrftoken", ControlToolTip:="Can be automatically extracted from cookies", IsAuth:=True, AllowNull:=True), ControlNumber(2), PClonable(Clone:=False)>
Friend ReadOnly Property HH_CSRF_TOKEN As PropertyValue Friend ReadOnly Property HH_CSRF_TOKEN As PropertyValue
<PropertyOption(ControlText:="x-ig-app-id", IsAuth:=True, AllowNull:=False), ControlNumber(3), PClonable(Clone:=False)> <PropertyOption(ControlText:="x-ig-app-id", IsAuth:=True, AllowNull:=False), ControlNumber(3), PClonable(Clone:=False)>
@@ -72,13 +72,17 @@ Namespace API.Instagram
'PropertyOption(ControlText:="x-ig-www-claim", IsAuth:=True, AllowNull:=True) 'PropertyOption(ControlText:="x-ig-www-claim", IsAuth:=True, AllowNull:=True)
<ControlNumber(5), PClonable(Clone:=False)> <ControlNumber(5), PClonable(Clone:=False)>
Friend Property HH_IG_WWW_CLAIM As PropertyValue Friend Property HH_IG_WWW_CLAIM As PropertyValue
<PropertyOption(ControlText:="sec-ch-ua", IsAuth:=True, AllowNull:=True), ControlNumber(6), PClonable> <PropertyOption(ControlText:="sec-ch-ua", IsAuth:=True, AllowNull:=True,
InheritanceName:=SettingsCLS.HEADER_DEF_sec_ch_ua), ControlNumber(6), PClonable, PXML(OnlyForChecked:=True)>
Private Property HH_BROWSER As PropertyValue Private Property HH_BROWSER As PropertyValue
<PropertyOption(ControlText:="sec-ch-ua-full", ControlToolTip:="sec-ch-ua-full-version-list", IsAuth:=True, AllowNull:=True), ControlNumber(7), PClonable> <PropertyOption(ControlText:="sec-ch-ua-full", ControlToolTip:="sec-ch-ua-full-version-list", IsAuth:=True, AllowNull:=True,
InheritanceName:=SettingsCLS.HEADER_DEF_sec_ch_ua_full_version_list), ControlNumber(7), PClonable, PXML(OnlyForChecked:=True)>
Private Property HH_BROWSER_EXT As PropertyValue Private Property HH_BROWSER_EXT As PropertyValue
<PropertyOption(ControlText:="sec-ch-ua-platform-ver", ControlToolTip:="sec-ch-ua-platform-version", IsAuth:=True, AllowNull:=True), ControlNumber(8), PClonable> <PropertyOption(ControlText:="sec-ch-ua-platform-ver", ControlToolTip:="sec-ch-ua-platform-version", IsAuth:=True, AllowNull:=True, LeftOffset:=135,
InheritanceName:=SettingsCLS.HEADER_DEF_sec_ch_ua_platform_version), ControlNumber(8), PClonable, PXML(OnlyForChecked:=True)>
Private Property HH_PLATFORM As PropertyValue Private Property HH_PLATFORM As PropertyValue
<PropertyOption(ControlText:="UserAgent", IsAuth:=True, AllowNull:=True), ControlNumber(9), PClonable> <PropertyOption(ControlText:="UserAgent", IsAuth:=True, AllowNull:=True,
InheritanceName:=SettingsCLS.HEADER_DEF_UserAgent), ControlNumber(9), PClonable, PXML(OnlyForChecked:=True)>
Private Property HH_USER_AGENT As PropertyValue Private Property HH_USER_AGENT As PropertyValue
Friend Overrides Function BaseAuthExists() As Boolean Friend Overrides Function BaseAuthExists() As Boolean
Return Responser.CookiesExists And ACheck(HH_IG_APP_ID.Value) And ACheck(HH_CSRF_TOKEN.Value) Return Responser.CookiesExists And ACheck(HH_IG_APP_ID.Value) And ACheck(HH_CSRF_TOKEN.Value)
@@ -95,7 +99,7 @@ Namespace API.Instagram
Case NameOf(HH_CSRF_TOKEN) : f = Header_CSRF_TOKEN Case NameOf(HH_CSRF_TOKEN) : f = Header_CSRF_TOKEN
Case NameOf(HH_BROWSER) : f = Header_Browser Case NameOf(HH_BROWSER) : f = Header_Browser
Case NameOf(HH_BROWSER_EXT) : f = Header_BrowserExt Case NameOf(HH_BROWSER_EXT) : f = Header_BrowserExt
Case NameOf(HH_PLATFORM) : f = Header_Platform Case NameOf(HH_PLATFORM) : f = Header_Platform_Verion
Case NameOf(HH_USER_AGENT) : isUserAgent = True Case NameOf(HH_USER_AGENT) : isUserAgent = True
End Select End Select
If Not f.IsEmptyString Then If Not f.IsEmptyString Then
@@ -140,14 +144,19 @@ Namespace API.Instagram
#Region "Download ready" #Region "Download ready"
<PropertyOption(ControlText:="Download timeline", ControlToolTip:="Download timeline"), PXML, ControlNumber(10), PClonable> <PropertyOption(ControlText:="Download timeline", ControlToolTip:="Download timeline"), PXML, ControlNumber(10), PClonable>
Friend ReadOnly Property DownloadTimeline As PropertyValue Friend ReadOnly Property DownloadTimeline As PropertyValue
<PXML> Private ReadOnly Property DownloadTimeline_Def As PropertyValue
<PropertyOption(ControlText:="Download reels", ControlToolTip:="Download reels"), PXML, ControlNumber(11), PClonable> <PropertyOption(ControlText:="Download reels", ControlToolTip:="Download reels"), PXML, ControlNumber(11), PClonable>
Friend ReadOnly Property DownloadReels As PropertyValue Friend ReadOnly Property DownloadReels As PropertyValue
<PXML> Private ReadOnly Property DownloadReels_Def As PropertyValue
<PropertyOption(ControlText:="Download stories", ControlToolTip:="Download stories"), PXML, ControlNumber(12), PClonable> <PropertyOption(ControlText:="Download stories", ControlToolTip:="Download stories"), PXML, ControlNumber(12), PClonable>
Friend ReadOnly Property DownloadStories As PropertyValue Friend ReadOnly Property DownloadStories As PropertyValue
<PXML> Private ReadOnly Property DownloadStories_Def As PropertyValue
<PropertyOption(ControlText:="Download stories: user", ControlToolTip:="Download stories (user)"), PXML, ControlNumber(13), PClonable> <PropertyOption(ControlText:="Download stories: user", ControlToolTip:="Download stories (user)"), PXML, ControlNumber(13), PClonable>
Friend ReadOnly Property DownloadStoriesUser As PropertyValue Friend ReadOnly Property DownloadStoriesUser As PropertyValue
<PXML> Private ReadOnly Property DownloadStoriesUser_Def As PropertyValue
<PropertyOption(ControlText:="Download tagged", ControlToolTip:="Download tagged posts"), PXML, ControlNumber(14), PClonable> <PropertyOption(ControlText:="Download tagged", ControlToolTip:="Download tagged posts"), PXML, ControlNumber(14), PClonable>
Friend ReadOnly Property DownloadTagged As PropertyValue Friend ReadOnly Property DownloadTagged As PropertyValue
<PXML> Private ReadOnly Property DownloadTagged_Def As PropertyValue
#End Region #End Region
#Region "429 bypass" #Region "429 bypass"
<PXML("InstagramDownloadingErrorDate")> <PXML("InstagramDownloadingErrorDate")>
@@ -224,7 +233,7 @@ Namespace API.Instagram
asbd = .Value(Header_ASBD_ID) asbd = .Value(Header_ASBD_ID)
browser = .Value(Header_Browser) browser = .Value(Header_Browser)
browserExt = .Value(Header_BrowserExt) browserExt = .Value(Header_BrowserExt)
platform = .Value(Header_Platform) platform = .Value(Header_Platform_Verion)
End If End If
.Add("Dnt", 1) .Add("Dnt", 1)
.Add("Sec-Ch-Ua-Mobile", "?0") .Add("Sec-Ch-Ua-Mobile", "?0")
@@ -249,10 +258,15 @@ Namespace API.Instagram
HH_USER_AGENT = New PropertyValue(useragent, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_USER_AGENT), v)) HH_USER_AGENT = New PropertyValue(useragent, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_USER_AGENT), v))
DownloadTimeline = New PropertyValue(True) DownloadTimeline = New PropertyValue(True)
DownloadTimeline_Def = New PropertyValue(DownloadTimeline.Value, GetType(Boolean))
DownloadReels = New PropertyValue(False) DownloadReels = New PropertyValue(False)
DownloadReels_Def = New PropertyValue(DownloadReels.Value, GetType(Boolean))
DownloadStories = New PropertyValue(True) DownloadStories = New PropertyValue(True)
DownloadStories_Def = New PropertyValue(DownloadStories.Value, GetType(Boolean))
DownloadStoriesUser = New PropertyValue(True) DownloadStoriesUser = New PropertyValue(True)
DownloadStoriesUser_Def = New PropertyValue(DownloadStoriesUser.Value, GetType(Boolean))
DownloadTagged = New PropertyValue(False) DownloadTagged = New PropertyValue(False)
DownloadTagged_Def = New PropertyValue(DownloadTagged.Value, GetType(Boolean))
RequestsWaitTimer = New PropertyValue(1000) RequestsWaitTimer = New PropertyValue(1000)
RequestsWaitTimerProvider = New TimersChecker(100) RequestsWaitTimerProvider = New TimersChecker(100)
@@ -362,6 +376,11 @@ Namespace API.Instagram
Private ____HH_PLATFORM As String = String.Empty Private ____HH_PLATFORM As String = String.Empty
Private ____HH_USER_AGENT As String = String.Empty Private ____HH_USER_AGENT As String = String.Empty
Private ____Cookies As CookieKeeper = Nothing Private ____Cookies As CookieKeeper = Nothing
Private __DownloadTimeline As Boolean = False
Private __DownloadReels As Boolean = False
Private __DownloadStories As Boolean = False
Private __DownloadStoriesUser As Boolean = False
Private __DownloadTagged As Boolean = False
Friend Overrides Sub BeginEdit() Friend Overrides Sub BeginEdit()
____HH_CSRF_TOKEN = AConvert(Of String)(HH_CSRF_TOKEN.Value, String.Empty) ____HH_CSRF_TOKEN = AConvert(Of String)(HH_CSRF_TOKEN.Value, String.Empty)
____HH_IG_APP_ID = AConvert(Of String)(HH_IG_APP_ID.Value, String.Empty) ____HH_IG_APP_ID = AConvert(Of String)(HH_IG_APP_ID.Value, String.Empty)
@@ -371,6 +390,11 @@ Namespace API.Instagram
____HH_PLATFORM = AConvert(Of String)(HH_PLATFORM.Value, String.Empty) ____HH_PLATFORM = AConvert(Of String)(HH_PLATFORM.Value, String.Empty)
____HH_USER_AGENT = AConvert(Of String)(HH_USER_AGENT.Value, String.Empty) ____HH_USER_AGENT = AConvert(Of String)(HH_USER_AGENT.Value, String.Empty)
____Cookies = Responser.Cookies.Copy ____Cookies = Responser.Cookies.Copy
__DownloadTimeline = DownloadTimeline.Value
__DownloadReels = DownloadReels.Value
__DownloadStories = DownloadStories.Value
__DownloadStoriesUser = DownloadStoriesUser.Value
__DownloadTagged = DownloadTagged.Value
MyBase.BeginEdit() MyBase.BeginEdit()
End Sub End Sub
Friend Overrides Sub Update() Friend Overrides Sub Update()
@@ -383,12 +407,33 @@ Namespace API.Instagram
New With {.ValueOld = ____HH_PLATFORM, .ValueNew = AConvert(Of String)(HH_PLATFORM.Value, String.Empty).ToString}, New With {.ValueOld = ____HH_PLATFORM, .ValueNew = AConvert(Of String)(HH_PLATFORM.Value, String.Empty).ToString},
New With {.ValueOld = ____HH_USER_AGENT, .ValueNew = AConvert(Of String)(HH_USER_AGENT.Value, String.Empty).ToString} New With {.ValueOld = ____HH_USER_AGENT, .ValueNew = AConvert(Of String)(HH_USER_AGENT.Value, String.Empty).ToString}
} }
Dim credentialsUpdated As Boolean = False
If vals.Any(Function(v) Not v.ValueOld = v.ValueNew) OrElse If vals.Any(Function(v) Not v.ValueOld = v.ValueNew) OrElse
Not Responser.Cookies.ListEquals(____Cookies) Then HH_IG_WWW_CLAIM.Value = 0 Not Responser.Cookies.ListEquals(____Cookies) Then HH_IG_WWW_CLAIM.Value = 0 : credentialsUpdated = True
If Responser.CookiesExists Then If Responser.CookiesExists Then
Dim csrf$ = If(Responser.Cookies.FirstOrDefault(Function(c) c.Name.StringToLower = Header_CSRF_TOKEN_COOKIE)?.Value, String.Empty) Dim csrf$ = If(Responser.Cookies.FirstOrDefault(Function(c) c.Name.StringToLower = Header_CSRF_TOKEN_COOKIE)?.Value, String.Empty)
If Not csrf.IsEmptyString Then HH_CSRF_TOKEN.Value = csrf If Not csrf.IsEmptyString Then
If Not AEquals(Of String)(CStr(HH_CSRF_TOKEN.Value), csrf) Then credentialsUpdated = True
HH_CSRF_TOKEN.Value = csrf
End If
End If End If
If credentialsUpdated AndAlso {New With {.ValueOld = __DownloadTimeline, .ValueNew = CBool(DownloadTimeline.Value)},
New With {.ValueOld = __DownloadReels, .ValueNew = CBool(DownloadReels.Value)},
New With {.ValueOld = __DownloadStories, .ValueNew = CBool(DownloadStories.Value)},
New With {.ValueOld = __DownloadStoriesUser, .ValueNew = CBool(DownloadStoriesUser.Value)},
New With {.ValueOld = __DownloadTagged, .ValueNew = CBool(DownloadTagged.Value)}}.
All(Function(v) v.ValueOld = v.ValueNew) Then
DownloadTimeline.Value = DownloadTimeline_Def.Value
DownloadReels.Value = DownloadReels_Def.Value
DownloadStories.Value = DownloadStories_Def.Value
DownloadStoriesUser.Value = DownloadStoriesUser_Def.Value
DownloadTagged.Value = DownloadTagged_Def.Value
End If
DownloadTimeline_Def.Value = DownloadTimeline.Value
DownloadReels_Def.Value = DownloadReels.Value
DownloadStories_Def.Value = DownloadStories.Value
DownloadStoriesUser_Def.Value = DownloadStoriesUser.Value
DownloadTagged_Def.Value = DownloadTagged.Value
End If End If
MyBase.Update() MyBase.Update()
End Sub End Sub

View File

@@ -22,7 +22,8 @@ Namespace API.JustForFans
Friend ReadOnly Property UserHash4 As PropertyValue Friend ReadOnly Property UserHash4 As PropertyValue
<PropertyOption(ControlText:="Accept", ControlToolTip:="Header 'Accept'"), PClonable> <PropertyOption(ControlText:="Accept", ControlToolTip:="Header 'Accept'"), PClonable>
Friend ReadOnly Property HeaderAccept As PropertyValue Friend ReadOnly Property HeaderAccept As PropertyValue
<PropertyOption, PClonable> Friend ReadOnly Property UserAgent As PropertyValue <PropertyOption(InheritanceName:=SettingsCLS.HEADER_DEF_UserAgent), PClonable, PXML(OnlyForChecked:=True)>
Friend ReadOnly Property UserAgent As PropertyValue
Private Sub UpdateHeader(ByVal HeaderName As String, ByVal HeaderValue As String) Private Sub UpdateHeader(ByVal HeaderName As String, ByVal HeaderValue As String)
Select Case HeaderName Select Case HeaderName
Case NameOf(HeaderAccept) : If HeaderValue.IsEmptyString Then Responser.Accept = Nothing Else Responser.Accept = HeaderValue Case NameOf(HeaderAccept) : If HeaderValue.IsEmptyString Then Responser.Accept = Nothing Else Responser.Accept = HeaderValue

View File

@@ -34,9 +34,10 @@ Namespace API.OnlyFans
Private ReadOnly Property HH_X_BC As PropertyValue Private ReadOnly Property HH_X_BC As PropertyValue
<PropertyOption(ControlText:=HeaderAppToken, AllowNull:=False), PClonable(Clone:=False)> <PropertyOption(ControlText:=HeaderAppToken, AllowNull:=False), PClonable(Clone:=False)>
Private ReadOnly Property HH_APP_TOKEN As PropertyValue Private ReadOnly Property HH_APP_TOKEN As PropertyValue
<PropertyOption(ControlText:=HeaderBrowser, ControlToolTip:="Can be null", AllowNull:=True), PClonable> <PropertyOption(ControlText:=HeaderBrowser, ControlToolTip:="Can be null", AllowNull:=True,
InheritanceName:=SettingsCLS.HEADER_DEF_sec_ch_ua), PClonable, PXML(OnlyForChecked:=True)>
Private ReadOnly Property HH_BROWSER As PropertyValue Private ReadOnly Property HH_BROWSER As PropertyValue
<PropertyOption(AllowNull:=False), PClonable> <PropertyOption(AllowNull:=False, InheritanceName:=SettingsCLS.HEADER_DEF_UserAgent), PClonable, PXML(OnlyForChecked:=True)>
Friend ReadOnly Property UserAgent As PropertyValue Friend ReadOnly Property UserAgent As PropertyValue
Private Sub UpdateHeader(ByVal PropertyName As String, ByVal Value As String) Private Sub UpdateHeader(ByVal PropertyName As String, ByVal Value As String)
Dim hName$ = String.Empty Dim hName$ = String.Empty

View File

@@ -34,13 +34,17 @@ Namespace API.ThreadsNet
End Property End Property
<PropertyOption(ControlText:="x-asbd-id", AllowNull:=True, IsAuth:=True), ControlNumber(20), PClonable> <PropertyOption(ControlText:="x-asbd-id", AllowNull:=True, IsAuth:=True), ControlNumber(20), PClonable>
Friend ReadOnly Property HH_ASBD_ID As PropertyValue Friend ReadOnly Property HH_ASBD_ID As PropertyValue
<PropertyOption(ControlText:="sec-ch-ua", AllowNull:=True, IsAuth:=True), ControlNumber(30), PClonable> <PropertyOption(ControlText:="sec-ch-ua", AllowNull:=True, IsAuth:=True,
InheritanceName:=SettingsCLS.HEADER_DEF_sec_ch_ua), ControlNumber(30), PClonable, PXML(OnlyForChecked:=True)>
Private ReadOnly Property HH_BROWSER As PropertyValue Private ReadOnly Property HH_BROWSER As PropertyValue
<PropertyOption(ControlText:="sec-ch-ua-full", ControlToolTip:="sec-ch-ua-full-version-list", AllowNull:=True, IsAuth:=True), ControlNumber(40), PClonable> <PropertyOption(ControlText:="sec-ch-ua-full", ControlToolTip:=SettingsCLS.HEADER_DEF_sec_ch_ua_full_version_list, AllowNull:=True, IsAuth:=True,
InheritanceName:=SettingsCLS.HEADER_DEF_sec_ch_ua_full_version_list), ControlNumber(40), PClonable, PXML(OnlyForChecked:=True)>
Private ReadOnly Property HH_BROWSER_EXT As PropertyValue Private ReadOnly Property HH_BROWSER_EXT As PropertyValue
<PropertyOption(ControlText:="sec-ch-ua-platform", ControlToolTip:="sec-ch-ua-platform", AllowNull:=True, IsAuth:=True, LeftOffset:=120), ControlNumber(50), PClonable> <PropertyOption(ControlText:="sec-ch-ua-platform-ver", ControlToolTip:=SettingsCLS.HEADER_DEF_sec_ch_ua_platform_version, AllowNull:=True, IsAuth:=True, LeftOffset:=135,
Private ReadOnly Property HH_PLATFORM As PropertyValue InheritanceName:=SettingsCLS.HEADER_DEF_sec_ch_ua_platform_version), ControlNumber(50), PClonable, PXML(OnlyForChecked:=True)>
<PropertyOption(ControlText:="UserAgent", IsAuth:=True), ControlNumber(60), PClonable> Friend ReadOnly Property HH_PLATFORM_VER As PropertyValue
<PropertyOption(ControlText:="UserAgent", IsAuth:=True,
InheritanceName:=SettingsCLS.HEADER_DEF_UserAgent), ControlNumber(60), PClonable, PXML(OnlyForChecked:=True)>
Private ReadOnly Property HH_USER_AGENT As PropertyValue Private ReadOnly Property HH_USER_AGENT As PropertyValue
Private Sub ChangeResponserFields(ByVal PropName As String, ByVal Value As Object) Private Sub ChangeResponserFields(ByVal PropName As String, ByVal Value As Object)
If Not PropName.IsEmptyString Then If Not PropName.IsEmptyString Then
@@ -52,7 +56,7 @@ Namespace API.ThreadsNet
Case NameOf(HH_CSRF_TOKEN) : f = IG.Header_CSRF_TOKEN Case NameOf(HH_CSRF_TOKEN) : f = IG.Header_CSRF_TOKEN
Case NameOf(HH_BROWSER) : f = IG.Header_Browser Case NameOf(HH_BROWSER) : f = IG.Header_Browser
Case NameOf(HH_BROWSER_EXT) : f = IG.Header_BrowserExt Case NameOf(HH_BROWSER_EXT) : f = IG.Header_BrowserExt
Case NameOf(HH_PLATFORM) : f = IG.Header_Platform Case NameOf(HH_PLATFORM_VER) : f = IG.Header_Platform_Verion
Case NameOf(HH_USER_AGENT) : isUserAgent = True Case NameOf(HH_USER_AGENT) : isUserAgent = True
End Select End Select
If Not f.IsEmptyString Then If Not f.IsEmptyString Then
@@ -96,7 +100,7 @@ Namespace API.ThreadsNet
asbd = .Value(IG.Header_ASBD_ID) asbd = .Value(IG.Header_ASBD_ID)
browser = .Value(IG.Header_Browser) browser = .Value(IG.Header_Browser)
browserExt = .Value(IG.Header_BrowserExt) browserExt = .Value(IG.Header_BrowserExt)
platform = .Value(IG.Header_Platform) platform = .Value(IG.Header_Platform_Verion)
End If End If
.Add(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.Authority, "www.threads.net")) .Add(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.Authority, "www.threads.net"))
.Add(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.Origin, "https://www.threads.net")) .Add(HttpHeaderCollection.GetSpecialHeader(MyHeaderTypes.Origin, "https://www.threads.net"))
@@ -122,7 +126,7 @@ Namespace API.ThreadsNet
HH_ASBD_ID = New PropertyValue(asbd, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_ASBD_ID), v)) HH_ASBD_ID = New PropertyValue(asbd, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_ASBD_ID), v))
HH_BROWSER = New PropertyValue(browser, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_BROWSER), v)) HH_BROWSER = New PropertyValue(browser, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_BROWSER), v))
HH_BROWSER_EXT = New PropertyValue(browserExt, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_BROWSER_EXT), v)) HH_BROWSER_EXT = New PropertyValue(browserExt, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_BROWSER_EXT), v))
HH_PLATFORM = New PropertyValue(platform, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_PLATFORM), v)) HH_PLATFORM_VER = New PropertyValue(platform, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_PLATFORM_VER), v))
HH_USER_AGENT = New PropertyValue(useragent, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_USER_AGENT), v)) HH_USER_AGENT = New PropertyValue(useragent, GetType(String), Sub(v) ChangeResponserFields(NameOf(HH_USER_AGENT), v))
UrlPatternUser = "https://www.threads.net/@{0}" UrlPatternUser = "https://www.threads.net/@{0}"

View File

@@ -23,31 +23,87 @@ Namespace Editors
<System.Diagnostics.DebuggerStepThrough()> <System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent() Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container() Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ColorPicker))
Dim TT_MAIN As System.Windows.Forms.ToolTip Dim TT_MAIN As System.Windows.Forms.ToolTip
Me.TP_MAIN = New System.Windows.Forms.TableLayoutPanel() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ColorPicker))
Me.LBL_CAPTION = New System.Windows.Forms.Label()
Me.LBL_COLORS = New System.Windows.Forms.Label()
Me.BTT_COLORS_FORE = New System.Windows.Forms.Button() Me.BTT_COLORS_FORE = New System.Windows.Forms.Button()
Me.BTT_COLORS_BACK = New System.Windows.Forms.Button() Me.BTT_COLORS_BACK = New System.Windows.Forms.Button()
Me.BTT_COLORS_CLEAR = New System.Windows.Forms.Button() Me.BTT_COLORS_CLEAR = New System.Windows.Forms.Button()
Me.BTT_SELECT = New System.Windows.Forms.Button()
Me.TP_MAIN = New System.Windows.Forms.TableLayoutPanel()
Me.LBL_CAPTION = New System.Windows.Forms.Label()
Me.LBL_COLORS = New System.Windows.Forms.Label()
TT_MAIN = New System.Windows.Forms.ToolTip(Me.components) TT_MAIN = New System.Windows.Forms.ToolTip(Me.components)
Me.TP_MAIN.SuspendLayout() Me.TP_MAIN.SuspendLayout()
Me.SuspendLayout() Me.SuspendLayout()
' '
'BTT_COLORS_FORE
'
Me.BTT_COLORS_FORE.Dock = System.Windows.Forms.DockStyle.Fill
Me.BTT_COLORS_FORE.Location = New System.Drawing.Point(254, 2)
Me.BTT_COLORS_FORE.Margin = New System.Windows.Forms.Padding(2)
Me.BTT_COLORS_FORE.Name = "BTT_COLORS_FORE"
Me.BTT_COLORS_FORE.Size = New System.Drawing.Size(18, 24)
Me.BTT_COLORS_FORE.TabIndex = 2
Me.BTT_COLORS_FORE.Tag = "F"
Me.BTT_COLORS_FORE.Text = "F"
TT_MAIN.SetToolTip(Me.BTT_COLORS_FORE, "Font color")
Me.BTT_COLORS_FORE.UseVisualStyleBackColor = True
'
'BTT_COLORS_BACK
'
Me.BTT_COLORS_BACK.Dock = System.Windows.Forms.DockStyle.Fill
Me.BTT_COLORS_BACK.Location = New System.Drawing.Point(276, 2)
Me.BTT_COLORS_BACK.Margin = New System.Windows.Forms.Padding(2)
Me.BTT_COLORS_BACK.Name = "BTT_COLORS_BACK"
Me.BTT_COLORS_BACK.Size = New System.Drawing.Size(18, 24)
Me.BTT_COLORS_BACK.TabIndex = 3
Me.BTT_COLORS_BACK.Tag = "C"
Me.BTT_COLORS_BACK.Text = "C"
TT_MAIN.SetToolTip(Me.BTT_COLORS_BACK, "Back color")
Me.BTT_COLORS_BACK.UseVisualStyleBackColor = True
'
'BTT_COLORS_CLEAR
'
Me.BTT_COLORS_CLEAR.BackgroundImage = CType(resources.GetObject("BTT_COLORS_CLEAR.BackgroundImage"), System.Drawing.Image)
Me.BTT_COLORS_CLEAR.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
Me.BTT_COLORS_CLEAR.Dock = System.Windows.Forms.DockStyle.Fill
Me.BTT_COLORS_CLEAR.Location = New System.Drawing.Point(320, 2)
Me.BTT_COLORS_CLEAR.Margin = New System.Windows.Forms.Padding(2)
Me.BTT_COLORS_CLEAR.Name = "BTT_COLORS_CLEAR"
Me.BTT_COLORS_CLEAR.Size = New System.Drawing.Size(18, 24)
Me.BTT_COLORS_CLEAR.TabIndex = 4
Me.BTT_COLORS_CLEAR.Tag = "D"
TT_MAIN.SetToolTip(Me.BTT_COLORS_CLEAR, "Reset")
Me.BTT_COLORS_CLEAR.UseVisualStyleBackColor = True
'
'BTT_SELECT
'
Me.BTT_SELECT.BackgroundImage = CType(resources.GetObject("BTT_SELECT.BackgroundImage"), System.Drawing.Image)
Me.BTT_SELECT.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
Me.BTT_SELECT.Dock = System.Windows.Forms.DockStyle.Fill
Me.BTT_SELECT.Location = New System.Drawing.Point(298, 2)
Me.BTT_SELECT.Margin = New System.Windows.Forms.Padding(2)
Me.BTT_SELECT.Name = "BTT_SELECT"
Me.BTT_SELECT.Size = New System.Drawing.Size(18, 24)
Me.BTT_SELECT.TabIndex = 5
TT_MAIN.SetToolTip(Me.BTT_SELECT, "Select color from saved ones")
Me.BTT_SELECT.UseVisualStyleBackColor = True
'
'TP_MAIN 'TP_MAIN
' '
Me.TP_MAIN.ColumnCount = 5 Me.TP_MAIN.ColumnCount = 6
Me.TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 105.0!)) Me.TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 105.0!))
Me.TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) Me.TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
Me.TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 22.0!)) Me.TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 22.0!))
Me.TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 22.0!)) Me.TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 22.0!))
Me.TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 22.0!)) Me.TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 22.0!))
Me.TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 22.0!))
Me.TP_MAIN.Controls.Add(Me.LBL_CAPTION, 0, 0) Me.TP_MAIN.Controls.Add(Me.LBL_CAPTION, 0, 0)
Me.TP_MAIN.Controls.Add(Me.LBL_COLORS, 1, 0) Me.TP_MAIN.Controls.Add(Me.LBL_COLORS, 1, 0)
Me.TP_MAIN.Controls.Add(Me.BTT_COLORS_FORE, 2, 0) Me.TP_MAIN.Controls.Add(Me.BTT_COLORS_FORE, 2, 0)
Me.TP_MAIN.Controls.Add(Me.BTT_COLORS_BACK, 3, 0) Me.TP_MAIN.Controls.Add(Me.BTT_COLORS_BACK, 3, 0)
Me.TP_MAIN.Controls.Add(Me.BTT_COLORS_CLEAR, 4, 0) Me.TP_MAIN.Controls.Add(Me.BTT_COLORS_CLEAR, 5, 0)
Me.TP_MAIN.Controls.Add(Me.BTT_SELECT, 4, 0)
Me.TP_MAIN.Dock = System.Windows.Forms.DockStyle.Fill Me.TP_MAIN.Dock = System.Windows.Forms.DockStyle.Fill
Me.TP_MAIN.Location = New System.Drawing.Point(0, 0) Me.TP_MAIN.Location = New System.Drawing.Point(0, 0)
Me.TP_MAIN.Margin = New System.Windows.Forms.Padding(0) Me.TP_MAIN.Margin = New System.Windows.Forms.Padding(0)
@@ -74,51 +130,11 @@ Namespace Editors
Me.LBL_COLORS.Location = New System.Drawing.Point(108, 3) Me.LBL_COLORS.Location = New System.Drawing.Point(108, 3)
Me.LBL_COLORS.Margin = New System.Windows.Forms.Padding(3) Me.LBL_COLORS.Margin = New System.Windows.Forms.Padding(3)
Me.LBL_COLORS.Name = "LBL_COLORS" Me.LBL_COLORS.Name = "LBL_COLORS"
Me.LBL_COLORS.Size = New System.Drawing.Size(163, 22) Me.LBL_COLORS.Size = New System.Drawing.Size(141, 22)
Me.LBL_COLORS.TabIndex = 1 Me.LBL_COLORS.TabIndex = 1
Me.LBL_COLORS.Text = "Here's what it looks like." Me.LBL_COLORS.Text = "Here's what it looks like."
Me.LBL_COLORS.TextAlign = System.Drawing.ContentAlignment.MiddleCenter Me.LBL_COLORS.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
' '
'BTT_COLORS_FORE
'
Me.BTT_COLORS_FORE.Dock = System.Windows.Forms.DockStyle.Fill
Me.BTT_COLORS_FORE.Location = New System.Drawing.Point(276, 2)
Me.BTT_COLORS_FORE.Margin = New System.Windows.Forms.Padding(2)
Me.BTT_COLORS_FORE.Name = "BTT_COLORS_FORE"
Me.BTT_COLORS_FORE.Size = New System.Drawing.Size(18, 24)
Me.BTT_COLORS_FORE.TabIndex = 2
Me.BTT_COLORS_FORE.Tag = "F"
Me.BTT_COLORS_FORE.Text = "F"
TT_MAIN.SetToolTip(Me.BTT_COLORS_FORE, "Font color")
Me.BTT_COLORS_FORE.UseVisualStyleBackColor = True
'
'BTT_COLORS_BACK
'
Me.BTT_COLORS_BACK.Dock = System.Windows.Forms.DockStyle.Fill
Me.BTT_COLORS_BACK.Location = New System.Drawing.Point(298, 2)
Me.BTT_COLORS_BACK.Margin = New System.Windows.Forms.Padding(2)
Me.BTT_COLORS_BACK.Name = "BTT_COLORS_BACK"
Me.BTT_COLORS_BACK.Size = New System.Drawing.Size(18, 24)
Me.BTT_COLORS_BACK.TabIndex = 3
Me.BTT_COLORS_BACK.Tag = "C"
Me.BTT_COLORS_BACK.Text = "C"
TT_MAIN.SetToolTip(Me.BTT_COLORS_BACK, "Back color")
Me.BTT_COLORS_BACK.UseVisualStyleBackColor = True
'
'BTT_COLORS_CLEAR
'
Me.BTT_COLORS_CLEAR.BackgroundImage = CType(resources.GetObject("BTT_COLORS_CLEAR.BackgroundImage"), System.Drawing.Image)
Me.BTT_COLORS_CLEAR.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
Me.BTT_COLORS_CLEAR.Dock = System.Windows.Forms.DockStyle.Fill
Me.BTT_COLORS_CLEAR.Location = New System.Drawing.Point(320, 2)
Me.BTT_COLORS_CLEAR.Margin = New System.Windows.Forms.Padding(2)
Me.BTT_COLORS_CLEAR.Name = "BTT_COLORS_CLEAR"
Me.BTT_COLORS_CLEAR.Size = New System.Drawing.Size(18, 24)
Me.BTT_COLORS_CLEAR.TabIndex = 4
Me.BTT_COLORS_CLEAR.Tag = "D"
TT_MAIN.SetToolTip(Me.BTT_COLORS_CLEAR, "Reset")
Me.BTT_COLORS_CLEAR.UseVisualStyleBackColor = True
'
'ColorPicker 'ColorPicker
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -137,5 +153,6 @@ Namespace Editors
Private WithEvents BTT_COLORS_CLEAR As Button Private WithEvents BTT_COLORS_CLEAR As Button
Private WithEvents TP_MAIN As TableLayoutPanel Private WithEvents TP_MAIN As TableLayoutPanel
Private WithEvents LBL_CAPTION As Label Private WithEvents LBL_CAPTION As Label
Private WithEvents BTT_SELECT As Button
End Class End Class
End Namespace End Namespace

View File

@@ -130,6 +130,15 @@
xAAADsQBlSsOGwAAAIZJREFUOE+1j10KwCAMgz2b755xl/IsvnaL2K20UfbDAmEako+ZROSTafjE12Go xAAADsQBlSsOGwAAAIZJREFUOE+1j10KwCAMgz2b755xl/IsvnaL2K20UfbDAmEako+ZROSTafjE12Go
tbbB43rK5xSAQq1VYFtmeQBoqZTSreVZvgTknM8yyyjA/qodsDF9gspD2Bj6B+DH+NqzhQQAG+POMnSX tbbB43rK5xSAQq1VYFtmeQBoqZTSreVZvgTknM8yyyjA/qodsDF9gspD2Bj6B+DH+NqzhQQAG+POMnSX
AFuc5QFgn6ClHh5iOQVAKNixyucB8NY0vG9JOzzyhrdq5IRgAAAAAElFTkSuQmCC AFuc5QFgn6ClHh5iOQVAKNixyucB8NY0vG9JOzzyhrdq5IRgAAAAAElFTkSuQmCC
</value>
</data>
<data name="BTT_SELECT.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6
JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAeElE
QVQ4T2P4//8/RRhMFHQfKgDi/yAaXQEhDCZAmkNbnvyXta4CciESLEws//FhmDqYAQUgzUBMngsowVgF
ScFgYjQQsUsQi8FEYsXyAiD+D6LRFRDCYAKk2bPo6H9J40wgFyKBLeCQMUwdzIACkGYgHnKB+J8BAD5Q
tqhi4tzWAAAAAElFTkSuQmCC
</value> </value>
</data> </data>
</root> </root>

View File

@@ -9,6 +9,7 @@
Imports System.ComponentModel Imports System.ComponentModel
Imports PersonalUtilities.Forms Imports PersonalUtilities.Forms
Imports PersonalUtilities.Functions.XML.Objects Imports PersonalUtilities.Functions.XML.Objects
Imports ADB = PersonalUtilities.Forms.Controls.Base.ActionButton.DefaultButtons
Namespace Editors Namespace Editors
Public Class ColorPicker : Implements IChangeDetectorCompatible Public Class ColorPicker : Implements IChangeDetectorCompatible
Private Event DataChanged As EventHandler Implements IChangeDetectorCompatible.DataChanged Private Event DataChanged As EventHandler Implements IChangeDetectorCompatible.DataChanged
@@ -38,6 +39,7 @@ Namespace Editors
Set(ByVal m As Padding) Set(ByVal m As Padding)
BTT_COLORS_BACK.Margin = m BTT_COLORS_BACK.Margin = m
BTT_COLORS_FORE.Margin = m BTT_COLORS_FORE.Margin = m
BTT_SELECT.Margin = m
BTT_COLORS_CLEAR.Margin = m BTT_COLORS_CLEAR.Margin = m
End Set End Set
End Property End Property
@@ -70,6 +72,15 @@ Namespace Editors
End If End If
End Set End Set
End Property End Property
<Category("Appearance2"), DefaultValue(True)>
Public Property ListButtonEnabled As Boolean
Get
Return BTT_SELECT.Enabled
End Get
Set(ByVal Enabled As Boolean)
BTT_SELECT.Enabled = Enabled
End Set
End Property
#End Region #End Region
#Region "Colors" #Region "Colors"
Private BackColorDefault As Color = DefaultBackColor Private BackColorDefault As Color = DefaultBackColor
@@ -96,7 +107,7 @@ Namespace Editors
End Property End Property
#End Region #End Region
#Region "Get, Set" #Region "Get, Set"
Friend Sub ColorsSet(ByVal b As XMLValue(Of Color), ByVal f As XMLValue(Of Color), ByVal bDefault As Color, ByVal fDefault As Color) Friend Overloads Sub ColorsSet(ByVal b As XMLValue(Of Color), ByVal f As XMLValue(Of Color), ByVal bDefault As Color, ByVal fDefault As Color)
BackColorDefault = bDefault BackColorDefault = bDefault
If b.Exists Then If b.Exists Then
BackColorImpl = b.Value BackColorImpl = b.Value
@@ -110,20 +121,41 @@ Namespace Editors
ForeColorImpl = Nothing ForeColorImpl = Nothing
End If End If
End Sub End Sub
Friend Overloads Sub ColorsSet(ByVal c As DataColor)
BackColorImpl = c.BackColor
ForeColorImpl = c.ForeColor
End Sub
Friend Sub ColorsSetUser(ByVal b As Color?, ByVal f As Color?) Friend Sub ColorsSetUser(ByVal b As Color?, ByVal f As Color?)
BackColorImpl = b BackColorImpl = b
ForeColorImpl = f ForeColorImpl = f
End Sub End Sub
Friend Sub ColorsGet(ByRef b As XMLValue(Of Color), ByRef f As XMLValue(Of Color)) Friend Overloads Sub ColorsGet(ByRef b As XMLValue(Of Color), ByRef f As XMLValue(Of Color))
If BackColorImpl.HasValue Then b.Value = BackColorImpl.Value Else b.ValueF = Nothing If BackColorImpl.HasValue Then b.Value = BackColorImpl.Value Else b.ValueF = Nothing
If ForeColorImpl.HasValue Then f.Value = ForeColorImpl.Value Else f.ValueF = Nothing If ForeColorImpl.HasValue Then f.Value = ForeColorImpl.Value Else f.ValueF = Nothing
End Sub End Sub
Friend Overloads Function ColorsGet() As DataColor
Return New DataColor With {.BackColor = BackColorImpl, .ForeColor = ForeColorImpl}
End Function
Friend Sub ColorsGetUser(ByRef b As Color?, ByRef f As Color?) Friend Sub ColorsGetUser(ByRef b As Color?, ByRef f As Color?)
b = BackColorImpl b = BackColorImpl
f = ForeColorImpl f = ForeColorImpl
End Sub End Sub
#End Region #End Region
#Region "Buttons handlers" #Region "Buttons handlers"
Friend Sub RemoveAllButtons()
With TP_MAIN
With .Controls
.Remove(BTT_COLORS_BACK)
.Remove(BTT_COLORS_FORE)
.Remove(BTT_COLORS_CLEAR)
.Remove(BTT_SELECT)
End With
With .ColumnStyles
For i% = 2 To .Count - 1 : .Item(i).Width = 0 : Next
End With
.Refresh()
End With
End Sub
Private Sub COLOR_BUTTONS_Click(ByVal Sender As Button, ByVal e As EventArgs) Handles BTT_COLORS_BACK.Click, Private Sub COLOR_BUTTONS_Click(ByVal Sender As Button, ByVal e As EventArgs) Handles BTT_COLORS_BACK.Click,
BTT_COLORS_FORE.Click, BTT_COLORS_FORE.Click,
BTT_COLORS_CLEAR.Click BTT_COLORS_CLEAR.Click
@@ -134,6 +166,48 @@ Namespace Editors
End Select End Select
RaiseEvent DataChanged(Me, Nothing) RaiseEvent DataChanged(Me, Nothing)
End Sub End Sub
Private Sub BTT_SELECT_Click(sender As Object, e As EventArgs) Handles BTT_SELECT.Click
Try
Using f As New SimpleListForm(Of DataColor)(Settings.Colors, Settings.Design) With {
.DesignXMLNodeName = "ColorsChooserForm",
.Buttons = {ADB.Add, ADB.Edit},
.AddFunction = Sub(ByVal __Sender As Object, ByVal ee As SimpleListFormEventArgs)
Dim newColor As DataColor = Nothing
Using ff As New ColorPickerInternalForm
ff.ShowDialog()
If ff.DialogResult = DialogResult.OK Then newColor = ff.ResultColor
End Using
If Settings.Colors.IndexOf(newColor) = -1 And newColor.Exists Then
Settings.Colors.Add(newColor)
ee.Item = newColor
ee.Result = True
Else
ee.Result = False
End If
End Sub,
.FormText = "Colors",
.Mode = SimpleListFormModes.SelectedItems,
.MultiSelect = False
}
AddHandler f.EditClick, Sub(ByVal __Sender As Object, ByVal ee As SimpleListFormEventArgs)
If Not IsNothing(ee.Item) AndAlso TypeOf ee.Item Is DataColor Then
Using ff As New ColorPickerInternalForm With {.ResultColor = ee.Item} : ff.ShowDialog() : End Using
End If
ee.Result = False
End Sub
Dim i% = Settings.Colors.IndexOf(New DataColor With {.BackColor = BackColorImpl, .ForeColor = ForeColorImpl})
If i >= 0 Then f.DataSelectedIndexes.Add(i)
If f.ShowDialog = DialogResult.OK Then
RaiseEvent DataChanged(Me, Nothing)
Dim resultColor As DataColor = f.DataResult.FirstOrDefault
BackColorImpl = resultColor.BackColor
ForeColorImpl = resultColor.ForeColor
End If
End Using
Catch ex As Exception
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "[ColorPicker.SelectColor]")
End Try
End Sub
#End Region #End Region
End Class End Class
End Namespace End Namespace

View File

@@ -0,0 +1,131 @@
' 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 Editors
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Friend Class ColorPickerInternalForm : Inherits System.Windows.Forms.Form
<System.Diagnostics.DebuggerNonUserCode()>
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
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Dim CONTAINER_MAIN As System.Windows.Forms.ToolStripContainer
Dim TP_MAIN As System.Windows.Forms.TableLayoutPanel
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(ColorPickerInternalForm))
Me.TXT_NAME = New PersonalUtilities.Forms.Controls.TextBoxExtended()
Me.COLOR_PICKER = New SCrawler.Editors.ColorPicker()
CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
TP_MAIN = New System.Windows.Forms.TableLayoutPanel()
CONTAINER_MAIN.ContentPanel.SuspendLayout()
CONTAINER_MAIN.SuspendLayout()
TP_MAIN.SuspendLayout()
CType(Me.TXT_NAME, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'CONTAINER_MAIN
'
'
'CONTAINER_MAIN.ContentPanel
'
CONTAINER_MAIN.ContentPanel.Controls.Add(TP_MAIN)
CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(444, 81)
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(444, 81)
CONTAINER_MAIN.TabIndex = 0
CONTAINER_MAIN.TopToolStripPanelVisible = False
'
'TP_MAIN
'
TP_MAIN.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.[Single]
TP_MAIN.ColumnCount = 1
TP_MAIN.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
TP_MAIN.Controls.Add(Me.TXT_NAME, 0, 0)
TP_MAIN.Controls.Add(Me.COLOR_PICKER, 0, 1)
TP_MAIN.Dock = System.Windows.Forms.DockStyle.Fill
TP_MAIN.Location = New System.Drawing.Point(0, 0)
TP_MAIN.Name = "TP_MAIN"
TP_MAIN.RowCount = 3
TP_MAIN.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
TP_MAIN.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!))
TP_MAIN.RowStyles.Add(New System.Windows.Forms.RowStyle())
TP_MAIN.Size = New System.Drawing.Size(444, 81)
TP_MAIN.TabIndex = 0
'
'TXT_NAME
'
Me.TXT_NAME.AutoShowClearButton = True
ActionButton1.BackgroundImage = CType(resources.GetObject("ActionButton1.BackgroundImage"), System.Drawing.Image)
ActionButton1.Name = "Clear"
ActionButton1.Tag = PersonalUtilities.Forms.Controls.Base.ActionButton.DefaultButtons.Clear
ActionButton1.Visible = False
Me.TXT_NAME.Buttons.Add(ActionButton1)
Me.TXT_NAME.CaptionText = "Name"
Me.TXT_NAME.CaptionWidth = 50.0R
Me.TXT_NAME.Dock = System.Windows.Forms.DockStyle.Fill
Me.TXT_NAME.LeaveDefaultButtons = True
Me.TXT_NAME.Location = New System.Drawing.Point(4, 4)
Me.TXT_NAME.Name = "TXT_NAME"
Me.TXT_NAME.Size = New System.Drawing.Size(436, 22)
Me.TXT_NAME.TabIndex = 0
'
'COLOR_PICKER
'
Me.COLOR_PICKER.ButtonsMargin = New System.Windows.Forms.Padding(1, 2, 1, 2)
Me.COLOR_PICKER.CaptionText = "Color"
Me.COLOR_PICKER.CaptionWidth = 57
Me.COLOR_PICKER.Dock = System.Windows.Forms.DockStyle.Fill
Me.COLOR_PICKER.ListButtonEnabled = False
Me.COLOR_PICKER.Location = New System.Drawing.Point(1, 30)
Me.COLOR_PICKER.Margin = New System.Windows.Forms.Padding(0)
Me.COLOR_PICKER.Name = "COLOR_PICKER"
Me.COLOR_PICKER.Padding = New System.Windows.Forms.Padding(0, 0, 2, 0)
Me.COLOR_PICKER.Size = New System.Drawing.Size(442, 25)
Me.COLOR_PICKER.TabIndex = 1
'
'ColorPickerInternalForm
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(444, 81)
Me.Controls.Add(CONTAINER_MAIN)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.KeyPreview = True
Me.MaximizeBox = False
Me.MaximumSize = New System.Drawing.Size(460, 120)
Me.MinimizeBox = False
Me.MinimumSize = New System.Drawing.Size(460, 120)
Me.Name = "ColorPickerInternalForm"
Me.ShowIcon = False
Me.ShowInTaskbar = False
Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide
Me.Text = "Color"
CONTAINER_MAIN.ContentPanel.ResumeLayout(False)
CONTAINER_MAIN.ResumeLayout(False)
CONTAINER_MAIN.PerformLayout()
TP_MAIN.ResumeLayout(False)
CType(Me.TXT_NAME, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Private WithEvents TXT_NAME As PersonalUtilities.Forms.Controls.TextBoxExtended
Private WithEvents COLOR_PICKER As ColorPicker
End Class
End Namespace

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="CONTAINER_MAIN.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="TP_MAIN.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="ActionButton1.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
xAAADsQBlSsOGwAAAIZJREFUOE+1j10KwCAMgz2b755xl/IsvnaL2K20UfbDAmEako+ZROSTafjE12Go
tbbB43rK5xSAQq1VYFtmeQBoqZTSreVZvgTknM8yyyjA/qodsDF9gspD2Bj6B+DH+NqzhQQAG+POMnSX
AFuc5QFgn6ClHh5iOQVAKNixyucB8NY0vG9JOzzyhrdq5IRgAAAAAElFTkSuQmCC
</value>
</data>
</root>

View File

@@ -0,0 +1,92 @@
' 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
Namespace Editors
Friend Class ColorPickerInternalForm
Private WithEvents MyDefs As DefaultFormOptions
Friend Property ResultColor As DataColor
Private Class ColorNameProvider : Inherits FieldsCheckerProviderBase
Private ReadOnly ExistNames As List(Of String)
Private ReadOnly CurrentName As String
Private LastValue As String
Public Overrides Property ErrorMessage As String
Get
If HasError Then
Return $"A color named '{LastValue}' already exists"
Else
Return String.Empty
End If
End Get
Set : End Set
End Property
Friend Sub New(ByVal _CurrentName As String)
ExistNames = New List(Of String)
CurrentName = _CurrentName.StringToLower
If Settings.Colors.Count > 0 Then ExistNames.ListAddList(Settings.Colors.Select(Function(c) c.Name.StringToLower), LAP.NotContainsOnly)
End Sub
Public Overrides Function Convert(ByVal Value As Object, ByVal DestinationType As Type, ByVal Provider As IFormatProvider,
Optional ByVal NothingArg As Object = Nothing, Optional ByVal e As ErrorsDescriber = Nothing) As Object
If ACheck(Value) Then
LastValue = Value
Dim v$ = CStr(Value).StringToLower
If v = CurrentName OrElse (ExistNames.Count = 0 OrElse Not ExistNames.Contains(v)) Then
Return Value
Else
HasError = True
End If
Else
HasError = True
End If
Return Nothing
End Function
End Class
Friend Sub New()
InitializeComponent()
MyDefs = New DefaultFormOptions(Me, Settings.Design)
End Sub
Private Sub ColorPickerInternalForm_Load(sender As Object, e As EventArgs) Handles Me.Load
With MyDefs
.MyViewInitialize(True)
.AddOkCancelToolbar()
If ResultColor.Exists Then
TXT_NAME.Text = ResultColor.Name
COLOR_PICKER.ColorsSet(ResultColor)
TXT_NAME.Buttons.Clear()
TXT_NAME.Buttons.UpdateButtonsPositions()
TXT_NAME.Enabled = False
COLOR_PICKER.RemoveAllButtons()
End If
.MyFieldsCheckerE = New FieldsChecker
.MyFieldsCheckerE.AddControl(Of String)(TXT_NAME, TXT_NAME.CaptionText,, New ColorNameProvider(ResultColor.Name))
.MyFieldsChecker.EndLoaderOperations()
.EndLoaderOperations()
End With
End Sub
Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick
If MyDefs.MyFieldsChecker.AllParamsOK Then
Dim c As DataColor = COLOR_PICKER.ColorsGet
If c.Exists Then
Dim i% = Settings.Colors.IndexOf(c)
If i = -1 Then
c.Name = TXT_NAME.Text
ResultColor = c
MyDefs.CloseForm()
Else
MsgBoxE({$"The selected color is already present: '{Settings.Colors(i).Name}'", "Color selector"}, vbCritical)
End If
Else
MsgBoxE({"You didn't choose a color", "Color selector"}, vbCritical)
End If
End If
End Sub
End Class
End Namespace

View File

@@ -0,0 +1,104 @@
' 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.Functions.XML
Imports PersonalUtilities.Functions.XML.Base
Imports PersonalUtilities.Tools
Namespace Editors
Friend Structure DataColor : Implements IEContainerProvider, IComparable(Of DataColor)
Private Const Name_BackColor As String = "BackColor"
Private Const Name_ForeColor As String = "ForeColor"
Friend BackColor As Color?
Friend ForeColor As Color?
Friend Name As String
Friend ReadOnly Property Exists As Boolean
Get
Return BackColor.HasValue Or ForeColor.HasValue Or Not Name.IsEmptyString
End Get
End Property
Friend Sub New(ByVal e As EContainer)
If Not e Is Nothing Then
BackColor = AConvert(Of Color)(e.Attribute(Name_BackColor).Value, AModes.Var, Nothing)
ForeColor = AConvert(Of Color)(e.Attribute(Name_ForeColor).Value, AModes.Var, Nothing)
Name = e.Value
End If
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 DataColor Then
With DirectCast(Obj, DataColor)
Return AEquals(BackColor, .BackColor) And AEquals(ForeColor, .ForeColor)
End With
Else
Return False
End If
End Function
Private Function CompareTo(ByVal Other As DataColor) As Integer Implements IComparable(Of DataColor).CompareTo
Return Name.CompareTo(Other.Name)
End Function
Private Function ToEContainer(Optional ByVal e As ErrorsDescriber = Nothing) As EContainer Implements IEContainerProvider.ToEContainer
Return New EContainer("Color", Name, {New EAttribute(Name_BackColor, AConvert(Of String)(BackColor, AModes.Var, String.Empty)),
New EAttribute(Name_ForeColor, AConvert(Of String)(ForeColor, AModes.Var, String.Empty))})
End Function
End Structure
Friend Class DataColorCollection : Implements IEnumerable(Of DataColor), IMyEnumerator(Of DataColor)
Private ReadOnly Colors As List(Of DataColor)
Private ReadOnly File As SFile = $"{SettingsFolderName}\Colors.xml"
Friend Sub New()
Colors = New List(Of DataColor)
If File.Exists Then
Using x As New XmlFile(File, Protector.Modes.All, False) With {.AllowSameNames = True}
x.LoadData()
If x.Count > 0 Then Colors.ListAddList(x, LAP.IgnoreICopier)
End Using
End If
End Sub
Friend ReadOnly Property Item(ByVal Index As Integer) As DataColor Implements IMyEnumerator(Of DataColor).MyEnumeratorObject
Get
Return Colors(Index)
End Get
End Property
Friend ReadOnly Property Count As Integer Implements IMyEnumerator(Of DataColor).MyEnumeratorCount
Get
Return Colors.Count
End Get
End Property
Friend Sub Update()
If Count > 0 Then
Using x As New XmlFile With {.AllowSameNames = True}
x.AddRange(Colors)
x.Name = "Colors"
x.Save(File, EDP.SendToLog)
End Using
Else
File.Delete()
End If
End Sub
Friend Function Add(ByVal Item As DataColor, Optional ByVal AutoUpdate As Boolean = True) As Integer
If IndexOf(Item) = -1 Then
Colors.Add(Item)
Colors.Sort()
If AutoUpdate Then Update()
Return IndexOf(Item)
Else
Return -1
End If
End Function
Friend Function IndexOf(ByVal Item As DataColor) As Integer
If Count > 0 Then Return Colors.IndexOf(Item) Else Return -1
End Function
Private Function GetEnumerator() As IEnumerator(Of DataColor) Implements IEnumerable(Of DataColor).GetEnumerator
Return New MyEnumerator(Of DataColor)(Me)
End Function
Private Function IEnumerable_GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
Return GetEnumerator()
End Function
End Class
End Namespace

File diff suppressed because it is too large Load Diff

View File

@@ -574,4 +574,10 @@ You can find more detailed information about the missing posts in the form that
AFuc5QFgn6ClHh5iOQVAKNixyucB8NY0vG9JOzzyhrdq5IRgAAAAAElFTkSuQmCC AFuc5QFgn6ClHh5iOQVAKNixyucB8NY0vG9JOzzyhrdq5IRgAAAAAElFTkSuQmCC
</value> </value>
</data> </data>
<metadata name="TP_HEADERS_DEF.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="TAB_HEADERS.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root> </root>

View File

@@ -15,6 +15,7 @@ Namespace Editors
Friend Class GlobalSettingsForm Friend Class GlobalSettingsForm
Private WithEvents MyDefs As DefaultFormOptions Private WithEvents MyDefs As DefaultFormOptions
Friend Property FeedParametersChanged As Boolean = False Friend Property FeedParametersChanged As Boolean = False
Friend Property HeadersChanged As Boolean = False
Friend Sub New() Friend Sub New()
InitializeComponent() InitializeComponent()
MyDefs = New DefaultFormOptions(Me, Settings.Design) MyDefs = New DefaultFormOptions(Me, Settings.Design)
@@ -52,6 +53,12 @@ Namespace Editors
TXT_YTDLP.Text = .YtdlpFile.File TXT_YTDLP.Text = .YtdlpFile.File
TXT_GALLERYDL.Text = .GalleryDLFile.File TXT_GALLERYDL.Text = .GalleryDLFile.File
TXT_CMD_ENCODING.Text = .CMDEncoding TXT_CMD_ENCODING.Text = .CMDEncoding
'Headers
TXT_H_DEF_UserAgent.Text = .HEADER_UserAgent
TXT_H_DEF_sec_ch_ua.Text = .HEADER_sec_ch_ua
TXT_H_DEF_sec_ch_ua_full_version_list.Text = .HEADER_sec_ch_ua_full_version_list
TXT_H_DEF_sec_ch_ua_platform.Text = .HEADER_sec_ch_ua_platform
TXT_H_DEF_sec_ch_ua_platform_version.Text = .HEADER_sec_ch_ua_platform_version
'Behavior 'Behavior
CH_EXIT_CONFIRM.Checked = .ExitConfirm CH_EXIT_CONFIRM.Checked = .ExitConfirm
CH_CLOSE_TO_TRAY.Checked = .CloseToTray CH_CLOSE_TO_TRAY.Checked = .CloseToTray
@@ -228,6 +235,14 @@ Namespace Editors
.YtdlpFile.File = TXT_YTDLP.Text .YtdlpFile.File = TXT_YTDLP.Text
.GalleryDLFile.File = TXT_GALLERYDL.Text .GalleryDLFile.File = TXT_GALLERYDL.Text
.CMDEncoding.Value = AConvert(Of Integer)(TXT_CMD_ENCODING.Text, SettingsCLS.DefaultCmdEncoding) .CMDEncoding.Value = AConvert(Of Integer)(TXT_CMD_ENCODING.Text, SettingsCLS.DefaultCmdEncoding)
'Headers
.HEADER_UserAgent.Value = TXT_H_DEF_UserAgent.Text
.HEADER_sec_ch_ua.Value = TXT_H_DEF_sec_ch_ua.Text
.HEADER_sec_ch_ua_full_version_list.Value = TXT_H_DEF_sec_ch_ua_full_version_list.Text
.HEADER_sec_ch_ua_platform.Value = TXT_H_DEF_sec_ch_ua_platform.Text
.HEADER_sec_ch_ua_platform_version.Value = TXT_H_DEF_sec_ch_ua_platform_version.Text
HeadersChanged = { .HEADER_UserAgent, .HEADER_sec_ch_ua, .HEADER_sec_ch_ua_full_version_list,
.HEADER_sec_ch_ua_platform, .HEADER_sec_ch_ua_platform_version}.Any(Function(hh) hh.ChangesDetected)
'Behavior 'Behavior
.ExitConfirm.Value = CH_EXIT_CONFIRM.Checked .ExitConfirm.Value = CH_EXIT_CONFIRM.Checked
.CloseToTray.Value = CH_CLOSE_TO_TRAY.Checked .CloseToTray.Value = CH_CLOSE_TO_TRAY.Checked

View File

@@ -323,6 +323,11 @@ CloseResume:
TrayIcon.Visible = .CloseToTray TrayIcon.Visible = .CloseToTray
LIST_PROFILES.ShowGroups = .UseGrouping LIST_PROFILES.ShowGroups = .UseGrouping
If f.FeedParametersChanged And Not MyFeed Is Nothing Then MyFeed.UpdateSettings() If f.FeedParametersChanged And Not MyFeed Is Nothing Then MyFeed.UpdateSettings()
If f.HeadersChanged Then
Settings.BeginUpdate()
Settings.Plugins.ForEach(Sub(p) p.Settings.UpdateInheritance())
Settings.EndUpdate()
End If
UpdateSilentButtons() UpdateSilentButtons()
UpdateImageColor() UpdateImageColor()
End If End If

View File

@@ -24,6 +24,15 @@ Namespace Plugin.Hosts
Protected Source As Object 'ReadOnly Protected Source As Object 'ReadOnly
Protected Member As MemberInfo Protected Member As MemberInfo
Private ReadOnly MemberRef As MemberInfo Private ReadOnly MemberRef As MemberInfo
Friend ReadOnly Property MemberRefObj As PropertyValue
Get
Try
If Not MemberRef Is Nothing AndAlso Not Source Is Nothing Then Return MemberRef.GetMemberValue(Source)
Catch ex As Exception
End Try
Return Nothing
End Get
End Property
Friend ReadOnly Options As PropertyOption Friend ReadOnly Options As PropertyOption
Friend Overridable ReadOnly Property Name As String Friend Overridable ReadOnly Property Name As String
Protected _Type As Type Protected _Type As Type
@@ -39,6 +48,7 @@ Namespace Plugin.Hosts
Friend ReadOnly Exists As Boolean = False Friend ReadOnly Exists As Boolean = False
#Region "XML" #Region "XML"
Private ReadOnly _XmlName As String Private ReadOnly _XmlName As String
Private ReadOnly _XmlNameChecked As String
#End Region #End Region
#Region "Control" #Region "Control"
Friend Property Control As Control Friend Property Control As Control
@@ -115,6 +125,12 @@ Namespace Plugin.Hosts
Else Else
Control = New TextBoxExtended Control = New TextBoxExtended
With DirectCast(Control, TextBoxExtended) With DirectCast(Control, TextBoxExtended)
If Not If(Options?.InheritanceName, String.Empty).IsEmptyString OrElse Not If(ExternalValue?.OnCheckboxCheckedChange, Nothing) Is Nothing Then
.CaptionMode = ICaptionControl.Modes.CheckBox
.ChangeControlsEnableOnCheckedChange = False
.Checked = Checked
AddHandler .ActionOnCheckedChange, AddressOf TextBoxCheckedChanged
End If
.CaptionText = Control_Caption .CaptionText = Control_Caption
.CaptionToolTipEnabled = Not Control_ToolTip.IsEmptyString .CaptionToolTipEnabled = Not Control_ToolTip.IsEmptyString
If LeftOffset > 0 Then If LeftOffset > 0 Then
@@ -123,6 +139,11 @@ Namespace Plugin.Hosts
Using l As New Label : .CaptionWidth = .CaptionText.MeasureTextDefault(l.Font).Width : End Using Using l As New Label : .CaptionWidth = .CaptionText.MeasureTextDefault(l.Font).Width : End Using
End If End If
If Not Control_ToolTip.IsEmptyString Then .CaptionToolTipText = Control_ToolTip : .CaptionToolTipEnabled = True If Not Control_ToolTip.IsEmptyString Then .CaptionToolTipText = Control_ToolTip : .CaptionToolTipEnabled = True
If .CaptionMode = ICaptionControl.Modes.CheckBox AndAlso Not If(Options?.InheritanceName, String.Empty).IsEmptyString Then
If Not .CaptionToolTipText.IsEmptyString Then .CaptionToolTipText &= vbCr
.CaptionToolTipText &= "If checked, the value will be inherited from the global settings default values."
.CaptionToolTipEnabled = True
End If
.Text = CStr(AConvert(Of String)(Value, String.Empty)) .Text = CStr(AConvert(Of String)(Value, String.Empty))
With .Buttons With .Buttons
.BeginInit() .BeginInit()
@@ -172,6 +193,39 @@ Namespace Plugin.Hosts
If Not t = .Text Then .Text = t : .Select(s, 0) If Not t = .Text Then .Text = t : .Select(s, 0)
End With End With
End Sub End Sub
Private _TextBoxCheckedChangedInternal As Boolean = False
Private Sub TextBoxCheckedChanged(ByVal Sender As Object, ByVal e As EventArgs, ByVal Checked As Boolean)
Try
If Not _TextBoxCheckedChangedInternal Then
Dim ee As New PropertyValueEventArgs With {.Checked = DirectCast(Sender, TextBoxExtended).Checked,
.ControlEnabled = DirectCast(Sender, TextBoxExtended).Enabled}
If ExternalValueExists Then
With DirectCast(Sender, TextBoxExtended)
If Not ExternalValue.OnCheckboxCheckedChange Is Nothing Then
ExternalValue.OnCheckboxCheckedChange.Invoke(ExternalValue, ee)
_TextBoxCheckedChangedInternal = True
.Checked = ee.Checked
_TextBoxCheckedChangedInternal = False
.Enabled(False) = .Enabled
End If
If Not If(Options?.InheritanceName, String.Empty).IsEmptyString Then
Dim setProp As Action(Of String) = Sub(newValue) If .Checked And Not newValue.IsEmptyString Then .Text = newValue
With Settings
Select Case Options.InheritanceName
Case SettingsCLS.HEADER_DEF_sec_ch_ua : setProp(.HEADER_sec_ch_ua)
Case SettingsCLS.HEADER_DEF_sec_ch_ua_full_version_list : setProp(.HEADER_sec_ch_ua_full_version_list)
Case SettingsCLS.HEADER_DEF_sec_ch_ua_platform : setProp(.HEADER_sec_ch_ua_platform)
Case SettingsCLS.HEADER_DEF_sec_ch_ua_platform_version : setProp(.HEADER_sec_ch_ua_platform_version)
Case SettingsCLS.HEADER_DEF_UserAgent : setProp(.HEADER_UserAgent)
End Select
End With
End If
End With
End If
End If
Catch ex As Exception
End Try
End Sub
Friend Sub UpdateValueByControl() Friend Sub UpdateValueByControl()
If Not Control Is Nothing AndAlso Not TypeOf Control Is Label Then If Not Control Is Nothing AndAlso Not TypeOf Control Is Label Then
If TypeOf Control Is CheckBox Then If TypeOf Control Is CheckBox Then
@@ -181,6 +235,7 @@ Namespace Plugin.Hosts
Else Else
UpdateProviderPropertyName() UpdateProviderPropertyName()
Value = AConvert(DirectCast(Control, TextBoxExtended).Text, AModes.Var, [Type],,,, ProviderValue) Value = AConvert(DirectCast(Control, TextBoxExtended).Text, AModes.Var, [Type],,,, ProviderValue)
Checked = DirectCast(Control, TextBoxExtended).Checked
End If End If
End If End If
End Sub End Sub
@@ -254,8 +309,18 @@ Namespace Plugin.Hosts
UpdateMember() UpdateMember()
Options = Member.GetCustomAttribute(Of PropertyOption)() Options = Member.GetCustomAttribute(Of PropertyOption)()
IsTaskCounter = Not Member.GetCustomAttribute(Of TaskCounter)() Is Nothing IsTaskCounter = Not Member.GetCustomAttribute(Of TaskCounter)() Is Nothing
_XmlName = If(Member.GetCustomAttribute(Of PXML)()?.ElementName, String.Empty) With Member.GetCustomAttribute(Of PXML)
If Not _XmlName.IsEmptyString Then XValue = CreateXMLValueInstance([Type], True) If Not .Self Is Nothing Then
_XmlName = .ElementName
If Not _XmlName.IsEmptyString Then
If Not If(Options?.InheritanceName, String.Empty).IsEmptyString OrElse
Not If(MemberRefObj?.OnCheckboxCheckedChange, Nothing) Is Nothing Then _XmlNameChecked = $"{_XmlName}_Checked"
If .OnlyForChecked Then _XmlName = String.Empty
If Not _XmlName.IsEmptyString Then XValue = CreateXMLValueInstance([Type], True)
If Not _XmlNameChecked.IsEmptyString Then XValueChecked = New XMLValue(Of Boolean)
End If
End If
End With
DependentNames.ListAddList(Member.GetCustomAttribute(Of DependentFields)?.Fields, LAP.NotContainsOnly) DependentNames.ListAddList(Member.GetCustomAttribute(Of DependentFields)?.Fields, LAP.NotContainsOnly)
Exists = Not If(Member.GetCustomAttribute(Of DoNotUse)()?.Value, False) Exists = Not If(Member.GetCustomAttribute(Of DoNotUse)()?.Value, False)
End If End If
@@ -266,6 +331,10 @@ Namespace Plugin.Hosts
XValue.SetEnvironment(_XmlName, _Value, Container, _Nodes, If(ProviderValue, FormatProvider)) XValue.SetEnvironment(_XmlName, _Value, Container, _Nodes, If(ProviderValue, FormatProvider))
Value(False) = XValue.Value Value(False) = XValue.Value
End If End If
If Not _XmlNameChecked.IsEmptyString And Not XValueChecked Is Nothing Then
XValueChecked.SetEnvironment(_XmlNameChecked, _Checked, Container, _Nodes)
Checked(False) = XValueChecked.Value
End If
End Sub End Sub
Friend Sub SetDependents(ByVal Props As List(Of PropertyValueHost)) Friend Sub SetDependents(ByVal Props As List(Of PropertyValueHost))
If DependentNames.Count > 0 And Props.Count > 0 Then If DependentNames.Count > 0 And Props.Count > 0 Then
@@ -277,10 +346,13 @@ Namespace Plugin.Hosts
Friend Sub UpdateMember() Friend Sub UpdateMember()
If Not ExternalValue Is Nothing Then If Not ExternalValue Is Nothing Then
Try : RemoveHandler ExternalValue.ValueChanged, AddressOf ExternalValueChanged : Catch : End Try Try : RemoveHandler ExternalValue.ValueChanged, AddressOf ExternalValueChanged : Catch : End Try
Try : RemoveHandler ExternalValue.CheckedChanged, AddressOf ExternalCheckedChanged : Catch : End Try
End If End If
_ExternalValue = DirectCast(DirectCast(MemberRef, PropertyInfo).GetValue(Source), PropertyValue) _ExternalValue = DirectCast(DirectCast(MemberRef, PropertyInfo).GetValue(Source), PropertyValue)
_Value = ExternalValue.Value _Value = ExternalValue.Value
_Checked = ExternalValue.Checked
AddHandler ExternalValue.ValueChanged, AddressOf ExternalValueChanged AddHandler ExternalValue.ValueChanged, AddressOf ExternalValueChanged
AddHandler ExternalValue.CheckedChanged, AddressOf ExternalCheckedChanged
End Sub End Sub
#End Region #End Region
#Region "Value" #Region "Value"
@@ -290,6 +362,33 @@ Namespace Plugin.Hosts
Return _ExternalValue Return _ExternalValue
End Get End Get
End Property End Property
Private ReadOnly Property ExternalValueExists As Boolean
Get
Return Not ExternalValue Is Nothing
End Get
End Property
Friend ReadOnly Property XValueChecked As XMLValue(Of Boolean)
Private ReadOnly Property CheckedExists As Boolean
Get
Return Not _XmlNameChecked.IsEmptyString
End Get
End Property
Private _Checked As Boolean = False
Friend Overloads Property Checked As Boolean
Get
Return _Checked
End Get
Set(ByVal _Checked As Boolean)
Checked(True) = _Checked
End Set
End Property
Private Overloads WriteOnly Property Checked(ByVal UpdateXML As Boolean) As Boolean
Set(ByVal _Checked As Boolean)
Me._Checked = _Checked
If Not ExternalValue Is Nothing And Not _ExternalInvoked Then ExternalValue.Checked = _Checked
If UpdateXML And Not XValueChecked Is Nothing Then XValueChecked.Value = _Checked
End Set
End Property
Friend ReadOnly Property XValue As IXMLValue Friend ReadOnly Property XValue As IXMLValue
Protected _Value As Object Protected _Value As Object
Friend Overloads Property Value As Object Implements IPropertyValue.Value Friend Overloads Property Value As Object Implements IPropertyValue.Value
@@ -317,6 +416,13 @@ Namespace Plugin.Hosts
_ExternalInvoked = False _ExternalInvoked = False
End If End If
End Sub End Sub
Private Sub ExternalCheckedChanged(ByVal NewValue As Object)
If Not _ExternalInvoked Then
_ExternalInvoked = True
Checked = NewValue
_ExternalInvoked = False
End If
End Sub
#End Region #End Region
#Region "IComparable Support" #Region "IComparable Support"
Private Function CompareTo(ByVal Other As PropertyValueHost) As Integer Implements IComparable(Of PropertyValueHost).CompareTo Private Function CompareTo(ByVal Other As PropertyValueHost) As Integer Implements IComparable(Of PropertyValueHost).CompareTo
@@ -337,6 +443,7 @@ Namespace Plugin.Hosts
UpdateMethod = Nothing UpdateMethod = Nothing
UpdateMethodArguments = Nothing UpdateMethodArguments = Nothing
XValue.DisposeIfReady XValue.DisposeIfReady
XValueChecked.DisposeIfReady
DisposeControl() DisposeControl()
DependentNames.Clear() DependentNames.Clear()
Dependents.Clear() Dependents.Clear()

View File

@@ -114,6 +114,33 @@ Namespace Plugin.Hosts
End Get End Get
End Property End Property
Friend ReadOnly Property PropList As List(Of PropertyValueHost) Friend ReadOnly Property PropList As List(Of PropertyValueHost)
Friend ReadOnly Property InheritanceValueExists As Boolean
Get
Return PropList.Count > 0 AndAlso PropList.Exists(Function(p) Not If(p.Options?.InheritanceName, String.Empty).IsEmptyString)
End Get
End Property
Friend Sub UpdateInheritance()
If InheritanceValueExists Then
Dim pp As PropertyValue = Nothing
Dim dataChanged As Boolean = False
Dim setProp As Action(Of String) = Sub(newValue) If pp.Checked And Not newValue.IsEmptyString Then pp.Value = newValue : dataChanged = True
For Each p As PropertyValueHost In PropList
pp = p.MemberRefObj
If Not pp Is Nothing And Not If(p.Options?.InheritanceName, String.Empty).IsEmptyString Then
With Settings
Select Case p.Options.InheritanceName
Case SettingsCLS.HEADER_DEF_sec_ch_ua : setProp(.HEADER_sec_ch_ua)
Case SettingsCLS.HEADER_DEF_sec_ch_ua_full_version_list : setProp(.HEADER_sec_ch_ua_full_version_list)
Case SettingsCLS.HEADER_DEF_sec_ch_ua_platform : setProp(.HEADER_sec_ch_ua_platform)
Case SettingsCLS.HEADER_DEF_sec_ch_ua_platform_version : setProp(.HEADER_sec_ch_ua_platform_version)
Case SettingsCLS.HEADER_DEF_UserAgent : setProp(.HEADER_UserAgent)
End Select
End With
End If
Next
If dataChanged Then Source.Update()
End If
End Sub
Friend ReadOnly Property Name As String Friend ReadOnly Property Name As String
Get Get
Return Source.Site Return Source.Site

View File

@@ -68,6 +68,9 @@ Namespace Plugin.Hosts
Return Hosts(0) Return Hosts(0)
End Get End Get
End Property End Property
Friend Sub UpdateInheritance()
If [Default].InheritanceValueExists Then Hosts.ForEach(Sub(h) h.UpdateInheritance())
End Sub
#End Region #End Region
#Region "Initializer" #Region "Initializer"
Friend Sub New(ByVal Plugin As Type, ByRef _XML As XmlFile, ByVal GlobalPath As SFile, Friend Sub New(ByVal Plugin As Type, ByRef _XML As XmlFile, ByVal GlobalPath As SFile,
@@ -401,9 +404,14 @@ Namespace Plugin.Hosts
#Region "BeginUpdate, EndUpdate" #Region "BeginUpdate, EndUpdate"
Friend Sub BeginUpdate() Friend Sub BeginUpdate()
Hosts.ForEach(Sub(h) h.Source.BeginUpdate()) Hosts.ForEach(Sub(h) h.Source.BeginUpdate())
HostsXml.ForEach(Sub(x) x.BeginUpdate())
End Sub End Sub
Friend Sub EndUpdate() Friend Sub EndUpdate()
Hosts.ForEach(Sub(h) h.Source.EndUpdate()) Hosts.ForEach(Sub(h) h.Source.EndUpdate())
If HostsXml.Count > 0 Then HostsXml.ForEach(Sub(ByVal x As XmlFile)
x.EndUpdate()
If x.ChangesDetected Then x.UpdateData(EDP.SendToLog)
End Sub)
End Sub End Sub
#End Region #End Region
#Region "CreateAbstract" #Region "CreateAbstract"

View File

@@ -346,6 +346,13 @@
<Compile Include="Editors\ColorPicker.vb"> <Compile Include="Editors\ColorPicker.vb">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="Editors\ColorPickerInternalForm.Designer.vb">
<DependentUpon>ColorPickerInternalForm.vb</DependentUpon>
</Compile>
<Compile Include="Editors\ColorPickerInternalForm.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Editors\DataColor.vb" />
<Compile Include="Editors\GlobalLocationsChooserForm.Designer.vb"> <Compile Include="Editors\GlobalLocationsChooserForm.Designer.vb">
<DependentUpon>GlobalLocationsChooserForm.vb</DependentUpon> <DependentUpon>GlobalLocationsChooserForm.vb</DependentUpon>
</Compile> </Compile>
@@ -567,6 +574,9 @@
<EmbeddedResource Include="Editors\ColorPicker.resx"> <EmbeddedResource Include="Editors\ColorPicker.resx">
<DependentUpon>ColorPicker.vb</DependentUpon> <DependentUpon>ColorPicker.vb</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Editors\ColorPickerInternalForm.resx">
<DependentUpon>ColorPickerInternalForm.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Editors\GlobalLocationsChooserForm.resx"> <EmbeddedResource Include="Editors\GlobalLocationsChooserForm.resx">
<DependentUpon>GlobalLocationsChooserForm.vb</DependentUpon> <DependentUpon>GlobalLocationsChooserForm.vb</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@@ -29,6 +29,13 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
Friend Const CollectionsFolderName As String = "Collections" Friend Const CollectionsFolderName As String = "Collections"
Private Const PermanentCacheSnapshotsPath As String = "_CacheSnapshots\" Private Const PermanentCacheSnapshotsPath As String = "_CacheSnapshots\"
Friend Const DefaultCmdEncoding As Integer = BatchExecutor.UnicodeEncoding Friend Const DefaultCmdEncoding As Integer = BatchExecutor.UnicodeEncoding
#Region "CONSTANTS"
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
Friend ReadOnly Design As XmlFile Friend ReadOnly Design As XmlFile
Private ReadOnly MyXML As XmlFile Private ReadOnly MyXML As XmlFile
#Region "Media environment" #Region "Media environment"
@@ -137,6 +144,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
Friend ReadOnly Property AutomationFile As XMLValue(Of String) Friend ReadOnly Property AutomationFile As XMLValue(Of String)
Friend ReadOnly Property Feeds As FeedSpecialCollection Friend ReadOnly Property Feeds As FeedSpecialCollection
Friend ReadOnly Property BlackList As List(Of UserBan) Friend ReadOnly Property BlackList As List(Of UserBan)
Friend ReadOnly Property Colors As Editors.DataColorCollection
Private ReadOnly BlackListFile As SFile = $"{SettingsFolderName}\BlackList.txt" Private ReadOnly BlackListFile As SFile = $"{SettingsFolderName}\BlackList.txt"
Private ReadOnly UsersSettingsFile As SFile = $"{SettingsFolderName}\Users.xml" Private ReadOnly UsersSettingsFile As SFile = $"{SettingsFolderName}\Users.xml"
Friend Sub New() Friend Sub New()
@@ -156,6 +164,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
GlobalLocations = New STDownloader.DownloadLocationsCollection GlobalLocations = New STDownloader.DownloadLocationsCollection
GlobalLocations.Load(True,, $"{SettingsFolderName}\GlobalLocations.xml") GlobalLocations.Load(True,, $"{SettingsFolderName}\GlobalLocations.xml")
Feeds = New FeedSpecialCollection Feeds = New FeedSpecialCollection
Colors = New Editors.DataColorCollection
Dim n() As String = {"MediaEnvironment"} Dim n() As String = {"MediaEnvironment"}
@@ -184,6 +193,13 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
UserAgent = New XMLValue(Of String)("UserAgent",, MyXML) UserAgent = New XMLValue(Of String)("UserAgent",, MyXML)
If Not UserAgent.IsEmptyString Then DefaultUserAgent = UserAgent If Not UserAgent.IsEmptyString Then DefaultUserAgent = UserAgent
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)
HEADER_sec_ch_ua_platform = New XMLValue(Of String)("sec_ch_ua_platform",, MyXML, n)
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)
n = {"Search"} n = {"Search"}
SearchInName = New XMLValue(Of Boolean)("SearchInName", True, MyXML, n) SearchInName = New XMLValue(Of Boolean)("SearchInName", True, MyXML, n)
SearchInDescription = New XMLValue(Of Boolean)("SearchInDescription", False, MyXML, n) SearchInDescription = New XMLValue(Of Boolean)("SearchInDescription", False, MyXML, n)
@@ -766,6 +782,13 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
Friend ReadOnly Property AddMissingToLog As XMLValue(Of Boolean) Friend ReadOnly Property AddMissingToLog As XMLValue(Of Boolean)
Friend ReadOnly Property AddMissingErrorsToLog As XMLValue(Of Boolean) Friend ReadOnly Property AddMissingErrorsToLog As XMLValue(Of Boolean)
Friend ReadOnly Property UserAgent As XMLValue(Of String) Friend ReadOnly Property UserAgent As XMLValue(Of String)
#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)
Friend ReadOnly Property HEADER_sec_ch_ua_platform As XMLValue(Of String)
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" #Region "Search"
Friend ReadOnly Property SearchInName As XMLValue(Of Boolean) Friend ReadOnly Property SearchInName As XMLValue(Of Boolean)
Friend ReadOnly Property SearchInDescription As XMLValue(Of Boolean) Friend ReadOnly Property SearchInDescription As XMLValue(Of Boolean)