From 0657f3d1955c57b0a596fc4fbe0dc1f9244218eb Mon Sep 17 00:00:00 2001 From: Andy <88590076+AAndyProgram@users.noreply.github.com> Date: Wed, 6 Dec 2023 18:28:36 +0300 Subject: [PATCH] 2023.12.6.1 Update updater YT: add new version check at start --- SCrawler.Shared/.editorconfig | 3 + SCrawler.Shared/Functions.vb | 33 ++++ .../My Project/Application.Designer.vb | 13 ++ SCrawler.Shared/My Project/Application.myapp | 10 ++ SCrawler.Shared/My Project/AssemblyInfo.vb | 37 +++++ .../My Project/Resources.Designer.vb | 63 ++++++++ SCrawler.Shared/My Project/Resources.resx | 117 ++++++++++++++ .../My Project/Settings.Designer.vb | 73 +++++++++ SCrawler.Shared/My Project/Settings.settings | 7 + SCrawler.Shared/SCrawler.Shared.vbproj | 151 ++++++++++++++++++ SCrawler.Updater/MainMod.vb | 21 +-- .../My Project/Resources.Designer.vb | 2 +- .../My Project/Settings.Designer.vb | 66 ++++---- SCrawler.Updater/SCrawler.Updater.vbproj | 7 +- SCrawler.YouTube/Base/YouTubeSettings.vb | 2 + SCrawler.YouTube/Declarations.vb | 11 ++ SCrawler.YouTube/Downloader/VideoListForm.vb | 5 +- SCrawler.YouTube/MainModShared.vb | 5 +- SCrawler.YouTube/SCrawler.YouTube.vbproj | 4 + SCrawler.sln | 14 ++ SCrawler/MainMod.vb | 4 +- SCrawler/SCrawler.vbproj | 4 + 22 files changed, 591 insertions(+), 61 deletions(-) create mode 100644 SCrawler.Shared/.editorconfig create mode 100644 SCrawler.Shared/Functions.vb create mode 100644 SCrawler.Shared/My Project/Application.Designer.vb create mode 100644 SCrawler.Shared/My Project/Application.myapp create mode 100644 SCrawler.Shared/My Project/AssemblyInfo.vb create mode 100644 SCrawler.Shared/My Project/Resources.Designer.vb create mode 100644 SCrawler.Shared/My Project/Resources.resx create mode 100644 SCrawler.Shared/My Project/Settings.Designer.vb create mode 100644 SCrawler.Shared/My Project/Settings.settings create mode 100644 SCrawler.Shared/SCrawler.Shared.vbproj diff --git a/SCrawler.Shared/.editorconfig b/SCrawler.Shared/.editorconfig new file mode 100644 index 0000000..3a44845 --- /dev/null +++ b/SCrawler.Shared/.editorconfig @@ -0,0 +1,3 @@ +[*.vb] +# Modifier preferences +file_header_template = Copyright (C) Andy https://github.com/AAndyProgram\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see \ No newline at end of file diff --git a/SCrawler.Shared/Functions.vb b/SCrawler.Shared/Functions.vb new file mode 100644 index 0000000..cb8be34 --- /dev/null +++ b/SCrawler.Shared/Functions.vb @@ -0,0 +1,33 @@ +' Copyright (C) Andy https://github.com/AAndyProgram +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY +Namespace [Shared] + Public Module Functions + Public Const NewReleaseFolderName As String = "__NewRelease" + Public Function GetCurrentMaxVer(Optional ByVal Path As SFile = Nothing) As Version + Try + If Path.IsEmptyString Then Path = Application.StartupPath.CSFileP + If Path.Exists(SFO.Path, False) Then + Dim versions As New List(Of Version) + Dim v As FileVersionInfo + With SFile.GetFiles(Path, "*.exe",, EDP.ReturnValue).ListIfNothing.Where(Function(f) f.Name = "SCrawler" Or f.Name = "YouTubeDownloader") + If .ListExists Then + For Each f As SFile In .Self + v = FileVersionInfo.GetVersionInfo(f) + versions.Add(New Version(v.ProductVersion)) + Next + End If + End With + If versions.Count > 0 Then Return versions.LastOrDefault + End If + Catch + End Try + Return Nothing + End Function + End Module +End Namespace \ No newline at end of file diff --git a/SCrawler.Shared/My Project/Application.Designer.vb b/SCrawler.Shared/My Project/Application.Designer.vb new file mode 100644 index 0000000..88dd01c --- /dev/null +++ b/SCrawler.Shared/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/SCrawler.Shared/My Project/Application.myapp b/SCrawler.Shared/My Project/Application.myapp new file mode 100644 index 0000000..758895d --- /dev/null +++ b/SCrawler.Shared/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 1 + true + diff --git a/SCrawler.Shared/My Project/AssemblyInfo.vb b/SCrawler.Shared/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..8213551 --- /dev/null +++ b/SCrawler.Shared/My Project/AssemblyInfo.vb @@ -0,0 +1,37 @@ +Imports System.Resources +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + + diff --git a/SCrawler.Shared/My Project/Resources.Designer.vb b/SCrawler.Shared/My Project/Resources.Designer.vb new file mode 100644 index 0000000..3d40d22 --- /dev/null +++ b/SCrawler.Shared/My Project/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("SCrawler.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/SCrawler.Shared/My Project/Resources.resx b/SCrawler.Shared/My Project/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/SCrawler.Shared/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SCrawler.Shared/My Project/Settings.Designer.vb b/SCrawler.Shared/My Project/Settings.Designer.vb new file mode 100644 index 0000000..fcfd812 --- /dev/null +++ b/SCrawler.Shared/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.SCrawler.My.MySettings + Get + Return Global.SCrawler.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/SCrawler.Shared/My Project/Settings.settings b/SCrawler.Shared/My Project/Settings.settings new file mode 100644 index 0000000..85b890b --- /dev/null +++ b/SCrawler.Shared/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/SCrawler.Shared/SCrawler.Shared.vbproj b/SCrawler.Shared/SCrawler.Shared.vbproj new file mode 100644 index 0000000..41ff721 --- /dev/null +++ b/SCrawler.Shared/SCrawler.Shared.vbproj @@ -0,0 +1,151 @@ + + + + + Debug + AnyCPU + {DC634700-24C7-42DD-BF8F-87E6CC54E625} + Library + SCrawler + SCrawler.Shared + 512 + Windows + v4.6.1 + true + + + true + full + true + true + bin\Debug\ + + + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + pdbonly + false + true + true + bin\Release\ + + + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + true + true + true + bin\x64\Debug\ + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + full + x64 + + + true + bin\x64\Release\ + true + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + pdbonly + x64 + + + true + true + true + bin\x86\Debug\ + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + full + x86 + + + true + bin\x86\Release\ + true + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + pdbonly + x86 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + True + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + {8405896b-2685-4916-bc93-1fb514c323a9} + PersonalUtilities + + + + \ No newline at end of file diff --git a/SCrawler.Updater/MainMod.vb b/SCrawler.Updater/MainMod.vb index 841984d..3d22721 100644 --- a/SCrawler.Updater/MainMod.vb +++ b/SCrawler.Updater/MainMod.vb @@ -12,8 +12,8 @@ Imports PersonalUtilities.Functions Imports PersonalUtilities.Functions.XML Imports PersonalUtilities.Tools.Web.Clients Imports PersonalUtilities.Tools.Web.Documents.JSON +Imports SCrawler.Shared Public Module MainMod - Private Const NewReleaseFolderName As String = "__NewRelease" Private MyProcessID As Integer = -1 Private MyWorkingPath As SFile = Nothing Private ReadOnly ProcessNames As String() = {"SCrawler", "YouTubeDownloader", "Updater"} @@ -226,23 +226,4 @@ Public Module MainMod End Try Return Nothing End Function - Private Function GetCurrentMaxVer(ByVal Path As SFile) As Version - Try - If Path.Exists(SFO.Path, False) Then - Dim versions As New List(Of Version) - Dim v As FileVersionInfo - With SFile.GetFiles(Path, "*.exe",, EDP.ReturnValue).ListIfNothing.Where(Function(f) f.Name = "SCrawler" Or f.Name = "YouTubeDownloader") - If .ListExists Then - For Each f As SFile In .Self - v = FileVersionInfo.GetVersionInfo(f) - versions.Add(New Version(v.ProductVersion)) - Next - End If - End With - If versions.Count > 0 Then Return versions.LastOrDefault - End If - Catch - End Try - Return Nothing - End Function End Module \ No newline at end of file diff --git a/SCrawler.Updater/My Project/Resources.Designer.vb b/SCrawler.Updater/My Project/Resources.Designer.vb index cef9a7b..6813345 100644 --- a/SCrawler.Updater/My Project/Resources.Designer.vb +++ b/SCrawler.Updater/My Project/Resources.Designer.vb @@ -39,7 +39,7 @@ Namespace My.Resources Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager Get If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("SCrawler.Updater.Resources", GetType(Resources).Assembly) + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("SCrawler.Resources", GetType(Resources).Assembly) resourceMan = temp End If Return resourceMan diff --git a/SCrawler.Updater/My Project/Settings.Designer.vb b/SCrawler.Updater/My Project/Settings.Designer.vb index 8998fdc..fcfd812 100644 --- a/SCrawler.Updater/My Project/Settings.Designer.vb +++ b/SCrawler.Updater/My Project/Settings.Designer.vb @@ -13,42 +13,42 @@ Option Explicit On Namespace My - - _ + + _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) - + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + #Region "My.Settings Auto-Save Functionality" #If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean + Private Shared addedHandler As Boolean - Private Shared addedHandlerLockObject As New Object + Private Shared addedHandlerLockObject As New Object - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub + _ + Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub #End If #End Region - + Public Shared ReadOnly Property [Default]() As MySettings Get - + #If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If #End If Return defaultInstance End Get @@ -57,16 +57,16 @@ Namespace My End Namespace Namespace My - - _ + + _ Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.SCrawler.Updater.My.MySettings + + _ + Friend ReadOnly Property Settings() As Global.SCrawler.My.MySettings Get - Return Global.SCrawler.Updater.My.MySettings.Default + Return Global.SCrawler.My.MySettings.Default End Get End Property End Module diff --git a/SCrawler.Updater/SCrawler.Updater.vbproj b/SCrawler.Updater/SCrawler.Updater.vbproj index 4123e60..b3f0404 100644 --- a/SCrawler.Updater/SCrawler.Updater.vbproj +++ b/SCrawler.Updater/SCrawler.Updater.vbproj @@ -7,7 +7,7 @@ {71263EEE-E25F-44DD-B0A9-F09047C0BEEA} Exe Sub Main - SCrawler.Updater + SCrawler Updater 512 Console @@ -121,6 +121,7 @@ True Application.myapp + True True @@ -163,6 +164,10 @@ {8405896b-2685-4916-bc93-1fb514c323a9} PersonalUtilities + + {dc634700-24c7-42dd-bf8f-87e6cc54e625} + SCrawler.Shared + \ No newline at end of file diff --git a/SCrawler.YouTube/Base/YouTubeSettings.vb b/SCrawler.YouTube/Base/YouTubeSettings.vb index a1b2989..d8d5c85 100644 --- a/SCrawler.YouTube/Base/YouTubeSettings.vb +++ b/SCrawler.YouTube/Base/YouTubeSettings.vb @@ -132,6 +132,8 @@ Namespace API.YouTube.Base OpenFolderInOtherProgram.Value = command End Set End Property + + Friend ReadOnly Property CheckUpdatesAtStart As XMLValue(Of Boolean) #End Region #Region "Info" {d4650f6b-5a54-44b6-999b-6c675b7116b1} SCrawler.PluginProvider + + {dc634700-24c7-42dd-bf8f-87e6cc54e625} + SCrawler.Shared + diff --git a/SCrawler.sln b/SCrawler.sln index 77a1a01..ff2c703 100644 --- a/SCrawler.sln +++ b/SCrawler.sln @@ -27,6 +27,8 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SCrawler.YouTubeDownloader" EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SCrawler.Updater", "SCrawler.Updater\SCrawler.Updater.vbproj", "{71263EEE-E25F-44DD-B0A9-F09047C0BEEA}" EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SCrawler.Shared", "SCrawler.Shared\SCrawler.Shared.vbproj", "{DC634700-24C7-42DD-BF8F-87E6CC54E625}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -121,6 +123,18 @@ Global {71263EEE-E25F-44DD-B0A9-F09047C0BEEA}.Release|x64.Build.0 = Release|x64 {71263EEE-E25F-44DD-B0A9-F09047C0BEEA}.Release|x86.ActiveCfg = Release|x86 {71263EEE-E25F-44DD-B0A9-F09047C0BEEA}.Release|x86.Build.0 = Release|x86 + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Debug|x64.ActiveCfg = Debug|x64 + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Debug|x64.Build.0 = Debug|x64 + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Debug|x86.ActiveCfg = Debug|x86 + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Debug|x86.Build.0 = Debug|x86 + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Release|Any CPU.Build.0 = Release|Any CPU + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Release|x64.ActiveCfg = Release|x64 + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Release|x64.Build.0 = Release|x64 + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Release|x86.ActiveCfg = Release|x86 + {DC634700-24C7-42DD-BF8F-87E6CC54E625}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SCrawler/MainMod.vb b/SCrawler/MainMod.vb index 736336c..e4835ba 100644 --- a/SCrawler/MainMod.vb +++ b/SCrawler/MainMod.vb @@ -151,7 +151,9 @@ Friend Module MainMod Friend Sub CheckVersion(ByVal Force As Boolean) With Settings If .CheckUpdatesAtStart Or Force Then - ShowProgramInfo(.ProgramText.Value.IfNullOrEmpty("SCrawler"), My.Application.Info.Version, True, Force, .Self, False, + ShowProgramInfo(.ProgramText.Value.IfNullOrEmpty("SCrawler"), + SCrawler.Shared.GetCurrentMaxVer(Application.StartupPath.CSFileP).IfNullOrEmpty(My.Application.Info.Version), + True, Force, .Self, False, .LatestVersion.Value, .ShowNewVersionNotification.Value, .ProgramDescription) End If End With diff --git a/SCrawler/SCrawler.vbproj b/SCrawler/SCrawler.vbproj index fe4132c..de66db4 100644 --- a/SCrawler/SCrawler.vbproj +++ b/SCrawler/SCrawler.vbproj @@ -636,6 +636,10 @@ {d4650f6b-5a54-44b6-999b-6c675b7116b1} SCrawler.PluginProvider + + {dc634700-24c7-42dd-bf8f-87e6cc54e625} + SCrawler.Shared + {7c764707-7fd1-469c-a365-94605c193607} SCrawler.YouTube