Skip to content

Miscellaneous changes to the code #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CMake

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} scs-telemetry

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,7 @@ $RECYCLE.BIN/
.vs


Working Data/
Working Data/

# IntelliJ Rider files
.idea/
7 changes: 2 additions & 5 deletions scs-client/C#/SCSSdkClient.Demo/SCSSdkClient.Demo/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SCSSdkClient.Demo
Expand All @@ -12,8 +9,8 @@ static class Program
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SCSSdkClientDemo());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand All @@ -10,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SCSSdkClient.Demo")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>SCSSdkClient.Demo</RootNamespace>
<AssemblyName>SCSSdkClient.Demo</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
Expand All @@ -35,8 +35,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\SCSSdkClient\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
<HintPath>..\..\SCSSdkClient\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ public partial class SCSSdkClientDemo : Form {
/// <summary>
/// The SCSSdkTelemetry object
/// </summary>
public SCSSdkTelemetry Telemetry;
public ScsSdkTelemetry Telemetry;

private float fuel;

/// <inheritdoc />
public SCSSdkClientDemo() {
InitializeComponent();
Telemetry = new SCSSdkTelemetry();
Telemetry = new ScsSdkTelemetry();
Telemetry.Data += Telemetry_Data;
Telemetry.JobStarted += TelemetryOnJobStarted;

Expand All @@ -29,7 +29,7 @@ public SCSSdkClientDemo() {
Telemetry.Train += TelemetryTrain;
Telemetry.RefuelStart += TelemetryRefuel;
Telemetry.RefuelEnd += TelemetryRefuelEnd;
Telemetry.RefuelPayed += TelemetryRefuelPayed;
Telemetry.RefuelPaid += TelemetryRefuelPaid;


if (Telemetry.Error != null) {
Expand Down Expand Up @@ -68,12 +68,12 @@ private void TelemetryTrain(object sender, EventArgs e) =>
private void TelemetryRefuel(object sender, EventArgs e) => rtb_fuel.Invoke((MethodInvoker)(()=>rtb_fuel.BackColor = Color.Green));
private void TelemetryRefuelEnd(object sender, EventArgs e) => rtb_fuel.Invoke((MethodInvoker)(()=>rtb_fuel.BackColor = Color.Red));

private void TelemetryRefuelPayed(object sender, EventArgs e) {
MessageBox.Show("Fuel Payed: " + fuel);
private void TelemetryRefuelPaid(object sender, EventArgs e) {
MessageBox.Show("Fuel Paid: " + fuel);
}


private void Telemetry_Data(SCSTelemetry data, bool updated) {
private void Telemetry_Data(ScsTelemetry data, bool updated) {
if (!updated) return;
try {
if (InvokeRequired) {
Expand Down Expand Up @@ -119,20 +119,20 @@ private void Telemetry_Data(SCSTelemetry data, bool updated) {
"\ttrain:\n" +
$"\t\t\t{data.SpecialEventsValues.Train}\n"+
"\tRefuel Payed:\n" +
$"\t\t\t{data.SpecialEventsValues.RefuelPayed}\n";
$"\t\t\t{data.SpecialEventsValues.RefuelPaid}\n";

common.Text = JsonConvert.SerializeObject(data.CommonValues, Formatting.Indented);
truck.Text = JsonConvert.SerializeObject(data.TruckValues, Formatting.Indented);
trailer.Text =
JsonConvert.SerializeObject(data.TrailerValues[0],
JsonConvert.SerializeObject(data.TrailerValues,
Formatting
.Indented); //TODO: UNTIL I WORK ON A BETTER DEMO SHOW ONLY TRAILER 0
.Indented); // TODO better trailer display
job.Text = JsonConvert.SerializeObject(data.JobValues, Formatting.Indented);
control.Text = JsonConvert.SerializeObject(data.ControlValues, Formatting.Indented);
navigation.Text = JsonConvert.SerializeObject(data.NavigationValues, Formatting.Indented);
substances.Text = JsonConvert.SerializeObject(data.Substances, Formatting.Indented);
gameplayevent.Text = JsonConvert.SerializeObject(data.GamePlay, Formatting.Indented);
rtb_fuel.Text = data.TruckValues.CurrentValues.DashboardValues.FuelValue.Amount + " "+ data.SpecialEventsValues.Refuel ;
rtb_fuel.Text = data.TruckValues.CurrentValues.DashboardValues.FuelValue.Amount + " "+ data.SpecialEventsValues.Refuel;
fuel = data.GamePlay.RefuelEvent.Amount;

} catch (Exception ex) {
Expand All @@ -142,11 +142,11 @@ private void Telemetry_Data(SCSTelemetry data, bool updated) {
}

private void SCSSdkClientDemo_FormClosing(object sender, FormClosingEventArgs e) {
Telemetry.pause(); // that line make it possible, but not every application wants to ask the user to quit, need to see if i can change that, when not use the try catch and IGNORE it (nothing changed )
Telemetry.Pause(); // that line make it possible, but not every application wants to ask the user to quit, need to see if i can change that, when not use the try catch and IGNORE it (nothing changed )
if (MessageBox.Show("Are you sure you want to quit?", "My Application", MessageBoxButtons.YesNo) ==
DialogResult.No) {
e.Cancel = true;
Telemetry.resume();
Telemetry.Resume();
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net471" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
</packages>
2 changes: 1 addition & 1 deletion scs-client/C#/SCSSdkClient/Extension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static T ToEnum<T>(this string enumString) where T : struct =>
/// </summary>
/// <param name="choob"></param>
/// <returns></returns>
public static string StringFormater(this string choob) {
public static string StringFormatter(this string choob) {
var result = "";
for (var index = 0; index < choob.Length; index++) {
var cha = choob[index];
Expand Down
31 changes: 26 additions & 5 deletions scs-client/C#/SCSSdkClient/JobMarket.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
namespace SCSSdkClient {
/// <summary>
/// Market of the job
/// </summary>
public enum JobMarket {
/// <summary>
/// Unknown market
/// </summary>
NoValue,
cargo_market,
quick_job,
freight_market,
external_contracts,
external_market
/// <summary>
/// Job with own truck and provided trailer
/// </summary>
CargoMarket,
/// <summary>
/// Job with provided truck and trailer
/// </summary>
QuickJob,
/// <summary>
/// Job with own truck and trailer
/// </summary>
FreightMarket,
/// <summary>
/// Job with own truck and provided trailer
/// </summary>
ExternalContracts,
/// <summary>
/// Job with own truck and own trailer
/// </summary>
ExternalMarket
}
}
2 changes: 1 addition & 1 deletion scs-client/C#/SCSSdkClient/Object/SCSTelemetry.Common.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma warning disable 1570

namespace SCSSdkClient.Object {
public partial class SCSTelemetry {
public partial class ScsTelemetry {
/// <summary>
/// Telemetry specific channels which might be used by more than one game.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions scs-client/C#/SCSSdkClient/Object/SCSTelemetry.Control.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma warning disable 1570

namespace SCSSdkClient.Object {
public partial class SCSTelemetry {
public partial class ScsTelemetry {
/// <summary>
/// User Input value and value used by the game
/// </summary>
Expand All @@ -27,7 +27,7 @@ public Control() {

/// <inheritdoc />
public override string ToString() =>
$"Input Values:\n\t{InputValues.ToString().StringFormater()}\nGame Values:\n\t{GameValues.ToString().StringFormater()}";
$"Input Values:\n\t{InputValues.ToString().StringFormatter()}\nGame Values:\n\t{GameValues.ToString().StringFormatter()}";

/// <summary>
/// Input value
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma warning disable 1570

namespace SCSSdkClient.Object {
public partial class SCSTelemetry {
public partial class ScsTelemetry {
/// <summary>
/// Represents a Double Placement similar to the one in the SDK with coordinate X,Y,Z and rotation X,Y,Z
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion scs-client/C#/SCSSdkClient/Object/SCSTelemetry.DVector.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma warning disable 1570

namespace SCSSdkClient.Object {
public partial class SCSTelemetry {
public partial class ScsTelemetry {
/// <summary>
/// Represent a Double Vector simular to the one in the SDK with X,Y and Z Coordinated
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion scs-client/C#/SCSSdkClient/Object/SCSTelemetry.Euler.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma warning disable 1570

namespace SCSSdkClient.Object{
public partial class SCSTelemetry {
public partial class ScsTelemetry {
/// <summary>
/// Orientation of object.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma warning disable 1570

namespace SCSSdkClient.Object {
public partial class SCSTelemetry {
public partial class ScsTelemetry {
/// <summary>
/// Represents a Float Placement simular to the one in the SDK with coordinate X,Y,Z and rotation X,Y,Z
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion scs-client/C#/SCSSdkClient/Object/SCSTelemetry.FVector.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma warning disable 1570

namespace SCSSdkClient.Object {
public partial class SCSTelemetry {
public partial class ScsTelemetry {
/// <summary>
/// Represent a Float Vector simular to the one in the SDK with X,Y and Z Coordinated
/// </summary>
Expand Down
Loading