Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Commit

Permalink
Bug fixes, duplicated code removed, simplified code and improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
DubStepMad committed Sep 16, 2017
1 parent 2096733 commit 87608f9
Show file tree
Hide file tree
Showing 23 changed files with 10,294 additions and 1,241 deletions.
9 changes: 6 additions & 3 deletions tsrvtcnew/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@
<setting name="ETS2Location" serializeAs="String">
<value />
</setting>
<setting name="singleplayer" serializeAs="String">
<value>False</value>
</setting>
</tsrvtcnew.Properties.Settings>
</userSettings>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source = |SQL/CE|" />
</connectionStrings>
<applicationSettings>
<tsrvtcnew.Properties.Settings>
<setting name="tbpath" serializeAs="String">
<value>C:\Program Files (x86)\TrucksBook Client</value>
</setting>
<setting name="tbpath" serializeAs="String">
<value>C:\Program Files (x86)\TrucksBook Client</value>
</setting>
</tsrvtcnew.Properties.Settings>
</applicationSettings>
</configuration>
2 changes: 1 addition & 1 deletion tsrvtcnew/Form1.Designer.cs

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

17 changes: 11 additions & 6 deletions tsrvtcnew/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,14 @@ private void btnrgui_Click(object sender, EventArgs e)
string SourcePath = (Properties.Settings.Default.datapath);
string DesPath = ("C:/ProgramData/TruckersMP");

if (SourcePath == "")
//gets application directory
string exeFile = (new System.Uri(Assembly.GetEntryAssembly().CodeBase)).AbsolutePath;
string exeDir = Path.GetDirectoryName(exeFile);
string fullPath = Path.Combine(exeDir, "custom gui");

if (fullPath == null)
{
MessageBox.Show("To replace the GUI please select the folder containg the data folder, not the data folder!");
MessageBox.Show("Application has not been installed correctly, please submit a bug report or re-install with admin permissions.");
errorsound();
return;
}
Expand Down Expand Up @@ -195,7 +200,7 @@ private void button1_Leave(object sender, EventArgs e)
}
void button1_MouseMove(object sender, MouseEventArgs e)
{
this.button1.BackgroundImage = ((Image)(Properties.Resources.crossbg));
this.button1.BackgroundImage = ((Image)(Properties.Resources.cross_hover));
}
private void btnmini_Click(object sender, EventArgs e)
{
Expand Down Expand Up @@ -280,7 +285,7 @@ private void btnsettings_Leave(object sender, EventArgs e)
button.BackgroundImage = ((Image)(Properties.Resources.settings_icon));
}

//audio for buttons
//audio for events
public static void goodsound()
{
SoundPlayer audio = new SoundPlayer(tsrvtcnew.Properties.Resources.good); //sound for process completed
Expand All @@ -297,7 +302,7 @@ public static void truckhorn()
audio.Play();
}

//button checks
//timer checks, this must stay false unless user changes through the program
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if (radioButton1.Checked)
Expand All @@ -307,7 +312,6 @@ private void radioButton1_CheckedChanged(object sender, EventArgs e)
calc_check = false;
}
}

private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
if (radioButton2.Checked)
Expand All @@ -318,6 +322,7 @@ private void radioButton2_CheckedChanged(object sender, EventArgs e)
}
}

//opens cconvoy control panel...
private void btnccpanel_Click(object sender, EventArgs e)
{
ccpanel newf = new ccpanel();
Expand Down
17 changes: 11 additions & 6 deletions tsrvtcnew/GameHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Net;
using Newtonsoft.Json.Linq;
using System.Security.Cryptography;
using System.Runtime.InteropServices;
using System.Security;
using System.Runtime.ConstrainedExecution;
using System.Collections.Generic;
using Microsoft.Win32;
using System.Threading;

Expand Down Expand Up @@ -123,10 +119,14 @@ public static bool launch()
if (SteamExe != null)
{
Process.Start(SteamExe);
Thread.Sleep(2000); //wait is needed to allow steam to update and connect
}
}
}

String gamelocation = Properties.Settings.Default.ETS2Location;

//allows a user who has trucksbook installed, run it before launching the game and connecting to MP
if (Properties.Settings.Default.tbchk == true)
{
if (!File.Exists(Path.Combine(Properties.Settings.Default.tbpath, "TB Client.exe")))
Expand All @@ -139,15 +139,20 @@ public static bool launch()
if (processes.Length == 0 && File.Exists(Path.Combine(Properties.Settings.Default.tbpath, "TB Client.exe")))
{
Process.Start(Path.Combine(Properties.Settings.Default.tbpath, "TB Client.exe"));
Thread.Sleep(1500);
Thread.Sleep(1500); //allows trucksbook to launch without the 'game running' error
}
}

if (Properties.Settings.Default.singleplayer == true)
{
Process.Start(gamelocation + "\\bin\\win_x64\\eurotrucks2.exe");
Environment.Exit(0);
}

String binPath;
String exe;
String dll;
String arguments = "";
String gamelocation = Properties.Settings.Default.ETS2Location;
String mplocation = Properties.Settings.Default.launcherpath;

//Lets get our games straight
Expand Down
76 changes: 39 additions & 37 deletions tsrvtcnew/Help.Designer.cs

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

12 changes: 7 additions & 5 deletions tsrvtcnew/Help.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ public Help()
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
private void btn_help_exit_Click(object sender, EventArgs e)
{
this.Close();
}

private void button1_Leave(object sender, EventArgs e)
//transparent background for when the user leaves the hovering button
private void btn_help_exit_Leave(object sender, EventArgs e)
{
this.button1.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.leave_img));
this.btn_help_exit.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.leave_img));
}

void button1_MouseMove(object sender, MouseEventArgs e)
//hover-over image for basic buttons
void btn_help_exit_MouseMove(object sender, MouseEventArgs e)
{
this.button1.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.hover_img));
this.btn_help_exit.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.cross_hover));
}

public const int WM_NCLBUTTONDOWN = 0xA1;
Expand Down
4 changes: 2 additions & 2 deletions tsrvtcnew/Help.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
[1] Type your message into the message box.
[2] Select the time you wish to have 'Seconds' or 'Minutes.
[3] Enter a time delay you wish to use.
[4] Once in-game, press Y to open the chat and then hold Left-ALT + Y to start the the feature.
[5] To stop, press Y to open chat and hold Left-ALT and Y again.
[4] Once in-game, press Y to open the chat and then hold Left-Ctrl + Y to start the the feature.
[5] To stop, press Y to open chat and hold Left-Ctrl and Y again.

*Wait 1 minute before starting again*</value>
</data>
Expand Down
25 changes: 8 additions & 17 deletions tsrvtcnew/Properties/Resources.Designer.cs

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

Loading

0 comments on commit 87608f9

Please sign in to comment.