mirror of
https://github.com/hama3254/Crunchyroll-Downloader-v3.0.git
synced 2024-12-27 08:31:49 +01:00
auto updater
auto updater (test version)
This commit is contained in:
parent
2c7d26fe51
commit
1b8098057a
Binary file not shown.
@ -159,6 +159,9 @@
|
|||||||
<setting name="HiddenQueue" serializeAs="String">
|
<setting name="HiddenQueue" serializeAs="String">
|
||||||
<value>False</value>
|
<value>False</value>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="UpdateLog" serializeAs="String">
|
||||||
|
<value>0</value>
|
||||||
|
</setting>
|
||||||
</Crunchyroll_Downloader.My.MySettings>
|
</Crunchyroll_Downloader.My.MySettings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -14,6 +14,8 @@ Imports Newtonsoft.Json.Linq
|
|||||||
Imports System.Runtime.InteropServices
|
Imports System.Runtime.InteropServices
|
||||||
Imports MyProvider.MyProvider
|
Imports MyProvider.MyProvider
|
||||||
Imports Crunchyroll_Downloader.CRD_Classes
|
Imports Crunchyroll_Downloader.CRD_Classes
|
||||||
|
Imports System.Runtime.Remoting.Contexts
|
||||||
|
Imports System.Reflection
|
||||||
|
|
||||||
Public Class Main
|
Public Class Main
|
||||||
Inherits MetroForm
|
Inherits MetroForm
|
||||||
@ -372,6 +374,10 @@ Public Class Main
|
|||||||
|
|
||||||
Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
|
|
||||||
|
If CBool(InStr(Assembly.GetExecutingAssembly().CodeBase, "Auto_Updated.exe")) Then
|
||||||
|
Pause(3)
|
||||||
|
End If
|
||||||
|
|
||||||
FillArray()
|
FillArray()
|
||||||
|
|
||||||
#Region "settings path"
|
#Region "settings path"
|
||||||
@ -569,7 +575,7 @@ Public Class Main
|
|||||||
RetryWithCachedFiles()
|
RetryWithCachedFiles()
|
||||||
|
|
||||||
'MsgBox(Curl_insecure.ToString)
|
'MsgBox(Curl_insecure.ToString)
|
||||||
|
BGW_Update.RunWorkerAsync()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
@ -2260,6 +2266,7 @@ Public Class Main
|
|||||||
Sub ServerStart()
|
Sub ServerStart()
|
||||||
Dim server As TcpListener
|
Dim server As TcpListener
|
||||||
server = Nothing
|
server = Nothing
|
||||||
|
System.Threading.Thread.Sleep(5000)
|
||||||
Try
|
Try
|
||||||
Dim Port As String = StartServer.ToString
|
Dim Port As String = StartServer.ToString
|
||||||
Dim localAddr As IPAddress = IPAddress.Parse("127.0.0.1")
|
Dim localAddr As IPAddress = IPAddress.Parse("127.0.0.1")
|
||||||
@ -3271,6 +3278,7 @@ Public Class Main
|
|||||||
|
|
||||||
Private Sub BGW_Update_DoWork(sender As Object, e As DoWorkEventArgs) Handles BGW_Update.DoWork
|
Private Sub BGW_Update_DoWork(sender As Object, e As DoWorkEventArgs) Handles BGW_Update.DoWork
|
||||||
Try
|
Try
|
||||||
|
|
||||||
Dim client0 As New WebClient
|
Dim client0 As New WebClient
|
||||||
client0.Encoding = Encoding.UTF8
|
client0.Encoding = Encoding.UTF8
|
||||||
client0.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
|
client0.Headers.Add(My.Settings.User_Agend.Replace(Chr(34), ""))
|
||||||
@ -3283,18 +3291,121 @@ Public Class Main
|
|||||||
For i As Integer = 1 To GitHubLastIsPre.Count - 1
|
For i As Integer = 1 To GitHubLastIsPre.Count - 1
|
||||||
Dim GitHubLastIsPre1() As String = GitHubLastIsPre(i).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries)
|
Dim GitHubLastIsPre1() As String = GitHubLastIsPre(i).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||||
|
|
||||||
If GitHubLastIsPre1(0) = "false" Then
|
'If GitHubLastIsPre1(0) = "false" Then
|
||||||
LastNonPreRelase = i
|
LastNonPreRelase = i
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
'End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Dim GitHubLastTag() As String = str0.Split(New String() {Chr(34) + "tag_name" + Chr(34) + ": " + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
Dim GitHubLastTag() As String = str0.Split(New String() {Chr(34) + "tag_name" + Chr(34) + ": " + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||||
Dim GitHubLastTag1() As String = GitHubLastTag(LastNonPreRelase).Split(New String() {Chr(34) + ","}, System.StringSplitOptions.RemoveEmptyEntries)
|
Dim GitHubLastTag1() As String = GitHubLastTag(LastNonPreRelase).Split(New String() {Chr(34) + ","}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||||
|
|
||||||
'LastVersionString = GitHubLastTag1(0)
|
'LastVersionString = GitHubLastTag1(0)
|
||||||
|
'MsgBox(GitHubLastTag1(0))
|
||||||
|
|
||||||
|
Dim OnlineVersionNumber As String = GitHubLastTag1(0).Replace("v", "")
|
||||||
|
'Debug.WriteLine("OnlineVersionNumber: " + OnlineVersionNumber)
|
||||||
|
|
||||||
|
Dim OnlineSplitVersion() As String = OnlineVersionNumber.Split(New String() {"."}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||||
|
Dim LocalSplitVersion() As String = Application.ProductVersion.Split(New String() {"."}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||||
|
|
||||||
|
Dim TestLenght As Integer = OnlineSplitVersion.Length
|
||||||
|
Dim UpdateAv As Boolean = False
|
||||||
|
|
||||||
|
If OnlineSplitVersion.Length > LocalSplitVersion.Length Then
|
||||||
|
TestLenght = LocalSplitVersion.Length
|
||||||
|
End If
|
||||||
|
|
||||||
|
'Debug.WriteLine("TestLenght: " + TestLenght.ToString)
|
||||||
|
'Debug.WriteLine("OnlineSplitVersion: " + OnlineSplitVersion.ToString)
|
||||||
|
'Debug.WriteLine("LocalSplitVersion: " + LocalSplitVersion.ToString)
|
||||||
|
|
||||||
|
For i As Integer = 0 To TestLenght - 1
|
||||||
|
If CInt(OnlineSplitVersion(i)) > CInt(LocalSplitVersion(i)) Then
|
||||||
|
'to update
|
||||||
|
UpdateAv = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
If UpdateAv = False Then 'no update needed
|
||||||
|
Debug.WriteLine("Update check passed")
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
Debug.WriteLine("Update check failed")
|
||||||
|
'Check for updated file
|
||||||
|
If File.Exists(Application.StartupPath + "\Auto_Updated.exe") And CBool(InStr(Assembly.GetExecutingAssembly().CodeBase, "Auto_Updated.exe")) = False Then
|
||||||
|
'there is an updated file but we are not it
|
||||||
|
Dim exepath As String = Application.StartupPath + "\" + "Auto_Updated.exe"
|
||||||
|
Dim startinfo As New System.Diagnostics.ProcessStartInfo
|
||||||
|
|
||||||
|
'all parameters required to run the process
|
||||||
|
startinfo.FileName = exepath
|
||||||
|
'startinfo.Arguments = cmd
|
||||||
|
startinfo.UseShellExecute = False
|
||||||
|
startinfo.WindowStyle = ProcessWindowStyle.Normal
|
||||||
|
startinfo.RedirectStandardError = True
|
||||||
|
startinfo.RedirectStandardInput = True
|
||||||
|
startinfo.RedirectStandardOutput = True
|
||||||
|
startinfo.CreateNoWindow = True
|
||||||
|
|
||||||
|
Dim proc As Process = New Process
|
||||||
|
proc.StartInfo = startinfo
|
||||||
|
proc.Start() ' start the process
|
||||||
|
Me.Invoke(New Action(Function() As Object
|
||||||
|
Me.Close()
|
||||||
|
Return Nothing
|
||||||
|
End Function))
|
||||||
|
|
||||||
|
Exit Sub 'do we need that?
|
||||||
|
ElseIf File.Exists(Application.StartupPath + "\Auto_Updated.exe") And CBool(InStr(Assembly.GetExecutingAssembly().CodeBase, "Auto_Updated.exe")) = True Then
|
||||||
|
'we are the update and failed the version check?
|
||||||
|
|
||||||
|
|
||||||
|
'if the online exe is tagged different/lower than the release tag we will get a loop (not good)
|
||||||
|
If My.Settings.UpdateLog = Date.Now.Day.ToString + Date.Now.Month.ToString Then ' is day + month enough ?
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
My.Settings.UpdateLog = Date.Now.Day.ToString + Date.Now.Month.ToString
|
||||||
|
My.Computer.FileSystem.RenameFile(Application.StartupPath + "\Auto_Updated.exe", GeräteID() + ".exe")
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
If CBool(InStr(str0, "Auto_Update_" + GitHubLastTag1(0) + ".exe")) Then
|
||||||
|
Debug.WriteLine(True.ToString)
|
||||||
|
Dim UpdateUrl() As String = str0.Split(New String() {"Auto_Update_" + GitHubLastTag1(0) + ".exe"}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||||
|
Dim UpdateUrl2() As String = UpdateUrl(1).Split(New String() {Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||||
|
Dim FinalUrl As String = UpdateUrl2(UpdateUrl2.Length - 1) + "Auto_Update_" + GitHubLastTag1(0) + ".exe"
|
||||||
|
Debug.WriteLine("Auto-Update: " + FinalUrl)
|
||||||
|
Debug.WriteLine("Auto-Update: " + Application.StartupPath + "\" + "Auto_Updated.exe")
|
||||||
|
client0.DownloadFile(FinalUrl, Application.StartupPath + "\" + "Auto_Updated.exe")
|
||||||
|
|
||||||
|
Dim exepath As String = Application.StartupPath + "\" + "Auto_Updated.exe"
|
||||||
|
Dim startinfo As New System.Diagnostics.ProcessStartInfo
|
||||||
|
|
||||||
|
'all parameters required to run the process
|
||||||
|
startinfo.FileName = exepath
|
||||||
|
'startinfo.Arguments = cmd
|
||||||
|
startinfo.UseShellExecute = False
|
||||||
|
startinfo.WindowStyle = ProcessWindowStyle.Normal
|
||||||
|
startinfo.RedirectStandardError = True
|
||||||
|
startinfo.RedirectStandardInput = True
|
||||||
|
startinfo.RedirectStandardOutput = True
|
||||||
|
startinfo.CreateNoWindow = True
|
||||||
|
|
||||||
|
Dim proc As Process = New Process
|
||||||
|
proc.StartInfo = startinfo
|
||||||
|
proc.Start() ' start the process
|
||||||
|
|
||||||
|
Me.Invoke(New Action(Function() As Object
|
||||||
|
Me.Close()
|
||||||
|
Return Nothing
|
||||||
|
End Function))
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
'Debug.WriteLine(GitHubLastTag1(0))
|
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Debug.WriteLine(ex.ToString)
|
Debug.WriteLine(ex.ToString)
|
||||||
|
@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
|
|||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("3.23.5")>
|
<Assembly: AssemblyVersion("3.23.6")>
|
||||||
<Assembly: AssemblyFileVersion("3.23.5")>
|
<Assembly: AssemblyFileVersion("3.23.6")>
|
||||||
<Assembly: NeutralResourcesLanguage("en")>
|
<Assembly: NeutralResourcesLanguage("en")>
|
||||||
|
@ -606,6 +606,18 @@ Namespace My
|
|||||||
Me("HiddenQueue") = value
|
Me("HiddenQueue") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Configuration.DefaultSettingValueAttribute("0")> _
|
||||||
|
Public Property UpdateLog() As String
|
||||||
|
Get
|
||||||
|
Return CType(Me("UpdateLog"),String)
|
||||||
|
End Get
|
||||||
|
Set
|
||||||
|
Me("UpdateLog") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
End Class
|
End Class
|
||||||
End Namespace
|
End Namespace
|
||||||
|
|
||||||
|
@ -140,5 +140,8 @@
|
|||||||
<Setting Name="HiddenQueue" Type="System.Boolean" Scope="User">
|
<Setting Name="HiddenQueue" Type="System.Boolean" Scope="User">
|
||||||
<Value Profile="(Default)">False</Value>
|
<Value Profile="(Default)">False</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="UpdateLog" Type="System.String" Scope="User">
|
||||||
|
<Value Profile="(Default)">0</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
Loading…
Reference in New Issue
Block a user