Skip to content

Commit

Permalink
BugFix - Improved Threads! V. 5.2.0.1 🔥
Browse files Browse the repository at this point in the history
  • Loading branch information
tsgsOFFICIAL committed Nov 8, 2024
1 parent 0810028 commit 20de39e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CS2-AutoAccept/CS2-AutoAccept.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<Description>A program to automatically find and press "ACCEPT" for you, when entering a competitive match in CS2.</Description>
<Copyright>©️ tsgsOFFICIAL - 2024</Copyright>
<FileVersion>5.2.0.0</FileVersion>
<FileVersion>5.2.0.1</FileVersion>
<AssemblyName>CS2-AutoAccept</AssemblyName>
</PropertyGroup>

Expand Down
15 changes: 7 additions & 8 deletions CS2-AutoAccept/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public partial class MainWindow : Window
private Updater? updater;
private Screen? _activeScreen;
private Thread? _scannerThread;
private CancellationTokenSource? cts;
private CancellationTokenSource? _scannerCancellationTokenSource;
private bool _scannerIsActive = false;
private bool _run_Continuously = false;
private bool _updateAvailable = false;
Expand Down Expand Up @@ -239,6 +239,7 @@ private void CloseApplication()
_hotKeyManager.Dispose();

Close();
Environment.Exit(0);
}
private void UpdateTrayIconVisibility()
{
Expand Down Expand Up @@ -430,12 +431,12 @@ private void HotKeyManager_KeyPressed(object? sender, KeyPressedEventArgs e)
{
if (!_scannerIsActive)
{
Program_state_Checked(this, new RoutedEventArgs());
Program_state.IsChecked = true;
ShowGameOverlay("AutoAccept ON");
}
else
{
Program_state_Unchecked(this, new RoutedEventArgs());
Program_state.IsChecked = false;
ShowGameOverlay("AutoAccept OFF");
}
}
Expand Down Expand Up @@ -608,13 +609,12 @@ private void Program_state_Checked(object sender, RoutedEventArgs e)
{
// PrintToLog("{Program_state_Checked}");
_scannerThread = new Thread(new ParameterizedThreadStart(Scanner)) { IsBackground = true };
cts = new CancellationTokenSource();
_scannerThread.Start(cts!.Token);
_scannerCancellationTokenSource = new CancellationTokenSource();
_scannerThread.Start(_scannerCancellationTokenSource!.Token);
_scannerIsActive = true;
// Change to a brighter color
Program_state.Foreground = new SolidColorBrush(Colors.LawnGreen);
Program_state.Content = "AutoAccept (ON)";
Program_state.IsChecked = true;
}
}
/// <summary>
Expand All @@ -627,14 +627,13 @@ private void Program_state_Unchecked(object sender, RoutedEventArgs e)
if (_scannerIsActive)
{
// PrintToLog("{Program_state_Unchecked}");
cts!.Cancel();
_scannerCancellationTokenSource!.Cancel();
Program_state_continuously.IsChecked = false;
_scannerIsActive = false;

// Change to a darker color
Program_state.Foreground = new SolidColorBrush(Colors.Red);
Program_state.Content = "AutoAccept (OFF)";
Program_state.IsChecked = false;
}
}
/// <summary>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 8 additions & 3 deletions CS2-AutoAccept/updateInfo.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"version": "5.2.0.0",
"type": "Feature",
"changelog": "Added the ability to set & use hotkeys.",
"version": "5.2.0.1",
"type": "Bug",
"changelog": "Fixed a minor bug with the internal threads.",
"historic_versions": [
{
"version": "5.2.0.0",
"type": "Feature",
"changelog": "Added the ability to set & use hotkeys."
},
{
"version": "5.1.5.5",
"type": "Feature",
Expand Down

0 comments on commit 20de39e

Please sign in to comment.