From 03e3a07947cb26464b3bcd48311fd2ec531e08c3 Mon Sep 17 00:00:00 2001 From: Andy <88590076+AAndyProgram@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:25:59 +0300 Subject: [PATCH] 2024.2.22.1 Feed: add the ability to update file location when moving media Automation: make the automation file relative --- SCrawler/Download/Automation/Scheduler.vb | 8 +- .../Automation/SchedulerEditorForm.vb | 4 +- SCrawler/Download/Feed/DownloadFeedForm.vb | 145 +++++++++++++++--- SCrawler/Download/Feed/FeedMedia.vb | 9 +- SCrawler/Download/Feed/FeedSpecial.vb | 21 +++ .../Download/Feed/FeedSpecialCollection.vb | 8 +- .../Editors/GlobalSettingsForm.Designer.vb | 40 +++-- SCrawler/Editors/GlobalSettingsForm.vb | 2 + SCrawler/SettingsCLS.vb | 6 +- 9 files changed, 200 insertions(+), 43 deletions(-) diff --git a/SCrawler/Download/Automation/Scheduler.vb b/SCrawler/Download/Automation/Scheduler.vb index bbe757b..9ce7b85 100644 --- a/SCrawler/Download/Automation/Scheduler.vb +++ b/SCrawler/Download/Automation/Scheduler.vb @@ -38,7 +38,13 @@ Namespace DownloadObjects End Property Friend Sub New() Plans = New List(Of AutoDownloader) - File = Settings.AutomationFile.Value.IfNullOrEmpty(FileDefault) + Dim sFolder As SFile = SettingsFolderName.CSFileP + File = New SFile(Settings.AutomationFile.Value.IfNullOrEmpty(FileDefault.ToString)) + If File.Path.IsEmptyString OrElse Not File.Path.StartsWith(sFolder.Path) Then + Dim updateSetting As Boolean = File.Path.IsEmptyString OrElse Not File.Path.StartsWith(sFolder.CutPath.Path) + File.Path = sFolder.Path + If File.Exists And updateSetting Then Settings.AutomationFile.Value = File.File + End If If Not File.Exists Then File = FileDefault Reset(File, True) End Sub diff --git a/SCrawler/Download/Automation/SchedulerEditorForm.vb b/SCrawler/Download/Automation/SchedulerEditorForm.vb index 89e8c13..79d52f5 100644 --- a/SCrawler/Download/Automation/SchedulerEditorForm.vb +++ b/SCrawler/Download/Automation/SchedulerEditorForm.vb @@ -279,9 +279,9 @@ Namespace DownloadObjects If Not Settings.Automation.File = f AndAlso Settings.Automation.Reset(f, False) Then Settings.Automation.File = f If selectedName = defName Then - Settings.AutomationFile.Value = Nothing + Settings.AutomationFile.Value = String.Empty Else - Settings.AutomationFile.Value = f + Settings.AutomationFile.Value = f.File End If PauseArr.UpdatePauseButtons() Refill() diff --git a/SCrawler/Download/Feed/DownloadFeedForm.vb b/SCrawler/Download/Feed/DownloadFeedForm.vb index 7bc18b5..436b0ed 100644 --- a/SCrawler/Download/Feed/DownloadFeedForm.vb +++ b/SCrawler/Download/Feed/DownloadFeedForm.vb @@ -180,7 +180,7 @@ Namespace DownloadObjects DataList.Clear() End Sub Private Sub DownloadFeedForm_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown - If e.KeyCode = Keys.F5 Then RefillList0() : e.Handled = True + If e.KeyCode = Keys.F5 Then RefillList() : e.Handled = True End Sub #End Region #Region "Feeds handlers" @@ -340,19 +340,19 @@ Namespace DownloadObjects MyRange.HandlersSuspended = True MyRange.Limit = c MyRange.HandlersSuspended = False - If Not MyDefs.Initializing Then RefillList0() + If Not MyDefs.Initializing Then RefillList() End With End Sub #End Region #Region "Refill" - Private Sub RefillList0(Optional ByVal RememberPosition As Boolean? = Nothing) + Private Overloads Sub RefillList(Optional ByVal RememberPosition As Boolean? = Nothing) If IsSession Then RefillList(FeedMode = FeedModes.Current, If(RememberPosition, True)) Else RefillSpecialFeedsData() End If End Sub - Private Sub RefillList(Optional ByVal RefillDataList As Boolean = True, Optional ByVal RememberPosition As Boolean = False) + Private Overloads Sub RefillList(ByVal RefillDataList As Boolean, ByVal RememberPosition As Boolean) DataPopulated = False Dim rIndx% = -1 If RememberPosition Then rIndx = MyRange.CurrentIndex @@ -493,39 +493,136 @@ Namespace DownloadObjects End Sub #End Region Private Sub BTT_COPY_MOVE_TO_Click(sender As Object, e As EventArgs) Handles BTT_COPY_TO.Click, BTT_MOVE_TO.Click + MoveCopyFiles(True, sender, Nothing, Nothing) + End Sub + Private Function MoveCopyFiles(ByVal IsInternal As Boolean, ByVal Sender As Object, ByVal NewDestination As SFile, ByVal FeedMediaFile As SFile) As Boolean Const MsgTitle$ = "Copy/Move checked files" Try - Dim isCopy As Boolean = sender Is BTT_COPY_TO + Dim isCopy As Boolean = Not Sender Is Nothing AndAlso Sender Is BTT_COPY_TO Dim dest As SFile = Nothing - Dim ff As SFile, df As SFile + Dim ff As SFile = Nothing, df As SFile Dim files As IEnumerable(Of SFile) = Nothing + Dim mm As UserMediaD + Dim mm_data As API.Base.UserMedia + Dim indx% + Dim renameExisting As Boolean = False + Dim downloaderFilesUpdated As Boolean = False + Dim eFiles As IEnumerable(Of SFile) + Dim finder As Predicate(Of UserMediaD) = Function(media) media.Data.File = ff + Dim x As XmlFile + Dim sessionData As New List(Of UserMediaD) + Dim sesFile As SFile + Dim sesFilesReplaced As Boolean = False + Dim filesReplace As New List(Of KeyValuePair(Of SFile, SFile)) + Dim updateFileLocations As Boolean = Settings.FeedUpdateFileLocationOnMove + Dim result As Boolean = False - With GetCheckedMedia() - If .ListExists Then files = .Select(Function(m) m.Data.File) - End With + If FeedMediaFile.IsEmptyString Then + With GetCheckedMedia() + If .ListExists Then files = .Select(Function(m) m.Data.File) + End With + Else + files = {FeedMediaFile} + End If If files.ListExists Then - Using f As New FeedCopyToForm(files, isCopy) - f.ShowDialog() - If f.DialogResult = DialogResult.OK Then dest = f.Destination - End Using + If NewDestination.IsEmptyString Then + Using f As New FeedCopyToForm(files, isCopy) + f.ShowDialog() + If f.DialogResult = DialogResult.OK Then dest = f.Destination + End Using + Else + dest = NewDestination + End If If Not dest.IsEmptyString Then + If Not isCopy Then + eFiles = files.Where(Function(ByVal fff As SFile) As Boolean + fff.Path = dest + Return fff.Exists + End Function) + If eFiles.ListExists Then _ + renameExisting = MsgBoxE(New MMessage("The following files already exist at the destination. " & + "Do you still want to move them? These files will be renamed and moved." & vbCr & + $"Destination: {dest.PathWithSeparator}{vbCr}{vbCr}" & + eFiles.ListToString(vbCr), MsgTitle, {"Move", "Cancel"}, vbExclamation)) = 0 + + End If For Each ff In files If Not ff.IsEmptyString Then df = ff df.Path = dest.Path - If isCopy Then ff.Copy(df) Else SFile.Move(ff, df) + If isCopy Then + If ff.Copy(df) Then result = True + Else + If df.Exists And renameExisting Then df = SFile.IndexReindex(df,,,, New ErrorsDescriber(False, False, False, df)) + If SFile.Move(ff, df) Then + result = True + If updateFileLocations Then + filesReplace.Add(New KeyValuePair(Of SFile, SFile)(ff, df)) + indx = Downloader.Files.FindIndex(finder) + If indx >= 0 Then + mm = Downloader.Files(indx) + mm_data = mm.Data + mm_data.File = df + mm = New UserMediaD(mm_data, mm.User, mm.Session, mm.Date) + Downloader.Files(indx) = mm + downloaderFilesUpdated = True + End If + End If + End If + End If End If Next - If Not isCopy Then RefillList0() - MsgBoxE({$"The following files were copied to{vbCr}{dest}{vbCr}{vbCr}{files.ListToString(vbCr)}", MsgTitle}) + If Not isCopy And updateFileLocations Then + If downloaderFilesUpdated Then Downloader.FilesSave() + If FeedMode = FeedModes.Saved And Not LoadedSessionName.IsEmptyString And filesReplace.Count > 0 Then + sesFile = $"{TDownloader.SessionsPath.CSFilePS}{LoadedSessionName}.xml" + If sesFile.Exists Then + sessionData.Clear() + x = New XmlFile(sesFile, Protector.Modes.All, False) With {.AllowSameNames = True} + x.LoadData() + If x.Count > 0 Then sessionData.ListAddList(x) + x.Dispose() + If sessionData.Count > 0 Then + For Each rfile As KeyValuePair(Of SFile, SFile) In filesReplace + ff = rfile.Key + df = rfile.Value + indx = sessionData.FindIndex(finder) + If indx >= 0 Then + mm = sessionData(indx) + mm_data = mm.Data + mm_data.File = df + mm = New UserMediaD(mm_data, mm.User, mm.Session, mm.Date) + sessionData(indx) = mm + sesFilesReplaced = True + End If + Next + If sesFilesReplaced Then + x = New XmlFile With {.AllowSameNames = True} + x.AddRange(sessionData) + x.Name = TDownloader.Name_SessionXML + x.Save(sesFile, EDP.SendToLog) + x.Dispose() + End If + sessionData.Clear() + End If + End If + End If + If filesReplace.Count > 0 Then filesReplace.ForEach(Sub(fr) Settings.Feeds.UpdateDataByFile(fr.Key, fr.Value)) + filesReplace.Clear() + RefillList() + End If + If IsInternal Then MsgBoxE({$"The following files were {IIf(isCopy, "copied", "moved")} to{vbCr}{dest}{vbCr}{vbCr}{files.ListToString(vbCr)}", MsgTitle}) End If Else MsgBoxE({"No files selected", MsgTitle}, vbExclamation) End If + Return result Catch ex As Exception - ErrorsDescriber.Execute(EDP.LogMessageValue, ex, MsgTitle) + Return ErrorsDescriber.Execute(EDP.LogMessageValue, ex, MsgTitle, False) + Finally + Settings.Feeds.UpdateWhereDataReplaced() End Try - End Sub + End Function #Region "Load fav, spec" Private Sub BTT_LOAD_FAV_Click(sender As Object, e As EventArgs) Handles BTT_LOAD_FAV.Click FeedChangeMode(FeedModes.Special, {FeedSpecial.FavoriteName}) @@ -713,7 +810,7 @@ Namespace DownloadObjects If MsgBoxE({"Are you sure you want to clear this session data?", "Clear session"}, vbExclamation,,, {"Process", "Cancel"}) = 0 Then Downloader.Files.Clear() ClearTable() - RefillList0() + RefillList() End If End Sub #End Region @@ -848,7 +945,7 @@ Namespace DownloadObjects Settings.FeedLastModeSubscriptions.Value = OPT_SUBSCRIPTIONS.Checked MENU_DOWN.Visible = OPT_SUBSCRIPTIONS.Checked End Sub, EDP.None) - If __refill Then RefillList0() + If __refill Then RefillList() End Sub #End Region Friend Sub Downloader_FilesChanged(ByVal Added As Boolean) @@ -856,10 +953,13 @@ Namespace DownloadObjects BTT_REFRESH.ControlChangeColor(ToolbarTOP, Added, False) End Sub Private Sub BTT_REFRESH_Click(sender As Object, e As EventArgs) Handles BTT_REFRESH.Click - RefillList0() + RefillList() End Sub #End Region #Region "FeedMedia handlers" + Private Sub FeedMedia_MediaMove(ByVal Sender As FeedMedia, ByVal Destination As SFile, ByRef Result As Boolean) + Result = MoveCopyFiles(False, Nothing, Destination, Sender.File) + End Sub Private Sub FeedMedia_MediaDeleted(ByVal Sender As FeedMedia) Try ControlInvoke(TP_DATA, Sub() TPRemoveControl(Sender, True)) @@ -1061,7 +1161,7 @@ Namespace DownloadObjects If d.ListExists AndAlso Not IsSubscription AndAlso d.All(FileNotExist) Then i = Sender.CurrentIndex Sender.HandlersSuspended = True - RefillList0(False) + RefillList(False) If Sender.Count > 0 Then If i.ValueBetween(0, Sender.Count - 1) Then Sender.CurrentIndex = i Sender.HandlersSuspended = False @@ -1087,6 +1187,7 @@ Namespace DownloadObjects With fmList.Last AddHandler .MediaDeleted, AddressOf FeedMedia_MediaDeleted AddHandler .MediaDownload, AddressOf FeedMedia_Download + AddHandler .MediaMove, AddressOf FeedMedia_MediaMove AddHandler .FeedAddWithRemove, AddressOf FeedMedia_FeedAddWithRemove End With End Sub) diff --git a/SCrawler/Download/Feed/FeedMedia.vb b/SCrawler/Download/Feed/FeedMedia.vb index e402f86..3f834b8 100644 --- a/SCrawler/Download/Feed/FeedMedia.vb +++ b/SCrawler/Download/Feed/FeedMedia.vb @@ -18,6 +18,7 @@ Namespace DownloadObjects Friend Event MediaDeleted(ByVal Sender As Object) Friend Event MediaDownload As EventHandler Friend Event FeedAddWithRemove(ByVal Sender As FeedMedia, ByVal Feeds As IEnumerable(Of String), ByVal Media As UserMediaD, ByVal RemoveOperation As Boolean) + Friend Event MediaMove(ByVal Sender As FeedMedia, ByVal Destination As SFile, ByRef Result As Boolean) #End Region #Region "Declarations" Private Const VideoHeight As Integer = 450 @@ -490,6 +491,8 @@ Namespace DownloadObjects Dim isCopy As Boolean = sender Is BTT_COPY_TO Dim dest As SFile = Nothing Dim ff As SFile = File + Dim result As Boolean = False + Using f As New FeedCopyToForm({File}, isCopy) f.ShowDialog() If f.DialogResult = DialogResult.OK Then dest = f.Destination @@ -497,11 +500,11 @@ Namespace DownloadObjects If Not dest.IsEmptyString Then ff.Path = dest If isCopy Then - File.Copy(ff) + result = File.Copy(ff) Else - If SFile.Move(File, ff) Then RaiseEvent MediaDeleted(Me) + RaiseEvent MediaMove(Me, dest, result) End If - MsgBoxE({$"File {IIf(isCopy, "copied", "moved")}{vbCr}Source: '{File}'{vbCr}Destination: '{ff}'", MsgTitle}) + If result Then MsgBoxE({$"File {IIf(isCopy, "copied", "moved")}{vbCr}Source: '{File}'{vbCr}Destination: '{ff}'", MsgTitle}) End If End If Catch ex As Exception diff --git a/SCrawler/Download/Feed/FeedSpecial.vb b/SCrawler/Download/Feed/FeedSpecial.vb index 43faa1c..1105c75 100644 --- a/SCrawler/Download/Feed/FeedSpecial.vb +++ b/SCrawler/Download/Feed/FeedSpecial.vb @@ -30,6 +30,7 @@ Namespace DownloadObjects Friend Const FavoriteName As String = "Favorite" Friend Const SpecialName As String = "Special" Private ReadOnly Items As List(Of UserMediaD) + Private _FilesUpdated As Boolean = False Private _File As SFile Friend ReadOnly Property File As SFile Get @@ -167,6 +168,26 @@ Namespace DownloadObjects Return Item End Function #End Region +#Region "UpdateDataByFile" + Friend Sub UpdateDataByFile(ByVal InitialFile As SFile, ByVal NewFile As SFile) + Try + Dim indx% = Items.FindIndex(Function(ii) ii.Data.File = InitialFile) + If indx >= 0 Then + Dim m As UserMediaD = Items(indx) + Dim mm As UserMedia = m.Data + mm.File = NewFile + m = New UserMediaD(mm, m.User, m.Session, m.Date) + Items(indx) = m + _FilesUpdated = True + End If + Catch ex As Exception + ErrorsDescriber.Execute(EDP.SendToLog, ex, "[FeedSpecial.UpdateDataByFile]") + End Try + End Sub + Friend Sub UpdateIfRequired() + If _FilesUpdated Then Save() : _FilesUpdated = False + End Sub +#End Region #Region "Add" Friend Overloads Function Add(ByVal Item As UserMediaD, Optional ByVal AutoSave As Boolean = True) As Boolean If Not Items.Contains(Item) Then diff --git a/SCrawler/Download/Feed/FeedSpecialCollection.vb b/SCrawler/Download/Feed/FeedSpecialCollection.vb index 5bc122b..c3c146f 100644 --- a/SCrawler/Download/Feed/FeedSpecialCollection.vb +++ b/SCrawler/Download/Feed/FeedSpecialCollection.vb @@ -174,7 +174,7 @@ Namespace DownloadObjects End Get End Property #End Region -#Region "Add, Delete" +#Region "Add, Delete, UpdateDataByFile, UpdateWhereDataReplaced" Friend Function Add(ByVal Name As String) As Integer Dim i% = -1 If Not Name.IsEmptyString Then @@ -219,6 +219,12 @@ Namespace DownloadObjects End If Return result End Function + Friend Sub UpdateDataByFile(ByVal InitialFile As SFile, ByVal NewFile As SFile) + If Count > 0 Then Feeds.ForEach(Sub(f) f.UpdateDataByFile(InitialFile, NewFile)) + End Sub + Friend Sub UpdateWhereDataReplaced() + If Count > 0 Then Feeds.ForEach(Sub(f) f.UpdateIfRequired()) + End Sub #End Region #Region "IndexOf" Friend Function IndexOf(ByVal Name As String) As Integer diff --git a/SCrawler/Editors/GlobalSettingsForm.Designer.vb b/SCrawler/Editors/GlobalSettingsForm.Designer.vb index 0393fd7..955dd54 100644 --- a/SCrawler/Editors/GlobalSettingsForm.Designer.vb +++ b/SCrawler/Editors/GlobalSettingsForm.Designer.vb @@ -133,6 +133,7 @@ Namespace Editors Me.CH_STD_SNAP_CACHE_PERMANENT = New System.Windows.Forms.CheckBox() Me.CH_STD_YT_CREATE_URL = New System.Windows.Forms.CheckBox() Me.CH_USE_DEF_ACC = New System.Windows.Forms.CheckBox() + Me.CH_NOTIFY_LOG = New System.Windows.Forms.CheckBox() Me.TXT_CHANNELS_ROWS = New PersonalUtilities.Forms.Controls.TextBoxExtended() Me.TXT_CHANNELS_COLUMNS = New PersonalUtilities.Forms.Controls.TextBoxExtended() Me.CH_DOWN_IMAGES_NATIVE = New System.Windows.Forms.CheckBox() @@ -178,7 +179,7 @@ Namespace Editors Me.TAB_MAIN = New System.Windows.Forms.TabControl() Me.TAB_ENVIR = New System.Windows.Forms.TabPage() Me.CONTAINER_MAIN = New System.Windows.Forms.ToolStripContainer() - Me.CH_NOTIFY_LOG = New System.Windows.Forms.CheckBox() + Me.CH_FEED_UP_FILE_LOC_MOVE = New System.Windows.Forms.CheckBox() TP_BASIS = New System.Windows.Forms.TableLayoutPanel() TP_IMAGES = New System.Windows.Forms.TableLayoutPanel() TP_FILE_NAME = New System.Windows.Forms.TableLayoutPanel() @@ -1037,6 +1038,18 @@ Namespace Editors TT_MAIN.SetToolTip(Me.CH_USE_DEF_ACC, "Use the default account if you deleted an account that you used for some users") Me.CH_USE_DEF_ACC.UseVisualStyleBackColor = True ' + 'CH_NOTIFY_LOG + ' + Me.CH_NOTIFY_LOG.AutoSize = True + Me.CH_NOTIFY_LOG.Dock = System.Windows.Forms.DockStyle.Fill + Me.CH_NOTIFY_LOG.Location = New System.Drawing.Point(4, 212) + Me.CH_NOTIFY_LOG.Name = "CH_NOTIFY_LOG" + Me.CH_NOTIFY_LOG.Size = New System.Drawing.Size(568, 19) + Me.CH_NOTIFY_LOG.TabIndex = 8 + Me.CH_NOTIFY_LOG.Text = "The log contains new data" + TT_MAIN.SetToolTip(Me.CH_NOTIFY_LOG, "Show a notification when the new data is added to the log.") + Me.CH_NOTIFY_LOG.UseVisualStyleBackColor = True + ' 'TP_CHANNELS_IMGS ' TP_CHANNELS_IMGS.ColumnCount = 2 @@ -1507,10 +1520,11 @@ Namespace Editors TP_FEED.Controls.Add(Me.CH_FEED_OPEN_LAST_MODE, 0, 7) TP_FEED.Controls.Add(Me.CH_FEED_SHOW_FRIENDLY, 0, 8) TP_FEED.Controls.Add(Me.CH_FEED_SHOW_SPEC_MEDIAITEM, 0, 9) + TP_FEED.Controls.Add(Me.CH_FEED_UP_FILE_LOC_MOVE, 0, 10) TP_FEED.Dock = System.Windows.Forms.DockStyle.Fill TP_FEED.Location = New System.Drawing.Point(0, 0) TP_FEED.Name = "TP_FEED" - TP_FEED.RowCount = 11 + TP_FEED.RowCount = 12 TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!)) TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) @@ -1521,6 +1535,7 @@ Namespace Editors TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) + TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!)) TP_FEED.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) TP_FEED.Size = New System.Drawing.Size(576, 399) TP_FEED.TabIndex = 0 @@ -2154,17 +2169,17 @@ Namespace Editors Me.CONTAINER_MAIN.TabIndex = 0 Me.CONTAINER_MAIN.TopToolStripPanelVisible = False ' - 'CH_NOTIFY_LOG + 'CH_FEED_UP_FILE_LOC_MOVE ' - Me.CH_NOTIFY_LOG.AutoSize = True - Me.CH_NOTIFY_LOG.Dock = System.Windows.Forms.DockStyle.Fill - Me.CH_NOTIFY_LOG.Location = New System.Drawing.Point(4, 212) - Me.CH_NOTIFY_LOG.Name = "CH_NOTIFY_LOG" - Me.CH_NOTIFY_LOG.Size = New System.Drawing.Size(568, 19) - Me.CH_NOTIFY_LOG.TabIndex = 8 - Me.CH_NOTIFY_LOG.Text = "The log contains new data" - TT_MAIN.SetToolTip(Me.CH_NOTIFY_LOG, "Show a notification when the new data is added to the log.") - Me.CH_NOTIFY_LOG.UseVisualStyleBackColor = True + Me.CH_FEED_UP_FILE_LOC_MOVE.AutoSize = True + Me.CH_FEED_UP_FILE_LOC_MOVE.Dock = System.Windows.Forms.DockStyle.Fill + Me.CH_FEED_UP_FILE_LOC_MOVE.Location = New System.Drawing.Point(4, 273) + Me.CH_FEED_UP_FILE_LOC_MOVE.Name = "CH_FEED_UP_FILE_LOC_MOVE" + Me.CH_FEED_UP_FILE_LOC_MOVE.Size = New System.Drawing.Size(568, 19) + Me.CH_FEED_UP_FILE_LOC_MOVE.TabIndex = 10 + Me.CH_FEED_UP_FILE_LOC_MOVE.Text = "Update file location when moved" + TT_MAIN.SetToolTip(Me.CH_FEED_UP_FILE_LOC_MOVE, "The file location will be updated in the session data and in the feeds data") + Me.CH_FEED_UP_FILE_LOC_MOVE.UseVisualStyleBackColor = True ' 'GlobalSettingsForm ' @@ -2357,5 +2372,6 @@ Namespace Editors Private WithEvents CH_USE_DEF_ACC As CheckBox Private WithEvents CH_FEED_SHOW_SPEC_MEDIAITEM As CheckBox Private WithEvents CH_NOTIFY_LOG As CheckBox + Private WithEvents CH_FEED_UP_FILE_LOC_MOVE As CheckBox End Class End Namespace \ No newline at end of file diff --git a/SCrawler/Editors/GlobalSettingsForm.vb b/SCrawler/Editors/GlobalSettingsForm.vb index 943afe9..a973f74 100644 --- a/SCrawler/Editors/GlobalSettingsForm.vb +++ b/SCrawler/Editors/GlobalSettingsForm.vb @@ -143,6 +143,7 @@ Namespace Editors CH_FEED_OPEN_LAST_MODE.Checked = .FeedOpenLastMode CH_FEED_SHOW_FRIENDLY.Checked = .FeedShowFriendlyNames CH_FEED_SHOW_SPEC_MEDIAITEM.Checked = .FeedShowSpecialFeedsMediaItem + CH_FEED_UP_FILE_LOC_MOVE.Checked = .FeedUpdateFileLocationOnMove End With .MyFieldsChecker = New FieldsChecker With .MyFieldsCheckerE @@ -316,6 +317,7 @@ Namespace Editors .FeedOpenLastMode.Value = CH_FEED_OPEN_LAST_MODE.Checked .FeedShowFriendlyNames.Value = CH_FEED_SHOW_FRIENDLY.Checked .FeedShowSpecialFeedsMediaItem.Value = CH_FEED_SHOW_SPEC_MEDIAITEM.Checked + .FeedUpdateFileLocationOnMove.Value = CH_FEED_UP_FILE_LOC_MOVE.Checked FeedParametersChanged = .FeedDataRows.ChangesDetected Or .FeedDataColumns.ChangesDetected Or .FeedEndless.ChangesDetected Or .FeedBackColor.ChangesDetected Or .FeedForeColor.ChangesDetected Or .FeedCenterImage.ChangesDetected diff --git a/SCrawler/SettingsCLS.vb b/SCrawler/SettingsCLS.vb index 440f22d..beccdab 100644 --- a/SCrawler/SettingsCLS.vb +++ b/SCrawler/SettingsCLS.vb @@ -134,7 +134,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable Friend ReadOnly Property DownloadLocations As STDownloader.DownloadLocationsCollection Friend ReadOnly Property GlobalLocations As STDownloader.DownloadLocationsCollection Friend Property Automation As Scheduler - Friend ReadOnly Property AutomationFile As XMLValue(Of SFile) + Friend ReadOnly Property AutomationFile As XMLValue(Of String) Friend ReadOnly Property Feeds As FeedSpecialCollection Friend ReadOnly Property BlackList As List(Of UserBan) Private ReadOnly BlackListFile As SFile = $"{SettingsFolderName}\BlackList.txt" @@ -179,7 +179,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable SeparateVideoFolder = New XMLValue(Of Boolean)("SeparateVideoFolder", True, MyXML) CollectionsPath = New XMLValue(Of String)("CollectionsPath", CollectionsFolderName, MyXML) - AutomationFile = New XMLValue(Of SFile)("AutomationFile",, MyXML) + AutomationFile = New XMLValue(Of String)("AutomationFile",, MyXML) UserAgent = New XMLValue(Of String)("UserAgent",, MyXML) If Not UserAgent.IsEmptyString Then DefaultUserAgent = UserAgent @@ -321,6 +321,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable FeedShowFriendlyNames = New XMLValue(Of Boolean)("ShowFriendlyNames", True, MyXML, n) FeedShowSpecialFeedsMediaItem = New XMLValue(Of Boolean)("ShowSpecialFeedsMediaItem", False, MyXML, n) FeedLastCopyMoveLocation = New XMLValue(Of SFile)("LastCopyMoveLocation",, MyXML, n) + FeedUpdateFileLocationOnMove = New XMLValue(Of Boolean)("UpdateFileLocationOnMove", True, MyXML, n) n = {"Users"} FromChannelDownloadTop = New XMLValue(Of Integer)("FromChannelDownloadTop", 10, MyXML, n) @@ -956,6 +957,7 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable Friend ReadOnly Property FeedShowFriendlyNames As XMLValue(Of Boolean) Friend ReadOnly Property FeedShowSpecialFeedsMediaItem As XMLValue(Of Boolean) Friend ReadOnly Property FeedLastCopyMoveLocation As XMLValue(Of SFile) + Friend ReadOnly Property FeedUpdateFileLocationOnMove As XMLValue(Of Boolean) #End Region #Region "New version properties" Friend ReadOnly Property CheckUpdatesAtStart As XMLValue(Of Boolean)