Skip to content
This repository has been archived by the owner on Jul 13, 2024. It is now read-only.

Commit

Permalink
fix user agent, auto update finished
Browse files Browse the repository at this point in the history
fix user agent #970
auto update finished #969
  • Loading branch information
hama3254 committed May 29, 2024
1 parent 1b80980 commit 1bf1e7d
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 25 deletions.
Binary file modified .vs/Crunchyroll Downloader/v17/.suo
Binary file not shown.
3 changes: 3 additions & 0 deletions Crunchyroll Downloader/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@
<setting name="UpdateLog" serializeAs="String">
<value>0</value>
</setting>
<setting name="UpdateMode" serializeAs="String">
<value>0</value>
</setting>
</Crunchyroll_Downloader.My.MySettings>
</userSettings>
</configuration>
7 changes: 7 additions & 0 deletions Crunchyroll Downloader/CRD-Classes.vb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
SubsOnly = 2
AudioOnly = 3
End Enum
Public Enum UpdateScope
Skip = 0
Info = 1
InfoPre = 2
Auto = 3
Pre = 4
End Enum

Public Enum ConvertSubsEnum
DisplayText = 0
Expand Down
2 changes: 1 addition & 1 deletion Crunchyroll Downloader/GetData.vb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Module GetData

End Function

Public Function CurlDeleteNew(ByVal Url As String, ByVal Auth As String, Optional ByVal UserAgent As String = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0") As String
Public Function CurlDeleteNew(ByVal Url As String, ByVal Auth As String, Optional ByVal UserAgent As String = Chr(34) + "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0" + Chr(34)) As String



Expand Down
46 changes: 37 additions & 9 deletions Crunchyroll Downloader/Main.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,8 @@ Public Class Main
'MsgBox(ex.ToString)

Else
MsgBox(ex.ToString, MsgBoxStyle.Information)
Error_msg.ShowErrorDia(ex.ToString, "Unknown Error - See details", False)
'MsgBox(ex.ToString, MsgBoxStyle.Information)
End If
End Try '
End Sub
Expand Down Expand Up @@ -3278,6 +3279,9 @@ Public Class Main

Private Sub BGW_Update_DoWork(sender As Object, e As DoWorkEventArgs) Handles BGW_Update.DoWork
Try
If My.Settings.UpdateMode = UpdateScope.Skip Then
Exit Sub
End If

Dim client0 As New WebClient
client0.Encoding = Encoding.UTF8
Expand All @@ -3286,19 +3290,23 @@ Public Class Main
Dim str0 As String = client0.DownloadString("https://api.github.com/repos/hama3254/Crunchyroll-Downloader-v3.0/releases")

Dim GitHubLastIsPre() As String = str0.Split(New String() {Chr(34) + "prerelease" + Chr(34) + ": "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim LastNonPreRelase As Integer = 0
Dim LastRelase As Integer = 0
Dim PreRelease As Boolean = False

For i As Integer = 1 To GitHubLastIsPre.Count - 1
Dim GitHubLastIsPre1() As String = GitHubLastIsPre(i).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries)

'If GitHubLastIsPre1(0) = "false" Then
LastNonPreRelase = i
Exit For
'End If
If GitHubLastIsPre1(0) = "false" Or My.Settings.UpdateMode = UpdateScope.Pre Or My.Settings.UpdateMode = UpdateScope.InfoPre Then
If GitHubLastIsPre1(0) = "true" Then
PreRelease = True
End If
LastRelase = i
Exit For
End If
Next

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(LastRelase).Split(New String() {Chr(34) + ","}, System.StringSplitOptions.RemoveEmptyEntries)

'LastVersionString = GitHubLastTag1(0)
'MsgBox(GitHubLastTag1(0))
Expand Down Expand Up @@ -3331,6 +3339,20 @@ Public Class Main
If UpdateAv = False Then 'no update needed
Debug.WriteLine("Update check passed")
Exit Sub
ElseIf UpdateAv = True Then
If My.Settings.UpdateMode = UpdateScope.Info Or My.Settings.UpdateMode = UpdateScope.InfoPre Then 'Infos only
Dim DisplayTest As String = "Update available: v"
If PreRelease = True Then
DisplayTest = "PreRelease available: v"
End If
Me.Invoke(New Action(Function() As Object
Me.Text = DisplayTest + OnlineVersionNumber
Me.Invalidate()
Return Nothing
End Function))

Exit Sub
End If
End If
Debug.WriteLine("Update check failed")
'Check for updated file
Expand Down Expand Up @@ -3368,12 +3390,12 @@ Public Class Main
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")
My.Computer.FileSystem.RenameFile(Application.StartupPath + "\Auto_Updated.exe", GeräteID() + ".exe") 'getting rid of the old version like its a temp file

End If


If CBool(InStr(str0, "Auto_Update_" + GitHubLastTag1(0) + ".exe")) Then
If CBool(InStr(str0, "Auto_Update_" + GitHubLastTag1(0) + ".exe")) Then ' check if i even upoaded the autoupdate
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)
Expand Down Expand Up @@ -3403,6 +3425,12 @@ Public Class Main
Me.Close()
Return Nothing
End Function))
Else
Me.Invoke(New Action(Function() As Object
Me.Text = "No Auto-Update possible"
Me.Invalidate()
Return Nothing
End Function))
End If


Expand Down
4 changes: 2 additions & 2 deletions Crunchyroll Downloader/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("3.23.6")>
<Assembly: AssemblyFileVersion("3.23.6")>
<Assembly: AssemblyVersion("3.23.7")>
<Assembly: AssemblyFileVersion("3.23.7")>
<Assembly: NeutralResourcesLanguage("en")>
12 changes: 12 additions & 0 deletions Crunchyroll Downloader/My Project/Settings.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Crunchyroll Downloader/My Project/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,8 @@
<Setting Name="UpdateLog" Type="System.String" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="UpdateMode" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>
27 changes: 15 additions & 12 deletions Crunchyroll Downloader/einstellungen.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Crunchyroll Downloader/einstellungen.resx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 20</value>
</metadata>
<metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 20</value>
</metadata>
<metadata name="BackgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>332, 20</value>
</metadata>
Expand Down
3 changes: 2 additions & 1 deletion Crunchyroll Downloader/einstellungen.vb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Public Class Einstellungen
Label6.Text = "You have: v" + Application.ProductVersion.ToString '+ " WebView2_Test"

BackgroundWorker1.RunWorkerAsync()

DD_Update.SelectedIndex = My.Settings.UpdateMode

'CR_Anime_Folge = CR_Name_Staffel0_Folge1(1)
'If GitHubLastTag1(0)
Expand Down Expand Up @@ -298,6 +298,7 @@ Public Class Einstellungen
My.Settings.LeadingZero = LeadingZeroDD.SelectedIndex
My.Settings.OverrideDub = CB_OverrideDub.Checked
My.Settings.Captions = CB_Cap.Checked
My.Settings.UpdateMode = DD_Update.SelectedIndex

If http_support.Text = "add-on support disabled" Then
My.Settings.ServerPort = 0
Expand Down

0 comments on commit 1bf1e7d

Please sign in to comment.