Skip to content

Commit

Permalink
0.0.0.3 300922
Browse files Browse the repository at this point in the history
almost certainly the final update:

- now uses ngserve.games to fix 404 errors
- removes useless splash screen
- remove annoying slide in on first time setup
- all HTTP connections are now HTTPS
- .net framework to 4.8
- newtonsoft.json is latest
- fixes news panel being way out of place
- changes various functions to sub-routines (as they should have been)
- removes unused forms
- other misc stuff too probably
  • Loading branch information
NarodGaming committed Sep 29, 2022
1 parent 3c464ae commit 9c617c8
Show file tree
Hide file tree
Showing 24 changed files with 66 additions and 448 deletions.
14 changes: 7 additions & 7 deletions TruckersMP Launcher/TruckersMP Launcher/App.config
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="YART.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="YART.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<system.windows.forms jitDebugging="true" />
<system.windows.forms jitDebugging="true"/>
<userSettings>
<YART.My.MySettings>
<setting name="FirstRun" serializeAs="String">
Expand All @@ -18,8 +18,8 @@
<value>False</value>
</setting>
<setting name="ID" serializeAs="String">
<value />
<value/>
</setting>
</YART.My.MySettings>
</userSettings>
</configuration>
</configuration>
10 changes: 4 additions & 6 deletions TruckersMP Launcher/TruckersMP Launcher/CrashHandler.vb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
' You must keep this message at the top of all the code files.

Public Class CrashHandler
Public Function HandleCrash(ex As Exception) ' when a crash is passed on through try & catch
Public Sub HandleCrash(ex As Exception) ' when a crash is passed on through try & catch
Me.Show() ' become visible to stop program closing
If ex.HelpLink = Nothing Then ' to stop a nullrefrenceexception
ex.HelpLink = "A help link could not be found."
End If ' log is started
crash_TextLog.Text = "-- YART (Yet Another TruckersMP Launcher) has unfortunately crashed --

We apologise for any inconvinience caused. Please send this bug report to Narod on TruckersMP Forums for support
We apologise for any inconvinience caused. Please create an issue on the GitHub repository.

-- Basic Crash Information --
Exception Name: " + ex.Message + "
Expand All @@ -28,10 +28,8 @@ Program Validity: " + Application.CompanyName + "
Program Forms: " + Application.OpenForms.ToString + "
Program Path: " + Application.ExecutablePath + "

If there is any information in this log you believe is private, please censor this before sending it to us."

Return Nothing ' fixes a warning
End Function
If there is any information in this log you believe is private, please censor this before sending it in."
End Sub

Private Sub crash_Close_Click(sender As Object, e As EventArgs) Handles crash_Close.Click
Application.Exit()
Expand Down
14 changes: 1 addition & 13 deletions TruckersMP Launcher/TruckersMP Launcher/FirstRun.Designer.vb

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

3 changes: 0 additions & 3 deletions TruckersMP Launcher/TruckersMP Launcher/FirstRun.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="zoom_timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="yart_instructions_tip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>133, 17</value>
</metadata>
Expand Down
17 changes: 0 additions & 17 deletions TruckersMP Launcher/TruckersMP Launcher/FirstRun.vb
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,6 @@ Imports System.IO
Imports System.Web.Script.Serialization ' json parsing

Public Class FirstRun
Private Sub FirstRun_Load(sender As Object, e As EventArgs) Handles MyBase.Load
zoom_timer.Start()
End Sub

Private Sub zoom_timer_Tick(sender As Object, e As EventArgs) Handles zoom_timer.Tick
If Not yart_introduction_lbl.Location.X = 12 Then
yart_introduction_lbl.Location = New Point(yart_introduction_lbl.Location.X - 1, yart_introduction_lbl.Location.Y)
Else
zoom_timer.Stop()
yart_instructions_lbl.Visible = True
yart_instructions2_lbl.Visible = True
yart_id.Visible = True
yart_id_status.Visible = True
yart_link_lbl.Visible = True
yart_tooltip_help.Visible = True
End If
End Sub

Private Sub yart_id_TextChanged(sender As Object, e As EventArgs) Handles yart_id.TextChanged
yart_id_status.Image = My.Resources.loading_circle
Expand Down
9 changes: 5 additions & 4 deletions TruckersMP Launcher/TruckersMP Launcher/Form1.Designer.vb

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

3 changes: 0 additions & 3 deletions TruckersMP Launcher/TruckersMP Launcher/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@
<metadata name="player_ban_activeban.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>142, 17</value>
</metadata>
<metadata name="player_ban_activeban.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>142, 17</value>
</metadata>
<metadata name="tip_launch_lbl.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>310, 17</value>
</metadata>
Expand Down
47 changes: 18 additions & 29 deletions TruckersMP Launcher/TruckersMP Launcher/Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ Public Class Form1
checkversion.Headers.Add("Cache-control", "no-store")
checkversion.Headers.Add("pragma", "no-cache")
checkversion.Headers.Add("Expries", "-1")
Dim versionresponse As String = checkversion.DownloadString("https://narodgaming.ml/yart/currentver.txt?t=" + Date.Now.ToLocalTime) ' adds the date to prevent caching
Dim versionresponse As String = checkversion.DownloadString("https://ngserve.games/yart/currentver.txt") ' adds the date to prevent caching

Dim YARTVersion As String = versionresponse.Split(" ")(0)
Dim YARTDate As String = versionresponse.Split(" ")(1)
Dim YARTVersion As String = versionresponse.Split(CChar(" "))(0)
Dim YARTDate As String = versionresponse.Split(CChar(" "))(1)

If Not (YARTVersion + "-" + YARTDate) = Application.ProductVersion + "-290517" Then ' if out of date
If Not (YARTVersion + "-" + YARTDate) = Application.ProductVersion + "-300922" Then ' if out of date
Dim wouldliketoupdate As MsgBoxResult = MsgBox("A new version is available, would you like to download it?", MsgBoxStyle.YesNo, "An update is available!") ' tells the user to update
If wouldliketoupdate = MsgBoxResult.Yes Then
Me.Dispose()
Expand All @@ -206,7 +206,7 @@ Public Class Form1
lbl_latest_launcher_ver.Text = "Latest Launcher Version: " + versionresponse
End If

lbl_launcher_ver.Text = "Launcher Version: " + Application.ProductVersion + "-290517" ' sets up product version
lbl_launcher_ver.Text = "Launcher Version: " + Application.ProductVersion + " 300922" ' sets up product version

Try
Dim version As String = "https://api.truckersmp.com/v2/version" ' gets TruckersMP version
Expand Down Expand Up @@ -234,11 +234,10 @@ Public Class Form1
lbl_supp_ats.Text = "Supported ATS Version: " + atssuppver
lbl_date_release.Text = "Latest Released on: " + timereleased

Dim ATSInstall = My.Computer.Registry.GetValue(
"HKEY_LOCAL_MACHINE\SOFTWARE\TruckersMP", "InstallLocationATS", Nothing) + "\bin\win_x64\amtrucks.exe"

Dim ETSInstall = My.Computer.Registry.GetValue(
"HKEY_LOCAL_MACHINE\SOFTWARE\TruckersMP", "InstallLocationETS2", Nothing) + "\bin\win_x64\eurotrucks2.exe"
Dim ATSInstall = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\TruckersMP", "InstallLocationATS", Nothing) + "\bin\win_x64\amtrucks.exe"

Dim ETSInstall = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\TruckersMP", "InstallLocationETS2", Nothing) + "\bin\win_x64\eurotrucks2.exe"

If ATSInstall = "\bin\win_x64\amtrucks.exe" Then
btn_atsmp.Enabled = False
Expand Down Expand Up @@ -330,10 +329,9 @@ Public Class Form1
Catch ex As Exception
' just have to catch incase already closed by FirstRun
End Try
SplashScreen.Dispose()
End Sub

Private Function ServersUpdate()
Private Function ServersUpdate() As Boolean
Try

Dim serversadd As String = "https://api.truckersmp.com/v2/servers"
Expand Down Expand Up @@ -691,7 +689,7 @@ Public Class Form1
End Sub

Private Sub btn_News_Click(sender As Object, e As EventArgs) Handles btn_News.Click
news_Browser.Navigate("http://truckersmp.com/blog")
news_Browser.Navigate("https://truckersmp.com/blog")
NewsShown = True

btn_Server.Enabled = True
Expand Down Expand Up @@ -846,7 +844,7 @@ Public Class Form1
End If
End Sub

Public Function RulesDone()
Public Sub RulesDone()
btn_Server.Enabled = True
btn_News.Enabled = True
btn_welcome.Enabled = True
Expand All @@ -857,16 +855,13 @@ Public Class Form1
pnl_tools.Visible = False
pnl_play.Visible = True
pnl_welcome.Visible = False

Return Nothing ' fixes a warning
End Function
End Sub

Private Sub btn_atsmp_Click(sender As Object, e As EventArgs) Handles btn_atsmp.Click ' uses main launcher due to injection, need help on intergrating this
Try
Dim readValue = My.Computer.Registry.GetValue(
"HKEY_LOCAL_MACHINE\SOFTWARE\TruckersMP", "InstallDir", Nothing)
Dim readValue = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\TruckersMP", "InstallDir", Nothing)

Process.Start(readValue + "\Launcher.exe")
Process.Start(readValue.ToString + "\Launcher.exe")
Application.Exit()
Catch ex As Exception
MsgBox("Could not open TruckersMP official launcher!" + vbCrLf + "Sending you to the download page...", MsgBoxStyle.Exclamation, "Error")
Expand All @@ -876,10 +871,9 @@ Public Class Form1

Private Sub btn_atssp_Click(sender As Object, e As EventArgs) Handles btn_atssp.Click
Try
Dim readValue = My.Computer.Registry.GetValue(
"HKEY_LOCAL_MACHINE\SOFTWARE\TruckersMP", "InstallLocationATS", Nothing)
Dim readValue = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\TruckersMP", "InstallLocationATS", Nothing)

Process.Start(readValue + "\bin\win_x64\amtrucks.exe")
Process.Start(readValue.ToString + "\bin\win_x64\amtrucks.exe")
Application.Exit()
Catch ex As Exception
MsgBox("Could not open American Truck Simulator, is it installed?", MsgBoxStyle.Exclamation, "Error")
Expand All @@ -901,10 +895,9 @@ Public Class Form1

Private Sub btn_ets2sp_Click(sender As Object, e As EventArgs) Handles btn_ets2sp.Click
Try
Dim readValue = My.Computer.Registry.GetValue(
"HKEY_LOCAL_MACHINE\SOFTWARE\TruckersMP", "InstallLocationETS2", Nothing)
Dim readValue = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\TruckersMP", "InstallLocationETS2", Nothing)

Process.Start(readValue + "\bin\win_x64\eurotrucks2.exe")
Process.Start(readValue.ToString + "\bin\win_x64\eurotrucks2.exe")
Application.Exit()
Catch ex As Exception
MsgBox("Could not open Euro Truck Simulator 2, is it installed?", MsgBoxStyle.Exclamation, "Error")
Expand All @@ -918,10 +911,6 @@ Public Class Form1
End If
End Sub

Private Sub yart_truckersfm_play_Click(sender As Object, e As EventArgs) Handles yart_truckersfm_play.Click
TruckersFM.Show()
End Sub

Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If FirstTime = False Then
Application.Exit()
Expand Down
12 changes: 6 additions & 6 deletions TruckersMP Launcher/TruckersMP Launcher/LauncherUpdater.vb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ Public Class LauncherUpdater
checkversion.Headers.Add("Cache-control", "no-store")
checkversion.Headers.Add("pragma", "no-cache")
checkversion.Headers.Add("Expries", "-1")
Dim versionresponse As String = checkversion.DownloadString("https://narodgaming.ml/yart/currentver.txt?t=" + Date.Now.ToLocalTime) ' adds the date to prevent caching
Dim versionresponse As String = checkversion.DownloadString("https://ngserve.games/yart/currentver.txt") ' adds the date to prevent caching

Dim YARTVersion As String = versionresponse.Split(" ")(0)
YartDate = versionresponse.Split(" ")(1)
Dim YARTVersion As String = versionresponse.Split(CChar(" "))(0)
YartDate = versionresponse.Split(CChar(" "))(1)

yart_updating_text.Text = "YART is updating to version " + YARTVersion + "!"
yart_updating_text.Visible = True
Expand All @@ -68,7 +68,7 @@ Public Class LauncherUpdater

Private Sub download_worker_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles download_worker.DoWork

Dim YartAddress As String = "https://narodgaming.ml/yart/downloads/" + YartDate + "/YART.exe"
Dim YartAddress As String = "https://ngserve.games/yart/downloads/YART.exe"

If File.Exists(Path.GetTempPath + "YART_NEW.exe") Then
File.Delete(Path.GetTempPath + "YART_NEW.exe")
Expand All @@ -81,7 +81,7 @@ Public Class LauncherUpdater
CreateRunScript()
End Sub

Private Function CreateRunScript()
Private Sub CreateRunScript()
Using sw As StreamWriter = File.CreateText(Directory.GetCurrentDirectory + "\update.bat")
sw.WriteLine("@echo off")
sw.WriteLine("set oldfile=%*")
Expand All @@ -93,5 +93,5 @@ Public Class LauncherUpdater

Process.Start("update.bat ", Application.ExecutablePath)
Application.Exit()
End Function
End Sub
End Class
Loading

0 comments on commit 9c617c8

Please sign in to comment.