diff --git a/Changelog.md b/Changelog.md index 4f9d67d..b5f7b45 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,7 +1,15 @@ +# 3.0.0.8 + +- Added + - Script mode ```command``` + - Disabled Instagram error 403 (Forbidden) logging for downloading tagged data +- Fixed + - The script does not run after the user download is complete + # 3.0.0.7 - Added - - Ability to run a script after the user download if complete + - Ability to run a script after the user download is complete - Hotkey ```F2``` for additional options in the user creation form - Fixed - (Issue #32) In some cases, Date and Time are still not added for Stories and Tagged Photos diff --git a/ProgramScreenshots/SettingsBasis.png b/ProgramScreenshots/SettingsBasis.png index 2d811af..8b08c3a 100644 Binary files a/ProgramScreenshots/SettingsBasis.png and b/ProgramScreenshots/SettingsBasis.png differ diff --git a/README.md b/README.md index 52bc1be..a610cb7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Social networks crawler [![GitHub release (latest by date)](https://img.shields.io/github/v/release/AAndyProgram/SCrawler)](https://github.com/AAndyProgram/SCrawler/releases/latest) -[![GitHub](https://img.shields.io/github/license/AAndyProgram/SCrawler)](https://github.com/AAndyProgram/SCrawler/) +[![GitHub license](https://img.shields.io/github/license/AAndyProgram/SCrawler)](https://github.com/AAndyProgram/SCrawler/blob/main/LICENSE) [![FAQ](https://img.shields.io/badge/FAQ-green)](FAQ.md) [![GUIDE](https://img.shields.io/badge/GUIDE-green)](https://github.com/AAndyProgram/SCrawler/wiki) [![How to support](https://img.shields.io/badge/HowToSupport-green)](HowToSupport.md) diff --git a/SCrawler/API/Base/UserDataBase.vb b/SCrawler/API/Base/UserDataBase.vb index 517cdc3..2e5ee99 100644 --- a/SCrawler/API/Base/UserDataBase.vb +++ b/SCrawler/API/Base/UserDataBase.vb @@ -117,7 +117,7 @@ Namespace API.Base Private Const Name_LastUpdated As String = "LastUpdated" Private Const Name_ScriptUse As String = "ScriptUse" - Private Const Name_ScriptFile As String = "ScriptFile" + Private Const Name_ScriptData As String = "ScriptData" Private Const Name_DataMerging As String = "DataMerging" #Region "Downloaded data" @@ -411,7 +411,7 @@ BlockNullPicture: #End Region #Region "Script" Friend Overridable Property ScriptUse As Boolean = False Implements IUserData.ScriptUse - Friend Overridable Property ScriptFile As SFile Implements IUserData.ScriptFile + Friend Overridable Property ScriptData As String Implements IUserData.ScriptData #End Region #End Region #Region "Plugins Support" @@ -585,16 +585,7 @@ BlockNullPicture: DownloadedPictures(True) = x.Value(Name_PicturesCount).FromXML(Of Integer)(0) LastUpdated = AConvert(Of Date)(x.Value(Name_LastUpdated), ADateTime.Formats.BaseDateTime, Nothing) ScriptUse = x.Value(Name_ScriptUse).FromXML(Of Boolean)(False) - Dim s$ = x.Value(Name_ScriptFile) - If Not s.IsEmptyString Then - If SFile.IsDirectory(s) Then - ScriptFile = s - Else - ScriptFile = New SFile(s) With {.Path = MyFile.Path} - End If - Else - ScriptFile = Nothing - End If + ScriptData = x.Value(Name_ScriptData) DataMerging = x.Value(Name_DataMerging).FromXML(Of Boolean)(False) ChangeCollectionName(x.Value(Name_CollectionName), False) Labels.ListAddList(x.Value(Name_LabelsName).StringToList(Of String, List(Of String))("|", EDP.ReturnValue), LAP.NotContainsOnly, LAP.ClearBeforeAdd) @@ -635,15 +626,7 @@ BlockNullPicture: x.Add(Name_PicturesCount, DownloadedPictures(True)) x.Add(Name_LastUpdated, AConvert(Of String)(LastUpdated, ADateTime.Formats.BaseDateTime, String.Empty)) x.Add(Name_ScriptUse, ScriptUse.BoolToInteger) - If Not ScriptFile.IsEmptyString Then - If ScriptFile.Path = MyFile.Path Then - x.Add(Name_ScriptFile, ScriptFile.File) - Else - x.Add(Name_ScriptFile, ScriptFile) - End If - Else - x.Add(Name_ScriptFile, String.Empty) - End If + x.Add(Name_ScriptData, ScriptData) x.Add(Name_CollectionName, CollectionName) x.Add(Name_LabelsName, Labels.ListToString(, "|", EDP.ReturnValue)) x.Add(Name_DataMerging, DataMerging.BoolToInteger) @@ -964,17 +947,18 @@ BlockNullPicture: End Function Private Sub RunScript() Try + Const spa$ = "{0}" If ScriptUse Then Dim ScriptPattern$ - If Not ScriptFile.IsEmptyString Then - ScriptPattern = ScriptFile + If Not ScriptData.IsEmptyString Then + ScriptPattern = ScriptData Else - ScriptPattern = Settings.ScriptFile.Value + ScriptPattern = Settings.ScriptData.Value End If If Not ScriptPattern.IsEmptyString Then - ScriptPattern &= " {0}" + If Not ScriptPattern.Contains(spa) Then ScriptPattern &= $" ""{spa}""" Using b As New BatchExecutor With {.RedirectStandardError = True} - b.Execute({String.Format(ScriptPattern, MyFile.CutPath(1).ToString)}, EDP.SendInLog + EDP.ThrowException) + b.Execute({String.Format(ScriptPattern, MyFile.CutPath(1).PathNoSeparator)}, EDP.SendInLog + EDP.ThrowException) If b.HasError Or Not b.ErrorOutput.IsEmptyString Then Throw New Exception(b.ErrorOutput, b.ErrorException) End Using End If @@ -1035,11 +1019,8 @@ BlockNullPicture: End If f.CutPath.Exists(SFO.Path) Directory.Move(UserBefore.File.CutPath(, EDP.ThrowException).Path, f.Path) - If Not ScriptFile.IsEmptyString AndAlso ScriptFile.Path = UserBefore.File.Path Then - Dim ff As SFile = ScriptFile - f.Path = MyFile.Path - ScriptFile = ff - End If + If Not ScriptData.IsEmptyString AndAlso ScriptData.Contains(UserBefore.File.PathNoSeparator) Then _ + ScriptData = ScriptData.Replace(UserBefore.File.PathNoSeparator, MyFile.PathNoSeparator) Settings.UsersList.Remove(UserBefore) Settings.UpdateUsersList(User) UpdateUserInformation() @@ -1093,11 +1074,8 @@ BlockNullPicture: New ErrorsDescriber(False, False, False, New List(Of SFile))).Count = 0 Then UserBefore.File.CutPath.Delete(SFO.Path, Settings.DeleteMode, EDP.SendInLog) End If - If Not ScriptFile.IsEmptyString AndAlso ScriptFile.Path = UserBefore.File.Path Then - Dim f As SFile = ScriptFile - f.Path = MyFile.Path - ScriptFile = f - End If + If Not ScriptData.IsEmptyString AndAlso ScriptData.Contains(UserBefore.File.PathNoSeparator) Then _ + ScriptData = ScriptData.Replace(UserBefore.File.PathNoSeparator, MyFile.PathNoSeparator) UpdateUserInformation() End If Catch ioex As InvalidOperationException When ioex.HelpLink = 1 @@ -1263,7 +1241,7 @@ BlockNullPicture: Property DownloadImages As Boolean Property DownloadVideos As Boolean Property ScriptUse As Boolean - Property ScriptFile As SFile + Property ScriptData As String Function GetLVI(ByVal Destination As ListView) As ListViewItem Function GetLVIGroup(ByVal Destination As ListView) As ListViewGroup Sub LoadUserInformation() diff --git a/SCrawler/API/Instagram/UserData.vb b/SCrawler/API/Instagram/UserData.vb index cca72cd..c010b5d 100644 --- a/SCrawler/API/Instagram/UserData.vb +++ b/SCrawler/API/Instagram/UserData.vb @@ -299,7 +299,7 @@ Namespace API.Instagram Catch dex As ObjectDisposedException When Disposed Exit Do Catch ex As Exception - If DownloadingException(ex, $"data downloading error [{URL}]") = 1 Then Continue Do Else Exit Do + If DownloadingException(ex, $"data downloading error [{URL}]", Section, False) = 1 Then Continue Do Else Exit Do End Try Loop Catch eex2 As ExitException @@ -538,7 +538,7 @@ Namespace API.Instagram End If Return Nothing Catch ex As Exception - DownloadingException(ex, "API.Instagram.GetStoriesList") + DownloadingException(ex, "API.Instagram.GetStoriesList", Sections.Stories, False) Return Nothing End Try End Function @@ -552,13 +552,18 @@ Namespace API.Instagram '''
''' 1 - continue ''' - Protected Overrides Function DownloadingException(ByVal ex As Exception, ByVal Message As String, Optional ByVal FromPE As Boolean = False) As Integer + Protected Overloads Overrides Function DownloadingException(ByVal ex As Exception, ByVal Message As String, Optional ByVal FromPE As Boolean = False) As Integer + Return DownloadingException(ex, Message, Sections.Timeline, FromPE) + End Function + Private Overloads Function DownloadingException(ByVal ex As Exception, ByVal Message As String, ByVal s As Sections, ByVal FromPE As Boolean) As Integer If Responser.StatusCode = HttpStatusCode.NotFound Then UserExists = False ElseIf Responser.StatusCode = HttpStatusCode.BadRequest Then HasError = True MyMainLOG = "Instagram credentials have expired" MySiteSettings.HashUpdateRequired.Value = True + ElseIf Responser.StatusCode = HttpStatusCode.Forbidden And s = Sections.Tagged Then + Return 3 ElseIf Responser.StatusCode = 429 Then With MySiteSettings Dim WaiterExists As Boolean = .LastApplyingValue.HasValue diff --git a/SCrawler/Editors/GlobalSettingsForm.Designer.vb b/SCrawler/Editors/GlobalSettingsForm.Designer.vb index 030eca3..1ed4516 100644 --- a/SCrawler/Editors/GlobalSettingsForm.Designer.vb +++ b/SCrawler/Editors/GlobalSettingsForm.Designer.vb @@ -153,7 +153,7 @@ TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) TP_BASIS.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) - TP_BASIS.Size = New System.Drawing.Size(570, 450) + TP_BASIS.Size = New System.Drawing.Size(570, 475) TP_BASIS.TabIndex = 0 ' 'TXT_GLOBAL_PATH @@ -689,7 +689,7 @@ TAB_BASIS.Location = New System.Drawing.Point(4, 22) TAB_BASIS.Name = "TAB_BASIS" TAB_BASIS.Padding = New System.Windows.Forms.Padding(3) - TAB_BASIS.Size = New System.Drawing.Size(576, 456) + TAB_BASIS.Size = New System.Drawing.Size(576, 481) TAB_BASIS.TabIndex = 0 TAB_BASIS.Text = "Basis" ' @@ -788,7 +788,7 @@ Me.TAB_MAIN.Location = New System.Drawing.Point(0, 0) Me.TAB_MAIN.Name = "TAB_MAIN" Me.TAB_MAIN.SelectedIndex = 0 - Me.TAB_MAIN.Size = New System.Drawing.Size(584, 482) + Me.TAB_MAIN.Size = New System.Drawing.Size(584, 507) Me.TAB_MAIN.TabIndex = 1 ' 'CONTAINER_MAIN @@ -797,7 +797,7 @@ 'CONTAINER_MAIN.ContentPanel ' Me.CONTAINER_MAIN.ContentPanel.Controls.Add(Me.TAB_MAIN) - Me.CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(584, 482) + Me.CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(584, 507) Me.CONTAINER_MAIN.Dock = System.Windows.Forms.DockStyle.Fill Me.CONTAINER_MAIN.LeftToolStripPanelVisible = False Me.CONTAINER_MAIN.Location = New System.Drawing.Point(0, 0) diff --git a/SCrawler/Editors/GlobalSettingsForm.vb b/SCrawler/Editors/GlobalSettingsForm.vb index 50cbe97..ec268d7 100644 --- a/SCrawler/Editors/GlobalSettingsForm.vb +++ b/SCrawler/Editors/GlobalSettingsForm.vb @@ -36,8 +36,8 @@ Namespace Editors TXT_FOLDER_CMD.Text = .OpenFolderInOtherProgram TXT_FOLDER_CMD.Checked = .OpenFolderInOtherProgram.Attribute CH_RECYCLE_DEL.Checked = .DeleteToRecycleBin - TXT_SCRIPT.Checked = .ScriptFile.Attribute - TXT_SCRIPT.Text = .ScriptFile.Value + TXT_SCRIPT.Checked = .ScriptData.Attribute + TXT_SCRIPT.Text = .ScriptData.Value 'Defaults CH_SEPARATE_VIDEO_FOLDER.Checked = .SeparateVideoFolder.Value CH_DEF_TEMP.Checked = .DefaultTemporary @@ -125,8 +125,8 @@ Namespace Editors .OpenFolderInOtherProgram.Value = TXT_FOLDER_CMD.Text .OpenFolderInOtherProgram.Attribute.Value = TXT_FOLDER_CMD.Checked .DeleteToRecycleBin.Value = CH_RECYCLE_DEL.Checked - .ScriptFile.Value = TXT_SCRIPT.Text - .ScriptFile.Attribute.Value = TXT_SCRIPT.Checked + .ScriptData.Value = TXT_SCRIPT.Text + .ScriptData.Attribute.Value = TXT_SCRIPT.Checked 'Defaults .SeparateVideoFolder.Value = CH_SEPARATE_VIDEO_FOLDER.Checked .DefaultTemporary.Value = CH_DEF_TEMP.Checked @@ -200,10 +200,7 @@ Namespace Editors ChangePositionControlsEnabling() End Sub Private Sub TXT_SCRIPT_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_SCRIPT.ActionOnButtonClick - If Sender.DefaultButton = ActionButton.DefaultButtons.Open Then - Dim f As SFile = SFile.SelectFiles(TXT_SCRIPT.Text, False, "Select script file",, EDP.None).FirstOrDefault - If Not f.IsEmptyString Then TXT_SCRIPT.Text = f - End If + 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 CH_COPY_CHANNEL_USER_IMAGE_ALL.Enabled = CH_COPY_CHANNEL_USER_IMAGE.Checked diff --git a/SCrawler/Editors/UserCreatorForm.Designer.vb b/SCrawler/Editors/UserCreatorForm.Designer.vb index 234473e..cf46304 100644 --- a/SCrawler/Editors/UserCreatorForm.Designer.vb +++ b/SCrawler/Editors/UserCreatorForm.Designer.vb @@ -125,7 +125,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, 92.0!)) + TP_SITE.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 96.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) @@ -169,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(271, 22) + Me.CMB_SITE.Size = New System.Drawing.Size(267, 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(360, 2) + Me.BTT_OTHER_SETTINGS.Location = New System.Drawing.Point(356, 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(90, 24) + Me.BTT_OTHER_SETTINGS.Size = New System.Drawing.Size(94, 24) Me.BTT_OTHER_SETTINGS.TabIndex = 2 Me.BTT_OTHER_SETTINGS.Text = "Options (F2)" TT_MAIN.SetToolTip(Me.BTT_OTHER_SETTINGS, "Other settings") diff --git a/SCrawler/Editors/UserCreatorForm.vb b/SCrawler/Editors/UserCreatorForm.vb index 2cdd07b..8eef094 100644 --- a/SCrawler/Editors/UserCreatorForm.vb +++ b/SCrawler/Editors/UserCreatorForm.vb @@ -18,6 +18,7 @@ Imports SCrawler.Plugin.Hosts Imports ADB = PersonalUtilities.Forms.Controls.Base.ActionButton.DefaultButtons Namespace Editors Friend Class UserCreatorForm : Implements IOkCancelToolbar + Private ReadOnly MyDef As DefaultFormProps(Of FieldsChecker) Friend Property User As UserInfo Friend Property UserInstance As IUserData @@ -71,7 +72,7 @@ Namespace Editors Return TXT_SCRIPT.Checked End Get End Property - Friend ReadOnly Property ScriptFile As SFile + Friend ReadOnly Property ScriptData As String Get Return TXT_SCRIPT.Text End Get @@ -122,7 +123,7 @@ Namespace Editors CH_TEMP.Checked = Settings.DefaultTemporary CH_DOWN_IMAGES.Checked = Settings.DefaultDownloadImages CH_DOWN_VIDEOS.Checked = Settings.DefaultDownloadVideos - TXT_SCRIPT.Checked = Settings.ScriptFile.Attribute + TXT_SCRIPT.Checked = Settings.ScriptData.Attribute SetParamsBySite() Else TP_ADD_BY_LIST.Enabled = False @@ -148,7 +149,7 @@ Namespace Editors CH_DOWN_IMAGES.Checked = .DownloadImages CH_DOWN_VIDEOS.Checked = .DownloadVideos TXT_SCRIPT.Checked = .ScriptUse - TXT_SCRIPT.Text = .ScriptFile + TXT_SCRIPT.Text = .ScriptData TXT_DESCR.Text = .Description UserLabels.ListAddList(.Labels) If UserLabels.ListExists Then TXT_LABELS.Text = UserLabels.ListToString @@ -237,7 +238,7 @@ Namespace Editors End If .ParseUserMediaOnly = CH_PARSE_USER_MEDIA.Checked .ScriptUse = TXT_SCRIPT.Checked - .ScriptFile = TXT_SCRIPT.Text + .ScriptData = TXT_SCRIPT.Text .UpdateUserInformation() End With End If @@ -488,10 +489,7 @@ CloseForm: End Using End Sub Private Sub TXT_SCRIPT_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_SCRIPT.ActionOnButtonClick - If Sender.DefaultButton = ADB.Open Then - Dim f As SFile = SFile.SelectFiles(TXT_SCRIPT.Text, False, "Select script file").FirstOrDefault - If Not f.IsEmptyString Then TXT_SCRIPT.Text = f - End If + SettingsCLS.ScriptTextBoxButtonClick(TXT_SCRIPT, Sender) End Sub End Class End Namespace \ No newline at end of file diff --git a/SCrawler/MainFrame.Designer.vb b/SCrawler/MainFrame.Designer.vb index 69561d5..275cddd 100644 --- a/SCrawler/MainFrame.Designer.vb +++ b/SCrawler/MainFrame.Designer.vb @@ -286,7 +286,7 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form Me.BTT_DOWN_SAVED.ImageTransparentColor = System.Drawing.Color.Magenta Me.BTT_DOWN_SAVED.Name = "BTT_DOWN_SAVED" Me.BTT_DOWN_SAVED.Size = New System.Drawing.Size(23, 22) - Me.BTT_DOWN_SAVED.ToolTipText = "Download Reddit saved posts" + Me.BTT_DOWN_SAVED.ToolTipText = "Download saved posts" ' 'BTT_DOWN_SELECTED ' @@ -565,7 +565,7 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form ' Me.USER_CONTEXT.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_CONTEXT_DOWN, Me.BTT_CONTEXT_DOWN_LIMITED, Me.BTT_CONTEXT_DOWN_DATE_LIMIT, Me.BTT_CONTEXT_EDIT, Me.BTT_CONTEXT_DELETE, CONTEXT_SEP_1, Me.BTT_CONTEXT_FAV, Me.BTT_CONTEXT_TEMP, Me.BTT_CONTEXT_READY, Me.BTT_CONTEXT_GROUPS, Me.BTT_CONTEXT_SCRIPT, Me.BTT_CONTEXT_ADD_TO_COL, Me.BTT_CONTEXT_COL_MERGE, Me.BTT_CONTEXT_CHANGE_FOLDER, CONTEXT_SEP_2, Me.BTT_CHANGE_IMAGE, CONTEXT_SEP_3, Me.BTT_CONTEXT_OPEN_PATH, CONTEXT_SEP_4, Me.BTT_CONTEXT_OPEN_SITE, CONTEXT_SEP_5, Me.BTT_CONTEXT_INFO}) Me.USER_CONTEXT.Name = "USER_CONTEXT" - Me.USER_CONTEXT.Size = New System.Drawing.Size(222, 430) + Me.USER_CONTEXT.Size = New System.Drawing.Size(222, 408) ' 'BTT_CONTEXT_DOWN ' diff --git a/SCrawler/MainFrame.vb b/SCrawler/MainFrame.vb index 98c580d..e9fe2f5 100644 --- a/SCrawler/MainFrame.vb +++ b/SCrawler/MainFrame.vb @@ -250,7 +250,7 @@ CloseResume: .FriendlyName = f.UserFriendly .Description = f.UserDescr .ScriptUse = f.ScriptUse - .ScriptFile = f.ScriptFile + .ScriptData = f.ScriptData If Not f.MyExchangeOptions Is Nothing Then DirectCast(.Self, UserDataBase).ExchangeOptionsSet(f.MyExchangeOptions) .Self.Labels.ListAddList(f.UserLabels, LAP.ClearBeforeAdd, LAP.NotContainsOnly) .UpdateUserInformation() diff --git a/SCrawler/My Project/AssemblyInfo.vb b/SCrawler/My Project/AssemblyInfo.vb index fc7db2b..eae1770 100644 --- a/SCrawler/My Project/AssemblyInfo.vb +++ b/SCrawler/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/SCrawler/SettingsCLS.vb b/SCrawler/SettingsCLS.vb index 3807610..094a345 100644 --- a/SCrawler/SettingsCLS.vb +++ b/SCrawler/SettingsCLS.vb @@ -8,6 +8,8 @@ ' but WITHOUT ANY WARRANTY Imports PersonalUtilities.Functions.XML Imports PersonalUtilities.Functions.XML.Base +Imports PersonalUtilities.Forms.Controls +Imports PersonalUtilities.Forms.Controls.Base Imports SCrawler.API Imports SCrawler.API.Base Imports SCrawler.Plugin.Hosts @@ -97,7 +99,7 @@ Friend Class SettingsCLS : Implements IDisposable FromChannelDownloadTopUse = New XMLValue(Of Boolean)("FromChannelDownloadTopUse", False, MyXML, n) FromChannelCopyImageToUser = New XMLValue(Of Boolean)("FromChannelCopyImageToUser", True, MyXML, n) UpdateUserDescriptionEveryTime = New XMLValue(Of Boolean)("UpdateUserDescriptionEveryTime", True, MyXML, n) - ScriptFile = New XMLValueAttribute(Of SFile, Boolean)("ScriptFile", "Use",,, MyXML, n) + ScriptData = New XMLValueAttribute(Of String, Boolean)("ScriptData", "Use",,, MyXML, n) n = {"Users", "FileName"} MaxUsersJobsCount = New XMLValue(Of Integer)("MaxJobsCount", DefaultMaxDownloadingTasks, MyXML, n) @@ -140,6 +142,15 @@ Friend Class SettingsCLS : Implements IDisposable If FileDateTimePositionEnd Then FileDateAppenderPattern = "{0}_{1}" Else FileDateAppenderPattern = "{1}_{0}" End If End Sub +#Region "Script" + Friend Shared Sub ScriptTextBoxButtonClick(ByRef TXT As TextBoxExtended, ByVal Sender As ActionButton) + If Sender.DefaultButton = ActionButton.DefaultButtons.Open Then + Dim f As SFile = SFile.SelectFiles(TXT.Text, False, "Select script file").FirstOrDefault + If Not f.IsEmptyString Then TXT.Text = f.ToString & " ""{0}""" + End If + End Sub + Friend ReadOnly Property ScriptData As XMLValueAttribute(Of String, Boolean) +#End Region #Region "USERS" Friend Sub LoadUsers() Try @@ -360,7 +371,6 @@ Friend Class SettingsCLS : Implements IDisposable End Property Friend ReadOnly Property MaxUsersJobsCount As XMLValue(Of Integer) Friend ReadOnly Property ImgurClientID As XMLValue(Of String) - Friend ReadOnly Property ScriptFile As XMLValueAttribute(Of SFile, Boolean) #Region "Defaults" Friend ReadOnly Property DefaultTemporary As XMLValue(Of Boolean) Friend ReadOnly Property DefaultDownloadImages As XMLValue(Of Boolean)