Advertisement
Guest User

Consec Programm Source Code **Unsicher**

a guest
Feb 18th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.91 KB | None | 0 0
  1. // Type: ConSecMonitor.MainWindow
  2. // Assembly: ConSecMonitor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
  3. // MVID: 3E409366-F669-4BF1-9E17-33E7F*******
  4.  
  5. using ConSecMonitor.My;
  6. using FPH.SpedV.API.Enums;
  7. using FPH.SpedV.API.Objects.Telemetry;
  8. using MahApps.Metro.Controls;
  9. using Microsoft.VisualBasic;
  10. using Microsoft.VisualBasic.CompilerServices;
  11. using Newtonsoft.Json;
  12. using System;
  13. using System.CodeDom.Compiler;
  14. using System.Collections.Generic;
  15. using System.ComponentModel;
  16. using System.Diagnostics;
  17. using System.Linq;
  18. using System.Net;
  19. using System.Runtime.CompilerServices;
  20. using System.Threading;
  21. using System.Windows;
  22. using System.Windows.Controls;
  23. using System.Windows.Markup;
  24.  
  25. namespace ConSecMonitor
  26. {
  27. /// <summary>MainWindow</summary>
  28. [DesignerGenerated]
  29. public class MainWindow : MetroWindow, IComponentConnector
  30. {
  31. private WPFOverlay WPFO;
  32. private bool WPFOinit;
  33. private string Server;
  34. private int ServerKey;
  35. private WebClient client;
  36. private bool startup;
  37. private bool _contentLoaded;
  38.  
  39. private virtual FPH.SpedV.API.Objects.Telemetry.Telemetry Telemetry
  40. {
  41. get
  42. {
  43. return this._Telemetry;
  44. }
  45. [MethodImpl(MethodImplOptions.Synchronized)] set
  46. {
  47. FPH.SpedV.API.Objects.Telemetry.Telemetry.DataRefreshedEventHandler refreshedEventHandler = new FPH.SpedV.API.Objects.Telemetry.Telemetry.DataRefreshedEventHandler(this.Telemetry_DataRefreshed);
  48. FPH.SpedV.API.Objects.Telemetry.Telemetry telemetry1 = this._Telemetry;
  49. if (telemetry1 != null)
  50. telemetry1.DataRefreshed -= refreshedEventHandler;
  51. this._Telemetry = value;
  52. FPH.SpedV.API.Objects.Telemetry.Telemetry telemetry2 = this._Telemetry;
  53. if (telemetry2 == null)
  54. return;
  55. telemetry2.DataRefreshed += refreshedEventHandler;
  56. }
  57. }
  58.  
  59. public MainWindow()
  60. {
  61. this.Loaded += new RoutedEventHandler(this.MainWindow_Loaded);
  62. this.Closing += new CancelEventHandler(this.MainWindow_Closing);
  63. this.WPFOinit = false;
  64. this.Server = "https://consec.sped-v.de/rest/";
  65. this.ServerKey = 0;
  66. this.client = new WebClient();
  67. this.startup = true;
  68. this.InitializeComponent();
  69. MyWpfExtension.Application.LoadSettings();
  70. this.TXT_telemetry.Text = MyWpfExtension.Application.Settings.GetValue<string>("TelemetryIP", "127.0.0.1", false, (JsonSerializer) null);
  71. this.NUD_dpi.Value = new double?((double) MyWpfExtension.Application.Settings.GetValue<int>("overlay.scale", 100, false, (JsonSerializer) null));
  72. this.NUD_maxWidth.Value = new double?((double) MyWpfExtension.Application.Settings.GetValue<int>("consec.maxwidth", 1920, false, (JsonSerializer) null));
  73. this.NUD_maxDrivers.Value = new double?((double) MyWpfExtension.Application.Settings.GetValue<int>("consec.maxdrivers", 5, false, (JsonSerializer) null));
  74. this.TXT_username.Text = MyWpfExtension.Application.Settings.GetValue<string>("consec.username", MyWpfExtension.Computer.Name, false, (JsonSerializer) null);
  75. this.CMB_position.SelectedIndex = 1;
  76. this.Telemetry = new FPH.SpedV.API.Objects.Telemetry.Telemetry(MyWpfExtension.Application.Settings.GetValue<string>("TelemetryIP", "127.0.0.1", false, (JsonSerializer) null), 1000);
  77. this.Title = "ConSec-Monitor 19.1.19.19";
  78. if (!this.client.DownloadString(this.Server + "version").Contains("19011919"))
  79. {
  80. if (Interaction.MsgBox((object) "Update verfügbar! Möchtest du zur Downloadseite gehen?", MsgBoxStyle.YesNo, (object) null) == MsgBoxResult.Yes)
  81. {
  82. try
  83. {
  84. Process.Start("http://convoy-security.de/filebase/index.php?file/33-consecmonitor/");
  85. }
  86. catch (Exception ex)
  87. {
  88. ProjectData.SetProjectError(ex);
  89. ProjectData.ClearProjectError();
  90. }
  91. }
  92. }
  93. this.startup = false;
  94. }
  95.  
  96. private void CheckForETSATSProcess()
  97. {
  98. try
  99. {
  100. // ISSUE: variable of a compiler-generated type
  101. MainWindow._Closure\u0024__11\u002D0 closure110_1;
  102. // ISSUE: object of a compiler-generated type is created
  103. // ISSUE: variable of a compiler-generated type
  104. MainWindow._Closure\u0024__11\u002D0 closure110_2 = new MainWindow._Closure\u0024__11\u002D0(closure110_1);
  105. // ISSUE: reference to a compiler-generated field
  106. closure110_2.\u0024VB\u0024Me = this;
  107. // ISSUE: reference to a compiler-generated field
  108. closure110_2.\u0024VB\u0024Local_P_ETS = ((IEnumerable<Process>) Process.GetProcessesByName("eurotrucks2")).FirstOrDefault<Process>();
  109. Process process = ((IEnumerable<Process>) Process.GetProcessesByName("amtrucks")).FirstOrDefault<Process>();
  110. // ISSUE: reference to a compiler-generated field
  111. if (closure110_2.\u0024VB\u0024Local_P_ETS == null & process != null)
  112. {
  113. // ISSUE: reference to a compiler-generated field
  114. closure110_2.\u0024VB\u0024Local_P_ETS = process;
  115. }
  116. // ISSUE: reference to a compiler-generated field
  117. if (closure110_2.\u0024VB\u0024Local_P_ETS != null && !this.WPFOinit && this.Telemetry.Connected == TelemetryConnectionState.InGame | this.Telemetry.Connected == TelemetryConnectionState.Paused)
  118. {
  119. try
  120. {
  121. // ISSUE: reference to a compiler-generated field
  122. FPH.SpedV.API.Objects.Telemetry.Telemetry.LogEvent("OLAY", "Initialize Connection to " + closure110_2.\u0024VB\u0024Local_P_ETS.ProcessName);
  123. // ISSUE: reference to a compiler-generated method
  124. this.Dispatcher.Invoke(new Action(closure110_2._Lambda\u0024__0));
  125. new Thread((ThreadStart) (() =>
  126. {
  127. while (this.WPFOinit)
  128. {
  129. this.Dispatcher.Invoke((Action) (() => this.WPFO.Update()));
  130. Thread.Sleep(30);
  131. }
  132. })).Start();
  133. // ISSUE: reference to a compiler-generated field
  134. FPH.SpedV.API.Objects.Telemetry.Telemetry.LogEvent("OLAY", "Connection initialized to " + closure110_2.\u0024VB\u0024Local_P_ETS.ProcessName);
  135. }
  136. catch (Exception ex)
  137. {
  138. ProjectData.SetProjectError(ex);
  139. Exception exception = ex;
  140. int num = (int) Interaction.MsgBox((object) (exception.Message + "\r\n" + exception.StackTrace), MsgBoxStyle.OkOnly, (object) null);
  141. ProjectData.ClearProjectError();
  142. }
  143. }
  144. else
  145. {
  146. // ISSUE: reference to a compiler-generated field
  147. if (closure110_2.\u0024VB\u0024Local_P_ETS != null || !this.WPFOinit)
  148. return;
  149. this.WPFOinit = false;
  150. this.WPFO?.Disable();
  151. FPH.SpedV.API.Objects.Telemetry.Telemetry.LogEvent("OLAY", "Missed Connection");
  152. }
  153. }
  154. catch (Exception ex)
  155. {
  156. ProjectData.SetProjectError(ex);
  157. ProjectData.ClearProjectError();
  158. }
  159. }
  160.  
  161. public void CheckThread()
  162. {
  163. while (true)
  164. {
  165. this.CheckForETSATSProcess();
  166. Thread.Sleep(10000);
  167. }
  168. }
  169.  
  170. private void MainWindow_Loaded(object sender, RoutedEventArgs e)
  171. {
  172. new Thread(new ThreadStart(this.CheckThread)).Start();
  173. }
  174.  
  175. private void CMD_save_Click(object sender, RoutedEventArgs e)
  176. {
  177. MyWpfExtension.Application.Settings.SetValue<string>("TelemetryIP", this.TXT_telemetry.Text, (JsonSerializer) null);
  178. MyWpfExtension.Application.Settings.SetValue<double?>("overlay.scale", this.NUD_dpi.Value, (JsonSerializer) null);
  179. MyWpfExtension.Application.Settings.SetValue<string>("consec.username", this.TXT_username.Text, (JsonSerializer) null);
  180. MyWpfExtension.Application.Settings.SetValue<double?>("consec.maxwidth", this.NUD_maxWidth.Value, (JsonSerializer) null);
  181. MyWpfExtension.Application.Settings.SetValue<double?>("consec.maxdrivers", this.NUD_maxDrivers.Value, (JsonSerializer) null);
  182. MyWpfExtension.Application.SaveSettings();
  183. this.Telemetry = new FPH.SpedV.API.Objects.Telemetry.Telemetry(MyWpfExtension.Application.Settings.GetValue<string>("TelemetryIP", "127.0.0.1", false, (JsonSerializer) null), 1000);
  184. if ((uint) this.ServerKey <= 0U)
  185. return;
  186. string str = this.client.DownloadString(this.Server + "changeName?key=" + Conversions.ToString(this.ServerKey) + "&name=" + WebUtility.UrlEncode(this.TXT_username.Text));
  187. if (Operators.CompareString(str, "Error occured", false) == 0)
  188. {
  189. this.ServerKey = 0;
  190. this.LBL_disclaimer.Content = (object) ("(c) Freie Programme Hohenstein 2019. Based upon FPH SpedV - " + Conversions.ToString(this.ServerKey));
  191. int num = (int) Interaction.MsgBox((object) "Fehler bei der Synchronisation mit dem Server.", MsgBoxStyle.Critical, (object) null);
  192. }
  193. else
  194. {
  195. this.refreshData(str, this.Telemetry.Data, MyWpfExtension.Application.Settings.GetValue<string>("consec.username", MyWpfExtension.Computer.Name, false, (JsonSerializer) null));
  196. int num = (int) Interaction.MsgBox((object) "Daten gespeichert und synchronisiert.", MsgBoxStyle.Information, (object) null);
  197. }
  198. }
  199.  
  200. private void Telemetry_DataRefreshed(MainData newData, MainData oldData)
  201. {
  202. if (this.ServerKey == 0)
  203. this.Dispatcher.Invoke((Action) (() =>
  204. {
  205. this.ServerKey = Conversions.ToInteger(this.client.DownloadString(this.Server + "login?name=" + WebUtility.UrlEncode(MyWpfExtension.Application.Settings.GetValue<string>("consec.username", MyWpfExtension.Computer.Name, false, (JsonSerializer) null))));
  206. this.LBL_disclaimer.Content = (object) ("(c) Freie Programme Hohenstein 2019. Based upon FPH SpedV - " + Conversions.ToString(this.ServerKey));
  207. this.client.DownloadString(this.Server + "setPosition?key=" + Conversions.ToString(this.ServerKey) + "&position=" + Conversions.ToString(this.CMB_position.SelectedIndex));
  208. }));
  209. string str = this.client.DownloadString(this.Server + "update?key=" + Conversions.ToString(this.ServerKey) + "&distance=" + Conversions.ToString(newData.navigation.estimatedDistance) + "&velocity=" + WebUtility.UrlEncode(Conversions.ToString(Math.Round(newData.truck.speed, 0)) + " km/h") + "&xcoord=" + Conversions.ToString(newData.truck.placement.x) + "&zcoord=" + Conversions.ToString(newData.truck.placement.z));
  210. if (Operators.CompareString(str, "Error occured", false) == 0)
  211. {
  212. this.ServerKey = 0;
  213. this.LBL_disclaimer.Content = (object) ("(c) Freie Programme Hohenstein 2019. Based upon FPH SpedV - " + Conversions.ToString(this.ServerKey));
  214. }
  215. else
  216. this.refreshData(str, this.Telemetry.Data, MyWpfExtension.Application.Settings.GetValue<string>("consec.username", MyWpfExtension.Computer.Name, false, (JsonSerializer) null));
  217. }
  218.  
  219.  
  220. ************************* usw.........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement