mirror of
https://github.com/AAndyProgram/SCrawler.git
synced 2026-03-15 08:12:17 +00:00
2022.8.22.0
Cleaned up the code Replace some old functions with new ones Adapted to the new library environment Enable/Disable display user/downloaded image Autodownloader option 'Show notification' not saved Separate thread for standalone video downloader Expanded the description of some errors with additional information Fixed date/time renaming issue Fixed internal library bugs Fixed minor bugs
This commit is contained in:
@@ -37,7 +37,7 @@ Namespace API.Base
|
||||
Using w As New WebClient
|
||||
Dim r$ = w.DownloadString($"https://downdetector.co.uk/status/{Site}/")
|
||||
If Not r.IsEmptyString Then
|
||||
l = FNF.RegexFields(Of Data)(r, {Params}, {1, 2})
|
||||
l = RegexFields(Of Data)(r, {Params}, {1, 2})
|
||||
If l.ListExists(2) Then
|
||||
l.Sort()
|
||||
l2 = New List(Of Data)
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
'
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports SCrawler.Plugin.Hosts
|
||||
Imports System.Threading
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Imports SCrawler.Plugin.Hosts
|
||||
Imports PDownload = SCrawler.Plugin.ISiteSettings.Download
|
||||
Namespace API.Base
|
||||
Friend NotInheritable Class ProfileSaved
|
||||
@@ -27,11 +27,8 @@ Namespace API.Base
|
||||
Using user As IUserData = HOST.GetInstance(PDownload.SavedPosts, Nothing, False, False)
|
||||
If Not user Is Nothing AndAlso (Not user.Name.IsEmptyString Or Not HOST.IsMyClass) Then
|
||||
u.Name = user.Name
|
||||
With DirectCast(user, UserDataBase).User
|
||||
u.IsChannel = .IsChannel
|
||||
u.UpdateUserFile()
|
||||
End With
|
||||
With DirectCast(user, UserDataBase)
|
||||
With .User : u.IsChannel = .IsChannel : u.UpdateUserFile() : End With
|
||||
.User = u
|
||||
.LoadUserInformation()
|
||||
.IsSavedPosts = True
|
||||
|
||||
@@ -25,7 +25,7 @@ Namespace API.Base
|
||||
Site = SiteName
|
||||
Responser = New Response($"{SettingsFolderName}\Responser_{Site}.xml")
|
||||
With Responser
|
||||
If .File.Exists Then .LoadSettings() Else .CookiesDomain = CookiesDomain : .SaveSettings()
|
||||
If .File.Exists Then .LoadSettings() Else .CookiesDomain = CookiesDomain : .Cookies = New CookieKeeper(.CookiesDomain) : .SaveSettings()
|
||||
End With
|
||||
End Sub
|
||||
#Region "XML"
|
||||
|
||||
@@ -83,11 +83,11 @@ Namespace API.Base
|
||||
Dim cb As Color = SystemColors.Control
|
||||
Dim cf As Color = SystemColors.ControlText
|
||||
If Not UserExists Then
|
||||
cb = ColorBttDeleteBack
|
||||
cf = ColorBttDeleteFore
|
||||
cb = MyColor.DeleteBack
|
||||
cf = MyColor.DeleteFore
|
||||
ElseIf UserSuspended Then
|
||||
cb = ColorBttEditBack
|
||||
cf = ColorBttEditFore
|
||||
cb = MyColor.EditBack
|
||||
cf = MyColor.EditFore
|
||||
End If
|
||||
For Each b As ToolStripMenuItem In {BTT_CONTEXT_DOWN, BTT_CONTEXT_EDIT, BTT_CONTEXT_DELETE, BTT_CONTEXT_OPEN_PATH, BTT_CONTEXT_OPEN_SITE}
|
||||
If Not b Is Nothing Then b.BackColor = cb : b.ForeColor = cf
|
||||
@@ -227,21 +227,21 @@ Namespace API.Base
|
||||
Return Nothing
|
||||
End If
|
||||
End Function
|
||||
Friend Function GetUserPictureAddress() As SFile
|
||||
Return GetPicture(Of SFile)(False)
|
||||
Friend Function GetUserPictureToastAddress() As SFile
|
||||
Return GetPicture(Of SFile)(False, True)
|
||||
End Function
|
||||
Friend Overridable Sub SetPicture(ByVal f As SFile) Implements IUserData.SetPicture
|
||||
Try
|
||||
If Not f.IsEmptyString AndAlso f.Exists Then
|
||||
If f.Exists Then
|
||||
Using p As New UserImage(f, User.File) : p.Save() : End Using
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
Protected Function GetNullPicture(ByVal MaxHeigh As XML.Base.XMLValue(Of Integer)) As Bitmap
|
||||
Return New Bitmap(CInt(DivideWithZeroChecking(MaxHeigh.Value, 100) * 75), MaxHeigh.Value)
|
||||
End Function
|
||||
Protected Function GetPicture(Of T)(Optional ByVal ReturnNullImageOnNothing As Boolean = True) As T
|
||||
Protected Function GetPicture(Of T)(Optional ByVal ReturnNullImageOnNothing As Boolean = True, Optional ByVal GetToast As Boolean = False) As T
|
||||
Dim rsfile As Boolean = GetType(T) Is GetType(SFile)
|
||||
Dim f As SFile = Nothing
|
||||
Dim p As UserImage = Nothing
|
||||
@@ -273,7 +273,7 @@ BlockPictureScan:
|
||||
New ErrorsDescriber(EDP.ReturnValue) With {
|
||||
.ReturnValue = New List(Of SFile),
|
||||
.ReturnValueExists = True}).FirstOrDefault
|
||||
If Not NewPicFile.IsEmptyString AndAlso NewPicFile.Exists Then
|
||||
If NewPicFile.Exists Then
|
||||
p = New UserImage(NewPicFile, MyFile)
|
||||
p.Save()
|
||||
GoTo BlockReturn
|
||||
@@ -288,8 +288,14 @@ BlockReturn:
|
||||
On Error GoTo BlockNullPicture
|
||||
If Not p Is Nothing Then
|
||||
Dim i As Image = Nothing
|
||||
Dim a As SFile = p.Address
|
||||
If Not rsfile Then
|
||||
Dim a As SFile = Nothing
|
||||
If rsfile Then
|
||||
If GetToast Then
|
||||
a = p.Large.Address
|
||||
Else
|
||||
a = p.Address
|
||||
End If
|
||||
Else
|
||||
Select Case Settings.ViewMode.Value
|
||||
Case View.LargeIcon : i = p.Large.OriginalImage.Clone
|
||||
Case View.SmallIcon : i = p.Small.OriginalImage.Clone
|
||||
@@ -301,8 +307,8 @@ BlockReturn:
|
||||
BlockNullPicture:
|
||||
If ReturnNullImageOnNothing Then
|
||||
Select Case Settings.ViewMode.Value
|
||||
Case View.LargeIcon : Return CObj(GetNullPicture(Settings.MaxLargeImageHeigh))
|
||||
Case View.SmallIcon : Return CObj(GetNullPicture(Settings.MaxSmallImageHeigh))
|
||||
Case View.LargeIcon : Return CObj(GetNullPicture(Settings.MaxLargeImageHeight))
|
||||
Case View.SmallIcon : Return CObj(GetNullPicture(Settings.MaxSmallImageHeight))
|
||||
End Select
|
||||
End If
|
||||
Return Nothing
|
||||
@@ -678,17 +684,8 @@ BlockNullPicture:
|
||||
x.LoadData()
|
||||
If x.Count > 0 Then
|
||||
Dim fs$ = MyFile.CutPath.PathWithSeparator
|
||||
Dim gfn As Func(Of String, String) = Function(ByVal Input As String) As String
|
||||
If Input.IsEmptyString Then
|
||||
Return String.Empty
|
||||
Else
|
||||
If Input.Contains("\") Then
|
||||
Return New SFile(Input).File
|
||||
Else
|
||||
Return Input
|
||||
End If
|
||||
End If
|
||||
End Function
|
||||
Dim gfn As Func(Of String, String) = Function(Input) If(Input.IsEmptyString, String.Empty,
|
||||
If(Input.Contains("\"), Input.CSFile.File, Input))
|
||||
For Each v As EContainer In x
|
||||
_ContentList.Add(New UserMedia With {
|
||||
.Type = AConvert(Of Integer)(v.Attribute(Name_MediaType).Value, 0),
|
||||
@@ -743,7 +740,7 @@ BlockNullPicture:
|
||||
If Not URL.IsEmptyString Then Process.Start(URL)
|
||||
Catch ex As Exception
|
||||
If Not e.Exists Then e = New ErrorsDescriber(EDP.ShowAllMsg)
|
||||
MsgBoxE({$"Error on trying to open [{Site}] page of user [{Name}]", $"User [{ToString()}]"}, MsgBoxStyle.Critical, e, ex)
|
||||
MsgBoxE({$"Error when trying to open [{Site}] page of user [{Name}]", $"User [{ToString()}]"}, MsgBoxStyle.Critical, e, ex)
|
||||
End Try
|
||||
End Sub
|
||||
Friend Overridable Sub OpenFolder() Implements IUserData.OpenFolder
|
||||
@@ -852,7 +849,7 @@ BlockNullPicture:
|
||||
MyFilePosts.Name &= "_Posts"
|
||||
MyFilePosts.Extension = "txt"
|
||||
Else
|
||||
Throw New ArgumentNullException("User.File", "User file does not detected")
|
||||
Throw New ArgumentNullException("User.File", "User file not detected")
|
||||
End If
|
||||
End Sub
|
||||
Protected MustOverride Sub DownloadDataF(ByVal Token As CancellationToken)
|
||||
@@ -962,8 +959,8 @@ BlockNullPicture:
|
||||
Protected Function ChangeFileNameByProvider(ByVal f As SFile, ByVal m As UserMedia) As SFile
|
||||
Dim ff As SFile = Nothing
|
||||
Try
|
||||
If Not f.IsEmptyString AndAlso f.Exists Then
|
||||
If Settings.FileReplaceNameByDate Or Settings.FileAddTimeToFileName Then
|
||||
If f.Exists Then
|
||||
If Not Settings.FileReplaceNameByDate.Value = FileNameReplaceMode.None Then
|
||||
ff = f
|
||||
ff.Name = String.Format(FileDateAppenderPattern, f.Name, CStr(AConvert(Of String)(If(m.Post.Date, Now), FileDateAppenderProvider, String.Empty)))
|
||||
ff = SFile.Indexed_IndexFile(ff,, New NumberedFile(ff))
|
||||
|
||||
@@ -79,7 +79,7 @@ Namespace API.Imgur
|
||||
End If
|
||||
Return Nothing
|
||||
Catch ex As Exception
|
||||
Return ErrorsDescriber.Execute(EDP.ShowMainMsg + EDP.SendInLog, ex, "Imgur standalone downloader: fetch media error")
|
||||
Return ErrorsDescriber.Execute(EDP.ShowMainMsg + EDP.SendInLog + EDP.ReturnValue, ex, "Imgur standalone downloader: fetch media error")
|
||||
End Try
|
||||
End Function
|
||||
Private Shared Function DownloadingException(ByVal ex As Exception, ByVal Message As String,
|
||||
|
||||
@@ -11,15 +11,6 @@ Namespace API.Instagram
|
||||
Friend Module Declarations
|
||||
Friend Const InstagramSite As String = "Instagram"
|
||||
Friend ReadOnly FilesPattern As RParams = RParams.DMS(".+?([^/\?]+?\.[\w\d]{3,4})(?=(\?|\Z))", 1, EDP.ReturnValue)
|
||||
Friend ReadOnly Property DateProvider As New JsonDate
|
||||
Friend Class JsonDate : Implements ICustomProvider
|
||||
Private 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 Implements ICustomProvider.Convert
|
||||
Return ADateTime.ParseUnicode(Value)
|
||||
End Function
|
||||
Private Function GetFormat(ByVal FormatType As Type) As Object Implements IFormatProvider.GetFormat
|
||||
Throw New NotImplementedException("GetFormat is not available in this context")
|
||||
End Function
|
||||
End Class
|
||||
Friend ReadOnly Property DateProvider As New CustomProvider(Function(v, d, p, n, e) ADateTime.ParseUnicode(v))
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -7,19 +7,18 @@
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Namespace API.Instagram
|
||||
Friend Class OptionsForm : Implements IOkCancelToolbar
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Friend Class OptionsForm
|
||||
Private WithEvents MyDefs As DefaultFormOptions
|
||||
Private ReadOnly Property MyExchangeOptions As EditorExchangeOptions
|
||||
Friend Sub New(ByRef ExchangeOptions As EditorExchangeOptions)
|
||||
InitializeComponent()
|
||||
MyExchangeOptions = ExchangeOptions
|
||||
MyDefs = New DefaultFormOptions
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
End Sub
|
||||
Private Sub OptionsForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design, True)
|
||||
.MyViewInitialize(True)
|
||||
.AddOkCancelToolbar()
|
||||
With MyExchangeOptions
|
||||
CH_GET_STORIES.Checked = .GetStories
|
||||
@@ -28,15 +27,12 @@ Namespace API.Instagram
|
||||
.EndLoaderOperations()
|
||||
End With
|
||||
End Sub
|
||||
Private Sub OK() Implements IOkCancelToolbar.OK
|
||||
Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick
|
||||
With MyExchangeOptions
|
||||
.GetStories = CH_GET_STORIES.Checked
|
||||
.GetTagged = CH_GET_TAGGED.Checked
|
||||
End With
|
||||
MyDefs.CloseForm()
|
||||
End Sub
|
||||
Private Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
MyDefs.CloseForm(DialogResult.Cancel)
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -10,7 +10,7 @@ Imports SCrawler.API.Base
|
||||
Imports SCrawler.Plugin
|
||||
Imports SCrawler.Plugin.Attributes
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Tools
|
||||
Imports PersonalUtilities.Tools.WEB
|
||||
Imports PersonalUtilities.Functions.XML
|
||||
Imports PersonalUtilities.Functions.XML.Base
|
||||
Imports PersonalUtilities.Functions.RegularExpressions
|
||||
@@ -55,7 +55,7 @@ Namespace API.Instagram
|
||||
Return Nothing
|
||||
End Function
|
||||
Private Function GetFormat(ByVal FormatType As Type) As Object Implements IFormatProvider.GetFormat
|
||||
Throw New NotImplementedException()
|
||||
Throw New NotImplementedException("[GetFormat] is not available in the context of [TimersChecker]")
|
||||
End Function
|
||||
End Class
|
||||
Private Class TaggedNotifyLimitChecker : Implements IFieldsCheckerProvider
|
||||
@@ -73,7 +73,7 @@ Namespace API.Instagram
|
||||
End If
|
||||
End Function
|
||||
Private Function GetFormat(ByVal FormatType As Type) As Object Implements IFormatProvider.GetFormat
|
||||
Throw New NotImplementedException()
|
||||
Throw New NotImplementedException("[GetFormat] is not available in the context of [TaggedNotifyLimitChecker]")
|
||||
End Function
|
||||
End Class
|
||||
#End Region
|
||||
@@ -186,13 +186,13 @@ Namespace API.Instagram
|
||||
End With
|
||||
End Sub
|
||||
#End Region
|
||||
Friend Overrides ReadOnly Property Responser As WEB.Response
|
||||
Friend Overrides ReadOnly Property Responser As Response
|
||||
Private Initialized As Boolean = False
|
||||
#End Region
|
||||
#Region "Initializer"
|
||||
Friend Sub New(ByRef _XML As XmlFile, ByVal GlobalPath As SFile)
|
||||
MyBase.New(InstagramSite)
|
||||
Responser = New WEB.Response($"{SettingsFolderName}\Responser_{Site}.xml")
|
||||
Responser = New Response($"{SettingsFolderName}\Responser_{Site}.xml")
|
||||
|
||||
Dim app_id$ = String.Empty
|
||||
Dim www_claim$ = String.Empty
|
||||
@@ -208,6 +208,7 @@ Namespace API.Instagram
|
||||
End With
|
||||
Else
|
||||
.CookiesDomain = "instagram.com"
|
||||
.Cookies = New CookieKeeper(.CookiesDomain)
|
||||
.SaveSettings()
|
||||
End If
|
||||
End With
|
||||
@@ -234,8 +235,7 @@ Namespace API.Instagram
|
||||
TaggedNotifyLimit = New PropertyValue(200)
|
||||
TaggedNotifyLimitProvider = New TaggedNotifyLimitChecker
|
||||
|
||||
DownloadingErrorDate = New XMLValue(Of Date) With {
|
||||
.Provider = New XMLValueConversionProvider(Function(ss, vv) AConvert(Of String)(vv, AModes.Var, Nothing))}
|
||||
DownloadingErrorDate = New XMLValue(Of Date) With {.Provider = New XMLValueConversionProvider(Function(ss, vv) AConvert(Of String)(vv, AModes.Var, Nothing))}
|
||||
DownloadingErrorDate.SetExtended("InstagramDownloadingErrorDate", Now.AddYears(-10), _XML, n)
|
||||
LastDownloadDate = New XMLValue(Of Date)("LastDownloadDate", Now.AddDays(-1), _XML, n)
|
||||
LastRequestsCount = New XMLValue(Of Integer)("LastRequestsCount", 0, _XML, n)
|
||||
@@ -288,7 +288,7 @@ Namespace API.Instagram
|
||||
Return True
|
||||
ElseIf v = -1 Then
|
||||
Return MsgBoxE({"You turn off notifications for tagged posts. This is highly undesirable. Do you still want to do it?",
|
||||
"Disabling tagged notification limits "}, MsgBoxStyle.YesNo) = MsgBoxResult.Yes
|
||||
"Disabling tagged notification limits"}, MsgBoxStyle.YesNo) = MsgBoxResult.Yes
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -104,11 +104,7 @@ Namespace API.Instagram
|
||||
End Try
|
||||
End Sub
|
||||
Private _InstaHash As String = String.Empty
|
||||
Friend Enum Sections
|
||||
Timeline
|
||||
Tagged
|
||||
Stories
|
||||
End Enum
|
||||
Private Enum Sections : Timeline : Tagged : Stories : End Enum
|
||||
Private Const StoriesFolder As String = "Stories"
|
||||
Private Const TaggedFolder As String = "Tagged"
|
||||
#Region "429 bypass"
|
||||
@@ -187,7 +183,7 @@ Namespace API.Instagram
|
||||
Dim m As New MMessage("You have not entered a valid posts limit", "Tagged posts download limit", {tryBtt, selectBtt, cancelBtt})
|
||||
Dim mh As New MMessage("", "Tagged posts download limit", {"Confirm", tryBtt, selectBtt, cancelBtt}) With {.ButtonsPerRow = 2}
|
||||
Do
|
||||
v = AConvert(Of Integer)(InputBoxE(aStr, "Tagged posts download limit", CInt(MySiteSettings.TaggedNotifyLimit.Value)), Nothing)
|
||||
v = AConvert(Of Integer)(InputBoxE(aStr, "Tagged posts download limit", CInt(MySiteSettings.TaggedNotifyLimit.Value)), AModes.Var, Nothing)
|
||||
If v.HasValue Then
|
||||
mh.Text = $"You have entered a limit of {v.Value.NumToString(p)} posts"
|
||||
Select Case MsgBoxE(mh).Index
|
||||
@@ -342,8 +338,7 @@ Namespace API.Instagram
|
||||
_TempPostsList.Add(PostID)
|
||||
ObtainMedia2(nn, PostID, SpecFolder)
|
||||
DownloadedTags += 1
|
||||
If DownloadTagsLimit.HasValue AndAlso DownloadedTags >= DownloadTagsLimit.Value Then _
|
||||
Throw New ExitException(_DownloadComplete)
|
||||
If DownloadTagsLimit.HasValue AndAlso DownloadedTags >= DownloadTagsLimit.Value Then Throw New ExitException(_DownloadComplete)
|
||||
Next
|
||||
If TaggedLimitsNotifications Then
|
||||
TaggedCount = j.Value("total_count").FromXML(Of Integer)(0)
|
||||
@@ -444,7 +439,6 @@ Namespace API.Instagram
|
||||
End Sub
|
||||
Protected Overrides Sub ReparseVideo(ByVal Token As CancellationToken)
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
#Region "Obtain Media"
|
||||
Private Sub ObtainMedia(ByVal node As EContainer, ByVal PostID As String, ByVal PostDate As String, ByVal SpecFolder As String)
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
Imports PersonalUtilities.Tools
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Imports PersonalUtilities.Functions.XML
|
||||
Imports System.Threading
|
||||
Imports SCrawler.API.Base
|
||||
Imports SCrawler.Plugin.Hosts
|
||||
Imports System.Threading
|
||||
Imports SCrawler.API.Reddit.RedditViewExchange
|
||||
Imports View = SCrawler.API.Reddit.IRedditView.View
|
||||
Imports Period = SCrawler.API.Reddit.IRedditView.Period
|
||||
@@ -112,7 +112,7 @@ Namespace API.Reddit
|
||||
ChannelExistentUserNames.ListAddList((From p As UserPost In PostsAll
|
||||
Where Not p.UserID.IsEmptyString AndAlso
|
||||
Settings.UsersList.Exists(Function(u) u.Site = Site And u.Name = p.UserID)
|
||||
Select p.UserID), LAP.NotContainsOnly)
|
||||
Select p.UserID), LNC)
|
||||
ChannelExistentUserNames.RemoveAll(Function(u) Not Settings.UsersList.Exists(Function(uu) uu.Site = Site And uu.Name = u))
|
||||
End If
|
||||
End Sub
|
||||
@@ -165,7 +165,7 @@ Namespace API.Reddit
|
||||
If Not ViewMode = View.New And AutoGetLimits Then
|
||||
Return _DownloadLimitPost
|
||||
Else
|
||||
Dim PID$ = ListAddList(Nothing, Posts, LAP.NotContainsOnly).ListAddList(PostsLatest, LAP.NotContainsOnly).ListSort.FirstOrDefault.ID
|
||||
Dim PID$ = ListAddList(Nothing, Posts, LNC).ListAddList(PostsLatest, LNC).ListSort.FirstOrDefault.ID
|
||||
If AutoGetLimits And Not PID.IsEmptyString Then
|
||||
Return PID
|
||||
Else
|
||||
@@ -233,11 +233,7 @@ Namespace API.Reddit
|
||||
Return New Channel(f)
|
||||
End Operator
|
||||
Public Overrides Function ToString() As String
|
||||
If Not Name.IsEmptyString Then
|
||||
Return Name
|
||||
Else
|
||||
Return ID
|
||||
End If
|
||||
Return If(Name.IsEmptyString, ID, Name)
|
||||
End Function
|
||||
Friend Sub Delete()
|
||||
File.Delete(, SFODelete.DeleteToRecycleBin)
|
||||
@@ -261,7 +257,7 @@ Namespace API.Reddit
|
||||
.DownloadData(Token)
|
||||
End With
|
||||
Dim b% = Posts.Count
|
||||
Posts.ListAddList(d.GetNewChannelPosts(), LAP.NotContainsOnly)
|
||||
Posts.ListAddList(d.GetNewChannelPosts(), LNC)
|
||||
If Posts.Count - b > 0 Then CountOfLoadedPostsPerSession.Add(Posts.Count - b)
|
||||
Posts.Sort()
|
||||
LatestParsedDate = If(Posts.FirstOrDefault(Function(pp) pp.Date.HasValue).Date, LatestParsedDate)
|
||||
@@ -364,8 +360,8 @@ Namespace API.Reddit
|
||||
UpdateUsersStats()
|
||||
If Not ViewMode = View.New Then
|
||||
Dim l As New List(Of String)
|
||||
If Posts.Count > 0 Or PostsLatest.Count > 0 Then l.ListAddList((From p In PostsAll Where Not p.ID.IsEmptyString Select p.ID), LAP.NotContainsOnly)
|
||||
l.ListAddList(PostsNames, LAP.NotContainsOnly)
|
||||
If Posts.Count > 0 Or PostsLatest.Count > 0 Then l.ListAddList((From p In PostsAll Where Not p.ID.IsEmptyString Select p.ID), LNC)
|
||||
l.ListAddList(PostsNames, LNC)
|
||||
If l.Count > 0 Then TextSaver.SaveTextToFile(l.ListToString("|"), FilePosts, True,, EDP.SendInLog)
|
||||
End If
|
||||
Using x As New XmlFile With {.AllowSameNames = True, .Name = "Channel"}
|
||||
|
||||
@@ -12,8 +12,16 @@ Imports SCrawler.API.Base
|
||||
Imports System.Threading
|
||||
Namespace API.Reddit
|
||||
Friend Class ChannelsCollection : Implements ICollection(Of Channel), IMyEnumerator(Of Channel), IChannelLimits, IDisposable
|
||||
Friend Shared ReadOnly Property ChannelsPath As SFile = $"{SettingsFolderName}\Channels\"
|
||||
Friend Shared ReadOnly Property ChannelsPathCache As SFile = $"{Settings.GlobalPath.Value.PathWithSeparator}_CachedData\"
|
||||
Friend Shared ReadOnly Property ChannelsPath As SFile
|
||||
Get
|
||||
Return $"{SettingsFolderName}\Channels\"
|
||||
End Get
|
||||
End Property
|
||||
Friend Shared ReadOnly Property ChannelsPathCache As SFile
|
||||
Get
|
||||
Return $"{Settings.GlobalPath.Value.PathWithSeparator}_CachedData\"
|
||||
End Get
|
||||
End Property
|
||||
Private ReadOnly Channels As List(Of Channel)
|
||||
Friend Structure ChannelImage : Implements IEquatable(Of ChannelImage)
|
||||
Friend File As SFile
|
||||
@@ -42,7 +50,7 @@ Namespace API.Reddit
|
||||
Return Nothing
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return ErrorsDescriber.Execute(EDP.SendInLog + EDP.ReturnValue, ex)
|
||||
Return ErrorsDescriber.Execute(EDP.SendInLog + EDP.ReturnValue, ex, "[API.Reddit.ChannelsCollection.GetUserFiles]")
|
||||
End Try
|
||||
End Function
|
||||
Friend Sub UpdateUsersStats()
|
||||
@@ -97,7 +105,7 @@ Namespace API.Reddit
|
||||
If Item(i).ID = ChannelID Then Return Item(i)
|
||||
Next
|
||||
End If
|
||||
Throw New ArgumentException($"Channel ID [{ChannelID}] does not found in channels collection", "ChannelID") With {.HelpLink = 1}
|
||||
Throw New ArgumentException($"Channel ID [{ChannelID}] not found in channel collection", "ChannelID") With {.HelpLink = 1}
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub DownloadData(ByVal Token As CancellationToken, Optional ByVal SkipExists As Boolean = True,
|
||||
|
||||
@@ -17,26 +17,8 @@ Namespace API.Reddit
|
||||
New NodeParams("children", True, True, True)}
|
||||
Friend ReadOnly UrlBasePattern As RParams = RParams.DM("(?<=/)([^/]+?\.[\w]{3,4})(?=(\?|\Z))", 0)
|
||||
Friend ReadOnly VideoRegEx As RParams = RParams.DM("http.{0,1}://[^" & Chr(34) & "]+?mp4", 0)
|
||||
Friend ReadOnly DateProvider As New JsonDate
|
||||
Friend ReadOnly DateProviderChannel As New JsonDateChannel
|
||||
Private ReadOnly EUR_PROVIDER As New ANumbers(ANumbers.Cultures.EUR)
|
||||
Friend Class JsonDate : Implements ICustomProvider
|
||||
Friend 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 Implements ICustomProvider.Convert
|
||||
Return ADateTime.ParseUnicodeJS(Value, NothingArg, e)
|
||||
End Function
|
||||
Private Function GetFormat(ByVal FormatType As Type) As Object Implements IFormatProvider.GetFormat
|
||||
Throw New NotImplementedException("GetFormat is not available in this context")
|
||||
End Function
|
||||
End Class
|
||||
Friend Class JsonDateChannel : Implements ICustomProvider
|
||||
Friend 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 Implements ICustomProvider.Convert
|
||||
Return ADateTime.ParseUnicode(AConvert(Of Integer)(Value, EUR_PROVIDER, Value), NothingArg, e)
|
||||
End Function
|
||||
Private Function GetFormat(ByVal FormatType As Type) As Object Implements IFormatProvider.GetFormat
|
||||
Throw New NotImplementedException("GetFormat is not available in this context")
|
||||
End Function
|
||||
End Class
|
||||
Friend ReadOnly DateProvider As New CustomProvider(Function(v, d, p, n, e) ADateTime.ParseUnicodeJS(v, n, e))
|
||||
Friend ReadOnly DateProviderChannel As New CustomProvider(Function(v, d, p, n, e) ADateTime.ParseUnicode(AConvert(Of Integer)(v, EUR_PROVIDER, v), n, e))
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -15,12 +15,10 @@ Namespace API.Reddit
|
||||
Friend Module M3U8_Declarations
|
||||
Friend ReadOnly BaseUrlPattern As RParams = RParams.DM("([htps:/]{7,8}.+?/.+?)(?=/)", 0, EDP.ReturnValue)
|
||||
''' <summary>Video</summary>
|
||||
Friend ReadOnly PlayListRegEx_1 As RParams = RParams.DM("(#EXT-X-STREAM-INF)(.+)(RESOLUTION=)(\d+)(.+?[\r\n]{1,2})(.+?)([\r\n]{1,2})", 0,
|
||||
RegexReturn.List, EDP.SendInLog, EDP.ReturnValue)
|
||||
Friend ReadOnly PlayListRegEx_1 As RParams = RParams.DM("(#EXT-X-STREAM-INF)(.+)(RESOLUTION=)(\d+)(.+?[\r\n]{1,2})(.+?)([\r\n]{1,2})", 0, RegexReturn.List)
|
||||
''' <summary>Audio, Video</summary>
|
||||
Friend ReadOnly PlayListRegEx_2 As RParams = RParams.DM("(?<=#EXT-X-BYTERANGE.+?[\r\n]{1,2})(.+)(?=[\r\n]{0,2})", 0,
|
||||
RegexReturn.List, EDP.SendInLog, EDP.ReturnValue)
|
||||
Friend ReadOnly PlayListAudioRegEx As RParams = RParams.DM("(HLS_AUDIO_(\d+)[^""]+)", 0, RegexReturn.List, EDP.SendInLog, EDP.ReturnValue)
|
||||
Friend ReadOnly PlayListRegEx_2 As RParams = RParams.DM("(?<=#EXT-X-BYTERANGE.+?[\r\n]{1,2})(.+)(?=[\r\n]{0,2})", 0, RegexReturn.List)
|
||||
Friend ReadOnly PlayListAudioRegEx As RParams = RParams.DM("(HLS_AUDIO_(\d+)[^""]+)", 0, RegexReturn.List)
|
||||
Friend ReadOnly DPED As New ErrorsDescriber(EDP.SendInLog + EDP.ReturnValue)
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -80,11 +78,11 @@ Namespace API.Reddit
|
||||
If Not r.IsEmptyString Then
|
||||
Dim l As New List(Of Resolution)
|
||||
If Type = Types.Video Then
|
||||
l = FNF.RegexFields(Of Resolution)(r, {PlayListRegEx_1}, {6, 4})
|
||||
l = RegexFields(Of Resolution)(r, {PlayListRegEx_1}, {6, 4})
|
||||
Else
|
||||
Try
|
||||
l = FNF.RegexFields(Of Resolution)(r, {PlayListAudioRegEx}, {1, 2})
|
||||
Catch anull As FNF.RegexFieldsTextBecameNullException
|
||||
l = RegexFields(Of Resolution)(r, {PlayListAudioRegEx}, {1, 2})
|
||||
Catch anull As RegexFieldsTextBecameNullException
|
||||
l.Clear()
|
||||
End Try
|
||||
End If
|
||||
|
||||
@@ -7,17 +7,16 @@
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Imports CView = SCrawler.API.Reddit.IRedditView.View
|
||||
Imports CPeriod = SCrawler.API.Reddit.IRedditView.Period
|
||||
Namespace API.Reddit
|
||||
Friend Class RedditViewSettingsForm : Implements IOkCancelToolbar
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Friend Class RedditViewSettingsForm
|
||||
Private WithEvents MyDefs As DefaultFormOptions
|
||||
Private ReadOnly Property MyOptions As IRedditView
|
||||
Friend Sub New(ByRef opt As IRedditView)
|
||||
InitializeComponent()
|
||||
MyOptions = opt
|
||||
MyDefs = New DefaultFormOptions
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
End Sub
|
||||
Private Sub ChannelSettingsForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
@@ -29,7 +28,7 @@ Namespace API.Reddit
|
||||
End If
|
||||
If Not n.IsEmptyString Then Text = n
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design, True)
|
||||
.MyViewInitialize(True)
|
||||
.AddOkCancelToolbar()
|
||||
Select Case MyOptions.ViewMode
|
||||
Case CView.Hot : OPT_VIEW_MODE_HOT.Checked = True
|
||||
@@ -51,7 +50,7 @@ Namespace API.Reddit
|
||||
MyDefs.InvokeLoaderError(ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub OK() Implements IOkCancelToolbar.OK
|
||||
Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick
|
||||
With MyOptions
|
||||
Select Case True
|
||||
Case OPT_VIEW_MODE_HOT.Checked : .ViewMode = CView.Hot
|
||||
@@ -69,9 +68,6 @@ Namespace API.Reddit
|
||||
End With
|
||||
MyDefs.CloseForm()
|
||||
End Sub
|
||||
Private Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
MyDefs.CloseForm(DialogResult.Cancel)
|
||||
End Sub
|
||||
Private Sub OPT_VIEW_MODE_NEW_CheckedChanged(sender As Object, e As EventArgs) Handles OPT_VIEW_MODE_NEW.CheckedChanged
|
||||
ChangePeriodEnabled()
|
||||
End Sub
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
Imports SCrawler.API.Base
|
||||
Imports SCrawler.Plugin
|
||||
Imports SCrawler.Plugin.Attributes
|
||||
Imports PersonalUtilities.Tools
|
||||
Imports PersonalUtilities.Tools.WEB
|
||||
Imports PersonalUtilities.Functions.RegularExpressions
|
||||
Imports DownDetector = SCrawler.API.Base.DownDetector
|
||||
Imports Download = SCrawler.Plugin.ISiteSettings.Download
|
||||
@@ -30,16 +30,17 @@ Namespace API.Reddit
|
||||
Friend ReadOnly Property SavedPostsUserName As PropertyValue
|
||||
<PropertyOption(ControlText:="Use M3U8", ControlToolTip:="Use M3U8 or mp4 for Reddit videos"), PXML>
|
||||
Friend ReadOnly Property UseM3U8 As PropertyValue
|
||||
Friend Overrides ReadOnly Property Responser As WEB.Response
|
||||
Friend Overrides ReadOnly Property Responser As Response
|
||||
Friend Sub New()
|
||||
MyBase.New(RedditSite)
|
||||
Responser = New WEB.Response($"{SettingsFolderName}\Responser_{Site}.xml")
|
||||
Responser = New Response($"{SettingsFolderName}\Responser_{Site}.xml")
|
||||
|
||||
With Responser
|
||||
If .File.Exists Then
|
||||
.LoadSettings()
|
||||
Else
|
||||
.CookiesDomain = "reddit.com"
|
||||
.Cookies = New CookieKeeper(.CookiesDomain)
|
||||
.Decoders.Add(SymbolsConverter.Converters.Unicode)
|
||||
.SaveSettings()
|
||||
End If
|
||||
|
||||
@@ -58,7 +58,7 @@ Namespace API.Reddit
|
||||
Friend Property AutoGetLimits As Boolean = True Implements IChannelLimits.AutoGetLimits
|
||||
#End Region
|
||||
Friend Property ChannelInfo As Channel
|
||||
Private ReadOnly ChannelPostsNames As New List(Of String)
|
||||
Private ReadOnly ChannelPostsNames As List(Of String)
|
||||
Friend Property SkipExistsUsers As Boolean = True Implements IChannelData.SkipExistsUsers
|
||||
Private ReadOnly _ExistsUsersNames As List(Of String)
|
||||
Friend Property SaveToCache As Boolean = False Implements IChannelData.SaveToCache
|
||||
|
||||
@@ -9,15 +9,6 @@
|
||||
Namespace API.RedGifs
|
||||
Friend Module Declarations
|
||||
Friend Const RedGifsSite As String = "RedGifs"
|
||||
Friend ReadOnly DateProvider As New JsonDate
|
||||
Friend Class JsonDate : Implements ICustomProvider
|
||||
Friend 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 Implements ICustomProvider.Convert
|
||||
Return ADateTime.ParseUnicode(Value, NothingArg, e)
|
||||
End Function
|
||||
Private Function GetFormat(ByVal FormatType As Type) As Object Implements IFormatProvider.GetFormat
|
||||
Throw New NotImplementedException("GetFormat is not available in this context")
|
||||
End Function
|
||||
End Class
|
||||
Friend ReadOnly DateProvider As New CustomProvider(Function(v, d, p, n, e) ADateTime.ParseUnicode(v, n, e))
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -9,8 +9,8 @@
|
||||
Imports PersonalUtilities.Functions.XML
|
||||
Imports PersonalUtilities.Functions.RegularExpressions
|
||||
Imports PersonalUtilities.Tools.WebDocuments.JSON
|
||||
Imports System.Threading
|
||||
Imports System.Net
|
||||
Imports System.Threading
|
||||
Imports SCrawler.API.Base
|
||||
Imports UTypes = SCrawler.API.Base.UserMedia.Types
|
||||
Namespace API.RedGifs
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
Imports SCrawler.API.Base
|
||||
Imports SCrawler.Plugin
|
||||
Imports SCrawler.Plugin.Attributes
|
||||
Imports PersonalUtilities.Tools
|
||||
Imports PersonalUtilities.Tools.WEB
|
||||
Imports PersonalUtilities.Functions.RegularExpressions
|
||||
Namespace API.Twitter
|
||||
<Manifest("AndyProgram_Twitter"), SavedPosts, UseClassAsIs>
|
||||
@@ -33,10 +33,10 @@ Namespace API.Twitter
|
||||
Private ReadOnly Property Token As PropertyValue
|
||||
<PropertyOption(ControlText:="Saved posts user name", ControlToolTip:="Personal profile username", LeftOffset:=120), PXML>
|
||||
Friend ReadOnly Property SavedPostsUserName As PropertyValue
|
||||
Friend Overrides ReadOnly Property Responser As WEB.Response
|
||||
Friend Overrides ReadOnly Property Responser As Response
|
||||
Friend Sub New()
|
||||
MyBase.New(TwitterSite)
|
||||
Responser = New WEB.Response($"{SettingsFolderName}\Responser_{Site}.xml")
|
||||
Responser = New Response($"{SettingsFolderName}\Responser_{Site}.xml")
|
||||
|
||||
Dim a$ = String.Empty
|
||||
Dim t$ = String.Empty
|
||||
@@ -52,11 +52,10 @@ Namespace API.Twitter
|
||||
.ContentType = "application/json"
|
||||
.Accept = "*/*"
|
||||
.CookiesDomain = "twitter.com"
|
||||
.Cookies = New CookieKeeper(.CookiesDomain)
|
||||
.Decoders.Add(SymbolsConverter.Converters.Unicode)
|
||||
With .Headers
|
||||
.Add("sec-ch-ua", " Not;A Brand" & Chr(34) & ";v=" & Chr(34) & "99" & Chr(34) & ", " & Chr(34) &
|
||||
"Google Chrome" & Chr(34) & ";v=" & Chr(34) & "91" & Chr(34) & ", " & Chr(34) & "Chromium" &
|
||||
Chr(34) & ";v=" & Chr(34) & "91" & Chr(34))
|
||||
.Add("sec-ch-ua", " Not;A Brand"";v=""99"", ""Google Chrome"";v=""91"", ""Chromium"";v=""91""")
|
||||
.Add("sec-ch-ua-mobile", "?0")
|
||||
.Add("sec-fetch-dest", "empty")
|
||||
.Add("sec-fetch-mode", "cors")
|
||||
|
||||
@@ -63,7 +63,7 @@ Namespace API.Twitter
|
||||
Dim r$ = Responser.GetResponse(URL,, EDP.ThrowException)
|
||||
If Not r.IsEmptyString Then
|
||||
Using w As EContainer = JsonDocument.Parse(r)
|
||||
If Not w Is Nothing AndAlso w.Count > 0 Then
|
||||
If w.ListExists Then
|
||||
For Each nn In If(IsSavedPosts, w({"globalObjects", "tweets"}).XmlIfNothing, w)
|
||||
ThrowAny(Token)
|
||||
If nn.Count > 0 Then
|
||||
@@ -141,8 +141,7 @@ Namespace API.Twitter
|
||||
If URL.Contains("twitter") Then
|
||||
Dim PostID$ = RegexReplace(URL, RParams.DM("(?<=/)\d+", 0))
|
||||
If Not PostID.IsEmptyString Then
|
||||
Dim r$ = DirectCast(resp.Copy(), Response).
|
||||
GetResponse($"https://api.twitter.com/1.1/statuses/show.json?id={PostID}",, EDP.ReturnValue)
|
||||
Dim r$ = DirectCast(resp.Copy(), Response).GetResponse($"https://api.twitter.com/1.1/statuses/show.json?id={PostID}",, EDP.ReturnValue)
|
||||
If Not r.IsEmptyString Then
|
||||
Using j As EContainer = JsonDocument.Parse(r)
|
||||
If j.ListExists Then
|
||||
@@ -163,7 +162,7 @@ Namespace API.Twitter
|
||||
Const P4K As String = "4096x4096"
|
||||
Try
|
||||
Dim ww As EContainer = w("sizes")
|
||||
If Not ww Is Nothing AndAlso ww.Count > 0 Then
|
||||
If ww.ListExists Then
|
||||
Dim l As New List(Of Sizes)
|
||||
Dim Orig As Sizes? = New Sizes(w.Value({"original_info"}, "height").FromXML(Of Integer)(-1), P4K)
|
||||
If Orig.Value.Value = -1 Then Orig = Nothing
|
||||
@@ -177,7 +176,6 @@ Namespace API.Twitter
|
||||
Return P4K
|
||||
ElseIf l(0).Data.IsEmptyString Then
|
||||
Return P4K
|
||||
'If LargeContained Then Return "large" Else Return P4K
|
||||
Else
|
||||
Return l(0).Data
|
||||
End If
|
||||
@@ -222,8 +220,8 @@ Namespace API.Twitter
|
||||
Dim url$, ff$
|
||||
Dim f As SFile
|
||||
Dim m As UserMedia
|
||||
With w({"extended_entities", "media"}).XmlIfNothing
|
||||
If .Count > 0 Then
|
||||
With w({"extended_entities", "media"})
|
||||
If .ListExists Then
|
||||
For Each n As EContainer In .Self
|
||||
If n.Value("type") = "animated_gif" Then
|
||||
With n({"video_info", "variants"}).XmlIfNothing.ItemF({gifUrl}).XmlIfNothing
|
||||
@@ -251,7 +249,7 @@ Namespace API.Twitter
|
||||
End Function
|
||||
Private Shared Function GetVideoNodeURL(ByVal w As EContainer) As String
|
||||
Dim v As EContainer = w.GetNode(VideoNode)
|
||||
If Not v Is Nothing AndAlso v.Count > 0 Then
|
||||
If v.ListExists Then
|
||||
Dim l As New List(Of Sizes)
|
||||
Dim u$
|
||||
Dim nn As EContainer
|
||||
|
||||
@@ -79,7 +79,7 @@ Namespace API
|
||||
If Count > 0 Then
|
||||
Return Collections(0).GetPicture
|
||||
Else
|
||||
Return GetNullPicture(Settings.MaxLargeImageHeigh)
|
||||
Return GetNullPicture(Settings.MaxLargeImageHeight)
|
||||
End If
|
||||
End Function
|
||||
#End Region
|
||||
@@ -191,10 +191,10 @@ Namespace API
|
||||
Friend Overrides Property LastUpdated As Date?
|
||||
Get
|
||||
If Count > 0 Then
|
||||
With If((From c As IUserData In Collections
|
||||
Where DirectCast(c, UserDataBase).LastUpdated.HasValue
|
||||
Select DirectCast(c, UserDataBase).LastUpdated.Value).ToList, New List(Of Date))
|
||||
If .Count > 0 Then Return .Max
|
||||
With (From c As IUserData In Collections
|
||||
Where DirectCast(c, UserDataBase).LastUpdated.HasValue
|
||||
Select DirectCast(c, UserDataBase).LastUpdated.Value).ToList
|
||||
If .ListExists Then Return .Max
|
||||
End With
|
||||
End If
|
||||
Return Nothing
|
||||
@@ -328,7 +328,7 @@ Namespace API
|
||||
Friend Overrides Sub OpenFolder()
|
||||
Try
|
||||
If Count > 0 Then GlobalOpenPath(Collections(0).File.CutPath(2))
|
||||
Catch ex As Exception
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
#End Region
|
||||
@@ -406,7 +406,7 @@ Namespace API
|
||||
If Count > 1 AndAlso ScriptUse Then Collections.ForEach(Sub(c) c.ScriptUse = True)
|
||||
End Sub
|
||||
Friend Sub AddRange(ByVal _Items As IEnumerable(Of IUserData))
|
||||
If Not _Items Is Nothing AndAlso _Items.Count > 0 Then
|
||||
If _Items.ListExists Then
|
||||
For i% = 0 To _Items.Count - 1 : Add(_Items(i)) : Next
|
||||
End If
|
||||
End Sub
|
||||
@@ -441,7 +441,7 @@ Namespace API
|
||||
Collections.ListClearDispose
|
||||
End Sub
|
||||
Friend Function Contains(ByVal _Item As IUserData) As Boolean Implements ICollection(Of IUserData).Contains
|
||||
Return Collections.Contains(_Item)
|
||||
Return Count > 0 AndAlso Collections.Contains(_Item)
|
||||
End Function
|
||||
Private Sub CopyTo(ByVal _Array() As IUserData, ByVal _ArrayIndex As Integer) Implements ICollection(Of IUserData).CopyTo
|
||||
Throw New NotImplementedException("[CopyTo] method does not supported in collections context")
|
||||
|
||||
@@ -216,7 +216,7 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
RefillChannels(Settings.LatestSelectedChannel.Value)
|
||||
ChangeComboIndex(0)
|
||||
MyRange.LabelText = String.Empty
|
||||
CMB_CHANNELS_ActionOnCheckedChange(CMB_CHANNELS.Checked)
|
||||
CMB_CHANNELS_ActionOnCheckedChange(Nothing, Nothing, CMB_CHANNELS.Checked)
|
||||
With LIST_POSTS
|
||||
Dim s As Size = GetImageSize()
|
||||
.LargeImageList = New ImageList With {.ColorDepth = ColorDepth.Depth32Bit, .ImageSize = s}
|
||||
@@ -296,8 +296,8 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
Const mhw% = 256
|
||||
Dim s As Size = LIST_POSTS.Size
|
||||
With LIST_POSTS
|
||||
s.Width -= (.Margin.Left + .Margin.Right)
|
||||
s.Height -= (.Margin.Top + .Margin.Bottom)
|
||||
s.Width -= .Margin.Horizontal
|
||||
s.Height -= .Margin.Vertical
|
||||
s.Width = s.Width / ImagesInRow - .Padding.Left * ImagesInRow - .Padding.Right * ImagesInRow
|
||||
s.Height = s.Height / ImagesRows - .Padding.Top * ImagesRows - .Padding.Bottom * ImagesRows
|
||||
If s.Width = 0 Then s.Width = 50
|
||||
@@ -400,7 +400,7 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
CH_HIDE_EXISTS_USERS.Enabled = True
|
||||
CMB_CHANNELS.Enabled(True) = True
|
||||
BTT_SHOW_STATS.Enabled = True
|
||||
CMB_CHANNELS_ActionOnCheckedChange(CMB_CHANNELS.Checked)
|
||||
CMB_CHANNELS_ActionOnCheckedChange(Nothing, Nothing, CMB_CHANNELS.Checked)
|
||||
MyRange.Enabled = True
|
||||
MyRange.UpdateControls()
|
||||
End If
|
||||
@@ -549,7 +549,7 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
If d.HasValue Then
|
||||
LBL_LIMIT_TEXT.Text = $"to date {AConvert(Of String)(d, ADateTime.Formats.BaseDateTime, String.Empty)}"
|
||||
Else
|
||||
LBL_LIMIT_TEXT.Text = $"to post [{c.First(Function(p) Not p.ID.IsEmptyString).ID}]"
|
||||
LBL_LIMIT_TEXT.Text = $"to post [{c.FirstOrDefault(Function(p) Not p.ID.IsEmptyString).ID}]"
|
||||
End If
|
||||
Else
|
||||
OPT_LIMITS_COUNT.Checked = True
|
||||
@@ -571,7 +571,7 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
Dim c As Channel = GetCurrentChannel()
|
||||
If Not c Is Nothing Then MyRange.Source = c
|
||||
End Sub
|
||||
Private Sub CMB_CHANNELS_ActionOnButtonClick(ByVal Sender As ActionButton) Handles CMB_CHANNELS.ActionOnButtonClick
|
||||
Private Sub CMB_CHANNELS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles CMB_CHANNELS.ActionOnButtonClick
|
||||
Dim c As Channel
|
||||
Select Case Sender.DefaultButton
|
||||
Case ADB.Refresh : RefillChannels()
|
||||
@@ -579,12 +579,12 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
Case ADB.Delete
|
||||
Try
|
||||
c = GetCurrentChannel()
|
||||
If Not c Is Nothing AndAlso MsgBoxE($"Do you really want to delete channel [{c}]?", MsgBoxStyle.Exclamation + MsgBoxStyle.YesNo) = 0 Then
|
||||
If Not c Is Nothing AndAlso MsgBoxE($"Are you sure you want to delete the channel [{c}]?", vbExclamation + vbYesNo) = vbYes Then
|
||||
Settings.Channels.Remove(c)
|
||||
RefillChannels()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Error on trying to delete channel")
|
||||
Catch del_ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, del_ex, "An error occurred while trying to delete a channel")
|
||||
End Try
|
||||
Case ADB.Up : ChangeComboIndex(-1)
|
||||
Case ADB.Down : ChangeComboIndex(1)
|
||||
@@ -597,19 +597,19 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
If f.DialogResult = DialogResult.OK Then c.Save()
|
||||
End Using
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Error on trying to edit channel")
|
||||
Catch edit_ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, edit_ex, "An error occurred while trying to edit a channel")
|
||||
End Try
|
||||
Case ADB.Info
|
||||
Try
|
||||
c = GetCurrentChannel()
|
||||
If Not c Is Nothing Then MsgBoxE({c.GetChannelStats(True), "Channel statistics"})
|
||||
Catch info_ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, info_ex, "Error on trying to show channel info")
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, info_ex, "An error occurred while trying to display channel information")
|
||||
End Try
|
||||
End Select
|
||||
End Sub
|
||||
Private Sub CMB_CHANNELS_ActionOnCheckedChange(ByVal Mode As Boolean) Handles CMB_CHANNELS.ActionOnCheckedChange
|
||||
Private Sub CMB_CHANNELS_ActionOnCheckedChange(ByVal Sender As Object, ByVal e As EventArgs, ByVal Checked As Boolean) Handles CMB_CHANNELS.ActionOnCheckedChange
|
||||
Dim OneChannel As Boolean = Not CMB_CHANNELS.Checked
|
||||
CMB_CHANNELS.Enabled(False) = OneChannel
|
||||
If OneChannel Then
|
||||
@@ -683,7 +683,7 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
Try
|
||||
If Not p.UserID.IsEmptyString Then Process.Start($"https://www.reddit.com/user/{p.UserID}")
|
||||
Catch ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, $"Error on opening user by [https://www.reddit.com/user/{p.UserID}]")
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, $"Error opening user by [https://www.reddit.com/user/{p.UserID}]")
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub BTT_C_OPEN_POST_Click(sender As Object, e As EventArgs) Handles BTT_C_OPEN_POST.Click
|
||||
@@ -693,7 +693,7 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
URL = $"https://www.reddit.com/r/{CMB_CHANNELS.Value}/comments/{p.ID.Split("_").Last}"
|
||||
If Not p.ID.IsEmptyString Then Process.Start(URL)
|
||||
Catch ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, $"Error on opening post by [{URL}]")
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, $"Error opening post by [{URL}]")
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub BTT_C_OPEN_PICTURE_Click(sender As Object, e As EventArgs) Handles BTT_C_OPEN_PICTURE.Click
|
||||
@@ -734,14 +734,14 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
MsgBoxE("User does not selected", MsgBoxStyle.Exclamation)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Error on removing user from selected")
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Error removing user from selected")
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub BTT_C_ADD_TO_BLACKLIST_Click(sender As Object, e As EventArgs) Handles BTT_C_ADD_TO_BLACKLIST.Click
|
||||
Try
|
||||
Dim u$ = GetPostBySelected().UserID
|
||||
If Not u.IsEmptyString Then
|
||||
Dim result% = MsgBoxE(New MMessage($"Do you really want to add user [{u}] to the BlackList?",
|
||||
Dim result% = MsgBoxE(New MMessage($"Are you sure you want to add user [{u}] to the BlackList?",
|
||||
"Adding user to the BlackList",
|
||||
{"Add", "Add and update ranges",
|
||||
"Add with the reason", "Add with the reason and update ranges",
|
||||
@@ -771,7 +771,7 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
#End Region
|
||||
Private Sub OpenPostPicture()
|
||||
Dim f As SFile = GetPostBySelected().CachedFile
|
||||
If f.Exists Then f.Open() Else MsgBoxE($"Picture file [{f}] does not found", MsgBoxStyle.Critical)
|
||||
If f.Exists Then f.Open() Else MsgBoxE($"Picture file [{f}] not found", MsgBoxStyle.Critical)
|
||||
End Sub
|
||||
Private Function GetPostBySelected(Optional ByVal SpecificTag As String = Nothing) As UserPost
|
||||
Dim p As UserPost = Nothing
|
||||
@@ -798,7 +798,7 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
MyRange.Limit = ImagesInRow * ImagesRows
|
||||
MyRange.GoTo(0)
|
||||
End Sub
|
||||
Private Sub MyRange_IndexChanged(ByVal Sender As IRangeSwitcherProvider, ByVal Index As Integer) Handles MyRange.IndexChanged
|
||||
Private Sub MyRange_IndexChanged(ByVal Sender As Object, ByVal e As EventArgs) Handles MyRange.IndexChanged
|
||||
Try
|
||||
If MyDefs.Initializing Then Exit Sub
|
||||
AppendPendingUsers()
|
||||
@@ -828,8 +828,8 @@ Friend Class ChannelViewForm : Implements IChannelLimits
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub MyRange_RangesChanged(ByVal Sender As IRangeSwitcherProvider, ByVal Index As Integer) Handles MyRange.RangesChanged
|
||||
If Sender.Count > 0 Then MyRange_IndexChanged(Nothing, 0)
|
||||
Private Sub MyRange_RangesChanged(ByVal Sender As IRangeSwitcherProvider, ByVal e As EventArgs) Handles MyRange.RangesChanged
|
||||
If Sender.Count > 0 Then Sender.CurrentIndex = 0
|
||||
End Sub
|
||||
#End Region
|
||||
End Class
|
||||
@@ -6,36 +6,22 @@
|
||||
'
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports System.ComponentModel
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Controls.Base
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Friend Class ChannelsStatsForm : Implements IOkCancelDeleteToolbar
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Friend Class ChannelsStatsForm
|
||||
Private WithEvents MyDefs As DefaultFormOptions
|
||||
Friend Property DeletedChannels As Integer = 0
|
||||
Friend Sub New()
|
||||
InitializeComponent()
|
||||
MyDefs = New DefaultFormOptions
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
End Sub
|
||||
Private Sub ChannelsStatsForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design)
|
||||
.AddOkCancelToolbar()
|
||||
.MyOkCancel.EnableDelete = False
|
||||
If Settings.Channels.Count > 0 Then
|
||||
RefillList()
|
||||
Else
|
||||
MsgBoxE("Channels not found", vbExclamation)
|
||||
End If
|
||||
.EndLoaderOperations()
|
||||
End With
|
||||
Catch ex As Exception
|
||||
MyDefs.InvokeLoaderError(ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub ChannelsStatsForm_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
||||
MyDefs.Dispose()
|
||||
With MyDefs
|
||||
.MyViewInitialize()
|
||||
.AddOkCancelToolbar()
|
||||
If Settings.Channels.Count > 0 Then RefillList() Else MsgBoxE("Channels not found", vbExclamation)
|
||||
.EndLoaderOperations()
|
||||
End With
|
||||
End Sub
|
||||
Private Sub RefillList()
|
||||
CMB_CHANNELS.Items.Clear()
|
||||
@@ -45,13 +31,7 @@ Friend Class ChannelsStatsForm : Implements IOkCancelDeleteToolbar
|
||||
CMB_CHANNELS.EndUpdate()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub OK() Implements IOkCancelToolbar.OK
|
||||
MyDefs.CloseForm()
|
||||
End Sub
|
||||
Private Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
MyDefs.CloseForm(DialogResult.Cancel)
|
||||
End Sub
|
||||
Private Sub Delete() Implements IOkCancelDeleteToolbar.Delete
|
||||
Private Sub MyDefs_ButtonDeleteClickOC(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonDeleteClickOC
|
||||
Try
|
||||
Dim c As List(Of String) = CMB_CHANNELS.Items.CheckedItems.Select(Function(cc) CStr(cc.Value(1))).ListIfNothing
|
||||
If c.ListExists Then
|
||||
@@ -76,7 +56,7 @@ Friend Class ChannelsStatsForm : Implements IOkCancelDeleteToolbar
|
||||
Private Sub CMB_CHANNELS_ActionOnChangeDetected(ByVal c As Boolean) Handles CMB_CHANNELS.ActionOnChangeDetected
|
||||
If Not MyDefs.Initializing Then MyDefs.MyOkCancel.EnableDelete = CMB_CHANNELS.ListCheckedIndexes.Count > 0
|
||||
End Sub
|
||||
Private Sub CMB_CHANNELS_ActionOnButtonClearClick() Handles CMB_CHANNELS.ActionOnButtonClearClick
|
||||
CMB_CHANNELS.ListCheckedIndexes = Nothing
|
||||
Private Sub CMB_CHANNELS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles CMB_CHANNELS.ActionOnButtonClick
|
||||
If Sender.DefaultButton = ActionButton.DefaultButtons.Clear Then CMB_CHANNELS.ListCheckedIndexes = Nothing
|
||||
End Sub
|
||||
End Class
|
||||
@@ -44,7 +44,6 @@ Namespace DownloadObjects
|
||||
If .Controls.Count > 0 Then
|
||||
For Each c As Control In .Controls
|
||||
If Not c Is Nothing Then c.Dispose()
|
||||
|
||||
Next
|
||||
.Controls.Clear()
|
||||
End If
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
Imports System.Threading
|
||||
Imports PersonalUtilities.Functions.XML
|
||||
Imports PersonalUtilities.Functions.XML.Base
|
||||
Imports PersonalUtilities.Tools
|
||||
Imports PersonalUtilities.Tools.Notifications
|
||||
Imports SCrawler.DownloadObjects.Groups
|
||||
Imports SCrawler.API
|
||||
@@ -16,6 +17,11 @@ Imports SCrawler.API.Base
|
||||
Namespace DownloadObjects
|
||||
Friend Class AutoDownloader : Inherits GroupParameters : Implements IEContainerProvider
|
||||
Friend Event UserFind(ByVal Key As String, ByVal Activate As Boolean)
|
||||
Friend Shared ReadOnly Property CachePath As SFile
|
||||
Get
|
||||
Return "_Cache\"
|
||||
End Get
|
||||
End Property
|
||||
Friend Enum Modes As Integer
|
||||
None = 0
|
||||
[Default] = 1
|
||||
@@ -38,56 +44,78 @@ Namespace DownloadObjects
|
||||
Private ReadOnly Property KeySite As String
|
||||
Private ReadOnly Property KeyDismiss As String
|
||||
Private ReadOnly Property Images As Dictionary(Of String, SFile)
|
||||
Private ReadOnly Property AutoDownloaderSource As AutoDownloader
|
||||
Private Sub New()
|
||||
Images = New Dictionary(Of String, SFile)
|
||||
End Sub
|
||||
Friend Sub New(ByVal _Key As String)
|
||||
Private Sub New(ByVal _Key As String)
|
||||
Me.New
|
||||
Key = _Key
|
||||
KeyFolder = $"{Key}{KeyOpenFolder}"
|
||||
KeySite = $"{Key}{KeyOpenSite}"
|
||||
KeyDismiss = $"{Key}{KeyBttDismiss}"
|
||||
End Sub
|
||||
Friend Sub New(ByVal _Key As String, ByRef _User As IUserData)
|
||||
Friend Sub New(ByVal _Key As String, ByRef _User As IUserData, ByRef Source As AutoDownloader)
|
||||
Me.New(_Key)
|
||||
User = _User
|
||||
IUserDataKey = _User.Key
|
||||
AutoDownloaderSource = Source
|
||||
If _User.IncludedInCollection Then
|
||||
Dim cn$ = _User.CollectionName
|
||||
Dim i% = Settings.Users.FindIndex(Function(u) u.IsCollection And u.Name = cn)
|
||||
If i >= 0 Then IUserDataKey = Settings.Users(i).Key
|
||||
End If
|
||||
End Sub
|
||||
Public Shared Widening Operator CType(ByVal Key As String) As NotifiedUser
|
||||
Return New NotifiedUser(Key)
|
||||
End Operator
|
||||
Friend Sub ShowNotification()
|
||||
Try
|
||||
If Not User Is Nothing Then
|
||||
Dim Text$ = $"{User.Site} - {User.Name}{vbNewLine}" &
|
||||
$"Downloaded: {User.DownloadedPictures(False)} images, {User.DownloadedVideos(False)} videos"
|
||||
Dim Title$
|
||||
If Not User.CollectionName.IsEmptyString Then
|
||||
Title = User.CollectionName
|
||||
Else
|
||||
Title = User.ToString
|
||||
End If
|
||||
Using Notify As New Notification(Text, Title) With {.Key = Key}
|
||||
Dim uPic As SFile = DirectCast(User, UserDataBase).GetUserPictureAddress
|
||||
Dim uif As SFile = Nothing
|
||||
Dim uifKey$ = String.Empty
|
||||
If uPic.Exists Then Notify.Images = {New ToastImage(uPic)}
|
||||
If User.DownloadedPictures(False) > 0 Then
|
||||
uif = DirectCast(User, UserDataBase).GetLastImageAddress
|
||||
If uif.Exists Then
|
||||
Notify.Images = {New ToastImage(uif, IImage.Modes.Inline)}
|
||||
uifKey = $"{Key}_{Images.Keys.Count + 1}_{KeyBttPhoto}"
|
||||
If Not Images.ContainsKey(uifKey) Then Images.Add(uifKey, uif)
|
||||
If Not AutoDownloaderSource Is Nothing Then
|
||||
If AutoDownloaderSource.ShowNotifications Then
|
||||
If Not User Is Nothing Then
|
||||
Dim Text$ = $"{User.Site} - {User.Name}{vbNewLine}" &
|
||||
$"Downloaded: {User.DownloadedPictures(False)} images, {User.DownloadedVideos(False)} videos"
|
||||
Dim Title$
|
||||
If Not User.CollectionName.IsEmptyString Then
|
||||
Title = User.CollectionName
|
||||
Else
|
||||
Title = User.ToString
|
||||
End If
|
||||
Using Notify As New Notification(Text, Title) With {.Key = Key}
|
||||
Dim uPic As SFile = Nothing
|
||||
Dim uif As SFile = Nothing
|
||||
Dim uif_compressed As SFile = Nothing
|
||||
Dim uifKey$ = String.Empty
|
||||
If AutoDownloaderSource.ShowPictureUser Then uPic = DirectCast(User, UserDataBase).GetUserPictureToastAddress
|
||||
If AutoDownloaderSource.ShowPictureUser AndAlso uPic.Exists Then Notify.Images = {New ToastImage(uPic)}
|
||||
If AutoDownloaderSource.ShowPictureDownloaded And User.DownloadedPictures(False) > 0 Then
|
||||
uif = DirectCast(User, UserDataBase).GetLastImageAddress
|
||||
If uif.Exists Then
|
||||
uif_compressed = uif
|
||||
uif_compressed.Path = CachePath.Path
|
||||
uif_compressed.Name = $"360_{uif.Name}"
|
||||
Using imgR As New ImageRenderer(uif, EDP.SendInLog)
|
||||
Try : imgR.FitToWidth(360).Save(uif_compressed) : Catch : End Try
|
||||
End Using
|
||||
If uif_compressed.Exists Then uif = uif_compressed
|
||||
If uif.Exists Then
|
||||
Notify.Images = {New ToastImage(uif, IImage.Modes.Inline)}
|
||||
uifKey = $"{Key}_{Images.Keys.Count + 1}_{KeyBttPhoto}"
|
||||
If Not Images.ContainsKey(uifKey) Then Images.Add(uifKey, uif)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Notify.Buttons = {
|
||||
New ToastButton(KeyFolder, "Folder"),
|
||||
New ToastButton(KeySite, "Site")
|
||||
}
|
||||
If Not uifKey.IsEmptyString Then Notify.Buttons = {New ToastButton(uifKey, "Photo")}
|
||||
Notify.Buttons = {New ToastButton(KeyDismiss, "Dismiss")}
|
||||
Notify.Show()
|
||||
End Using
|
||||
End If
|
||||
Notify.Buttons = {
|
||||
New ToastButton(KeyFolder, "Folder"),
|
||||
New ToastButton(KeySite, "Site")
|
||||
}
|
||||
If Not uifKey.IsEmptyString Then Notify.Buttons = {New ToastButton(uifKey, "Photo")}
|
||||
Notify.Buttons = {New ToastButton(KeyDismiss, "Dismiss")}
|
||||
Notify.Show()
|
||||
End Using
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.SendInLog, ex, "[AutoDownloader.NotifiedUser.ShowNotification]")
|
||||
@@ -144,6 +172,8 @@ Namespace DownloadObjects
|
||||
Private Const Name_StartupDelay As String = "StartupDelay"
|
||||
Private Const Name_LastDownloadDate As String = "LastDownloadDate"
|
||||
Private Const Name_ShowNotifications As String = "Notify"
|
||||
Private Const Name_ShowPictureDown As String = "ShowDownloadedPicture"
|
||||
Private Const Name_ShowPictureUser As String = "ShowUserPicture"
|
||||
#End Region
|
||||
#Region "Declarations"
|
||||
Friend Property Source As Scheduler
|
||||
@@ -161,6 +191,8 @@ Namespace DownloadObjects
|
||||
Friend Property Timer As Integer = DefaultTimer
|
||||
Friend Property StartupDelay As Integer = 0
|
||||
Friend Property ShowNotifications As Boolean = True
|
||||
Friend Property ShowPictureDownloaded As Boolean = True
|
||||
Friend Property ShowPictureUser As Boolean = True
|
||||
#Region "Date"
|
||||
Private ReadOnly LastDownloadDateXML As Date? = Nothing
|
||||
Private _LastDownloadDate As Date = Now.AddYears(-1)
|
||||
@@ -190,6 +222,7 @@ Namespace DownloadObjects
|
||||
End If
|
||||
End Function
|
||||
#End Region
|
||||
#Region "Information"
|
||||
Friend ReadOnly Property Information As String
|
||||
Get
|
||||
Return $"Last download date: {GetLastDateString()} ({GetWorkingState()})"
|
||||
@@ -214,8 +247,7 @@ Namespace DownloadObjects
|
||||
Public Overrides Function ToString() As String
|
||||
Return $"{Name} ({GetWorkingState()}): last download date: {GetLastDateString()}; next run: {GetNextDateString()}"
|
||||
End Function
|
||||
Private File As SFile = $"Settings\AutoDownload.xml"
|
||||
Private AThread As Thread
|
||||
#End Region
|
||||
#End Region
|
||||
#Region "Initializer"
|
||||
Private ReadOnly Initialization As Boolean = True
|
||||
@@ -245,6 +277,8 @@ Namespace DownloadObjects
|
||||
StartupDelay = x.Value(Name_StartupDelay).FromXML(Of Integer)(0)
|
||||
If StartupDelay < 0 Then StartupDelay = 0
|
||||
ShowNotifications = x.Value(Name_ShowNotifications).FromXML(Of Boolean)(True)
|
||||
ShowPictureDownloaded = x.Value(Name_ShowPictureDown).FromXML(Of Boolean)(True)
|
||||
ShowPictureUser = x.Value(Name_ShowPictureUser).FromXML(Of Boolean)(True)
|
||||
LastDownloadDateXML = AConvert(Of Date)(x.Value(Name_LastDownloadDate), DateProvider, Nothing)
|
||||
If LastDownloadDateXML.HasValue Then
|
||||
LastDownloadDate = LastDownloadDateXML.Value
|
||||
@@ -285,12 +319,15 @@ Namespace DownloadObjects
|
||||
New EContainer(Name_Timer, Timer),
|
||||
New EContainer(Name_StartupDelay, StartupDelay),
|
||||
New EContainer(Name_ShowNotifications, ShowNotifications.BoolToInteger),
|
||||
New EContainer(Name_ShowPictureDown, ShowPictureDownloaded.BoolToInteger),
|
||||
New EContainer(Name_ShowPictureUser, ShowPictureUser.BoolToInteger),
|
||||
New EContainer(Name_LastDownloadDate, CStr(AConvert(Of String)(If(LastDownloadDateXML.HasValue Or _LastDownloadDateChanged,
|
||||
CObj(LastDownloadDate), Nothing), DateProvider, String.Empty)))
|
||||
}
|
||||
End Function
|
||||
#End Region
|
||||
#Region "Execution"
|
||||
Private AThread As Thread
|
||||
Friend ReadOnly Property Working As Boolean
|
||||
Get
|
||||
Return If(AThread?.IsAlive, False)
|
||||
@@ -406,7 +443,7 @@ Namespace DownloadObjects
|
||||
If i >= 0 Then
|
||||
UserKeys(i).ShowNotification()
|
||||
Else
|
||||
UserKeys.Add(New NotifiedUser(k, TDownloader.GetUserFromMainCollection(u)))
|
||||
UserKeys.Add(New NotifiedUser(k, TDownloader.GetUserFromMainCollection(u), Me))
|
||||
UserKeys.Last.ShowNotification()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -30,6 +30,7 @@ Namespace DownloadObjects
|
||||
Dim TP_MODE As System.Windows.Forms.TableLayoutPanel
|
||||
Dim ActionButton3 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Dim ActionButton4 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Dim TP_NOTIFY As System.Windows.Forms.TableLayoutPanel
|
||||
Dim TT_MAIN As System.Windows.Forms.ToolTip
|
||||
Me.DEF_GROUP = New SCrawler.DownloadObjects.Groups.GroupDefaults()
|
||||
Me.TXT_GROUPS = New PersonalUtilities.Forms.Controls.TextBoxExtended()
|
||||
@@ -38,12 +39,15 @@ Namespace DownloadObjects
|
||||
Me.OPT_SPEC = New System.Windows.Forms.RadioButton()
|
||||
Me.OPT_DISABLED = New System.Windows.Forms.RadioButton()
|
||||
Me.OPT_GROUP = New System.Windows.Forms.RadioButton()
|
||||
Me.CH_NOTIFY = New System.Windows.Forms.CheckBox()
|
||||
Me.TXT_TIMER = New PersonalUtilities.Forms.Controls.TextBoxExtended()
|
||||
Me.LBL_LAST_TIME_UP = New System.Windows.Forms.Label()
|
||||
Me.NUM_DELAY = New PersonalUtilities.Forms.Controls.TextBoxExtended()
|
||||
Me.CH_NOTIFY = New System.Windows.Forms.CheckBox()
|
||||
Me.CH_SHOW_PIC = New System.Windows.Forms.CheckBox()
|
||||
Me.CH_SHOW_PIC_USER = New System.Windows.Forms.CheckBox()
|
||||
CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
|
||||
TP_MODE = New System.Windows.Forms.TableLayoutPanel()
|
||||
TP_NOTIFY = New System.Windows.Forms.TableLayoutPanel()
|
||||
TT_MAIN = New System.Windows.Forms.ToolTip(Me.components)
|
||||
CONTAINER_MAIN.ContentPanel.SuspendLayout()
|
||||
CONTAINER_MAIN.SuspendLayout()
|
||||
@@ -52,6 +56,7 @@ Namespace DownloadObjects
|
||||
TP_MODE.SuspendLayout()
|
||||
CType(Me.TXT_TIMER, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.NUM_DELAY, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
TP_NOTIFY.SuspendLayout()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'CONTAINER_MAIN
|
||||
@@ -77,10 +82,10 @@ Namespace DownloadObjects
|
||||
Me.DEF_GROUP.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
|
||||
Me.DEF_GROUP.Controls.Add(Me.TXT_GROUPS, 0, 5)
|
||||
Me.DEF_GROUP.Controls.Add(TP_MODE, 0, 0)
|
||||
Me.DEF_GROUP.Controls.Add(Me.CH_NOTIFY, 0, 6)
|
||||
Me.DEF_GROUP.Controls.Add(Me.TXT_TIMER, 0, 7)
|
||||
Me.DEF_GROUP.Controls.Add(Me.LBL_LAST_TIME_UP, 0, 9)
|
||||
Me.DEF_GROUP.Controls.Add(Me.NUM_DELAY, 0, 8)
|
||||
Me.DEF_GROUP.Controls.Add(TP_NOTIFY, 0, 6)
|
||||
Me.DEF_GROUP.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.DEF_GROUP.Location = New System.Drawing.Point(0, 0)
|
||||
Me.DEF_GROUP.Name = "DEF_GROUP"
|
||||
@@ -96,6 +101,7 @@ Namespace DownloadObjects
|
||||
Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
|
||||
Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!))
|
||||
Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
|
||||
Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!))
|
||||
Me.DEF_GROUP.Size = New System.Drawing.Size(476, 301)
|
||||
Me.DEF_GROUP.TabIndex = 0
|
||||
'
|
||||
@@ -136,7 +142,7 @@ Namespace DownloadObjects
|
||||
TP_MODE.RowCount = 1
|
||||
TP_MODE.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
|
||||
TP_MODE.Size = New System.Drawing.Size(474, 25)
|
||||
TP_MODE.TabIndex = 1
|
||||
TP_MODE.TabIndex = 0
|
||||
'
|
||||
'OPT_ALL
|
||||
'
|
||||
@@ -203,17 +209,6 @@ Namespace DownloadObjects
|
||||
TT_MAIN.SetToolTip(Me.OPT_GROUP, "Download groups")
|
||||
Me.OPT_GROUP.UseVisualStyleBackColor = True
|
||||
'
|
||||
'CH_NOTIFY
|
||||
'
|
||||
Me.CH_NOTIFY.AutoSize = True
|
||||
Me.CH_NOTIFY.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.CH_NOTIFY.Location = New System.Drawing.Point(4, 169)
|
||||
Me.CH_NOTIFY.Name = "CH_NOTIFY"
|
||||
Me.CH_NOTIFY.Size = New System.Drawing.Size(468, 19)
|
||||
Me.CH_NOTIFY.TabIndex = 3
|
||||
Me.CH_NOTIFY.Text = "Show notifications"
|
||||
Me.CH_NOTIFY.UseVisualStyleBackColor = True
|
||||
'
|
||||
'TXT_TIMER
|
||||
'
|
||||
ActionButton3.BackgroundImage = CType(resources.GetObject("ActionButton3.BackgroundImage"), System.Drawing.Image)
|
||||
@@ -225,7 +220,7 @@ Namespace DownloadObjects
|
||||
Me.TXT_TIMER.Location = New System.Drawing.Point(4, 195)
|
||||
Me.TXT_TIMER.Name = "TXT_TIMER"
|
||||
Me.TXT_TIMER.Size = New System.Drawing.Size(468, 22)
|
||||
Me.TXT_TIMER.TabIndex = 4
|
||||
Me.TXT_TIMER.TabIndex = 2
|
||||
'
|
||||
'LBL_LAST_TIME_UP
|
||||
'
|
||||
@@ -235,7 +230,7 @@ Namespace DownloadObjects
|
||||
Me.LBL_LAST_TIME_UP.Location = New System.Drawing.Point(4, 250)
|
||||
Me.LBL_LAST_TIME_UP.Name = "LBL_LAST_TIME_UP"
|
||||
Me.LBL_LAST_TIME_UP.Size = New System.Drawing.Size(468, 25)
|
||||
Me.LBL_LAST_TIME_UP.TabIndex = 6
|
||||
Me.LBL_LAST_TIME_UP.TabIndex = 4
|
||||
Me.LBL_LAST_TIME_UP.Text = "Last download date: "
|
||||
Me.LBL_LAST_TIME_UP.TextAlign = System.Drawing.ContentAlignment.TopCenter
|
||||
'
|
||||
@@ -256,9 +251,64 @@ Namespace DownloadObjects
|
||||
Me.NUM_DELAY.NumberMaximum = New Decimal(New Integer() {1440, 0, 0, 0})
|
||||
Me.NUM_DELAY.NumberUpDownAlign = System.Windows.Forms.LeftRightAlignment.Left
|
||||
Me.NUM_DELAY.Size = New System.Drawing.Size(468, 22)
|
||||
Me.NUM_DELAY.TabIndex = 5
|
||||
Me.NUM_DELAY.TabIndex = 3
|
||||
Me.NUM_DELAY.Text = "0"
|
||||
'
|
||||
'TP_NOTIFY
|
||||
'
|
||||
TP_NOTIFY.ColumnCount = 3
|
||||
TP_NOTIFY.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333!))
|
||||
TP_NOTIFY.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333!))
|
||||
TP_NOTIFY.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333!))
|
||||
TP_NOTIFY.Controls.Add(Me.CH_NOTIFY, 0, 0)
|
||||
TP_NOTIFY.Controls.Add(Me.CH_SHOW_PIC, 1, 0)
|
||||
TP_NOTIFY.Controls.Add(Me.CH_SHOW_PIC_USER, 2, 0)
|
||||
TP_NOTIFY.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
TP_NOTIFY.Location = New System.Drawing.Point(1, 166)
|
||||
TP_NOTIFY.Margin = New System.Windows.Forms.Padding(0)
|
||||
TP_NOTIFY.Name = "TP_NOTIFY"
|
||||
TP_NOTIFY.RowCount = 1
|
||||
TP_NOTIFY.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
|
||||
TP_NOTIFY.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!))
|
||||
TP_NOTIFY.Size = New System.Drawing.Size(474, 25)
|
||||
TP_NOTIFY.TabIndex = 1
|
||||
'
|
||||
'CH_NOTIFY
|
||||
'
|
||||
Me.CH_NOTIFY.AutoSize = True
|
||||
Me.CH_NOTIFY.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.CH_NOTIFY.Location = New System.Drawing.Point(3, 3)
|
||||
Me.CH_NOTIFY.Name = "CH_NOTIFY"
|
||||
Me.CH_NOTIFY.Size = New System.Drawing.Size(152, 19)
|
||||
Me.CH_NOTIFY.TabIndex = 0
|
||||
Me.CH_NOTIFY.Text = "Show notifications"
|
||||
TT_MAIN.SetToolTip(Me.CH_NOTIFY, "Show notification when some data has been downloaded")
|
||||
Me.CH_NOTIFY.UseVisualStyleBackColor = True
|
||||
'
|
||||
'CH_SHOW_PIC
|
||||
'
|
||||
Me.CH_SHOW_PIC.AutoSize = True
|
||||
Me.CH_SHOW_PIC.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.CH_SHOW_PIC.Location = New System.Drawing.Point(161, 3)
|
||||
Me.CH_SHOW_PIC.Name = "CH_SHOW_PIC"
|
||||
Me.CH_SHOW_PIC.Size = New System.Drawing.Size(152, 19)
|
||||
Me.CH_SHOW_PIC.TabIndex = 1
|
||||
Me.CH_SHOW_PIC.Text = "Show download picture"
|
||||
TT_MAIN.SetToolTip(Me.CH_SHOW_PIC, "Show downloaded image in notification")
|
||||
Me.CH_SHOW_PIC.UseVisualStyleBackColor = True
|
||||
'
|
||||
'CH_SHOW_PIC_USER
|
||||
'
|
||||
Me.CH_SHOW_PIC_USER.AutoSize = True
|
||||
Me.CH_SHOW_PIC_USER.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.CH_SHOW_PIC_USER.Location = New System.Drawing.Point(319, 3)
|
||||
Me.CH_SHOW_PIC_USER.Name = "CH_SHOW_PIC_USER"
|
||||
Me.CH_SHOW_PIC_USER.Size = New System.Drawing.Size(152, 19)
|
||||
Me.CH_SHOW_PIC_USER.TabIndex = 2
|
||||
Me.CH_SHOW_PIC_USER.Text = "Show user picture"
|
||||
TT_MAIN.SetToolTip(Me.CH_SHOW_PIC_USER, "Show user image in notification")
|
||||
Me.CH_SHOW_PIC_USER.UseVisualStyleBackColor = True
|
||||
'
|
||||
'AutoDownloaderEditorForm
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
@@ -285,6 +335,8 @@ Namespace DownloadObjects
|
||||
TP_MODE.PerformLayout()
|
||||
CType(Me.TXT_TIMER, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.NUM_DELAY, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
TP_NOTIFY.ResumeLayout(False)
|
||||
TP_NOTIFY.PerformLayout()
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
@@ -299,5 +351,7 @@ Namespace DownloadObjects
|
||||
Private WithEvents OPT_GROUP As RadioButton
|
||||
Private WithEvents LBL_LAST_TIME_UP As Label
|
||||
Private WithEvents NUM_DELAY As PersonalUtilities.Forms.Controls.TextBoxExtended
|
||||
Private WithEvents CH_SHOW_PIC As CheckBox
|
||||
Private WithEvents CH_SHOW_PIC_USER As CheckBox
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -228,6 +228,9 @@
|
||||
VnR1MIwhwMTCyqEQ37qEmZVDFF0OE/9nAACtFF4Ey6OP+wAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="TP_NOTIFY.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAwAMDAQAAEABABoBgAAxgAAACAgEAABAAQA6AIAAC4HAAAYGBAAAQAEAOgBAAAWCgAAEBAQAAEA
|
||||
|
||||
@@ -8,17 +8,16 @@
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Controls.Base
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Imports DModes = SCrawler.DownloadObjects.AutoDownloader.Modes
|
||||
Namespace DownloadObjects
|
||||
Friend Class AutoDownloaderEditorForm : Implements IOkCancelToolbar
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Friend Class AutoDownloaderEditorForm
|
||||
Private WithEvents MyDefs As DefaultFormOptions
|
||||
Private ReadOnly MyGroups As List(Of String)
|
||||
Private ReadOnly Property Plan As AutoDownloader
|
||||
Friend Sub New(ByRef _Plan As AutoDownloader)
|
||||
InitializeComponent()
|
||||
Plan = _Plan
|
||||
MyDefs = New DefaultFormOptions
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
MyGroups.ListAddList(Plan.Groups, LAP.NotContainsOnly)
|
||||
End Sub
|
||||
Private Class AutomationTimerChecker : Implements IFieldsCheckerProvider
|
||||
@@ -39,7 +38,7 @@ Namespace DownloadObjects
|
||||
End Class
|
||||
Private Sub AutoDownloaderEditorForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design, True)
|
||||
.MyViewInitialize(True)
|
||||
.AddOkCancelToolbar()
|
||||
With Plan
|
||||
Select Case .Mode
|
||||
@@ -49,14 +48,16 @@ Namespace DownloadObjects
|
||||
Case DModes.Specified : OPT_SPEC.Checked = True
|
||||
Case DModes.Groups : OPT_GROUP.Checked = True
|
||||
End Select
|
||||
ChangeEnabled()
|
||||
DEF_GROUP.Set(Plan)
|
||||
If MyGroups.Count > 0 Then TXT_GROUPS.Text = MyGroups.ListToString
|
||||
If Settings.Groups.Count = 0 Then TXT_GROUPS.Clear() : TXT_GROUPS.Enabled = False
|
||||
CH_NOTIFY.Checked = .ShowNotifications
|
||||
CH_SHOW_PIC.Checked = .ShowPictureDownloaded
|
||||
CH_SHOW_PIC_USER.Checked = .ShowPictureUser
|
||||
TXT_TIMER.Text = .Timer
|
||||
NUM_DELAY.Value = .StartupDelay
|
||||
LBL_LAST_TIME_UP.Text = .Information
|
||||
ChangeEnabled()
|
||||
End With
|
||||
.MyFieldsChecker = New FieldsChecker
|
||||
With .MyFieldsCheckerE
|
||||
@@ -71,8 +72,8 @@ Namespace DownloadObjects
|
||||
Private Sub AutoDownloaderEditorForm_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
|
||||
MyGroups.Clear()
|
||||
End Sub
|
||||
Private Sub OK() Implements IOkCancelToolbar.OK
|
||||
If If(MyDefs.MyFieldsChecker?.AllParamsOK, True) Then
|
||||
Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick
|
||||
If MyDefs.MyFieldsChecker.AllParamsOK Then
|
||||
With Plan
|
||||
Select Case True
|
||||
Case OPT_DISABLED.Checked : .Mode = DModes.None
|
||||
@@ -84,6 +85,9 @@ Namespace DownloadObjects
|
||||
DEF_GROUP.Get(Plan)
|
||||
.Groups.Clear()
|
||||
.Groups.ListAddList(MyGroups)
|
||||
.ShowNotifications = CH_NOTIFY.Checked
|
||||
.ShowPictureDownloaded = CH_SHOW_PIC.Checked
|
||||
.ShowPictureUser = CH_SHOW_PIC_USER.Checked
|
||||
.Timer = AConvert(Of Integer)(TXT_TIMER.Text, AutoDownloader.DefaultTimer)
|
||||
.StartupDelay = NUM_DELAY.Value
|
||||
.Update()
|
||||
@@ -91,10 +95,7 @@ Namespace DownloadObjects
|
||||
MyDefs.CloseForm()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
MyDefs.CloseForm(DialogResult.Cancel)
|
||||
End Sub
|
||||
Private Sub TXT_GROUPS_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_GROUPS.ActionOnButtonClick
|
||||
Private Sub TXT_GROUPS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_GROUPS.ActionOnButtonClick
|
||||
Select Case Sender.DefaultButton
|
||||
Case ActionButton.DefaultButtons.Edit
|
||||
Using f As New LabelsForm(MyGroups, Settings.Groups.Select(Function(g) g.Name)) With {.Text = "Groups"}
|
||||
@@ -119,14 +120,19 @@ Namespace DownloadObjects
|
||||
Private Sub OPT_GROUP_CheckedChanged(sender As Object, e As EventArgs) Handles OPT_GROUP.CheckedChanged
|
||||
ChangeEnabled()
|
||||
End Sub
|
||||
Private Sub CH_NOTIFY_CheckedChanged(sender As Object, e As EventArgs) Handles CH_NOTIFY.CheckedChanged
|
||||
ChangeEnabled()
|
||||
End Sub
|
||||
Private Sub ChangeEnabled()
|
||||
DEF_GROUP.Enabled = OPT_SPEC.Checked
|
||||
TXT_GROUPS.Enabled = OPT_GROUP.Checked
|
||||
TXT_TIMER.Enabled = Not OPT_DISABLED.Checked
|
||||
NUM_DELAY.Enabled = Not OPT_DISABLED.Checked
|
||||
CH_NOTIFY.Enabled = Not OPT_DISABLED.Checked
|
||||
CH_SHOW_PIC.Enabled = CH_NOTIFY.Checked And Not OPT_DISABLED.Checked
|
||||
CH_SHOW_PIC_USER.Enabled = CH_NOTIFY.Checked And Not OPT_DISABLED.Checked
|
||||
End Sub
|
||||
Private Sub NUM_DELAY_ActionOnButtonClick(ByVal Sender As ActionButton) Handles NUM_DELAY.ActionOnButtonClick
|
||||
Private Sub NUM_DELAY_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles NUM_DELAY.ActionOnButtonClick
|
||||
If Sender.DefaultButton = ActionButton.DefaultButtons.Clear Then NUM_DELAY.Value = 0
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -55,7 +55,7 @@ Namespace DownloadObjects
|
||||
End If
|
||||
BTT_CLEAR.Visible = ViewMode = ViewModes.Session
|
||||
RefillList()
|
||||
Catch ex As Exception
|
||||
Catch
|
||||
Finally
|
||||
Opened = True
|
||||
End Try
|
||||
@@ -96,7 +96,7 @@ Namespace DownloadObjects
|
||||
_TempUsersList.ListAddList(Downloader.Downloaded, LParams)
|
||||
Else
|
||||
_TempUsersList.ListAddList(Settings.Users.SelectMany(Of IUserData) _
|
||||
(Function(u) If(u.IsCollection, DirectCast(u, API.UserDataBind).Collections, {u})), LParams)
|
||||
(Function(u) If(u.IsCollection, DirectCast(u, API.UserDataBind).Collections, {u})), LParams)
|
||||
End If
|
||||
If _TempUsersList.Count > 0 Then
|
||||
_TempUsersList.Sort(New UsersDateOrder)
|
||||
@@ -163,7 +163,7 @@ Namespace DownloadObjects
|
||||
Try
|
||||
If _LatestSelected.ValueBetween(0, _TempUsersList.Count - 1) AndAlso
|
||||
Not DirectCast(_TempUsersList(_LatestSelected), UserDataBase).Disposed Then _TempUsersList(_LatestSelected).OpenFolder()
|
||||
Catch ex As Exception
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
Friend Sub Downloader_OnDownloadCountChange()
|
||||
|
||||
@@ -87,7 +87,7 @@ Namespace DownloadObjects.Groups
|
||||
If Not e.Value.IsEmptyString Then Labels.ListAddList(e.Value.Split("|"), LAP.NotContainsOnly)
|
||||
End Sub
|
||||
Public Overrides Function ToString() As String
|
||||
Return $"{IIf(Index >= 0 And Index <= 8, $"#{Index + 1}: ", String.Empty)}{Name}"
|
||||
Return $"{IIf(Index.ValueBetween(0, 8), $"#{Index + 1}: ", String.Empty)}{Name}"
|
||||
End Function
|
||||
Private _ControlSent As Boolean = False
|
||||
Friend Function GetControl() As ToolStripMenuItem
|
||||
|
||||
@@ -44,10 +44,7 @@ Namespace DownloadObjects.Groups
|
||||
End Property
|
||||
Friend Sub Update()
|
||||
If Count > 0 Then
|
||||
Using x As New XmlFile With {.Name = "Groups", .AllowSameNames = True}
|
||||
x.AddRange(GroupsList)
|
||||
x.Save(GroupFile)
|
||||
End Using
|
||||
Using x As New XmlFile With {.Name = "Groups", .AllowSameNames = True} : x.AddRange(GroupsList) : x.Save(GroupFile) : End Using
|
||||
Else
|
||||
GroupFile.Delete()
|
||||
End If
|
||||
|
||||
@@ -100,7 +100,7 @@ Namespace DownloadObjects.Groups
|
||||
Controls.Add(TP_2, 0, 3)
|
||||
Controls.Add(TXT_LABELS, 0, 4)
|
||||
End Sub
|
||||
Private Sub TXT_LABELS_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_LABELS.ActionOnButtonClick
|
||||
Private Sub TXT_LABELS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_LABELS.ActionOnButtonClick
|
||||
Select Case Sender.DefaultButton
|
||||
Case ADB.Edit
|
||||
Using f As New LabelsForm(Labels)
|
||||
|
||||
@@ -7,15 +7,14 @@
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Namespace DownloadObjects.Groups
|
||||
Friend Class GroupEditorForm : Implements IOkCancelToolbar
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Friend Class GroupEditorForm
|
||||
Private WithEvents MyDefs As DefaultFormOptions
|
||||
Friend Property MyGroup As DownloadGroup
|
||||
Friend Sub New(ByRef g As DownloadGroup)
|
||||
InitializeComponent()
|
||||
MyGroup = g
|
||||
MyDefs = New DefaultFormOptions
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
End Sub
|
||||
Friend Class NameChecker : Implements IFieldsCheckerProvider
|
||||
Private Property ErrorMessage As String Implements IFieldsCheckerProvider.ErrorMessage
|
||||
@@ -48,7 +47,7 @@ Namespace DownloadObjects.Groups
|
||||
End Class
|
||||
Private Sub GroupEditorForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design, True)
|
||||
.MyViewInitialize(True)
|
||||
.AddOkCancelToolbar()
|
||||
If Not MyGroup Is Nothing Then
|
||||
With MyGroup
|
||||
@@ -59,13 +58,13 @@ Namespace DownloadObjects.Groups
|
||||
Text = "New Group"
|
||||
End If
|
||||
.MyFieldsChecker = New FieldsChecker
|
||||
DirectCast(.MyFieldsChecker, FieldsChecker).AddControl(Of String)(DEFS_GROUP.TXT_NAME, DEFS_GROUP.TXT_NAME.CaptionText,,
|
||||
New NameChecker(If(MyGroup?.Name, String.Empty), Settings.Groups, "Group"))
|
||||
.MyFieldsCheckerE.AddControl(Of String)(DEFS_GROUP.TXT_NAME, DEFS_GROUP.TXT_NAME.CaptionText,,
|
||||
New NameChecker(If(MyGroup?.Name, String.Empty), Settings.Groups, "Group"))
|
||||
.MyFieldsChecker.EndLoaderOperations()
|
||||
.EndLoaderOperations()
|
||||
End With
|
||||
End Sub
|
||||
Private Sub OK() Implements IOkCancelToolbar.OK
|
||||
Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick
|
||||
If MyDefs.MyFieldsChecker.AllParamsOK Then
|
||||
If MyGroup Is Nothing Then MyGroup = New DownloadGroup
|
||||
With MyGroup
|
||||
@@ -75,8 +74,5 @@ Namespace DownloadObjects.Groups
|
||||
MyDefs.CloseForm()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
MyDefs.CloseForm(DialogResult.Cancel)
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
37
SCrawler/Download/SchedulerEditorForm.Designer.vb
generated
37
SCrawler/Download/SchedulerEditorForm.Designer.vb
generated
@@ -22,27 +22,28 @@ Namespace DownloadObjects
|
||||
Private components As System.ComponentModel.IContainer
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
Me.CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
|
||||
Dim CONTAINER_MAIN As System.Windows.Forms.ToolStripContainer
|
||||
Me.LIST_PLANS = New System.Windows.Forms.ListBox()
|
||||
Me.CONTAINER_MAIN.ContentPanel.SuspendLayout()
|
||||
Me.CONTAINER_MAIN.SuspendLayout()
|
||||
CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
|
||||
CONTAINER_MAIN.ContentPanel.SuspendLayout()
|
||||
CONTAINER_MAIN.SuspendLayout()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'CONTAINER_MAIN
|
||||
'
|
||||
Me.CONTAINER_MAIN.BottomToolStripPanelVisible = False
|
||||
CONTAINER_MAIN.BottomToolStripPanelVisible = False
|
||||
'
|
||||
'CONTAINER_MAIN.ContentPanel
|
||||
'
|
||||
Me.CONTAINER_MAIN.ContentPanel.Controls.Add(Me.LIST_PLANS)
|
||||
Me.CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(414, 316)
|
||||
Me.CONTAINER_MAIN.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.CONTAINER_MAIN.LeftToolStripPanelVisible = False
|
||||
Me.CONTAINER_MAIN.Location = New System.Drawing.Point(0, 0)
|
||||
Me.CONTAINER_MAIN.Name = "CONTAINER_MAIN"
|
||||
Me.CONTAINER_MAIN.RightToolStripPanelVisible = False
|
||||
Me.CONTAINER_MAIN.Size = New System.Drawing.Size(414, 341)
|
||||
Me.CONTAINER_MAIN.TabIndex = 0
|
||||
CONTAINER_MAIN.ContentPanel.Controls.Add(Me.LIST_PLANS)
|
||||
CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(414, 316)
|
||||
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(414, 341)
|
||||
CONTAINER_MAIN.TabIndex = 0
|
||||
'
|
||||
'LIST_PLANS
|
||||
'
|
||||
@@ -58,20 +59,18 @@ Namespace DownloadObjects
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(414, 341)
|
||||
Me.Controls.Add(Me.CONTAINER_MAIN)
|
||||
Me.Controls.Add(CONTAINER_MAIN)
|
||||
Me.KeyPreview = True
|
||||
Me.MinimumSize = New System.Drawing.Size(430, 380)
|
||||
Me.Name = "SchedulerEditorForm"
|
||||
Me.ShowIcon = False
|
||||
Me.Text = "Scheduler"
|
||||
Me.CONTAINER_MAIN.ContentPanel.ResumeLayout(False)
|
||||
Me.CONTAINER_MAIN.ResumeLayout(False)
|
||||
Me.CONTAINER_MAIN.PerformLayout()
|
||||
CONTAINER_MAIN.ContentPanel.ResumeLayout(False)
|
||||
CONTAINER_MAIN.ResumeLayout(False)
|
||||
CONTAINER_MAIN.PerformLayout()
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
||||
Private WithEvents CONTAINER_MAIN As ToolStripContainer
|
||||
Private WithEvents LIST_PLANS As ListBox
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -117,4 +117,7 @@
|
||||
<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>
|
||||
</root>
|
||||
@@ -9,42 +9,38 @@
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Namespace DownloadObjects
|
||||
Friend Class SchedulerEditorForm : Implements IEditToolbar
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Friend Class SchedulerEditorForm
|
||||
Private WithEvents MyDefs As DefaultFormOptions
|
||||
Private WithEvents BTT_SKIP As ToolStripButton
|
||||
Private WithEvents BTT_START As ToolStripButton
|
||||
Friend Sub New()
|
||||
InitializeComponent()
|
||||
MyDefs = New DefaultFormOptions
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
BTT_SKIP = New ToolStripButton With {
|
||||
.Text = "Skip",
|
||||
.ToolTipText = "Skip next run",
|
||||
.AutoToolTip = True,
|
||||
.DisplayStyle = ToolStripItemDisplayStyle.Text
|
||||
}
|
||||
BTT_START = New ToolStripButton With {
|
||||
.Text = "Start",
|
||||
.Image = My.Resources.StartPic_01_Green_16,
|
||||
.ToolTipText = "Run selected plan",
|
||||
.AutoToolTip = True
|
||||
}
|
||||
End Sub
|
||||
Private Sub SchedulerEditorForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design)
|
||||
.AddEditToolbar()
|
||||
BTT_SKIP = New ToolStripButton With {
|
||||
.Text = "Skip",
|
||||
.ToolTipText = "Skip next run",
|
||||
.AutoToolTip = True,
|
||||
.DisplayStyle = ToolStripItemDisplayStyle.Text
|
||||
}
|
||||
BTT_START = New ToolStripButton With {
|
||||
.Text = "Start",
|
||||
.Image = My.Resources.StartPic_01_Green_16,
|
||||
.ToolTipText = "Run selected plan",
|
||||
.AutoToolTip = True
|
||||
}
|
||||
.MyEditToolbar.ToolStrip.Items.AddRange({BTT_START, BTT_SKIP})
|
||||
.MyViewInitialize()
|
||||
.AddEditToolbarPlus({BTT_START, BTT_SKIP})
|
||||
Refill()
|
||||
.EndLoaderOperations(False)
|
||||
End With
|
||||
End Sub
|
||||
Private Sub SchedulerEditorForm_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
|
||||
BTT_SKIP.Dispose()
|
||||
End Sub
|
||||
Private Sub SchedulerEditorForm_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
|
||||
If e.KeyCode = Keys.Escape Then Close()
|
||||
End Sub
|
||||
Private Sub Refill() Implements IEditToolbar.Update
|
||||
Private Sub Refill() Handles MyDefs.ButtonUpdateClick
|
||||
Try
|
||||
LIST_PLANS.Items.Clear()
|
||||
If Settings.Automation.Count > 0 Then
|
||||
@@ -57,7 +53,7 @@ Namespace DownloadObjects
|
||||
ErrorsDescriber.Execute(EDP.SendInLog, ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub Add() Implements IEditToolbar.Add
|
||||
Private Sub MyDefs_ButtonAddClick(ByVal Sender As Object, ByVal e As EditToolbar.EditToolbarEventArgs) Handles MyDefs.ButtonAddClick
|
||||
Dim a As New AutoDownloader(True)
|
||||
Using f As New AutoDownloaderEditorForm(a)
|
||||
f.ShowDialog()
|
||||
@@ -69,7 +65,7 @@ Namespace DownloadObjects
|
||||
End If
|
||||
End Using
|
||||
End Sub
|
||||
Private Sub Edit() Implements IEditToolbar.Edit
|
||||
Private Sub Edit() Handles MyDefs.ButtonEditClick
|
||||
If _LatestSelected.ValueBetween(0, LIST_PLANS.Items.Count - 1) Then
|
||||
Using f As New AutoDownloaderEditorForm(Settings.Automation(_LatestSelected)) : f.ShowDialog() : End Using
|
||||
Refill()
|
||||
@@ -78,14 +74,16 @@ Namespace DownloadObjects
|
||||
End If
|
||||
End Sub
|
||||
Private _DeleteInProgress As Boolean = False
|
||||
Private Async Sub Delete() Implements IEditToolbar.Delete
|
||||
Private Async Sub MyDefs_ButtonDeleteClickE(ByVal Sender As Object, ByVal e As EditToolbar.EditToolbarEventArgs) Handles MyDefs.ButtonDeleteClickE
|
||||
If Not _DeleteInProgress Then
|
||||
If _LatestSelected.ValueBetween(0, LIST_PLANS.Items.Count - 1) Then
|
||||
_DeleteInProgress = True
|
||||
Dim n$ = Settings.Automation(_LatestSelected).Name
|
||||
Await Settings.Automation.RemoveAt(_LatestSelected)
|
||||
Refill()
|
||||
MsgBoxE($"Plan [{n}] deleted")
|
||||
If MsgBoxE({$"Are you sure you want to delete the [{n}] plan?", "Deleting a plan..."}, vbExclamation + vbYesNo) = vbYes Then
|
||||
Await Settings.Automation.RemoveAt(_LatestSelected)
|
||||
Refill()
|
||||
MsgBoxE($"Plan [{n}] deleted")
|
||||
End If
|
||||
_DeleteInProgress = False
|
||||
Else
|
||||
MsgBoxE("You have not selected a plan to delete.", vbExclamation)
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports System.Threading
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Imports EOptions = PersonalUtilities.Forms.Toolbars.IMyProgress.EnableOptions
|
||||
Imports PersonalUtilities.Tools
|
||||
Imports SCrawler.API
|
||||
Imports SCrawler.API.Base
|
||||
Imports SCrawler.Plugin.Hosts
|
||||
Imports Download = SCrawler.Plugin.ISiteSettings.Download
|
||||
Imports EOptions = PersonalUtilities.Forms.Toolbars.IMyProgress.EnableOptions
|
||||
Namespace DownloadObjects
|
||||
Friend Class TDownloader : Implements IDisposable
|
||||
#Region "Events"
|
||||
@@ -34,7 +34,7 @@ Namespace DownloadObjects
|
||||
End Property
|
||||
Friend ReadOnly Property Count As Integer
|
||||
Get
|
||||
If Pool.Count = 0 Then Return 0 Else Return Pool.Sum(Function(j) j.Count)
|
||||
Return If(Pool.Count = 0, 0, Pool.Sum(Function(j) j.Count))
|
||||
End Get
|
||||
End Property
|
||||
#End Region
|
||||
@@ -53,30 +53,11 @@ Namespace DownloadObjects
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "Jobs"
|
||||
Friend Class Job : Implements IDisposable
|
||||
Friend Event OnItemsCountChange(ByVal Sender As Job, ByVal Count As Integer)
|
||||
Friend Class Job : Inherits JobThread(Of IUserData)
|
||||
Private ReadOnly Hosts As List(Of SettingsHost)
|
||||
Private ReadOnly Keys As List(Of String)
|
||||
Private ReadOnly RemovingKeys As List(Of String)
|
||||
Private TokenSource As CancellationTokenSource
|
||||
Friend Token As CancellationToken
|
||||
Private [Thread] As Thread
|
||||
Private _Working As Boolean
|
||||
Friend ReadOnly Property Items As List(Of IUserData)
|
||||
Friend ReadOnly Property [Type] As Download
|
||||
Friend ReadOnly Property Count As Integer
|
||||
Get
|
||||
Return Items.Count
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub Clear()
|
||||
Items.Clear()
|
||||
End Sub
|
||||
Friend ReadOnly Property Working As Boolean
|
||||
Get
|
||||
Return _Working OrElse If(Thread?.IsAlive, False)
|
||||
End Get
|
||||
End Property
|
||||
Friend ReadOnly Property IsSeparated As Boolean
|
||||
Get
|
||||
Return Hosts.Count = 1 AndAlso Hosts(0).IsSeparatedTasks
|
||||
@@ -102,21 +83,19 @@ Namespace DownloadObjects
|
||||
Return Nothing
|
||||
End Get
|
||||
End Property
|
||||
Friend Property Progress As MyProgress
|
||||
Friend Sub New(ByVal JobType As Download)
|
||||
Hosts = New List(Of SettingsHost)
|
||||
RemovingKeys = New List(Of String)
|
||||
Keys = New List(Of String)
|
||||
Items = New List(Of IUserData)
|
||||
[Type] = JobType
|
||||
End Sub
|
||||
Friend Function Add(ByVal User As IUserData) As Boolean
|
||||
Public Overrides Function Add(ByVal User As IUserData) As Boolean
|
||||
With DirectCast(User, UserDataBase)
|
||||
If Keys.Count > 0 Then
|
||||
Dim i% = Keys.IndexOf(.User.Plugin)
|
||||
If i >= 0 Then
|
||||
Items.Add(User)
|
||||
RaiseEvent OnItemsCountChange(Me, Count)
|
||||
OnItemsCountChange(Me, Count)
|
||||
Return True
|
||||
Else
|
||||
If RemovingKeys.Count > 0 Then Return RemovingKeys.IndexOf(.User.Plugin) >= 0
|
||||
@@ -151,29 +130,13 @@ Namespace DownloadObjects
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
Friend Sub ThrowIfCancellationRequested()
|
||||
Token.ThrowIfCancellationRequested()
|
||||
End Sub
|
||||
Friend ReadOnly Property IsCancellationRequested As Boolean
|
||||
Get
|
||||
Return Token.IsCancellationRequested
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub [Start](ByVal [ThreadStart] As ThreadStart)
|
||||
Thread = New Thread(ThreadStart) With {.IsBackground = True}
|
||||
Thread.SetApartmentState(ApartmentState.MTA)
|
||||
Thread.Start()
|
||||
End Sub
|
||||
Friend Sub [Start]()
|
||||
Public Overrides Sub Start()
|
||||
If Hosts.Count > 0 Then Hosts.ForEach(Sub(h) h.DownloadStarted([Type]))
|
||||
TokenSource = New CancellationTokenSource
|
||||
Token = TokenSource.Token
|
||||
_Working = True
|
||||
End Sub
|
||||
Friend Sub [Stop]()
|
||||
If Not TokenSource Is Nothing Then TokenSource.Cancel()
|
||||
End Sub
|
||||
Friend Sub Stopped()
|
||||
Public Overrides Sub Stopped()
|
||||
_Working = False
|
||||
TokenSource = Nothing
|
||||
Try
|
||||
@@ -186,25 +149,13 @@ Namespace DownloadObjects
|
||||
If Hosts.Count > 0 Then Hosts.ForEach(Sub(h) h.DownloadDone([Type]))
|
||||
End Sub
|
||||
#Region "IDisposable Support"
|
||||
Private disposedValue As Boolean = False
|
||||
Protected Overridable Overloads Sub Dispose(ByVal disposing As Boolean)
|
||||
If Not disposedValue Then
|
||||
If disposing Then
|
||||
Hosts.Clear()
|
||||
Keys.Clear()
|
||||
RemovingKeys.Clear()
|
||||
Items.Clear()
|
||||
End If
|
||||
disposedValue = True
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
If Not disposedValue And disposing Then
|
||||
Hosts.Clear()
|
||||
Keys.Clear()
|
||||
RemovingKeys.Clear()
|
||||
End If
|
||||
End Sub
|
||||
Protected Overrides Sub Finalize()
|
||||
Dispose(False)
|
||||
MyBase.Finalize()
|
||||
End Sub
|
||||
Friend Overloads Sub Dispose() Implements IDisposable.Dispose
|
||||
Dispose(True)
|
||||
GC.SuppressFinalize(Me)
|
||||
MyBase.Dispose(disposing)
|
||||
End Sub
|
||||
#End Region
|
||||
End Class
|
||||
|
||||
15
SCrawler/Download/VideosDownloaderForm.Designer.vb
generated
15
SCrawler/Download/VideosDownloaderForm.Designer.vb
generated
@@ -16,11 +16,13 @@
|
||||
Private Sub InitializeComponent()
|
||||
Dim SEP_1 As System.Windows.Forms.ToolStripSeparator
|
||||
Dim SEP_2 As System.Windows.Forms.ToolStripSeparator
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(VideosDownloaderForm))
|
||||
Me.ToolbarTOP = New System.Windows.Forms.ToolStrip()
|
||||
Me.BTT_ADD = New System.Windows.Forms.ToolStripButton()
|
||||
Me.BTT_ADD_LIST = New System.Windows.Forms.ToolStripButton()
|
||||
Me.BTT_DELETE = New System.Windows.Forms.ToolStripButton()
|
||||
Me.BTT_DOWN = New System.Windows.Forms.ToolStripButton()
|
||||
Me.BTT_STOP = New System.Windows.Forms.ToolStripButton()
|
||||
Me.BTT_OPEN_PATH = New System.Windows.Forms.ToolStripButton()
|
||||
Me.ToolbarBOTTOM = New System.Windows.Forms.StatusStrip()
|
||||
Me.PR_V = New System.Windows.Forms.ToolStripProgressBar()
|
||||
@@ -45,7 +47,7 @@
|
||||
'ToolbarTOP
|
||||
'
|
||||
Me.ToolbarTOP.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
|
||||
Me.ToolbarTOP.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_ADD, Me.BTT_ADD_LIST, Me.BTT_DELETE, SEP_1, Me.BTT_DOWN, SEP_2, Me.BTT_OPEN_PATH})
|
||||
Me.ToolbarTOP.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_ADD, Me.BTT_ADD_LIST, Me.BTT_DELETE, SEP_1, Me.BTT_DOWN, Me.BTT_STOP, SEP_2, Me.BTT_OPEN_PATH})
|
||||
Me.ToolbarTOP.Location = New System.Drawing.Point(0, 0)
|
||||
Me.ToolbarTOP.Name = "ToolbarTOP"
|
||||
Me.ToolbarTOP.Size = New System.Drawing.Size(524, 25)
|
||||
@@ -87,6 +89,16 @@
|
||||
Me.BTT_DOWN.Size = New System.Drawing.Size(104, 22)
|
||||
Me.BTT_DOWN.Text = "Download (F5)"
|
||||
'
|
||||
'BTT_STOP
|
||||
'
|
||||
Me.BTT_STOP.AutoToolTip = False
|
||||
Me.BTT_STOP.Enabled = False
|
||||
Me.BTT_STOP.Image = CType(resources.GetObject("BTT_STOP.Image"), System.Drawing.Image)
|
||||
Me.BTT_STOP.ImageTransparentColor = System.Drawing.Color.Magenta
|
||||
Me.BTT_STOP.Name = "BTT_STOP"
|
||||
Me.BTT_STOP.Size = New System.Drawing.Size(51, 22)
|
||||
Me.BTT_STOP.Text = "Stop"
|
||||
'
|
||||
'BTT_OPEN_PATH
|
||||
'
|
||||
Me.BTT_OPEN_PATH.AutoToolTip = False
|
||||
@@ -156,5 +168,6 @@
|
||||
Private WithEvents LIST_VIDEOS As ListBox
|
||||
Private WithEvents BTT_DOWN As ToolStripButton
|
||||
Private WithEvents BTT_OPEN_PATH As ToolStripButton
|
||||
Private WithEvents BTT_STOP As ToolStripButton
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -126,6 +126,36 @@
|
||||
<metadata name="ToolbarTOP.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="BTT_STOP.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAVCSURBVEhLjZVtTFNXGMcLQmdHO6CdhGSlc4gDBAr2Qrmo
|
||||
GJygFFuBtoLKiJpRcUXFF5QoRmM00SgmS/Zh+7B92DKTmblEl2VzgEDmBBJgoBPDm4qlLX0vXOaWLNCz
|
||||
/ynFl1g2nuSX9p7zP//nyXPOPZdHo7+gIKItPv6L9tjYkSaZ7PMtUuk7GA7zT/5PDCuV7BOZ7M5obGzf
|
||||
jYQEPYYiQIh/ksYDo1HYXVBwfbi+noxduUIe1dX5mli2NVskWonp8DlV8BhkmHXWHTuecpcukenGRvKk
|
||||
rMz9aVJSjSwyMhrTc0laV6z4bOjIEfL47FkyduYMMUNsOn6c3GLZO3KR6H1IgiYZzcn5AOYm7vJlwmEt
|
||||
19BApk+fJsMajecHqfQTSMQgjNcukZip+eO6OvL05ElihmjiwgUyXl/va1Iqf0sTiRIhfCUJ2rLJWl5u
|
||||
ppVT82mYc8eOkWkU5q2sJG0xMQOQsUDEa4mLuzpSVUXGkMAEzCdOECsW2M+fJxa0q4VlO1OFwiSI/UmG
|
||||
FYpNE2Vl5qmLFwmHYqZRFId104cPk8l9+8htpdK5SyL5DtIiIOZply9/91Zm5p3RPXt84xBZwASqsWNP
|
||||
XGiZ4+hR0o4kq4XC5N8ZpsCi11unzp3zt4RDxRzay9XWkimYt2dluRMFgq9hbAByQDecF85IJElI0mna
|
||||
tYtYDxwgtv37if3QIeJEMg+M8Ozrysm5N1ZcbOZOnfJXzGGOg5arqZkzZxh3skBwFX5VICVgHgr8wV8t
|
||||
Fif/olB0mCoqfLbqauIALqORuGHgRTLvwYNkCtVOUWM8c3j2m6O9HSzrkQuF1JxWvgosBS+OaiD4SrF4
|
||||
VUt6eqd12zbi2L2buIDHYCBeVDiJhJPYwMniYuLdsIF4c3KIG3RkZ3szRKJrWL8X0MoF4DXz+eBnRUen
|
||||
3JbLO81q9Yx7+3biUqmIi2GIUyolTpGIOMPDiXPJEmITCn0t8fEeNiqKbmg1SAVvggXN58Pfrm65vH8C
|
||||
hjaY2YEDUGM/YWHkoULxtz4p6SfoPwZpYFHm/rBWVhqta9eabALB6+aAjo0nJMy0aTSPkuPiirEkEizO
|
||||
3GswHHVu3Oi0ofqFzC3gKTClpJA+rXZg55o1GVj6n9eKP1wGQ4Nj82aXLSLiNXMHek/bRc3HwEhoKHkA
|
||||
BjMyfP063UM9y9I2LZzEs3fvSUdhoTtY5Q6JhIwXFv5jSUz0UfPhgHkv6AD3GWYWSQZ2LpQER7EB5h6c
|
||||
DL/xK22JiSGDRUV/nlu/vqtXrZ4wJSeTP2DaA+6CX0Eb6MvKmu3W6+9tlMvpBfniqndXVdU7VCqPPZj5
|
||||
smVkqKjoWQ3DtEC6vzA19cOBkpJHg+j9vHkraAa3QLdSOdul0/V+pdHQjeeDEJ67tNRsj4oKWjk1r1Yo
|
||||
miE0ArqR4kN5eWv7tdrRe2lpz81/Bj+Cm6A/N3emR6sdgnY54PPsOt2gWyYLWrmRYW5DVBMwn/9S8Q/n
|
||||
57N9Ot1oT1qa72Xz70NCSM+6dTPtarUFugIQzeuqqNgxoVa7XDB9qfK/DgQ3nw9+bV5eNjZ2pDs9ndwI
|
||||
mN/Nzp79VqUaL1q58kto5hIgljaXlZ0yb93qsbOsb0ilelabmdmK8YXM54NvyM1V0HZ0Yx1u29nrKpXl
|
||||
LYGgEXOlYK5FiBAmPj6yV6v95nFJieNafj5OX2gtxhkgpPNUtEDwb5aXf3S/tNRyV6NxFiYm0m+BFkgB
|
||||
Pa7P19I/USATbAn8Lvb1fwPQo0lPjhq8B4K+cEsArZh+rOkvfV5M0CLo/f92AJowUBiP9y9PzdvIaubv
|
||||
/QAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="ToolbarBOTTOM.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>124, 17</value>
|
||||
</metadata>
|
||||
|
||||
@@ -8,27 +8,26 @@
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports System.ComponentModel
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Tools
|
||||
Namespace DownloadObjects
|
||||
Friend Class VideosDownloaderForm
|
||||
#Region "Declarations"
|
||||
Private MyView As FormsView
|
||||
Private ReadOnly MyPR As Toolbars.MyProgress
|
||||
Private ReadOnly UrlList As List(Of String)
|
||||
Private ReadOnly DownloadingUrlsFile As SFile = $"{SettingsFolderName}\VideosUrls.txt"
|
||||
Private ReadOnly MyJob As JobThread(Of String)
|
||||
#End Region
|
||||
#Region "Initializer"
|
||||
Friend Sub New()
|
||||
InitializeComponent()
|
||||
UrlList = New List(Of String)
|
||||
MyPR = New Toolbars.MyProgress(ToolbarBOTTOM, PR_V, LBL_STATUS, "Downloading video")
|
||||
MyJob = New JobThread(Of String) With {.Progress = New Toolbars.MyProgress(ToolbarBOTTOM, PR_V, LBL_STATUS, "Downloading video")}
|
||||
If DownloadingUrlsFile.Exists Then _
|
||||
UrlList.ListAddList(DownloadingUrlsFile.GetText.StringToList(Of String, List(Of String))(Environment.NewLine), LAP.NotContainsOnly)
|
||||
MyJob.Items.ListAddList(DownloadingUrlsFile.GetText.StringToList(Of String, List(Of String))(Environment.NewLine), LAP.NotContainsOnly)
|
||||
End Sub
|
||||
Private Sub VideosDownloaderForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
MyView = New FormsView(Me)
|
||||
MyView.ImportFromXML(Settings.Design)
|
||||
MyView.SetMeSize()
|
||||
RefillList(False)
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
MyView = New FormsView(Me)
|
||||
MyView.ImportFromXML(Settings.Design)
|
||||
MyView.SetMeSize()
|
||||
RefillList(False)
|
||||
End Sub
|
||||
Private Sub VideosDownloaderForm_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
||||
e.Cancel = True
|
||||
@@ -36,95 +35,120 @@ Namespace DownloadObjects
|
||||
End Sub
|
||||
Private Sub VideosDownloaderForm_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
|
||||
If Not MyView Is Nothing Then MyView.Dispose(Settings.Design)
|
||||
If UrlList.Count > 0 Then UpdateUrlsFile()
|
||||
UrlList.Clear()
|
||||
If MyJob.Count > 0 Then UpdateUrlsFile()
|
||||
MyJob.Dispose()
|
||||
End Sub
|
||||
Private Sub VideosDownloaderForm_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
|
||||
Dim b As Boolean = True
|
||||
Select Case e.KeyCode
|
||||
Case Keys.Insert : AddVideo()
|
||||
Case Keys.F5 : DownloadVideos()
|
||||
Case Keys.F8 : BTT_DELETE_Click(Nothing, EventArgs.Empty)
|
||||
Case Keys.Insert : AddItem()
|
||||
Case Keys.F5 : StartDownloading()
|
||||
Case Keys.F8 : DeleteItem()
|
||||
Case Else : b = False
|
||||
End Select
|
||||
If b Then e.Handled = True
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "Refill, Update file"
|
||||
Private Sub RefillList(Optional ByVal Update As Boolean = True)
|
||||
Try
|
||||
With LIST_VIDEOS
|
||||
.Items.Clear()
|
||||
If UrlList.Count > 0 Then UrlList.ForEach(Sub(u) .Items.Add(u))
|
||||
If .Items.Count > 0 And _LatestSelected >= 0 And _LatestSelected <= .Items.Count - 1 Then .SelectedIndex = _LatestSelected
|
||||
If Update Then UpdateUrlsFile()
|
||||
End With
|
||||
Dim a As Action = Sub()
|
||||
With LIST_VIDEOS
|
||||
.Items.Clear()
|
||||
If MyJob.Count > 0 Then MyJob.Items.ForEach(Sub(u) .Items.Add(u))
|
||||
If _LatestSelected.ValueBetween(0, .Items.Count - 1) Then .SelectedIndex = _LatestSelected
|
||||
If Update Then UpdateUrlsFile()
|
||||
End With
|
||||
End Sub
|
||||
If LIST_VIDEOS.InvokeRequired Then LIST_VIDEOS.Invoke(a) Else a.Invoke
|
||||
Catch ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Error on list refill")
|
||||
ErrorsDescriber.Execute(EDP.SendInLog, ex, "Error on list refill")
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub UpdateUrlsFile()
|
||||
If UrlList.Count > 0 Then
|
||||
TextSaver.SaveTextToFile(UrlList.ListToString(Environment.NewLine), DownloadingUrlsFile, True,, EDP.SendInLog)
|
||||
If MyJob.Count > 0 Then
|
||||
TextSaver.SaveTextToFile(MyJob.ListToString(Environment.NewLine), DownloadingUrlsFile, True,, EDP.SendInLog)
|
||||
Else
|
||||
DownloadingUrlsFile.Delete(, Settings.DeleteMode, EDP.SendInLog)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub BTT_ADD_Click(sender As Object, e As EventArgs) Handles BTT_ADD.Click
|
||||
AddVideo()
|
||||
End Sub
|
||||
Private Sub AddVideo()
|
||||
#End Region
|
||||
#Region "Add, Delete"
|
||||
Private Sub AddItem() Handles BTT_ADD.Click
|
||||
Dim URL$ = GetNewVideoURL()
|
||||
If Not URL.IsEmptyString Then
|
||||
If Not UrlList.Contains(URL) Then
|
||||
UrlList.Add(URL)
|
||||
If Not MyJob.Contains(URL) Then
|
||||
MyJob.Add(URL)
|
||||
RefillList()
|
||||
Else
|
||||
MsgBoxE("This URL already added to list")
|
||||
MsgBoxE("This URL has already been added to the list")
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub BTT_ADD_LIST_Click(sender As Object, e As EventArgs) Handles BTT_ADD_LIST.Click
|
||||
Private Sub AddItemsRange() Handles BTT_ADD_LIST.Click
|
||||
Dim l$ = InputBoxE("Enter URLs (new line as delimiter):", "URLs list", GetCurrentBuffer(),,,,,, True)
|
||||
If Not l.IsEmptyString Then
|
||||
Dim ub% = UrlList.Count
|
||||
UrlList.ListAddList(l.StringFormatLines.StringToList(Of String, List(Of String))(vbCrLf).ListForEach(Function(u, i) u.Trim,, False))
|
||||
If Not UrlList.Count = ub Then RefillList()
|
||||
Dim ub% = MyJob.Count
|
||||
MyJob.Items.ListAddList(l.StringFormatLines.StringToList(Of String, List(Of String))(vbCrLf).ListForEach(Function(u, i) u.Trim,, False))
|
||||
If Not MyJob.Count = ub Then RefillList()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub BTT_DELETE_Click(sender As Object, e As EventArgs) Handles BTT_DELETE.Click
|
||||
If _LatestSelected >= 0 And _LatestSelected <= UrlList.Count - 1 Then
|
||||
If MsgBoxE({$"Do you really want to delete video URL:{vbCr}{UrlList(_LatestSelected)}", "Deleting URL..."},
|
||||
MsgBoxStyle.Exclamation + MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
|
||||
UrlList.RemoveAt(_LatestSelected)
|
||||
Private Sub DeleteItem() Handles BTT_DELETE.Click
|
||||
If _LatestSelected.ValueBetween(0, MyJob.Count - 1) Then
|
||||
If MsgBoxE({$"Are you sure you want to delete the video URL:{vbCr}{MyJob(_LatestSelected)}", "Deleting URL..."}, vbExclamation + vbYesNo) = vbYes Then
|
||||
MyJob.Items.RemoveAt(_LatestSelected)
|
||||
RefillList()
|
||||
End If
|
||||
Else
|
||||
MsgBoxE("URL does not selected", MsgBoxStyle.Exclamation)
|
||||
MsgBoxE("URL not selected", MsgBoxStyle.Exclamation)
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "Start, Stop"
|
||||
Private Sub BTT_DOWN_Click(sender As Object, e As EventArgs) Handles BTT_DOWN.Click
|
||||
DownloadVideos()
|
||||
StartDownloading()
|
||||
End Sub
|
||||
Private Sub BTT_STOP_Click(sender As Object, e As EventArgs) Handles BTT_STOP.Click
|
||||
SetControlValueInvoke(ToolbarTOP, BTT_STOP, Sub() BTT_STOP.Enabled = False)
|
||||
MyJob.Stop()
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "Downloading"
|
||||
Private Sub StartDownloading()
|
||||
If Not MyJob.Working And MyJob.Count > 0 Then
|
||||
SetControlValueInvoke(ToolbarTOP, BTT_DOWN, Sub() BTT_DOWN.Enabled = False)
|
||||
SetControlValueInvoke(ToolbarTOP, BTT_STOP, Sub() BTT_STOP.Enabled = True)
|
||||
MyJob.Start(AddressOf DownloadVideos, Threading.ApartmentState.STA)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub DownloadVideos()
|
||||
If UrlList.Count > 0 Then
|
||||
MyPR.TotalCount = UrlList.Count
|
||||
MyPR.Enabled = True
|
||||
MyJob.Start()
|
||||
If MyJob.Count > 0 Then
|
||||
MyJob.Progress.TotalCount = MyJob.Count
|
||||
MyJob.Progress.Enabled = True
|
||||
Dim IsFirst As Boolean = True
|
||||
For i% = UrlList.Count - 1 To 0 Step -1
|
||||
If DownloadVideoByURL(UrlList(i), IsFirst, True) Then UrlList.RemoveAt(i)
|
||||
MyPR.Perform()
|
||||
For i% = MyJob.Count - 1 To 0 Step -1
|
||||
If MyJob.IsCancellationRequested Then Exit For
|
||||
If DownloadVideoByURL(MyJob(i), IsFirst, True) Then MyJob.Items.RemoveAt(i)
|
||||
MyJob.Progress.Perform()
|
||||
IsFirst = False
|
||||
Next
|
||||
MyPR.Done()
|
||||
MyJob.Progress.Done()
|
||||
RefillList()
|
||||
MyPR.Enabled = False
|
||||
Else
|
||||
MsgBoxE("No one video added", MsgBoxStyle.Exclamation)
|
||||
MyJob.Progress.Enabled = False
|
||||
End If
|
||||
SetControlValueInvoke(ToolbarTOP, BTT_DOWN, Sub() BTT_DOWN.Enabled = True)
|
||||
SetControlValueInvoke(ToolbarTOP, BTT_STOP, Sub() BTT_STOP.Enabled = False)
|
||||
MyJob.Stopped()
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "List handlers"
|
||||
Private _LatestSelected As Integer = -1
|
||||
Private Sub LIST_VIDEOS_SelectedIndexChanged(sender As Object, e As EventArgs) Handles LIST_VIDEOS.SelectedIndexChanged
|
||||
_LatestSelected = LIST_VIDEOS.SelectedIndex
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "Open path"
|
||||
Private Sub BTT_OPEN_PATH_Click(sender As Object, e As EventArgs) Handles BTT_OPEN_PATH.Click
|
||||
With Settings.LatestSavingPath
|
||||
If Not .Value.IsEmptyString Then
|
||||
@@ -134,9 +158,10 @@ Namespace DownloadObjects
|
||||
MsgBoxE($"Path [{ .Value}] does not exists!", MsgBoxStyle.Exclamation)
|
||||
End If
|
||||
Else
|
||||
MsgBoxE("Saving path does not set!", MsgBoxStyle.Exclamation)
|
||||
MsgBoxE("Save path not specified!", MsgBoxStyle.Exclamation)
|
||||
End If
|
||||
End With
|
||||
End Sub
|
||||
#End Region
|
||||
End Class
|
||||
End Namespace
|
||||
59
SCrawler/Editors/CollectionEditorForm.Designer.vb
generated
59
SCrawler/Editors/CollectionEditorForm.Designer.vb
generated
@@ -14,13 +14,14 @@
|
||||
Private components As System.ComponentModel.IContainer
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
Dim ActionButton1 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Dim CONTAINER_MAIN As System.Windows.Forms.ToolStripContainer
|
||||
Dim ActionButton3 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(CollectionEditorForm))
|
||||
Dim ActionButton2 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Me.CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
|
||||
Dim ActionButton4 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Me.CMB_COLLECTIONS = New PersonalUtilities.Forms.Controls.ComboBoxExtended()
|
||||
Me.CONTAINER_MAIN.ContentPanel.SuspendLayout()
|
||||
Me.CONTAINER_MAIN.SuspendLayout()
|
||||
CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
|
||||
CONTAINER_MAIN.ContentPanel.SuspendLayout()
|
||||
CONTAINER_MAIN.SuspendLayout()
|
||||
CType(Me.CMB_COLLECTIONS, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
@@ -29,28 +30,28 @@
|
||||
'
|
||||
'CONTAINER_MAIN.ContentPanel
|
||||
'
|
||||
Me.CONTAINER_MAIN.ContentPanel.Controls.Add(Me.CMB_COLLECTIONS)
|
||||
Me.CONTAINER_MAIN.ContentPanel.Padding = New System.Windows.Forms.Padding(2, 0, 2, 0)
|
||||
Me.CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(454, 251)
|
||||
Me.CONTAINER_MAIN.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.CONTAINER_MAIN.LeftToolStripPanelVisible = False
|
||||
Me.CONTAINER_MAIN.Location = New System.Drawing.Point(0, 0)
|
||||
Me.CONTAINER_MAIN.Name = "CONTAINER_MAIN"
|
||||
Me.CONTAINER_MAIN.RightToolStripPanelVisible = False
|
||||
Me.CONTAINER_MAIN.Size = New System.Drawing.Size(454, 251)
|
||||
Me.CONTAINER_MAIN.TabIndex = 0
|
||||
Me.CONTAINER_MAIN.TopToolStripPanelVisible = False
|
||||
CONTAINER_MAIN.ContentPanel.Controls.Add(Me.CMB_COLLECTIONS)
|
||||
CONTAINER_MAIN.ContentPanel.Padding = New System.Windows.Forms.Padding(2, 0, 2, 0)
|
||||
CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(454, 251)
|
||||
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(454, 251)
|
||||
CONTAINER_MAIN.TabIndex = 0
|
||||
CONTAINER_MAIN.TopToolStripPanelVisible = False
|
||||
'
|
||||
'CMB_COLLECTIONS
|
||||
'
|
||||
ActionButton1.BackgroundImage = CType(resources.GetObject("ActionButton1.BackgroundImage"), System.Drawing.Image)
|
||||
ActionButton1.Name = "Add"
|
||||
ActionButton1.ToolTipText = "Add new collection"
|
||||
ActionButton2.BackgroundImage = CType(resources.GetObject("ActionButton2.BackgroundImage"), System.Drawing.Image)
|
||||
ActionButton2.Name = "ArrowDown"
|
||||
ActionButton2.Visible = False
|
||||
Me.CMB_COLLECTIONS.Buttons.Add(ActionButton1)
|
||||
Me.CMB_COLLECTIONS.Buttons.Add(ActionButton2)
|
||||
ActionButton3.BackgroundImage = CType(resources.GetObject("ActionButton3.BackgroundImage"), System.Drawing.Image)
|
||||
ActionButton3.Name = "Add"
|
||||
ActionButton3.ToolTipText = "Add new collection"
|
||||
ActionButton4.BackgroundImage = CType(resources.GetObject("ActionButton4.BackgroundImage"), System.Drawing.Image)
|
||||
ActionButton4.Name = "ArrowDown"
|
||||
ActionButton4.Visible = False
|
||||
Me.CMB_COLLECTIONS.Buttons.Add(ActionButton3)
|
||||
Me.CMB_COLLECTIONS.Buttons.Add(ActionButton4)
|
||||
Me.CMB_COLLECTIONS.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.CMB_COLLECTIONS.ListDropDownStyle = PersonalUtilities.Forms.Controls.ComboBoxExtended.ListMode.Simple
|
||||
Me.CMB_COLLECTIONS.Location = New System.Drawing.Point(2, 0)
|
||||
@@ -63,7 +64,7 @@
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(454, 251)
|
||||
Me.Controls.Add(Me.CONTAINER_MAIN)
|
||||
Me.Controls.Add(CONTAINER_MAIN)
|
||||
Me.KeyPreview = True
|
||||
Me.MinimizeBox = False
|
||||
Me.MinimumSize = New System.Drawing.Size(470, 290)
|
||||
@@ -71,15 +72,13 @@
|
||||
Me.ShowIcon = False
|
||||
Me.ShowInTaskbar = False
|
||||
Me.Text = "Collection"
|
||||
Me.CONTAINER_MAIN.ContentPanel.ResumeLayout(False)
|
||||
Me.CONTAINER_MAIN.ResumeLayout(False)
|
||||
Me.CONTAINER_MAIN.PerformLayout()
|
||||
CONTAINER_MAIN.ContentPanel.ResumeLayout(False)
|
||||
CONTAINER_MAIN.ResumeLayout(False)
|
||||
CONTAINER_MAIN.PerformLayout()
|
||||
CType(Me.CMB_COLLECTIONS, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
||||
Private WithEvents CONTAINER_MAIN As ToolStripContainer
|
||||
Private WithEvents CMB_COLLECTIONS As PersonalUtilities.Forms.Controls.ComboBoxExtended
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -117,8 +117,11 @@
|
||||
<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>
|
||||
<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">
|
||||
<data name="ActionButton3.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6
|
||||
JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsTAAALEwEAmpwYAAADmUlE
|
||||
@@ -140,7 +143,7 @@
|
||||
0AUyNxOP1DOwcaG/8I+/LRB+At7psBnyDBG0AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="ActionButton2.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<data name="ActionButton4.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAE65JREFUeF7t
|
||||
3X2sJWddB/DdLi2lQG2hdOHuvfM887J7Cxca4ELTQMDWKigIFpBAEAgi9g+CJpJo9Q8NJhgBiYZIYspL
|
||||
|
||||
@@ -8,15 +8,14 @@
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Controls.Base
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Namespace Editors
|
||||
Friend Class CollectionEditorForm : Implements IOkCancelToolbar
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Friend Class CollectionEditorForm
|
||||
Private WithEvents MyDefs As DefaultFormOptions
|
||||
Private ReadOnly Collections As List(Of String)
|
||||
Friend Property [Collection] As String = String.Empty
|
||||
Friend Sub New()
|
||||
InitializeComponent()
|
||||
MyDefs = New DefaultFormOptions
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
Collections = New List(Of String)
|
||||
End Sub
|
||||
Friend Sub New(ByVal CollectionName As String)
|
||||
@@ -26,7 +25,7 @@ Namespace Editors
|
||||
Private Sub CollectionEditorForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design)
|
||||
.MyViewInitialize()
|
||||
.AddOkCancelToolbar()
|
||||
Collections.ListAddList((From c In Settings.Users Where c.IsCollection Select c.CollectionName), LAP.NotContainsOnly, EDP.ThrowException)
|
||||
If Collections.ListExists Then Collections.Sort() : CMB_COLLECTIONS.Items.AddRange(From c In Collections Select New ListItem(c))
|
||||
@@ -44,7 +43,7 @@ Namespace Editors
|
||||
Private Sub CollectionEditorForm_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
|
||||
If e.KeyCode = Keys.Insert Then AddNewCollection() : e.Handled = True Else e.Handled = False
|
||||
End Sub
|
||||
Private Sub OK() Implements IOkCancelToolbar.OK
|
||||
Private Sub MyDefs_ButtonOkClick() Handles MyDefs.ButtonOkClick
|
||||
If CMB_COLLECTIONS.SelectedIndex >= 0 Then
|
||||
Collection = CMB_COLLECTIONS.Value.ToString
|
||||
MyDefs.CloseForm()
|
||||
@@ -52,15 +51,12 @@ Namespace Editors
|
||||
MsgBoxE("Collection not selected", MsgBoxStyle.Exclamation)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
MyDefs.CloseForm(DialogResult.Cancel)
|
||||
End Sub
|
||||
Private Sub CMB_COLLECTIONS_ActionOnButtonClick(ByVal Sender As ActionButton) Handles CMB_COLLECTIONS.ActionOnButtonClick
|
||||
Private Sub CMB_COLLECTIONS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles CMB_COLLECTIONS.ActionOnButtonClick
|
||||
If Sender.DefaultButton = ActionButton.DefaultButtons.Add Then AddNewCollection()
|
||||
End Sub
|
||||
Private Sub CMB_COLLECTIONS_ActionOnListDoubleClick(ByVal _Item As ListViewItem) Handles CMB_COLLECTIONS.ActionOnListDoubleClick
|
||||
_Item.Selected = True
|
||||
OK()
|
||||
MyDefs_ButtonOkClick()
|
||||
End Sub
|
||||
Private Sub AddNewCollection()
|
||||
Dim c$ = InputBoxE("Enter new collection name:", "Collection name")
|
||||
|
||||
4
SCrawler/Editors/GlobalSettingsForm.Designer.vb
generated
4
SCrawler/Editors/GlobalSettingsForm.Designer.vb
generated
@@ -215,7 +215,7 @@
|
||||
Me.TXT_IMAGE_LARGE.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.TXT_IMAGE_LARGE.Location = New System.Drawing.Point(3, 3)
|
||||
Me.TXT_IMAGE_LARGE.Name = "TXT_IMAGE_LARGE"
|
||||
Me.TXT_IMAGE_LARGE.NumberMaximum = New Decimal(New Integer() {1000, 0, 0, 0})
|
||||
Me.TXT_IMAGE_LARGE.NumberMaximum = New Decimal(New Integer() {256, 0, 0, 0})
|
||||
Me.TXT_IMAGE_LARGE.NumberMinimum = New Decimal(New Integer() {50, 0, 0, 0})
|
||||
Me.TXT_IMAGE_LARGE.Size = New System.Drawing.Size(278, 22)
|
||||
Me.TXT_IMAGE_LARGE.TabIndex = 0
|
||||
@@ -231,7 +231,7 @@
|
||||
Me.TXT_IMAGE_SMALL.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.TXT_IMAGE_SMALL.Location = New System.Drawing.Point(287, 3)
|
||||
Me.TXT_IMAGE_SMALL.Name = "TXT_IMAGE_SMALL"
|
||||
Me.TXT_IMAGE_SMALL.NumberMaximum = New Decimal(New Integer() {500, 0, 0, 0})
|
||||
Me.TXT_IMAGE_SMALL.NumberMaximum = New Decimal(New Integer() {256, 0, 0, 0})
|
||||
Me.TXT_IMAGE_SMALL.NumberMinimum = New Decimal(New Integer() {10, 0, 0, 0})
|
||||
Me.TXT_IMAGE_SMALL.Size = New System.Drawing.Size(278, 22)
|
||||
Me.TXT_IMAGE_SMALL.TabIndex = 1
|
||||
|
||||
@@ -8,24 +8,23 @@
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Controls.Base
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Namespace Editors
|
||||
Friend Class GlobalSettingsForm : Implements IOkCancelToolbar
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Friend Class GlobalSettingsForm
|
||||
Private WithEvents MyDefs As DefaultFormOptions
|
||||
Friend Sub New()
|
||||
InitializeComponent()
|
||||
MyDefs = New DefaultFormOptions
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
End Sub
|
||||
Private Sub GlobalSettingsForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design, True)
|
||||
.MyViewInitialize(True)
|
||||
.AddOkCancelToolbar()
|
||||
With Settings
|
||||
'Basis
|
||||
TXT_GLOBAL_PATH.Text = .GlobalPath.Value
|
||||
TXT_IMAGE_LARGE.Value = .MaxLargeImageHeigh.Value
|
||||
TXT_IMAGE_SMALL.Value = .MaxSmallImageHeigh.Value
|
||||
TXT_IMAGE_LARGE.Value = .MaxLargeImageHeight.Value
|
||||
TXT_IMAGE_SMALL.Value = .MaxSmallImageHeight.Value
|
||||
TXT_COLLECTIONS_PATH.Text = .CollectionsPath
|
||||
TXT_MAX_JOBS_USERS.Value = .MaxUsersJobsCount.Value
|
||||
TXT_MAX_JOBS_CHANNELS.Value = .ChannelsMaxJobsCount.Value
|
||||
@@ -60,9 +59,9 @@ Namespace Editors
|
||||
TXT_DOWN_COMPLETE_SCRIPT.Text = .DownloadsCompleteCommand
|
||||
TXT_DOWN_COMPLETE_SCRIPT.Checked = .DownloadsCompleteCommand.Attribute
|
||||
'Downloading: file names
|
||||
CH_FILE_NAME_CHANGE.Checked = .FileReplaceNameByDate Or .FileAddDateToFileName Or .FileAddTimeToFileName
|
||||
OPT_FILE_NAME_REPLACE.Checked = .FileReplaceNameByDate
|
||||
OPT_FILE_NAME_ADD_DATE.Checked = Not .FileReplaceNameByDate
|
||||
CH_FILE_NAME_CHANGE.Checked = Not .FileReplaceNameByDate.Value = FileNameReplaceMode.None
|
||||
OPT_FILE_NAME_REPLACE.Checked = .FileReplaceNameByDate.Value = FileNameReplaceMode.Replace
|
||||
OPT_FILE_NAME_ADD_DATE.Checked = .FileReplaceNameByDate.Value = FileNameReplaceMode.Add
|
||||
CH_FILE_DATE.Checked = .FileAddDateToFileName
|
||||
CH_FILE_TIME.Checked = .FileAddTimeToFileName
|
||||
OPT_FILE_DATE_START.Checked = Not .FileDateTimePositionEnd
|
||||
@@ -78,19 +77,19 @@ Namespace Editors
|
||||
CH_CHANNELS_USERS_TEMP.Checked = .ChannelsDefaultTemporary
|
||||
End With
|
||||
.MyFieldsChecker = New FieldsChecker
|
||||
With DirectCast(.MyFieldsChecker, FieldsChecker)
|
||||
With .MyFieldsCheckerE
|
||||
.AddControl(Of String)(TXT_GLOBAL_PATH, TXT_GLOBAL_PATH.CaptionText)
|
||||
.AddControl(Of String)(TXT_COLLECTIONS_PATH, TXT_COLLECTIONS_PATH.CaptionText)
|
||||
.EndLoaderOperations()
|
||||
End With
|
||||
.EndLoaderOperations()
|
||||
ChangeFileNameChangersEnabling()
|
||||
.EndLoaderOperations()
|
||||
End With
|
||||
Catch ex As Exception
|
||||
MyDefs.InvokeLoaderError(ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub OK() Implements IOkCancelToolbar.OK
|
||||
Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick
|
||||
If MyDefs.MyFieldsChecker.AllParamsOK Then
|
||||
With Settings
|
||||
Dim a As Func(Of String, Object, Integer) =
|
||||
@@ -124,8 +123,8 @@ Namespace Editors
|
||||
|
||||
'Basis
|
||||
.GlobalPath.Value = TXT_GLOBAL_PATH.Text
|
||||
.MaxLargeImageHeigh.Value = CInt(TXT_IMAGE_LARGE.Value)
|
||||
.MaxSmallImageHeigh.Value = CInt(TXT_IMAGE_SMALL.Value)
|
||||
.MaxLargeImageHeight.Value = CInt(TXT_IMAGE_LARGE.Value)
|
||||
.MaxSmallImageHeight.Value = CInt(TXT_IMAGE_SMALL.Value)
|
||||
.CollectionsPath.Value = TXT_COLLECTIONS_PATH.Text
|
||||
.MaxUsersJobsCount.Value = CInt(TXT_MAX_JOBS_USERS.Value)
|
||||
.ChannelsMaxJobsCount.Value = TXT_MAX_JOBS_CHANNELS.Value
|
||||
@@ -161,14 +160,14 @@ Namespace Editors
|
||||
.DownloadsCompleteCommand.Attribute.Value = TXT_DOWN_COMPLETE_SCRIPT.Checked
|
||||
'Downloading: file names
|
||||
If CH_FILE_NAME_CHANGE.Checked Then
|
||||
.FileReplaceNameByDate.Value = OPT_FILE_NAME_REPLACE.Checked
|
||||
.FileReplaceNameByDate.Value = If(OPT_FILE_NAME_REPLACE.Checked, FileNameReplaceMode.Replace, FileNameReplaceMode.Add)
|
||||
.FileAddDateToFileName.Value = CH_FILE_DATE.Checked
|
||||
.FileAddTimeToFileName.Value = CH_FILE_TIME.Checked
|
||||
.FileDateTimePositionEnd.Value = OPT_FILE_DATE_END.Checked
|
||||
Else
|
||||
.FileAddDateToFileName.Value = False
|
||||
.FileAddTimeToFileName.Value = False
|
||||
.FileReplaceNameByDate.Value = False
|
||||
.FileReplaceNameByDate.Value = FileNameReplaceMode.None
|
||||
End If
|
||||
'Channels
|
||||
.ChannelsImagesRows.Value = CInt(TXT_CHANNELS_ROWS.Value)
|
||||
@@ -184,19 +183,16 @@ Namespace Editors
|
||||
MyDefs.CloseForm()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
MyDefs.CloseForm(DialogResult.Cancel)
|
||||
End Sub
|
||||
Private Sub TXT_GLOBAL_PATH_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_GLOBAL_PATH.ActionOnButtonClick
|
||||
Private Sub TXT_GLOBAL_PATH_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_GLOBAL_PATH.ActionOnButtonClick
|
||||
If Sender.DefaultButton = ActionButton.DefaultButtons.Open Then
|
||||
Dim f As SFile = SFile.SelectPath(Settings.GlobalPath.Value)
|
||||
If Not f.IsEmptyString Then TXT_GLOBAL_PATH.Text = f
|
||||
End If
|
||||
End Sub
|
||||
Private Sub TXT_MAX_JOBS_USERS_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_MAX_JOBS_USERS.ActionOnButtonClick
|
||||
Private Sub TXT_MAX_JOBS_USERS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_MAX_JOBS_USERS.ActionOnButtonClick
|
||||
If Sender.DefaultButton = ActionButton.DefaultButtons.Refresh Then TXT_MAX_JOBS_USERS.Value = SettingsCLS.DefaultMaxDownloadingTasks
|
||||
End Sub
|
||||
Private Sub TXT_MAX_JOBS_CHANNELS_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_MAX_JOBS_CHANNELS.ActionOnButtonClick
|
||||
Private Sub TXT_MAX_JOBS_CHANNELS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_MAX_JOBS_CHANNELS.ActionOnButtonClick
|
||||
If Sender.DefaultButton = ActionButton.DefaultButtons.Refresh Then TXT_MAX_JOBS_CHANNELS.Value = SettingsCLS.DefaultMaxDownloadingTasks
|
||||
End Sub
|
||||
Private Sub CH_FILE_NAME_CHANGE_CheckedChanged(sender As Object, e As EventArgs) Handles CH_FILE_NAME_CHANGE.CheckedChanged
|
||||
@@ -217,11 +213,12 @@ Namespace Editors
|
||||
Dim b As Boolean = CH_FILE_NAME_CHANGE.Checked
|
||||
OPT_FILE_NAME_REPLACE.Enabled = b
|
||||
OPT_FILE_NAME_ADD_DATE.Enabled = b
|
||||
If Not OPT_FILE_NAME_REPLACE.Checked And Not OPT_FILE_NAME_ADD_DATE.Checked Then OPT_FILE_NAME_REPLACE.Checked = True
|
||||
CH_FILE_DATE.Enabled = b
|
||||
CH_FILE_TIME.Enabled = b
|
||||
ChangePositionControlsEnabling()
|
||||
End Sub
|
||||
Private Sub TXT_SCRIPT_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_SCRIPT.ActionOnButtonClick
|
||||
Private Sub TXT_SCRIPT_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_SCRIPT.ActionOnButtonClick
|
||||
SettingsCLS.ScriptTextBoxButtonClick(TXT_SCRIPT, Sender)
|
||||
End Sub
|
||||
Private Sub CH_COPY_CHANNEL_USER_IMAGE_CheckedChanged(sender As Object, e As EventArgs) Handles CH_COPY_CHANNEL_USER_IMAGE.CheckedChanged
|
||||
|
||||
37
SCrawler/Editors/LabelsForm.Designer.vb
generated
37
SCrawler/Editors/LabelsForm.Designer.vb
generated
@@ -13,14 +13,15 @@ Partial Friend Class LabelsForm : Inherits System.Windows.Forms.Form
|
||||
Private components As System.ComponentModel.IContainer
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
Dim CONTAINER_MAIN As System.Windows.Forms.ToolStripContainer
|
||||
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(LabelsForm))
|
||||
Dim ActionButton2 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Dim ActionButton3 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Me.CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
|
||||
Me.CMB_LABELS = New PersonalUtilities.Forms.Controls.ComboBoxExtended()
|
||||
Me.CONTAINER_MAIN.ContentPanel.SuspendLayout()
|
||||
Me.CONTAINER_MAIN.SuspendLayout()
|
||||
CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
|
||||
CONTAINER_MAIN.ContentPanel.SuspendLayout()
|
||||
CONTAINER_MAIN.SuspendLayout()
|
||||
CType(Me.CMB_LABELS, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
@@ -29,16 +30,16 @@ Partial Friend Class LabelsForm : Inherits System.Windows.Forms.Form
|
||||
'
|
||||
'CONTAINER_MAIN.ContentPanel
|
||||
'
|
||||
Me.CONTAINER_MAIN.ContentPanel.Controls.Add(Me.CMB_LABELS)
|
||||
Me.CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(374, 421)
|
||||
Me.CONTAINER_MAIN.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.CONTAINER_MAIN.LeftToolStripPanelVisible = False
|
||||
Me.CONTAINER_MAIN.Location = New System.Drawing.Point(0, 0)
|
||||
Me.CONTAINER_MAIN.Name = "CONTAINER_MAIN"
|
||||
Me.CONTAINER_MAIN.RightToolStripPanelVisible = False
|
||||
Me.CONTAINER_MAIN.Size = New System.Drawing.Size(374, 421)
|
||||
Me.CONTAINER_MAIN.TabIndex = 0
|
||||
Me.CONTAINER_MAIN.TopToolStripPanelVisible = False
|
||||
CONTAINER_MAIN.ContentPanel.Controls.Add(Me.CMB_LABELS)
|
||||
CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(374, 421)
|
||||
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(374, 421)
|
||||
CONTAINER_MAIN.TabIndex = 0
|
||||
CONTAINER_MAIN.TopToolStripPanelVisible = False
|
||||
'
|
||||
'CMB_LABELS
|
||||
'
|
||||
@@ -69,7 +70,7 @@ Partial Friend Class LabelsForm : Inherits System.Windows.Forms.Form
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(374, 421)
|
||||
Me.Controls.Add(Me.CONTAINER_MAIN)
|
||||
Me.Controls.Add(CONTAINER_MAIN)
|
||||
Me.KeyPreview = True
|
||||
Me.MinimizeBox = False
|
||||
Me.MinimumSize = New System.Drawing.Size(390, 460)
|
||||
@@ -77,14 +78,12 @@ Partial Friend Class LabelsForm : Inherits System.Windows.Forms.Form
|
||||
Me.ShowIcon = False
|
||||
Me.ShowInTaskbar = False
|
||||
Me.Text = "Labels"
|
||||
Me.CONTAINER_MAIN.ContentPanel.ResumeLayout(False)
|
||||
Me.CONTAINER_MAIN.ResumeLayout(False)
|
||||
Me.CONTAINER_MAIN.PerformLayout()
|
||||
CONTAINER_MAIN.ContentPanel.ResumeLayout(False)
|
||||
CONTAINER_MAIN.ResumeLayout(False)
|
||||
CONTAINER_MAIN.PerformLayout()
|
||||
CType(Me.CMB_LABELS, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
||||
Private WithEvents CONTAINER_MAIN As ToolStripContainer
|
||||
Private WithEvents CMB_LABELS As PersonalUtilities.Forms.Controls.ComboBoxExtended
|
||||
End Class
|
||||
@@ -117,6 +117,9 @@
|
||||
<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>
|
||||
<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>
|
||||
|
||||
@@ -7,12 +7,11 @@
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Imports PersonalUtilities.Forms.Controls
|
||||
Imports PersonalUtilities.Forms.Controls.Base
|
||||
Imports PersonalUtilities.Functions.Messaging
|
||||
Friend Class LabelsForm : Implements IOkCancelDeleteToolbar
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Friend Class LabelsForm
|
||||
Private WithEvents MyDefs As DefaultFormOptions
|
||||
Friend ReadOnly Property LabelsList As List(Of String)
|
||||
Private ReadOnly _Source As IEnumerable(Of String) = Nothing
|
||||
Private ReadOnly Property Source As IEnumerable(Of String)
|
||||
@@ -32,7 +31,7 @@ Friend Class LabelsForm : Implements IOkCancelDeleteToolbar
|
||||
InitializeComponent()
|
||||
LabelsList = New List(Of String)
|
||||
LabelsList.ListAddList(LabelsArr)
|
||||
MyDefs = New DefaultFormOptions
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
End Sub
|
||||
Friend Sub New(ByVal Current As IEnumerable(Of String), ByVal Source As IEnumerable(Of String))
|
||||
Me.New(Current)
|
||||
@@ -41,8 +40,9 @@ Friend Class LabelsForm : Implements IOkCancelDeleteToolbar
|
||||
Private Sub LabelsForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design)
|
||||
.AddOkCancelToolbar(, WithDeleteButton)
|
||||
.MyViewInitialize()
|
||||
.AddOkCancelToolbar()
|
||||
.MyOkCancel.BTT_DELETE.Visible = WithDeleteButton
|
||||
If Source.Count > 0 Then
|
||||
Dim items As New List(Of Integer)
|
||||
CMB_LABELS.BeginUpdate()
|
||||
@@ -66,7 +66,7 @@ Friend Class LabelsForm : Implements IOkCancelDeleteToolbar
|
||||
Private Sub LabelsForm_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
|
||||
LabelsList.Clear()
|
||||
End Sub
|
||||
Private Sub OK() Implements IOkCancelToolbar.OK
|
||||
Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick
|
||||
Try
|
||||
If MultiUser Then
|
||||
Dim m As New MMessage("You are changing labels for more one user" & vbNewLine & "What do you want to do?",
|
||||
@@ -88,18 +88,15 @@ Friend Class LabelsForm : Implements IOkCancelDeleteToolbar
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Choosing labels")
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
MyDefs.CloseForm(DialogResult.Cancel)
|
||||
End Sub
|
||||
Private Sub Delete() Implements IOkCancelDeleteToolbar.Delete
|
||||
Private Sub MyDefs_ButtonDeleteClickOC(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonDeleteClickOC
|
||||
LabelsList.Clear()
|
||||
MyDefs.CloseForm()
|
||||
End Sub
|
||||
Private Sub CMB_LABELS_ActionOnButtonClick(ByVal Sender As ActionButton) Handles CMB_LABELS.ActionOnButtonClick
|
||||
If Sender.DefaultButton = ActionButton.DefaultButtons.Add Then AddNewLabel()
|
||||
End Sub
|
||||
Private Sub CMB_LABELS_ActionOnButtonClearClick() Handles CMB_LABELS.ActionOnButtonClearClick
|
||||
CMB_LABELS.Clear(ComboBoxExtended.ClearMode.CheckedIndexes)
|
||||
Private Sub CMB_LABELS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles CMB_LABELS.ActionOnButtonClick
|
||||
Select Case Sender.DefaultButton
|
||||
Case ActionButton.DefaultButtons.Add : AddNewLabel()
|
||||
Case ActionButton.DefaultButtons.Clear : CMB_LABELS.Clear(ComboBoxExtended.ClearMode.CheckedIndexes)
|
||||
End Select
|
||||
End Sub
|
||||
Private Sub AddNewLabel()
|
||||
Dim nl$ = InputBoxE("Enter new label name:", "New label")
|
||||
|
||||
@@ -21,8 +21,6 @@ Namespace Editors
|
||||
Private Sub InitCheckBox(ByRef CH As CheckBox, ByVal Caption As String)
|
||||
CH = New CheckBox With {.Text = Caption, .Dock = DockStyle.Fill, .UseVisualStyleBackColor = True,
|
||||
.ThreeState = True, .CheckState = CheckState.Indeterminate}
|
||||
AddHandler CH.CheckedChanged, AddressOf Checker_CheckedChanged
|
||||
AddHandler CH.CheckStateChanged, AddressOf Checker_CheckedChanged
|
||||
End Sub
|
||||
Private Sub SiteDefaults_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
|
||||
CH_TEMP.Dispose()
|
||||
@@ -64,11 +62,6 @@ Namespace Editors
|
||||
Private Function ShouldSerializeBaseControlsPadding() As Boolean
|
||||
Return Not _BaseControlsPadding.Equals(New Padding(0))
|
||||
End Function
|
||||
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
|
||||
Public Property ChangesDetected As Boolean = False
|
||||
Private Sub Checker_CheckedChanged(sender As Object, e As EventArgs)
|
||||
ChangesDetected = True
|
||||
End Sub
|
||||
<Browsable(True), EditorBrowsable(EditorBrowsableState.Always), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
|
||||
Category("Values"), DefaultValue(CheckState.Indeterminate), DisplayName("Temporary"), Description("Temporary profile")>
|
||||
Public Property MyTemporary As CheckState
|
||||
|
||||
37
SCrawler/Editors/SiteEditorForm.Designer.vb
generated
37
SCrawler/Editors/SiteEditorForm.Designer.vb
generated
@@ -22,20 +22,21 @@
|
||||
Dim ActionButton4 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Dim ActionButton5 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Dim ActionButton6 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Dim CONTAINER_MAIN As System.Windows.Forms.ToolStripContainer
|
||||
Me.TP_MAIN = New System.Windows.Forms.TableLayoutPanel()
|
||||
Me.TXT_PATH = New PersonalUtilities.Forms.Controls.TextBoxExtended()
|
||||
Me.TXT_COOKIES = New PersonalUtilities.Forms.Controls.TextBoxExtended()
|
||||
Me.TP_SITE_PROPS = New SCrawler.Editors.SiteDefaults()
|
||||
Me.TXT_PATH_SAVED_POSTS = New PersonalUtilities.Forms.Controls.TextBoxExtended()
|
||||
Me.CH_GET_USER_MEDIA_ONLY = New System.Windows.Forms.CheckBox()
|
||||
Me.CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
|
||||
Me.TT_MAIN = New System.Windows.Forms.ToolTip(Me.components)
|
||||
CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
|
||||
Me.TP_MAIN.SuspendLayout()
|
||||
CType(Me.TXT_PATH, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.TXT_COOKIES, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.TXT_PATH_SAVED_POSTS, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.CONTAINER_MAIN.ContentPanel.SuspendLayout()
|
||||
Me.CONTAINER_MAIN.SuspendLayout()
|
||||
CONTAINER_MAIN.ContentPanel.SuspendLayout()
|
||||
CONTAINER_MAIN.SuspendLayout()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'TP_MAIN
|
||||
@@ -142,23 +143,23 @@
|
||||
'
|
||||
'CONTAINER_MAIN.ContentPanel
|
||||
'
|
||||
Me.CONTAINER_MAIN.ContentPanel.Controls.Add(Me.TP_MAIN)
|
||||
Me.CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(544, 219)
|
||||
Me.CONTAINER_MAIN.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.CONTAINER_MAIN.LeftToolStripPanelVisible = False
|
||||
Me.CONTAINER_MAIN.Location = New System.Drawing.Point(0, 0)
|
||||
Me.CONTAINER_MAIN.Name = "CONTAINER_MAIN"
|
||||
Me.CONTAINER_MAIN.RightToolStripPanelVisible = False
|
||||
Me.CONTAINER_MAIN.Size = New System.Drawing.Size(544, 219)
|
||||
Me.CONTAINER_MAIN.TabIndex = 0
|
||||
Me.CONTAINER_MAIN.TopToolStripPanelVisible = False
|
||||
CONTAINER_MAIN.ContentPanel.Controls.Add(Me.TP_MAIN)
|
||||
CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(544, 219)
|
||||
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(544, 219)
|
||||
CONTAINER_MAIN.TabIndex = 0
|
||||
CONTAINER_MAIN.TopToolStripPanelVisible = False
|
||||
'
|
||||
'SiteEditorForm
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(544, 219)
|
||||
Me.Controls.Add(Me.CONTAINER_MAIN)
|
||||
Me.Controls.Add(CONTAINER_MAIN)
|
||||
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
|
||||
Me.KeyPreview = True
|
||||
Me.MaximizeBox = False
|
||||
@@ -174,14 +175,12 @@
|
||||
CType(Me.TXT_PATH, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.TXT_COOKIES, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.TXT_PATH_SAVED_POSTS, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.CONTAINER_MAIN.ContentPanel.ResumeLayout(False)
|
||||
Me.CONTAINER_MAIN.ResumeLayout(False)
|
||||
Me.CONTAINER_MAIN.PerformLayout()
|
||||
CONTAINER_MAIN.ContentPanel.ResumeLayout(False)
|
||||
CONTAINER_MAIN.ResumeLayout(False)
|
||||
CONTAINER_MAIN.PerformLayout()
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
||||
Private WithEvents CONTAINER_MAIN As ToolStripContainer
|
||||
Private WithEvents TXT_PATH As PersonalUtilities.Forms.Controls.TextBoxExtended
|
||||
Private WithEvents TXT_COOKIES As PersonalUtilities.Forms.Controls.TextBoxExtended
|
||||
Private WithEvents TP_MAIN As TableLayoutPanel
|
||||
|
||||
@@ -222,6 +222,9 @@
|
||||
AFuc5QFgn6ClHh5iOQVAKNixyucB8NY0vG9JOzzyhrdq5IRgAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="CONTAINER_MAIN.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="TT_MAIN.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
|
||||
@@ -9,16 +9,15 @@
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Controls
|
||||
Imports PersonalUtilities.Forms.Controls.Base
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Imports PersonalUtilities.Tools.WEB
|
||||
Imports CookieControl = PersonalUtilities.Tools.WEB.CookieListForm.CookieControl
|
||||
Imports SCrawler.Plugin
|
||||
Imports SCrawler.Plugin.Hosts
|
||||
Namespace Editors
|
||||
Friend Class SiteEditorForm : Implements IOkCancelToolbar
|
||||
Friend Class SiteEditorForm
|
||||
Private ReadOnly LBL_AUTH As Label
|
||||
Private ReadOnly LBL_OTHER As Label
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Private WithEvents MyDefs As DefaultFormOptions
|
||||
Private WithEvents SpecialButton As Button
|
||||
#Region "Providers"
|
||||
Private Class SavedPostsChecker : Implements IFieldsCheckerProvider
|
||||
@@ -35,14 +34,14 @@ Namespace Editors
|
||||
End If
|
||||
End Function
|
||||
Private Function GetFormat(ByVal FormatType As Type) As Object Implements IFormatProvider.GetFormat
|
||||
Throw New NotImplementedException()
|
||||
Throw New NotImplementedException("[GetFormat] is not available in the context of [SavedPostsChecker]")
|
||||
End Function
|
||||
End Class
|
||||
#End Region
|
||||
Private ReadOnly Property Host As SettingsHost
|
||||
Friend Sub New(ByVal h As SettingsHost)
|
||||
InitializeComponent()
|
||||
MyDefs = New DefaultFormOptions
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
Host = h
|
||||
LBL_AUTH = New Label With {.Text = "Authorization", .TextAlign = ContentAlignment.MiddleCenter, .Dock = DockStyle.Fill}
|
||||
LBL_OTHER = New Label With {.Text = "Other Parameters", .TextAlign = ContentAlignment.MiddleCenter, .Dock = DockStyle.Fill}
|
||||
@@ -50,7 +49,7 @@ Namespace Editors
|
||||
Private Sub SiteEditorForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design, True)
|
||||
.MyViewInitialize(True)
|
||||
.AddOkCancelToolbar()
|
||||
|
||||
.MyFieldsChecker = New FieldsChecker
|
||||
@@ -68,7 +67,7 @@ Namespace Editors
|
||||
|
||||
SiteDefaultsFunctions.SetChecker(TP_SITE_PROPS, Host)
|
||||
|
||||
With DirectCast(MyDefs.MyFieldsChecker, FieldsChecker)
|
||||
With MyDefs.MyFieldsCheckerE
|
||||
.AddControl(Of String)(TXT_PATH, TXT_PATH.CaptionText, True, New SavedPostsChecker)
|
||||
.AddControl(Of String)(TXT_PATH_SAVED_POSTS, TXT_PATH_SAVED_POSTS.CaptionText, True, New SavedPostsChecker)
|
||||
End With
|
||||
@@ -115,10 +114,9 @@ Namespace Editors
|
||||
.CreateControl(TT_MAIN)
|
||||
AddTpControl(.Control, .ControlHeight)
|
||||
If .LeftOffset > offset Then offset = .LeftOffset
|
||||
If Not .Options.AllowNull Or Not .ProviderFieldsChecker Is Nothing Then
|
||||
DirectCast(MyDefs.MyFieldsChecker, FieldsChecker).
|
||||
AddControl(.Control, .Options.ControlText, .Type, .Options.AllowNull, .ProviderFieldsChecker)
|
||||
End If
|
||||
If Not .Options.AllowNull Or Not .ProviderFieldsChecker Is Nothing Then _
|
||||
MyDefs.MyFieldsCheckerE.AddControl(.Control, .Options.ControlText, .Type,
|
||||
.Options.AllowNull, .ProviderFieldsChecker)
|
||||
End If
|
||||
End With
|
||||
End If
|
||||
@@ -155,7 +153,7 @@ Namespace Editors
|
||||
LBL_AUTH.Dispose()
|
||||
LBL_OTHER.Dispose()
|
||||
End Sub
|
||||
Private Sub OK() Implements IOkCancelToolbar.OK
|
||||
Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick
|
||||
If MyDefs.MyFieldsChecker.AllParamsOK Then
|
||||
Dim i%, ii%
|
||||
With Host
|
||||
@@ -198,13 +196,10 @@ Namespace Editors
|
||||
MyDefs.CloseForm()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
MyDefs.CloseForm(DialogResult.Cancel)
|
||||
End Sub
|
||||
Private Sub TXT_PATH_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_PATH.ActionOnButtonClick
|
||||
Private Sub TXT_PATH_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_PATH.ActionOnButtonClick
|
||||
ChangePath(Sender, Host.Path(False), TXT_PATH)
|
||||
End Sub
|
||||
Private Sub TXT_PATH_SAVED_POSTS_ActionOnButtonClick(Sender As ActionButton) Handles TXT_PATH_SAVED_POSTS.ActionOnButtonClick
|
||||
Private Sub TXT_PATH_SAVED_POSTS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_PATH_SAVED_POSTS.ActionOnButtonClick
|
||||
ChangePath(Sender, Host.SavedPostsPath(False), TXT_PATH_SAVED_POSTS)
|
||||
End Sub
|
||||
Private Sub ChangePath(ByVal Sender As ActionButton, ByVal PathValue As SFile, ByRef CNT As TextBoxExtended)
|
||||
@@ -213,27 +208,27 @@ Namespace Editors
|
||||
If Not f.IsEmptyString Then CNT.Text = f
|
||||
End If
|
||||
End Sub
|
||||
Private Sub TXT_COOKIES_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_COOKIES.ActionOnButtonClick
|
||||
If Sender.DefaultButton = ActionButton.DefaultButtons.Edit Then
|
||||
If Not Host.Responser Is Nothing Then
|
||||
Using f As New CookieListForm(Host.Responser) With {
|
||||
.MyDesignXML = Settings.Design,
|
||||
.DisableControls = CookieControl.AddFromInternal + CookieControl.AuthorizeProgram + CookieControl.OpenBrowser
|
||||
}
|
||||
f.ShowDialog()
|
||||
End Using
|
||||
SetCookieText()
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub TXT_COOKIES_ActionOnButtonClearClick() Handles TXT_COOKIES.ActionOnButtonClearClick
|
||||
If Not Host.Responser Is Nothing Then
|
||||
With Host.Responser
|
||||
If Not .Cookies Is Nothing Then .Cookies.Dispose()
|
||||
.Cookies = New CookieKeeper(.CookiesDomain)
|
||||
End With
|
||||
SetCookieText()
|
||||
End If
|
||||
Private Sub TXT_COOKIES_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_COOKIES.ActionOnButtonClick
|
||||
Select Case Sender.DefaultButton
|
||||
Case ActionButton.DefaultButtons.Edit
|
||||
If Not Host.Responser Is Nothing Then
|
||||
Using f As New CookieListForm(Host.Responser) With {
|
||||
.MyDesignXML = Settings.Design,
|
||||
.DisableControls = CookieControl.AddFromInternal + CookieControl.AuthorizeProgram + CookieControl.OpenBrowser
|
||||
}
|
||||
f.ShowDialog()
|
||||
End Using
|
||||
SetCookieText()
|
||||
End If
|
||||
Case ActionButton.DefaultButtons.Clear
|
||||
If Not Host.Responser Is Nothing Then
|
||||
With Host.Responser
|
||||
If Not .Cookies Is Nothing Then .Cookies.Dispose()
|
||||
.Cookies = New CookieKeeper(.CookiesDomain)
|
||||
End With
|
||||
SetCookieText()
|
||||
End If
|
||||
End Select
|
||||
End Sub
|
||||
Private Sub SetCookieText()
|
||||
If Not Host.Responser Is Nothing Then TXT_COOKIES.Text = $"{If(Host.Responser.Cookies?.Count, 0)} cookies"
|
||||
|
||||
@@ -7,39 +7,42 @@
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Imports PersonalUtilities.Forms.Controls.Base
|
||||
Namespace Editors
|
||||
Friend Class SiteSelectionForm : Implements IOkCancelToolbar
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Friend Class SiteSelectionForm
|
||||
Private WithEvents MyDefs As DefaultFormOptions
|
||||
Friend ReadOnly Property SelectedSites As List(Of String)
|
||||
Friend Sub New(ByVal s As List(Of String))
|
||||
InitializeComponent()
|
||||
SelectedSites.ListAddList(s)
|
||||
If SelectedSites Is Nothing Then SelectedSites = New List(Of String)
|
||||
MyDefs = New DefaultFormOptions
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
End Sub
|
||||
Private Sub SiteSelectionForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design, True)
|
||||
.AddOkCancelToolbar()
|
||||
CMB_SITES.BeginUpdate()
|
||||
Dim sl As List(Of String) = ListAddList(Nothing, Settings.Plugins.Select(Function(p) p.Name))
|
||||
CMB_SITES.Items.AddRange(sl.Select(Function(s) New ListItem(s)))
|
||||
Dim l As New List(Of Integer)
|
||||
If SelectedSites.Count > 0 Then sl.ForEach(Sub(s) If SelectedSites.Contains(s) Then l.Add(sl.IndexOf(s)))
|
||||
sl.Clear()
|
||||
CMB_SITES.EndUpdate()
|
||||
If l.Count > 0 Then CMB_SITES.ListCheckedIndexes = l : l.Clear()
|
||||
.DelegateClosingChecker = False
|
||||
.EndLoaderOperations()
|
||||
.MyOkCancel.EnableOK = True
|
||||
End With
|
||||
Try
|
||||
With MyDefs
|
||||
.MyViewInitialize(True)
|
||||
.AddOkCancelToolbar()
|
||||
CMB_SITES.BeginUpdate()
|
||||
Dim sl As List(Of String) = ListAddList(Nothing, Settings.Plugins.Select(Function(p) p.Name))
|
||||
CMB_SITES.Items.AddRange(sl.Select(Function(s) New ListItem(s)))
|
||||
Dim l As New List(Of Integer)
|
||||
If SelectedSites.Count > 0 Then sl.ForEach(Sub(s) If SelectedSites.Contains(s) Then l.Add(sl.IndexOf(s)))
|
||||
sl.Clear()
|
||||
CMB_SITES.EndUpdate()
|
||||
If l.Count > 0 Then CMB_SITES.ListCheckedIndexes = l : l.Clear()
|
||||
.DelegateClosingChecker = False
|
||||
.EndLoaderOperations()
|
||||
.MyOkCancel.EnableOK = True
|
||||
End With
|
||||
Catch ex As Exception
|
||||
MyDefs.InvokeLoaderError(ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub SiteSelectionForm_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
|
||||
SelectedSites.Clear()
|
||||
End Sub
|
||||
Public Sub OK() Implements IOkCancelToolbar.OK
|
||||
Private Sub MyDefs_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDefs.ButtonOkClick
|
||||
Try
|
||||
SelectedSites.ListAddList(CMB_SITES.Items.CheckedItems.Select(Function(i) CStr(i.Value(0))), LAP.ClearBeforeAdd)
|
||||
MyDefs.CloseForm()
|
||||
@@ -47,8 +50,5 @@ Namespace Editors
|
||||
ErrorsDescriber.Execute(EDP.LogMessageValue, ex)
|
||||
End Try
|
||||
End Sub
|
||||
Public Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
MyDefs.CloseForm(DialogResult.Cancel)
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
45
SCrawler/Editors/UserCreatorForm.Designer.vb
generated
45
SCrawler/Editors/UserCreatorForm.Designer.vb
generated
@@ -32,6 +32,7 @@
|
||||
Dim ActionButton7 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Dim ActionButton8 As PersonalUtilities.Forms.Controls.Base.ActionButton = New PersonalUtilities.Forms.Controls.Base.ActionButton()
|
||||
Dim TT_MAIN As System.Windows.Forms.ToolTip
|
||||
Dim CONTAINER_MAIN As System.Windows.Forms.ToolStripContainer
|
||||
Me.TXT_USER = New PersonalUtilities.Forms.Controls.TextBoxExtended()
|
||||
Me.CH_IS_CHANNEL = New System.Windows.Forms.CheckBox()
|
||||
Me.CMB_SITE = New PersonalUtilities.Forms.Controls.ComboBoxExtended()
|
||||
@@ -50,13 +51,13 @@
|
||||
Me.CH_DOWN_VIDEOS = New System.Windows.Forms.CheckBox()
|
||||
Me.TXT_SPEC_FOLDER = New PersonalUtilities.Forms.Controls.TextBoxExtended()
|
||||
Me.TXT_SCRIPT = New PersonalUtilities.Forms.Controls.TextBoxExtended()
|
||||
Me.CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
|
||||
TP_MAIN = New System.Windows.Forms.TableLayoutPanel()
|
||||
TP_SITE = New System.Windows.Forms.TableLayoutPanel()
|
||||
TP_PARAMS = New System.Windows.Forms.TableLayoutPanel()
|
||||
TP_OTHER = New System.Windows.Forms.TableLayoutPanel()
|
||||
TP_DOWN_OPTIONS = New System.Windows.Forms.TableLayoutPanel()
|
||||
TT_MAIN = New System.Windows.Forms.ToolTip(Me.components)
|
||||
CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer()
|
||||
TP_MAIN.SuspendLayout()
|
||||
CType(Me.TXT_USER, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
TP_SITE.SuspendLayout()
|
||||
@@ -70,8 +71,8 @@
|
||||
TP_DOWN_OPTIONS.SuspendLayout()
|
||||
CType(Me.TXT_SPEC_FOLDER, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.TXT_SCRIPT, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.CONTAINER_MAIN.ContentPanel.SuspendLayout()
|
||||
Me.CONTAINER_MAIN.SuspendLayout()
|
||||
CONTAINER_MAIN.ContentPanel.SuspendLayout()
|
||||
CONTAINER_MAIN.SuspendLayout()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'TP_MAIN
|
||||
@@ -125,7 +126,7 @@
|
||||
TP_SITE.ColumnCount = 3
|
||||
TP_SITE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 79.0!))
|
||||
TP_SITE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
|
||||
TP_SITE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 98.0!))
|
||||
TP_SITE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100.0!))
|
||||
TP_SITE.Controls.Add(Me.CH_IS_CHANNEL, 0, 0)
|
||||
TP_SITE.Controls.Add(Me.CMB_SITE, 1, 0)
|
||||
TP_SITE.Controls.Add(Me.BTT_OTHER_SETTINGS, 2, 0)
|
||||
@@ -168,17 +169,17 @@
|
||||
Me.CMB_SITE.Location = New System.Drawing.Point(84, 3)
|
||||
Me.CMB_SITE.Margin = New System.Windows.Forms.Padding(3, 2, 3, 3)
|
||||
Me.CMB_SITE.Name = "CMB_SITE"
|
||||
Me.CMB_SITE.Size = New System.Drawing.Size(265, 22)
|
||||
Me.CMB_SITE.Size = New System.Drawing.Size(263, 22)
|
||||
Me.CMB_SITE.TabIndex = 1
|
||||
Me.CMB_SITE.TextBoxBorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
|
||||
'
|
||||
'BTT_OTHER_SETTINGS
|
||||
'
|
||||
Me.BTT_OTHER_SETTINGS.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.BTT_OTHER_SETTINGS.Location = New System.Drawing.Point(354, 2)
|
||||
Me.BTT_OTHER_SETTINGS.Location = New System.Drawing.Point(352, 2)
|
||||
Me.BTT_OTHER_SETTINGS.Margin = New System.Windows.Forms.Padding(1)
|
||||
Me.BTT_OTHER_SETTINGS.Name = "BTT_OTHER_SETTINGS"
|
||||
Me.BTT_OTHER_SETTINGS.Size = New System.Drawing.Size(96, 24)
|
||||
Me.BTT_OTHER_SETTINGS.Size = New System.Drawing.Size(98, 24)
|
||||
Me.BTT_OTHER_SETTINGS.TabIndex = 2
|
||||
Me.BTT_OTHER_SETTINGS.Text = "Options (F2)"
|
||||
TT_MAIN.SetToolTip(Me.BTT_OTHER_SETTINGS, "Other settings")
|
||||
@@ -438,23 +439,23 @@
|
||||
'
|
||||
'CONTAINER_MAIN.ContentPanel
|
||||
'
|
||||
Me.CONTAINER_MAIN.ContentPanel.Controls.Add(TP_MAIN)
|
||||
Me.CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(454, 461)
|
||||
Me.CONTAINER_MAIN.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.CONTAINER_MAIN.LeftToolStripPanelVisible = False
|
||||
Me.CONTAINER_MAIN.Location = New System.Drawing.Point(0, 0)
|
||||
Me.CONTAINER_MAIN.Name = "CONTAINER_MAIN"
|
||||
Me.CONTAINER_MAIN.RightToolStripPanelVisible = False
|
||||
Me.CONTAINER_MAIN.Size = New System.Drawing.Size(454, 461)
|
||||
Me.CONTAINER_MAIN.TabIndex = 0
|
||||
Me.CONTAINER_MAIN.TopToolStripPanelVisible = False
|
||||
CONTAINER_MAIN.ContentPanel.Controls.Add(TP_MAIN)
|
||||
CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(454, 461)
|
||||
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(454, 461)
|
||||
CONTAINER_MAIN.TabIndex = 0
|
||||
CONTAINER_MAIN.TopToolStripPanelVisible = False
|
||||
'
|
||||
'UserCreatorForm
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(454, 461)
|
||||
Me.Controls.Add(Me.CONTAINER_MAIN)
|
||||
Me.Controls.Add(CONTAINER_MAIN)
|
||||
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
|
||||
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
||||
Me.KeyPreview = True
|
||||
@@ -484,14 +485,12 @@
|
||||
TP_DOWN_OPTIONS.PerformLayout()
|
||||
CType(Me.TXT_SPEC_FOLDER, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.TXT_SCRIPT, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.CONTAINER_MAIN.ContentPanel.ResumeLayout(False)
|
||||
Me.CONTAINER_MAIN.ResumeLayout(False)
|
||||
Me.CONTAINER_MAIN.PerformLayout()
|
||||
CONTAINER_MAIN.ContentPanel.ResumeLayout(False)
|
||||
CONTAINER_MAIN.ResumeLayout(False)
|
||||
CONTAINER_MAIN.PerformLayout()
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
||||
Private WithEvents CONTAINER_MAIN As ToolStripContainer
|
||||
Private WithEvents TXT_USER As PersonalUtilities.Forms.Controls.TextBoxExtended
|
||||
Private WithEvents CH_TEMP As CheckBox
|
||||
Private WithEvents CH_FAV As CheckBox
|
||||
|
||||
@@ -294,6 +294,9 @@
|
||||
AFuc5QFgn6ClHh5iOQVAKNixyucB8NY0vG9JOzzyhrdq5IRgAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="CONTAINER_MAIN.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAkAMDAQAAAAAABoBgAAlgAAACAgEAAAAAAA6AIAAP4GAAAQEBAAAAAAACgBAADmCQAAMDAAAAEA
|
||||
|
||||
@@ -9,15 +9,14 @@
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Controls
|
||||
Imports PersonalUtilities.Forms.Controls.Base
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Imports PersonalUtilities.Functions.RegularExpressions
|
||||
Imports SCrawler.API.Base
|
||||
Imports SCrawler.Plugin
|
||||
Imports SCrawler.Plugin.Hosts
|
||||
Imports ADB = PersonalUtilities.Forms.Controls.Base.ActionButton.DefaultButtons
|
||||
Namespace Editors
|
||||
Friend Class UserCreatorForm : Implements IOkCancelToolbar
|
||||
Private ReadOnly MyDef As DefaultFormOptions
|
||||
Friend Class UserCreatorForm
|
||||
Private WithEvents MyDef As DefaultFormOptions
|
||||
Friend Property User As UserInfo
|
||||
Private Property UserInstance As IUserData
|
||||
#Region "User options"
|
||||
@@ -100,7 +99,7 @@ Namespace Editors
|
||||
Friend Sub New()
|
||||
InitializeComponent()
|
||||
UserLabels = New List(Of String)
|
||||
MyDef = New DefaultFormOptions
|
||||
MyDef = New DefaultFormOptions(Me, Settings.Design)
|
||||
End Sub
|
||||
''' <summary>Edit exist user</summary>
|
||||
Friend Sub New(ByVal _Instance As IUserData)
|
||||
@@ -115,7 +114,7 @@ Namespace Editors
|
||||
Private Sub UserCreatorForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
With MyDef
|
||||
.MyViewInitialize(Me, Settings.Design, True)
|
||||
.MyViewInitialize(True)
|
||||
.AddOkCancelToolbar()
|
||||
CH_AUTO_DETECT_SITE.Enabled = False
|
||||
With CMB_SITE
|
||||
@@ -168,7 +167,7 @@ Namespace Editors
|
||||
End If
|
||||
End If
|
||||
.MyFieldsChecker = New FieldsChecker
|
||||
DirectCast(.MyFieldsChecker, FieldsChecker).AddControl(Of String)(TXT_USER, TXT_USER.CaptionText)
|
||||
.MyFieldsCheckerE.AddControl(Of String)(TXT_USER, TXT_USER.CaptionText)
|
||||
.MyFieldsChecker.EndLoaderOperations()
|
||||
.EndLoaderOperations()
|
||||
End With
|
||||
@@ -190,7 +189,7 @@ Namespace Editors
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "Ok, Cancel"
|
||||
Private Sub OK() Implements IOkCancelToolbar.OK
|
||||
Private Sub MyDef_ButtonOkClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDef.ButtonOkClick
|
||||
If Not CH_ADD_BY_LIST.Checked Then
|
||||
If MyDef.MyFieldsChecker.AllParamsOK Then
|
||||
Dim s As SettingsHost = GetSiteByCheckers()
|
||||
@@ -250,13 +249,13 @@ Namespace Editors
|
||||
CloseForm:
|
||||
MyDef.CloseForm()
|
||||
End Sub
|
||||
Private Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
Private Sub MyDef_ButtonCancelClick(ByVal Sender As Object, ByVal e As KeyHandleEventArgs) Handles MyDef.ButtonCancelClick
|
||||
MyDef.CloseForm(IIf(StartIndex >= 0, DialogResult.OK, DialogResult.Cancel))
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "Controls handlers"
|
||||
Private _TextChangeInvoked As Boolean = False
|
||||
Private Sub TXT_USER_ActionOnTextChange() Handles TXT_USER.ActionOnTextChange
|
||||
Private Sub TXT_USER_ActionOnTextChanged(ByVal Sender As Object, ByVal e As EventArgs) Handles TXT_USER.ActionOnTextChanged
|
||||
Try
|
||||
If Not _TextChangeInvoked Then
|
||||
_TextChangeInvoked = True
|
||||
@@ -280,10 +279,10 @@ CloseForm:
|
||||
End If
|
||||
_TextChangeInvoked = False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub CMB_SITE_ActionSelectedItemChanged(ByVal _Item As ListViewItem) Handles CMB_SITE.ActionSelectedItemChanged
|
||||
Private Sub CMB_SITE_ActionSelectedItemChanged(ByVal Item As ListViewItem) Handles CMB_SITE.ActionSelectedItemChanged
|
||||
CH_IS_CHANNEL.Checked = False
|
||||
MyExchangeOptions = Nothing
|
||||
SetParamsBySite()
|
||||
@@ -296,8 +295,8 @@ CloseForm:
|
||||
MyDef.MyOkCancel.EnableOK = True
|
||||
End If
|
||||
End Sub
|
||||
Private Sub TXT_SPEC_FOLDER_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_SPEC_FOLDER.ActionOnButtonClick
|
||||
If Sender.DefaultButton = ActionButton.DefaultButtons.Open Then
|
||||
Private Sub TXT_SPEC_FOLDER_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_SPEC_FOLDER.ActionOnButtonClick
|
||||
If Sender.DefaultButton = ADB.Open Then
|
||||
Dim f As SFile = Nothing
|
||||
If Not TXT_SPEC_FOLDER.Text.IsEmptyString Then f = $"{TXT_SPEC_FOLDER.Text}\"
|
||||
f = SFile.SelectPath(f, True)
|
||||
@@ -333,13 +332,13 @@ CloseForm:
|
||||
BTT_OTHER_SETTINGS.Enabled = True
|
||||
End If
|
||||
End Sub
|
||||
Private Sub TXT_LABELS_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_LABELS.ActionOnButtonClick
|
||||
Private Sub TXT_LABELS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_LABELS.ActionOnButtonClick
|
||||
Select Case Sender.DefaultButton
|
||||
Case ADB.Open : ChangeLabels()
|
||||
Case ADB.Clear : UserLabels.Clear()
|
||||
End Select
|
||||
End Sub
|
||||
Private Sub TXT_SCRIPT_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_SCRIPT.ActionOnButtonClick
|
||||
Private Sub TXT_SCRIPT_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_SCRIPT.ActionOnButtonClick
|
||||
SettingsCLS.ScriptTextBoxButtonClick(TXT_SCRIPT, Sender)
|
||||
End Sub
|
||||
#End Region
|
||||
@@ -449,7 +448,7 @@ CloseForm:
|
||||
End If
|
||||
Return False
|
||||
Catch ex As Exception
|
||||
Return ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Error on adding users by list", False)
|
||||
Return ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Error when adding users by list", False)
|
||||
End Try
|
||||
End Function
|
||||
Private Function GetSiteByText(ByRef TXT As String) As ExchangeOptions
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports PersonalUtilities.Forms
|
||||
Imports PersonalUtilities.Forms.Toolbars
|
||||
Friend Class FDatePickerForm : Implements IOkCancelDeleteToolbar
|
||||
Private MyDefs As DefaultFormOptions
|
||||
Friend Class FDatePickerForm
|
||||
Private ReadOnly MyDefs As DefaultFormOptions
|
||||
Friend ReadOnly Property SelectedDate As Date?
|
||||
Get
|
||||
If DT.Checked Then Return DT.Value.Date Else Return Nothing
|
||||
@@ -19,12 +18,12 @@ Friend Class FDatePickerForm : Implements IOkCancelDeleteToolbar
|
||||
Friend Sub New(ByVal d As Date?)
|
||||
InitializeComponent()
|
||||
_InitialValue = d
|
||||
MyDefs = New DefaultFormOptions(Me, Settings.Design)
|
||||
End Sub
|
||||
Private Sub FDatePickerForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
MyDefs = New DefaultFormOptions
|
||||
With MyDefs
|
||||
.MyViewInitialize(Me, Settings.Design, True)
|
||||
.AddOkCancelToolbar()
|
||||
.MyViewInitialize(True)
|
||||
.AddOkCancelToolbar(True)
|
||||
If _InitialValue.HasValue Then
|
||||
DT.Checked = True
|
||||
DT.Value = _InitialValue.Value.Date
|
||||
@@ -36,13 +35,4 @@ Friend Class FDatePickerForm : Implements IOkCancelDeleteToolbar
|
||||
MyDefs.MyOkCancel.EnableOK = True
|
||||
End With
|
||||
End Sub
|
||||
Private Sub OK() Implements IOkCancelToolbar.OK
|
||||
MyDefs.CloseForm()
|
||||
End Sub
|
||||
Private Sub Cancel() Implements IOkCancelToolbar.Cancel
|
||||
MyDefs.CloseForm(DialogResult.Cancel)
|
||||
End Sub
|
||||
Private Sub Delete() Implements IOkCancelDeleteToolbar.Delete
|
||||
MyDefs.CloseForm(DialogResult.Abort)
|
||||
End Sub
|
||||
End Class
|
||||
@@ -101,7 +101,7 @@ Friend Class LabelsKeeper : Implements ICollection(Of String), IMyEnumerator(Of
|
||||
End Function
|
||||
Private ReadOnly Property IsReadOnly As Boolean = False Implements ICollection(Of String).IsReadOnly
|
||||
Private Sub CopyTo(ByVal _Array() As String, ByVal ArrayIndex As Integer) Implements ICollection(Of String).CopyTo
|
||||
Throw New NotImplementedException()
|
||||
LabelsList.CopyTo(_Array, ArrayIndex)
|
||||
End Sub
|
||||
#Region "IEnumerable Support"
|
||||
Private Function GetEnumerator() As IEnumerator(Of String) Implements IEnumerable(Of String).GetEnumerator
|
||||
|
||||
@@ -47,8 +47,8 @@ Friend Class ListImagesLoader
|
||||
If Settings.ViewModeIsPicture Then
|
||||
.LargeImageList.ColorDepth = ColorDepth.Depth32Bit
|
||||
.SmallImageList.ColorDepth = ColorDepth.Depth32Bit
|
||||
.LargeImageList.ImageSize = New Size(DivideWithZeroChecking(Settings.MaxLargeImageHeigh.Value, 100) * 75, Settings.MaxLargeImageHeigh.Value)
|
||||
.SmallImageList.ImageSize = New Size(DivideWithZeroChecking(Settings.MaxSmallImageHeigh.Value, 100) * 75, Settings.MaxSmallImageHeigh.Value)
|
||||
.LargeImageList.ImageSize = New Size(DivideWithZeroChecking(Settings.MaxLargeImageHeight.Value, 100) * 75, Settings.MaxLargeImageHeight.Value)
|
||||
.SmallImageList.ImageSize = New Size(DivideWithZeroChecking(Settings.MaxSmallImageHeight.Value, 100) * 75, Settings.MaxSmallImageHeight.Value)
|
||||
End If
|
||||
End With
|
||||
End Sub
|
||||
@@ -148,11 +148,11 @@ Friend Class ListImagesLoader
|
||||
Friend Shared Function ApplyLVIColor(ByVal User As IUserData, ByVal LVI As ListViewItem, ByVal IsInit As Boolean) As ListViewItem
|
||||
With LVI
|
||||
If Not User.Exists Then
|
||||
.BackColor = ColorBttDeleteBack
|
||||
.ForeColor = ColorBttDeleteFore
|
||||
.BackColor = MyColor.DeleteBack
|
||||
.ForeColor = MyColor.DeleteFore
|
||||
ElseIf User.Suspended Then
|
||||
.BackColor = ColorBttEditBack
|
||||
.ForeColor = ColorBttEditFore
|
||||
.BackColor = MyColor.EditBack
|
||||
.ForeColor = MyColor.EditFore
|
||||
ElseIf CheckUserCollection(User) Then
|
||||
.BackColor = Color.LightSkyBlue
|
||||
.ForeColor = Color.MidnightBlue
|
||||
|
||||
18
SCrawler/MainFrame.Designer.vb
generated
18
SCrawler/MainFrame.Designer.vb
generated
@@ -50,6 +50,7 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
|
||||
Me.BTT_DOWN_SITE_FULL = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.BTT_ADD_NEW_GROUP = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.BTT_DOWN_AUTOMATION = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.BTT_DOWN_AUTOMATION_PAUSE = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.BTT_DOWN_VIDEO = New System.Windows.Forms.ToolStripButton()
|
||||
Me.BTT_DOWN_STOP = New System.Windows.Forms.ToolStripButton()
|
||||
Me.MENU_VIEW = New System.Windows.Forms.ToolStripDropDownButton()
|
||||
@@ -104,7 +105,6 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
|
||||
Me.BTT_TRAY_SHOW_HIDE = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.BTT_TRAY_CLOSE = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.BTT_TRAY_CLOSE_NO_SCRIPT = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.BTT_DOWN_AUTOMATION_PAUSE = New System.Windows.Forms.ToolStripMenuItem()
|
||||
SEP_1 = New System.Windows.Forms.ToolStripSeparator()
|
||||
SEP_2 = New System.Windows.Forms.ToolStripSeparator()
|
||||
CONTEXT_SEP_1 = New System.Windows.Forms.ToolStripSeparator()
|
||||
@@ -372,6 +372,13 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
|
||||
Me.BTT_DOWN_AUTOMATION.Size = New System.Drawing.Size(231, 22)
|
||||
Me.BTT_DOWN_AUTOMATION.Text = "Automation"
|
||||
'
|
||||
'BTT_DOWN_AUTOMATION_PAUSE
|
||||
'
|
||||
Me.BTT_DOWN_AUTOMATION_PAUSE.Image = Global.SCrawler.My.Resources.Resources.Pause_Blue_16
|
||||
Me.BTT_DOWN_AUTOMATION_PAUSE.Name = "BTT_DOWN_AUTOMATION_PAUSE"
|
||||
Me.BTT_DOWN_AUTOMATION_PAUSE.Size = New System.Drawing.Size(231, 22)
|
||||
Me.BTT_DOWN_AUTOMATION_PAUSE.Text = "Pause automation"
|
||||
'
|
||||
'BTT_DOWN_VIDEO
|
||||
'
|
||||
Me.BTT_DOWN_VIDEO.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text
|
||||
@@ -547,7 +554,7 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
|
||||
Me.BTT_DONATE.Name = "BTT_DONATE"
|
||||
Me.BTT_DONATE.Size = New System.Drawing.Size(23, 20)
|
||||
Me.BTT_DONATE.Text = "Donate"
|
||||
Me.BTT_DONATE.ToolTipText = "Donate"
|
||||
Me.BTT_DONATE.ToolTipText = "Support"
|
||||
'
|
||||
'Toolbar_BOTTOM
|
||||
'
|
||||
@@ -766,13 +773,6 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
|
||||
Me.BTT_TRAY_CLOSE_NO_SCRIPT.ToolTipText = "Close the program without executing the script"
|
||||
Me.BTT_TRAY_CLOSE_NO_SCRIPT.Visible = False
|
||||
'
|
||||
'BTT_DOWN_AUTOMATION_PAUSE
|
||||
'
|
||||
Me.BTT_DOWN_AUTOMATION_PAUSE.Image = Global.SCrawler.My.Resources.Resources.Pause_Blue_16
|
||||
Me.BTT_DOWN_AUTOMATION_PAUSE.Name = "BTT_DOWN_AUTOMATION_PAUSE"
|
||||
Me.BTT_DOWN_AUTOMATION_PAUSE.Size = New System.Drawing.Size(231, 22)
|
||||
Me.BTT_DOWN_AUTOMATION_PAUSE.Text = "Pause automation"
|
||||
'
|
||||
'MainFrame
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
|
||||
@@ -138,7 +138,7 @@ EndFunction:
|
||||
Downloader.Dispose()
|
||||
MyProgressForm.Dispose()
|
||||
InfoForm.Dispose()
|
||||
MainFrameObj.CLearNotifications()
|
||||
MainFrameObj.ClearNotifications()
|
||||
If Not MyChannels Is Nothing Then MyChannels.Dispose()
|
||||
If Not VideoDownloader Is Nothing Then VideoDownloader.Dispose()
|
||||
If Not MySavedPosts Is Nothing Then MySavedPosts.Dispose()
|
||||
@@ -206,7 +206,7 @@ CloseResume:
|
||||
Case Keys.F2 : DownloadVideoByURL()
|
||||
Case Keys.F3 : EditSelectedUser()
|
||||
Case Keys.F5 : BTT_DOWN_SELECTED.PerformClick()
|
||||
Case Keys.F6 : If Settings.ShowingMode.Value = ShowingModes.All Then BTT_DOWN_ALL.PerformClick()
|
||||
Case Keys.F6 : BTT_DOWN_ALL.PerformClick()
|
||||
Case Else : b = NumGroup(e)
|
||||
End Select
|
||||
If b Then e.Handled = True
|
||||
@@ -262,13 +262,13 @@ CloseResume:
|
||||
#Region "Settings"
|
||||
Private Sub BTT_SETTINGS_Click(sender As Object, e As EventArgs) Handles BTT_SETTINGS.Click
|
||||
With Settings
|
||||
Dim mhl% = .MaxLargeImageHeigh.Value
|
||||
Dim mhs% = .MaxSmallImageHeigh.Value
|
||||
Dim mhl% = .MaxLargeImageHeight.Value
|
||||
Dim mhs% = .MaxSmallImageHeight.Value
|
||||
Dim sg As Boolean = .ShowGroups
|
||||
Using f As New GlobalSettingsForm
|
||||
f.ShowDialog()
|
||||
If f.DialogResult = DialogResult.OK Then
|
||||
If ((Not .MaxLargeImageHeigh = mhl Or Not .MaxSmallImageHeigh = mhs) And .ViewModeIsPicture) Or
|
||||
If ((Not .MaxLargeImageHeight = mhl Or Not .MaxSmallImageHeight = mhs) And .ViewModeIsPicture) Or
|
||||
(Not sg = Settings.ShowGroups And .UseGrouping) Then RefillList()
|
||||
TrayIcon.Visible = .CloseToTray
|
||||
LIST_PROFILES.ShowGroups = .UseGrouping
|
||||
@@ -565,7 +565,6 @@ CloseResume:
|
||||
.ShowingMode.Value = m
|
||||
End If
|
||||
End With
|
||||
BTT_DOWN_ALL.Enabled = m = ShowingModes.All
|
||||
End Sub
|
||||
Private Sub SetExcludedButtonChecker()
|
||||
BTT_SHOW_EXCLUDED_LABELS.Checked = Settings.Labels.Excluded.Count > 0
|
||||
@@ -696,7 +695,7 @@ CloseResume:
|
||||
End If
|
||||
End Using
|
||||
Else
|
||||
MsgBoxE("No one user does not detected", vbExclamation)
|
||||
MsgBoxE("No user found", vbExclamation)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.ShowAllMsg, ex, "[ChangeUserGroups]")
|
||||
@@ -747,7 +746,7 @@ CloseResume:
|
||||
End Sub
|
||||
Private Sub BTT_CONTEXT_ADD_TO_COL_Click(sender As Object, e As EventArgs) Handles BTT_CONTEXT_ADD_TO_COL.Click
|
||||
If Settings.CollectionsPath.Value.IsEmptyString Then
|
||||
MsgBoxE("Collection path does not set", MsgBoxStyle.Exclamation)
|
||||
MsgBoxE("Collection path not specified", MsgBoxStyle.Exclamation)
|
||||
Else
|
||||
Dim user As IUserData = GetSelectedUser()
|
||||
If Not user Is Nothing Then
|
||||
@@ -979,7 +978,7 @@ CloseResume:
|
||||
On Error Resume Next
|
||||
If user.IsCollection Then
|
||||
If USER_CONTEXT.Visible Then USER_CONTEXT.Hide()
|
||||
MsgBoxE($"This is collection!{vbNewLine}Edit collections does not allowed!", vbExclamation)
|
||||
MsgBoxE($"This is collection!{vbNewLine}Collection editing not allowed!", vbExclamation)
|
||||
Else
|
||||
Using f As New UserCreatorForm(user)
|
||||
f.ShowDialog()
|
||||
|
||||
@@ -27,14 +27,14 @@ Friend Class MainFrameObjects
|
||||
Else
|
||||
RemoveHandler User.UserUpdated, AddressOf MF.User_OnUserUpdated
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
Friend Sub CollectionHandler(ByVal [Collection] As UserDataBind)
|
||||
Try
|
||||
AddHandler Collection.OnCollectionSelfRemoved, AddressOf MF.CollectionRemoved
|
||||
AddHandler Collection.OnUserRemoved, AddressOf MF.UserRemovedFromCollection
|
||||
Catch ex As Exception
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
Friend Sub Focus(Optional ByVal Show As Boolean = False)
|
||||
@@ -54,7 +54,7 @@ Friend Class MainFrameObjects
|
||||
Friend Overloads Sub ShowNotification(ByVal Message As String, ByVal Title As String, ByVal Icon As ToolTipIcon)
|
||||
MF.TrayIcon.ShowBalloonTip(2000, Title, Message, Icon)
|
||||
End Sub
|
||||
Friend Sub CLearNotifications()
|
||||
Friend Sub ClearNotifications()
|
||||
Notificator.Clear()
|
||||
End Sub
|
||||
Private Sub Notificator_OnClicked(ByVal Key As String) Handles Notificator.OnClicked
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
'
|
||||
' 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.Functions.RegularExpressions
|
||||
Imports PersonalUtilities.Tools
|
||||
@@ -16,7 +15,6 @@ Imports SCrawler.API
|
||||
Imports SCrawler.API.Base
|
||||
Imports SCrawler.Plugin.Hosts
|
||||
Imports SCrawler.DownloadObjects
|
||||
Imports DownOptions = SCrawler.Plugin.ISiteSettings.Download
|
||||
Friend Module MainMod
|
||||
Friend Settings As SettingsCLS
|
||||
Friend Const SettingsFolderName As String = "Settings"
|
||||
@@ -85,6 +83,11 @@ Friend Module MainMod
|
||||
Deleted = 10000
|
||||
Suspended = 12000
|
||||
End Enum
|
||||
Friend Enum FileNameReplaceMode As Integer
|
||||
None = 0
|
||||
Replace = 1
|
||||
Add = 2
|
||||
End Enum
|
||||
Friend Downloader As TDownloader
|
||||
Friend InfoForm As DownloadedInfoForm
|
||||
Friend VideoDownloader As VideosDownloaderForm
|
||||
@@ -133,138 +136,6 @@ Friend Module MainMod
|
||||
Return $"{If(Host?.Name, String.Empty)}{Opt}"
|
||||
End If
|
||||
End Function
|
||||
Friend Structure UserInfo : Implements IComparable(Of UserInfo), IEquatable(Of UserInfo), ICloneable, IEContainerProvider
|
||||
Friend Const Name_Site As String = "Site"
|
||||
Friend Const Name_Plugin As String = "Plugin"
|
||||
Friend Const Name_Collection As String = "Collection"
|
||||
Friend Const Name_Merged As String = "Merged"
|
||||
Friend Const Name_IsChannel As String = "IsChannel"
|
||||
Friend Const Name_SpecialPath As String = "SpecialPath"
|
||||
Friend Name As String
|
||||
Friend Site As String
|
||||
Friend Plugin As String
|
||||
Friend File As SFile
|
||||
Friend SpecialPath As SFile
|
||||
Friend Merged As Boolean
|
||||
Friend IncludedInCollection As Boolean
|
||||
Friend CollectionName As String
|
||||
Friend IsChannel As Boolean
|
||||
Friend [Protected] As Boolean
|
||||
Friend ReadOnly Property DownloadOption As DownOptions
|
||||
Get
|
||||
If IsChannel Then
|
||||
Return DownOptions.Channel
|
||||
Else
|
||||
Return DownOptions.Main
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub New(ByVal _Name As String, ByVal Host As SettingsHost, Optional ByVal Collection As String = Nothing,
|
||||
Optional ByVal _Merged As Boolean = False, Optional ByVal _SpecialPath As SFile = Nothing)
|
||||
Name = _Name
|
||||
Site = Host.Name
|
||||
Plugin = Host.Key
|
||||
IncludedInCollection = Not Collection.IsEmptyString
|
||||
CollectionName = Collection
|
||||
Merged = _Merged
|
||||
SpecialPath = _SpecialPath
|
||||
UpdateUserFile()
|
||||
End Sub
|
||||
Private Sub New(ByVal x As EContainer)
|
||||
Name = x.Value
|
||||
Site = x.Attribute(Name_Site).Value
|
||||
Plugin = x.Attribute(Name_Plugin).Value
|
||||
CollectionName = x.Attribute(Name_Collection).Value
|
||||
IncludedInCollection = Not CollectionName.IsEmptyString
|
||||
Merged = x.Attribute(Name_Merged).Value.FromXML(Of Boolean)(False)
|
||||
SpecialPath = SFile.GetPath(x.Attribute(Name_SpecialPath).Value)
|
||||
IsChannel = x.Attribute(Name_IsChannel).Value.FromXML(Of Boolean)(False)
|
||||
'UpdateUserFile()
|
||||
End Sub
|
||||
Friend Sub New(ByVal c As Reddit.Channel)
|
||||
Name = c.Name
|
||||
Site = Reddit.RedditSite
|
||||
Plugin = Reddit.RedditSiteKey
|
||||
File = c.File
|
||||
IsChannel = True
|
||||
End Sub
|
||||
Public Shared Widening Operator CType(ByVal x As EContainer) As UserInfo
|
||||
Return New UserInfo(x)
|
||||
End Operator
|
||||
Public Shared Widening Operator CType(ByVal u As UserInfo) As String
|
||||
Return u.Name
|
||||
End Operator
|
||||
Public Shared Operator =(ByVal x As UserInfo, ByVal y As UserInfo)
|
||||
Return x.Equals(y)
|
||||
End Operator
|
||||
Public Shared Operator <>(ByVal x As UserInfo, ByVal y As UserInfo)
|
||||
Return Not x.Equals(y)
|
||||
End Operator
|
||||
Public Overrides Function ToString() As String
|
||||
Return Name
|
||||
End Function
|
||||
Friend Sub UpdateUserFile()
|
||||
File = New SFile With {
|
||||
.Separator = "\",
|
||||
.Path = GetFilePathByParams(),
|
||||
.Extension = "xml",
|
||||
.Name = $"{UserDataBase.UserFileAppender}_{Site}_{Name}"
|
||||
}
|
||||
End Sub
|
||||
Private Function GetFilePathByParams() As String
|
||||
If [Protected] Then Return String.Empty
|
||||
If Not SpecialPath.IsEmptyString Then
|
||||
Return $"{SpecialPath.PathWithSeparator}{SettingsFolderName}"
|
||||
ElseIf Merged And IncludedInCollection Then
|
||||
Return $"{Settings.CollectionsPathF.PathNoSeparator}\{CollectionName}\{SettingsFolderName}"
|
||||
Else
|
||||
If IncludedInCollection Then
|
||||
Return $"{Settings.CollectionsPathF.PathNoSeparator}\{CollectionName}\{Site}_{Name}\{SettingsFolderName}"
|
||||
ElseIf Not Settings(Plugin) Is Nothing Then
|
||||
Return $"{Settings(Plugin).Path.PathNoSeparator}\{Name}\{SettingsFolderName}"
|
||||
Else
|
||||
Dim s$ = Site.ToLower
|
||||
Dim i% = Settings.Plugins.FindIndex(Function(p) p.Name.ToLower = s)
|
||||
If i >= 0 Then Return $"{Settings.Plugins(i).Settings.Path.PathNoSeparator}\{Name}\{SettingsFolderName}" Else Return String.Empty
|
||||
End If
|
||||
End If
|
||||
End Function
|
||||
Friend Function GetContainer(Optional ByVal e As ErrorsDescriber = Nothing) As EContainer Implements IEContainerProvider.ToEContainer
|
||||
Return New EContainer("User", Name, {New EAttribute(Name_Site, Site),
|
||||
New EAttribute(Name_Plugin, Plugin),
|
||||
New EAttribute(Name_Collection, CollectionName),
|
||||
New EAttribute(Name_Merged, Merged.BoolToInteger),
|
||||
New EAttribute(Name_IsChannel, IsChannel.BoolToInteger),
|
||||
New EAttribute(Name_SpecialPath, SpecialPath.PathWithSeparator)})
|
||||
End Function
|
||||
Friend Function CompareTo(ByVal Other As UserInfo) As Integer Implements IComparable(Of UserInfo).CompareTo
|
||||
If Site = Other.Site Then
|
||||
Return Name.CompareTo(Other.Name)
|
||||
Else
|
||||
Return Site.CompareTo(Other.Site)
|
||||
End If
|
||||
End Function
|
||||
Friend Overloads Function Equals(ByVal Other As UserInfo) As Boolean Implements IEquatable(Of UserInfo).Equals
|
||||
Return Site = Other.Site And Name = Other.Name
|
||||
End Function
|
||||
Public Overloads Overrides Function Equals(ByVal Obj As Object) As Boolean
|
||||
Return Equals(DirectCast(Obj, UserInfo))
|
||||
End Function
|
||||
Friend Function Clone() As Object Implements ICloneable.Clone
|
||||
Return New UserInfo With {
|
||||
.Name = Name,
|
||||
.Site = Site,
|
||||
.Plugin = Plugin,
|
||||
.File = File,
|
||||
.SpecialPath = SpecialPath,
|
||||
.Merged = Merged,
|
||||
.IncludedInCollection = IncludedInCollection,
|
||||
.CollectionName = CollectionName,
|
||||
.IsChannel = IsChannel,
|
||||
.[Protected] = [Protected]
|
||||
}
|
||||
End Function
|
||||
End Structure
|
||||
#Region "Image Handlers management"
|
||||
Friend Sub ImageHandler(ByVal User As IUserData)
|
||||
ImageHandler(User, False)
|
||||
@@ -324,7 +195,7 @@ Friend Module MainMod
|
||||
ElseIf URL.Contains("imgur.com") Then
|
||||
um = Imgur.Envir.GetVideoInfo(URL)
|
||||
Else
|
||||
MsgBoxE("Site of video URL does not recognized" & vbCr & "Operation canceled", MsgBoxStyle.Exclamation, e)
|
||||
MsgBoxE("Site of video URL not recognized" & vbCr & "Operation canceled", MsgBoxStyle.Exclamation, e)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
@@ -377,13 +248,13 @@ Friend Module MainMod
|
||||
Result = True
|
||||
End If
|
||||
Else
|
||||
If um.Count = 1 Then MsgBoxE("File does not downloaded", MsgBoxStyle.Critical, e)
|
||||
If um.Count = 1 Then MsgBoxE("File not downloaded", MsgBoxStyle.Critical, e)
|
||||
End If
|
||||
Else
|
||||
If um.Count = 1 Then MsgBoxE("File destination does not pointed" & vbCr & "Operation canceled",, e)
|
||||
If um.Count = 1 Then MsgBoxE("File destination not specified" & vbCr & "Operation canceled",, e)
|
||||
End If
|
||||
Else
|
||||
If um.Count = 1 Then MsgBoxE("File URL does not found!", MsgBoxStyle.Critical, e)
|
||||
If um.Count = 1 Then MsgBoxE("File URL not found!", MsgBoxStyle.Critical, e)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
@@ -392,100 +263,13 @@ Friend Module MainMod
|
||||
End If
|
||||
Return Result
|
||||
Catch ex As Exception
|
||||
Return ErrorsDescriber.Execute(e, ex, "Downloading video by URL error", False)
|
||||
Return ErrorsDescriber.Execute(e, ex, $"Error when trying to download video from URL: [{URL}]", False)
|
||||
End Try
|
||||
End Function
|
||||
#End Region
|
||||
#Region "Blacklist Support"
|
||||
Friend Structure UserBan
|
||||
Friend ReadOnly Name As String
|
||||
Friend ReadOnly Reason As String
|
||||
Friend ReadOnly Exists As Boolean
|
||||
Friend Sub New(ByVal Value As String)
|
||||
If Not Value.IsEmptyString Then
|
||||
Dim v$() = Value.Split("|")
|
||||
If v.ListExists Then
|
||||
Name = v(0)
|
||||
If v.Length > 1 Then Reason = v(1)
|
||||
Exists = True
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Friend Sub New(ByVal _Name As String, ByVal _Reason As String)
|
||||
Name = _Name
|
||||
Reason = _Reason
|
||||
Exists = True
|
||||
End Sub
|
||||
Public Shared Widening Operator CType(ByVal Value As String) As UserBan
|
||||
Return New UserBan(Value)
|
||||
End Operator
|
||||
Public Shared Widening Operator CType(ByVal b As UserBan) As String
|
||||
Return b.ToString
|
||||
End Operator
|
||||
Public Overrides Function ToString() As String
|
||||
Return $"{Name}|{Reason}"
|
||||
End Function
|
||||
Friend Function Info() As String
|
||||
If Not Reason.IsEmptyString Then
|
||||
Return $"[{Name}] ({Reason})"
|
||||
Else
|
||||
Return Name
|
||||
End If
|
||||
End Function
|
||||
Public Overrides Function Equals(ByVal Obj As Object) As Boolean
|
||||
If Not IsNothing(Obj) Then
|
||||
If TypeOf Obj Is UserBan Then
|
||||
Return Name = DirectCast(Obj, UserBan).Name
|
||||
Else
|
||||
Return Name = New UserBan(CStr(Obj)).Name
|
||||
End If
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
End Structure
|
||||
Friend Function UserBanned(ByVal UserNames() As String) As String()
|
||||
If UserNames.ListExists Then
|
||||
Dim i%
|
||||
Dim Found As New List(Of UserBan)
|
||||
For Each user In UserNames
|
||||
i = Settings.BlackList.FindIndex(Function(u) u.Name = user)
|
||||
If i >= 0 Then Found.Add(Settings.BlackList(i))
|
||||
Next
|
||||
If Found.Count = 0 Then
|
||||
Return New String() {}
|
||||
Else
|
||||
Dim m As New MMessage With {
|
||||
.Title = "Banned user found",
|
||||
.Buttons = {"Remove from ban and add", "Leave in ban and add", "Skip"},
|
||||
.Style = MsgBoxStyle.Exclamation,
|
||||
.Exists = True
|
||||
}
|
||||
If Found.Count = 1 Then
|
||||
m.Text = $"This user is banned:{vbNewLine}User: {Found(0).Name}"
|
||||
If Not Found(0).Reason.IsEmptyString Then m.Text.StringAppendLine($"Reason: {Found(0).Reason}")
|
||||
Else
|
||||
m.Text = $"These users was banned:{vbNewLine.StringDup(2)}{Found.Select(Function(u) u.Info).ListToString(vbNewLine)}"
|
||||
End If
|
||||
Dim r% = MsgBoxE(m)
|
||||
If r = 2 Then
|
||||
Return Found.Select(Function(u) u.Name).ToArray
|
||||
Else
|
||||
If r = 0 Then
|
||||
Settings.BlackList.ListDisposeRemove(Found)
|
||||
Settings.UpdateBlackList()
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Return New String() {}
|
||||
End Function
|
||||
Friend Function UserBanned(ByVal UserName As String) As Boolean
|
||||
Return UserBanned({UserName}).ListExists
|
||||
End Function
|
||||
#End Region
|
||||
Friend Sub CheckVersion(ByVal Force As Boolean)
|
||||
If Settings.CheckUpdatesAtStart Or Force Then _
|
||||
GitHub.DefaultVersionChecker(My.Application.Info.Version, "AAndyProgram", "SCrawler",
|
||||
Settings.LatestVersion.Value, Settings.ShowNewVersionNotification.Value, Force)
|
||||
GitHub.DefaultVersionChecker(My.Application.Info.Version, "AAndyProgram", "SCrawler",
|
||||
Settings.LatestVersion.Value, Settings.ShowNewVersionNotification.Value, Force)
|
||||
End Sub
|
||||
End Module
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("Social networks media downloader")>
|
||||
<Assembly: AssemblyCompany("AndyProgram")>
|
||||
<Assembly: AssemblyProduct("SCrawler")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("AndyProgram")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
@@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2022.7.7.0")>
|
||||
<Assembly: AssemblyFileVersion("2022.7.7.0")>
|
||||
<Assembly: AssemblyVersion("2022.8.22.0")>
|
||||
<Assembly: AssemblyFileVersion("2022.8.22.0")>
|
||||
<Assembly: NeutralResourcesLanguage("en")>
|
||||
|
||||
@@ -67,7 +67,7 @@ Namespace Plugin.Hosts
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.SendInLog, ex, "[PluginHost.New]")
|
||||
ErrorsDescriber.Execute(EDP.SendInLog, ex, $"[PluginHost.New({AssemblyFile})]")
|
||||
_HasError = True
|
||||
End Try
|
||||
End Sub
|
||||
@@ -93,7 +93,7 @@ Namespace Plugin.Hosts
|
||||
End If
|
||||
Return pList
|
||||
Catch ex As Exception
|
||||
ErrorsDescriber.Execute(EDP.SendInLog, ex, "[PluginHost.GetPluginsHosts]")
|
||||
ErrorsDescriber.Execute(EDP.SendInLog, ex, $"[PluginHost.GetPluginsHosts({GlobalPath})]")
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
@@ -86,7 +86,7 @@ Namespace Plugin.Hosts
|
||||
Friend Sub DisposeControl()
|
||||
If Not Control Is Nothing Then Control.Dispose() : Control = Nothing
|
||||
End Sub
|
||||
Private Sub TextBoxClick(ByVal Sender As ActionButton)
|
||||
Private Sub TextBoxClick(ByVal Sender As ActionButton, ByVal e As EventArgs)
|
||||
Try
|
||||
If Sender.DefaultButton = ADB.Refresh AndAlso Not Source Is Nothing AndAlso Not UpdateMethod Is Nothing Then
|
||||
If CBool(UpdateMethod.Invoke(Source, Nothing)) Then
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
'
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY
|
||||
Imports PersonalUtilities.Functions.XML
|
||||
Imports SCrawler.API.Base
|
||||
Imports System.Threading
|
||||
Imports System.Reflection
|
||||
Imports PersonalUtilities.Functions.XML
|
||||
Imports SCrawler.API.Base
|
||||
Imports UStates = SCrawler.Plugin.PluginUserMedia.States
|
||||
Imports UTypes = SCrawler.Plugin.PluginUserMedia.Types
|
||||
Namespace Plugin.Hosts
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.16299.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -308,6 +312,7 @@
|
||||
<Compile Include="PluginsEnvironment\Hosts\SettingsHost.vb" />
|
||||
<Compile Include="SettingsCLS.vb" />
|
||||
<Compile Include="Download\TDownloader.vb" />
|
||||
<Compile Include="UserBan.vb" />
|
||||
<Compile Include="UserImage.vb" />
|
||||
<Compile Include="Download\VideosDownloaderForm.Designer.vb">
|
||||
<DependentUpon>VideosDownloaderForm.vb</DependentUpon>
|
||||
@@ -315,6 +320,7 @@
|
||||
<Compile Include="Download\VideosDownloaderForm.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UserInfo.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="API\Instagram\OptionsForm.resx">
|
||||
|
||||
@@ -70,8 +70,10 @@ Friend Class SettingsCLS : Implements IDisposable
|
||||
If tmpPluginList.ListExists Then Plugins.AddRange(tmpPluginList)
|
||||
|
||||
FastProfilesLoading = New XMLValue(Of Boolean)("FastProfilesLoading", False, MyXML)
|
||||
MaxLargeImageHeigh = New XMLValue(Of Integer)("MaxLargeImageHeigh", 150, MyXML)
|
||||
MaxSmallImageHeigh = New XMLValue(Of Integer)("MaxSmallImageHeigh", 15, MyXML)
|
||||
MaxLargeImageHeight = New XMLValue(Of Integer)("MaxLargeImageHeight", 150, MyXML)
|
||||
MaxLargeImageHeight.ReplaceByValue("MaxLargeImageHeigh",, MyXML)
|
||||
MaxSmallImageHeight = New XMLValue(Of Integer)("MaxSmallImageHeight", 15, MyXML)
|
||||
MaxSmallImageHeight.ReplaceByValue("MaxSmallImageHeigh",, MyXML)
|
||||
DownloadOpenInfo = New XMLValueAttribute(Of Boolean, Boolean)("DownloadOpenInfo", "OpenAgain", False, False, MyXML)
|
||||
DownloadOpenProgress = New XMLValueAttribute(Of Boolean, Boolean)("DownloadOpenProgress", "OpenAgain", False, False, MyXML)
|
||||
DownloadsCompleteCommand = New XMLValueAttribute(Of String, Boolean)("DownloadsCompleteCommand", "Use",,, MyXML)
|
||||
@@ -119,7 +121,7 @@ Friend Class SettingsCLS : Implements IDisposable
|
||||
AddHandler FileAddTimeToFileName.OnValueChanged, AddressOf ChangeDateProvider
|
||||
FileDateTimePositionEnd = New XMLValue(Of Boolean)("FileDateTimePositionEnd", True, MyXML, n)
|
||||
AddHandler FileDateTimePositionEnd.OnValueChanged, AddressOf ChangeDateProvider
|
||||
FileReplaceNameByDate = New XMLValue(Of Boolean)("FileReplaceNameByDate", False, MyXML, n)
|
||||
FileReplaceNameByDate = New XMLValue(Of Integer)("FileReplaceNameByDate", FileNameReplaceMode.None, MyXML, n)
|
||||
|
||||
CheckUpdatesAtStart = New XMLValue(Of Boolean)("CheckUpdatesAtStart", True, MyXML)
|
||||
ShowNewVersionNotification = New XMLValue(Of Boolean)("ShowNewVersionNotification", True, MyXML)
|
||||
@@ -151,7 +153,11 @@ Friend Class SettingsCLS : Implements IDisposable
|
||||
If FileAddDateToFileName Then p = "yyyyMMdd"
|
||||
If FileAddTimeToFileName Then p.StringAppend("HHmmss", "_")
|
||||
If Not p.IsEmptyString Then FileDateAppenderProvider = New ADateTime(p) Else FileDateAppenderProvider = New ADateTime("yyyyMMdd_HHmmss")
|
||||
If FileDateTimePositionEnd Then FileDateAppenderPattern = "{0}_{1}" Else FileDateAppenderPattern = "{1}_{0}"
|
||||
If FileReplaceNameByDate.Value = FileNameReplaceMode.Replace Then
|
||||
FileDateAppenderPattern = "{1}"
|
||||
Else
|
||||
If FileDateTimePositionEnd Then FileDateAppenderPattern = "{0}_{1}" Else FileDateAppenderPattern = "{1}_{0}"
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
#Region "Script"
|
||||
@@ -378,7 +384,7 @@ Friend Class SettingsCLS : Implements IDisposable
|
||||
Friend ReadOnly Property CollectionsPathF As SFile
|
||||
Get
|
||||
If GlobalPath.IsEmptyString Then
|
||||
Throw New ArgumentNullException("GlobalPath", "GlobalPath does not set")
|
||||
Throw New ArgumentNullException("GlobalPath", "GlobalPath not set")
|
||||
Else
|
||||
Return SFile.GetPath($"{GlobalPath.Value.PathWithSeparator}{CollectionsPath.Value}")
|
||||
End If
|
||||
@@ -402,13 +408,13 @@ Friend Class SettingsCLS : Implements IDisposable
|
||||
Friend ReadOnly Property FileAddDateToFileName As XMLValue(Of Boolean)
|
||||
Friend ReadOnly Property FileAddTimeToFileName As XMLValue(Of Boolean)
|
||||
Friend ReadOnly Property FileDateTimePositionEnd As XMLValue(Of Boolean)
|
||||
Friend ReadOnly Property FileReplaceNameByDate As XMLValue(Of Boolean)
|
||||
Friend ReadOnly Property FileReplaceNameByDate As XMLValue(Of Integer)
|
||||
#End Region
|
||||
#End Region
|
||||
#Region "View"
|
||||
Friend ReadOnly Property FastProfilesLoading As XMLValue(Of Boolean)
|
||||
Friend ReadOnly Property MaxLargeImageHeigh As XMLValue(Of Integer)
|
||||
Friend ReadOnly Property MaxSmallImageHeigh As XMLValue(Of Integer)
|
||||
Friend ReadOnly Property MaxLargeImageHeight As XMLValue(Of Integer)
|
||||
Friend ReadOnly Property MaxSmallImageHeight As XMLValue(Of Integer)
|
||||
Friend ReadOnly Property DownloadOpenInfo As XMLValueAttribute(Of Boolean, Boolean)
|
||||
Friend ReadOnly Property DownloadOpenProgress As XMLValueAttribute(Of Boolean, Boolean)
|
||||
Friend ReadOnly Property DownloadsCompleteCommand As XMLValueAttribute(Of String, Boolean)
|
||||
@@ -481,6 +487,7 @@ Friend Class SettingsCLS : Implements IDisposable
|
||||
DeleteCachePath()
|
||||
End If
|
||||
If Not Automation Is Nothing Then Automation.Dispose()
|
||||
AutoDownloader.CachePath.Delete(SFO.Path, SFODelete.DeletePermanently, EDP.None)
|
||||
Plugins.Clear()
|
||||
Users.ListClearDispose
|
||||
UsersList.Clear()
|
||||
|
||||
95
SCrawler/UserBan.vb
Normal file
95
SCrawler/UserBan.vb
Normal file
@@ -0,0 +1,95 @@
|
||||
' Copyright (C) 2022 Andy
|
||||
' 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
|
||||
Partial Friend Module MainMod
|
||||
Friend Structure UserBan
|
||||
Friend ReadOnly Name As String
|
||||
Friend ReadOnly Reason As String
|
||||
Friend ReadOnly Exists As Boolean
|
||||
Friend Sub New(ByVal Value As String)
|
||||
If Not Value.IsEmptyString Then
|
||||
Dim v$() = Value.Split("|")
|
||||
If v.ListExists Then
|
||||
Name = v(0)
|
||||
If v.Length > 1 Then Reason = v(1)
|
||||
Exists = True
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Friend Sub New(ByVal _Name As String, ByVal _Reason As String)
|
||||
Name = _Name
|
||||
Reason = _Reason
|
||||
Exists = True
|
||||
End Sub
|
||||
Public Shared Widening Operator CType(ByVal Value As String) As UserBan
|
||||
Return New UserBan(Value)
|
||||
End Operator
|
||||
Public Shared Widening Operator CType(ByVal b As UserBan) As String
|
||||
Return b.ToString
|
||||
End Operator
|
||||
Public Overrides Function ToString() As String
|
||||
Return $"{Name}|{Reason}"
|
||||
End Function
|
||||
Friend Function Info() As String
|
||||
If Not Reason.IsEmptyString Then
|
||||
Return $"[{Name}] ({Reason})"
|
||||
Else
|
||||
Return Name
|
||||
End If
|
||||
End Function
|
||||
Public Overrides Function Equals(ByVal Obj As Object) As Boolean
|
||||
If Not IsNothing(Obj) Then
|
||||
If TypeOf Obj Is UserBan Then
|
||||
Return Name = DirectCast(Obj, UserBan).Name
|
||||
Else
|
||||
Return Name = New UserBan(CStr(Obj)).Name
|
||||
End If
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
End Structure
|
||||
Friend Function UserBanned(ByVal UserNames() As String) As String()
|
||||
If UserNames.ListExists Then
|
||||
Dim i%
|
||||
Dim Found As New List(Of UserBan)
|
||||
For Each user In UserNames
|
||||
i = Settings.BlackList.FindIndex(Function(u) u.Name = user)
|
||||
If i >= 0 Then Found.Add(Settings.BlackList(i))
|
||||
Next
|
||||
If Found.Count = 0 Then
|
||||
Return New String() {}
|
||||
Else
|
||||
Dim m As New MMessage With {
|
||||
.Title = "Banned user found",
|
||||
.Buttons = {"Remove from ban and add", "Leave in ban and add", "Skip"},
|
||||
.Style = MsgBoxStyle.Exclamation,
|
||||
.Exists = True
|
||||
}
|
||||
If Found.Count = 1 Then
|
||||
m.Text = $"This user is banned:{vbNewLine}User: {Found(0).Name}"
|
||||
If Not Found(0).Reason.IsEmptyString Then m.Text.StringAppendLine($"Reason: {Found(0).Reason}")
|
||||
Else
|
||||
m.Text = $"These users have been banned:{vbNewLine.StringDup(2)}{Found.Select(Function(u) u.Info).ListToString(vbNewLine)}"
|
||||
End If
|
||||
Dim r% = MsgBoxE(m)
|
||||
If r = 2 Then
|
||||
Return Found.Select(Function(u) u.Name).ToArray
|
||||
Else
|
||||
If r = 0 Then
|
||||
Settings.BlackList.ListDisposeRemove(Found)
|
||||
Settings.UpdateBlackList()
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Return New String() {}
|
||||
End Function
|
||||
Friend Function UserBanned(ByVal UserName As String) As Boolean
|
||||
Return UserBanned({UserName}).ListExists
|
||||
End Function
|
||||
End Module
|
||||
@@ -25,8 +25,8 @@ Friend Class UserImage : Inherits ImageRenderer
|
||||
_SmallAddress = Address
|
||||
_SmallAddress.Name &= ImagePostfix_Small
|
||||
If GenerateLargeSmallPictures Then
|
||||
GetImage(Settings.MaxSmallImageHeigh.Value, True)
|
||||
GetImage(Settings.MaxLargeImageHeigh.Value, False)
|
||||
GetImage(Settings.MaxSmallImageHeight.Value, True)
|
||||
GetImage(Settings.MaxLargeImageHeight.Value, False)
|
||||
End If
|
||||
End Sub
|
||||
Friend Sub New(ByVal _ImgOriginal As SFile, ByVal _ImgLarge As SFile, ByVal _ImgSmall As SFile, ByVal Destination As SFile)
|
||||
@@ -39,27 +39,15 @@ Friend Class UserImage : Inherits ImageRenderer
|
||||
_SmallAddress = _ImgSmall
|
||||
End Sub
|
||||
''' <inheritdoc cref="GetImage(Integer, Boolean)"/>
|
||||
Friend ReadOnly Property SmallSize As Size
|
||||
Get
|
||||
Return GetImage(Settings.MaxSmallImageHeigh.Value, True).Size
|
||||
End Get
|
||||
End Property
|
||||
''' <inheritdoc cref="GetImage(Integer, Boolean)"/>
|
||||
Friend ReadOnly Property Small As ImageRenderer
|
||||
Get
|
||||
Return GetImage(Settings.MaxSmallImageHeigh.Value, True)
|
||||
End Get
|
||||
End Property
|
||||
''' <inheritdoc cref="GetImage(Integer, Boolean)"/>
|
||||
Friend ReadOnly Property LargeSize As Size
|
||||
Get
|
||||
Return GetImage(Settings.MaxLargeImageHeigh.Value, False).Size
|
||||
Return GetImage(Settings.MaxSmallImageHeight.Value, True)
|
||||
End Get
|
||||
End Property
|
||||
''' <inheritdoc cref="GetImage(Integer, Boolean)"/>
|
||||
Friend ReadOnly Property Large As ImageRenderer
|
||||
Get
|
||||
Return GetImage(Settings.MaxLargeImageHeigh.Value, False)
|
||||
Return GetImage(Settings.MaxLargeImageHeight.Value, False)
|
||||
End Get
|
||||
End Property
|
||||
''' <exception cref="ArgumentNullException"></exception>
|
||||
|
||||
148
SCrawler/UserInfo.vb
Normal file
148
SCrawler/UserInfo.vb
Normal file
@@ -0,0 +1,148 @@
|
||||
' Copyright (C) 2022 Andy
|
||||
' 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 SCrawler.API
|
||||
Imports SCrawler.API.Base
|
||||
Imports SCrawler.Plugin.Hosts
|
||||
Imports DownOptions = SCrawler.Plugin.ISiteSettings.Download
|
||||
Partial Friend Module MainMod
|
||||
Friend Structure UserInfo : Implements IComparable(Of UserInfo), IEquatable(Of UserInfo), ICloneable, IEContainerProvider
|
||||
Friend Const Name_Site As String = "Site"
|
||||
Friend Const Name_Plugin As String = "Plugin"
|
||||
Friend Const Name_Collection As String = "Collection"
|
||||
Friend Const Name_Merged As String = "Merged"
|
||||
Friend Const Name_IsChannel As String = "IsChannel"
|
||||
Friend Const Name_SpecialPath As String = "SpecialPath"
|
||||
Friend Name As String
|
||||
Friend Site As String
|
||||
Friend Plugin As String
|
||||
Friend File As SFile
|
||||
Friend SpecialPath As SFile
|
||||
Friend Merged As Boolean
|
||||
Friend IncludedInCollection As Boolean
|
||||
Friend CollectionName As String
|
||||
Friend IsChannel As Boolean
|
||||
Friend [Protected] As Boolean
|
||||
Friend ReadOnly Property DownloadOption As DownOptions
|
||||
Get
|
||||
If IsChannel Then
|
||||
Return DownOptions.Channel
|
||||
Else
|
||||
Return DownOptions.Main
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub New(ByVal _Name As String, ByVal Host As SettingsHost, Optional ByVal Collection As String = Nothing,
|
||||
Optional ByVal _Merged As Boolean = False, Optional ByVal _SpecialPath As SFile = Nothing)
|
||||
Name = _Name
|
||||
Site = Host.Name
|
||||
Plugin = Host.Key
|
||||
IncludedInCollection = Not Collection.IsEmptyString
|
||||
CollectionName = Collection
|
||||
Merged = _Merged
|
||||
SpecialPath = _SpecialPath
|
||||
UpdateUserFile()
|
||||
End Sub
|
||||
Private Sub New(ByVal x As EContainer)
|
||||
Name = x.Value
|
||||
Site = x.Attribute(Name_Site).Value
|
||||
Plugin = x.Attribute(Name_Plugin).Value
|
||||
CollectionName = x.Attribute(Name_Collection).Value
|
||||
IncludedInCollection = Not CollectionName.IsEmptyString
|
||||
Merged = x.Attribute(Name_Merged).Value.FromXML(Of Boolean)(False)
|
||||
SpecialPath = SFile.GetPath(x.Attribute(Name_SpecialPath).Value)
|
||||
IsChannel = x.Attribute(Name_IsChannel).Value.FromXML(Of Boolean)(False)
|
||||
'UpdateUserFile()
|
||||
End Sub
|
||||
Friend Sub New(ByVal c As Reddit.Channel)
|
||||
Name = c.Name
|
||||
Site = Reddit.RedditSite
|
||||
Plugin = Reddit.RedditSiteKey
|
||||
File = c.File
|
||||
IsChannel = True
|
||||
End Sub
|
||||
Public Shared Widening Operator CType(ByVal x As EContainer) As UserInfo
|
||||
Return New UserInfo(x)
|
||||
End Operator
|
||||
Public Shared Widening Operator CType(ByVal u As UserInfo) As String
|
||||
Return u.Name
|
||||
End Operator
|
||||
Public Shared Operator =(ByVal x As UserInfo, ByVal y As UserInfo)
|
||||
Return x.Equals(y)
|
||||
End Operator
|
||||
Public Shared Operator <>(ByVal x As UserInfo, ByVal y As UserInfo)
|
||||
Return Not x.Equals(y)
|
||||
End Operator
|
||||
Public Overrides Function ToString() As String
|
||||
Return Name
|
||||
End Function
|
||||
Friend Sub UpdateUserFile()
|
||||
File = New SFile With {
|
||||
.Separator = "\",
|
||||
.Path = GetFilePathByParams(),
|
||||
.Extension = "xml",
|
||||
.Name = $"{UserDataBase.UserFileAppender}_{Site}_{Name}"
|
||||
}
|
||||
End Sub
|
||||
Private Function GetFilePathByParams() As String
|
||||
If [Protected] Then Return String.Empty
|
||||
If Not SpecialPath.IsEmptyString Then
|
||||
Return $"{SpecialPath.PathWithSeparator}{SettingsFolderName}"
|
||||
ElseIf Merged And IncludedInCollection Then
|
||||
Return $"{Settings.CollectionsPathF.PathNoSeparator}\{CollectionName}\{SettingsFolderName}"
|
||||
Else
|
||||
If IncludedInCollection Then
|
||||
Return $"{Settings.CollectionsPathF.PathNoSeparator}\{CollectionName}\{Site}_{Name}\{SettingsFolderName}"
|
||||
ElseIf Not Settings(Plugin) Is Nothing Then
|
||||
Return $"{Settings(Plugin).Path.PathNoSeparator}\{Name}\{SettingsFolderName}"
|
||||
Else
|
||||
Dim s$ = Site.ToLower
|
||||
Dim i% = Settings.Plugins.FindIndex(Function(p) p.Name.ToLower = s)
|
||||
If i >= 0 Then Return $"{Settings.Plugins(i).Settings.Path.PathNoSeparator}\{Name}\{SettingsFolderName}" Else Return String.Empty
|
||||
End If
|
||||
End If
|
||||
End Function
|
||||
Friend Function GetContainer(Optional ByVal e As ErrorsDescriber = Nothing) As EContainer Implements IEContainerProvider.ToEContainer
|
||||
Return New EContainer("User", Name, {New EAttribute(Name_Site, Site),
|
||||
New EAttribute(Name_Plugin, Plugin),
|
||||
New EAttribute(Name_Collection, CollectionName),
|
||||
New EAttribute(Name_Merged, Merged.BoolToInteger),
|
||||
New EAttribute(Name_IsChannel, IsChannel.BoolToInteger),
|
||||
New EAttribute(Name_SpecialPath, SpecialPath.PathWithSeparator)})
|
||||
End Function
|
||||
Friend Function CompareTo(ByVal Other As UserInfo) As Integer Implements IComparable(Of UserInfo).CompareTo
|
||||
If Site = Other.Site Then
|
||||
Return Name.CompareTo(Other.Name)
|
||||
Else
|
||||
Return Site.CompareTo(Other.Site)
|
||||
End If
|
||||
End Function
|
||||
Friend Overloads Function Equals(ByVal Other As UserInfo) As Boolean Implements IEquatable(Of UserInfo).Equals
|
||||
Return Site = Other.Site And Name = Other.Name
|
||||
End Function
|
||||
Public Overloads Overrides Function Equals(ByVal Obj As Object) As Boolean
|
||||
Return Equals(DirectCast(Obj, UserInfo))
|
||||
End Function
|
||||
Friend Function Clone() As Object Implements ICloneable.Clone
|
||||
Return New UserInfo With {
|
||||
.Name = Name,
|
||||
.Site = Site,
|
||||
.Plugin = Plugin,
|
||||
.File = File,
|
||||
.SpecialPath = SpecialPath,
|
||||
.Merged = Merged,
|
||||
.IncludedInCollection = IncludedInCollection,
|
||||
.CollectionName = CollectionName,
|
||||
.IsChannel = IsChannel,
|
||||
.[Protected] = [Protected]
|
||||
}
|
||||
End Function
|
||||
End Structure
|
||||
End Module
|
||||
Reference in New Issue
Block a user