Skip to content

Commit

Permalink
chore: 2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MurkyYT committed Aug 5, 2024
1 parent 0057b83 commit ffc6402
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/CSAuto/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,17 @@ public partial class App : Application
private string languageName = null;
protected override void OnStartup(StartupEventArgs e)
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
AppDomain.CurrentDomain.AppendPrivatePath("bin");
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
string[] files = Directory.GetFiles(Log.WorkPath, "*.dll");
bool didCleanOld = files.Length > 0;
RealStartup(e);
if (didCleanOld)
{
Process.Start(Log.WorkPath + "\\bin\\updater.exe", "--cleanup \"" + Args + " --restart\"");
App.Current.Shutdown();
}
}
void RealStartup(StartupEventArgs e)
{
Expand Down
2 changes: 1 addition & 1 deletion src/CSAuto/MainApp.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public partial class MainApp : Window
#region Constants
public const string VER = "2.1.2";
public const string FULL_VER = VER + (DEBUG_REVISION == "" ? "" : " REV "+ DEBUG_REVISION);
const string DEBUG_REVISION = "14";
const string DEBUG_REVISION = "";
const string GAME_PROCCES_NAME = "cs2";
const string GAME_WINDOW_NAME = "Counter-Strike 2";
const string GAME_CLASS_NAME = "SDL_app";
Expand Down
31 changes: 30 additions & 1 deletion src/Updater/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;

Expand All @@ -15,7 +18,33 @@ public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
new MainWindow(e.Args).Show();
if (e.Args[0] == "--cleanup")
{
string[] files = Directory.GetFiles(Log.WorkPath + "\\..", "*.dll");
bool didCleanOld = files.Length > 0;
foreach (var file in files)
{
while (true)
{
try
{
File.Delete(file);
break;
}
catch { }
}
}
if (didCleanOld)
{
Directory.Delete(Log.WorkPath + "\\..\\ru");
File.Delete(Log.WorkPath + "\\..\\steamapi.exe");
File.Delete(Log.WorkPath + "\\..\\updater.exe");
}
Process.Start(Log.WorkPath + "\\..\\CSAuto.exe", e.Args[1]);
App.Current.Shutdown();
}
else
new MainWindow(e.Args).Show();
}
}
}
1 change: 1 addition & 0 deletions src/Updater/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static class Log
static string path = strWorkPath;
static string lineTemplate = "[%date%] (%caller%) - %message%";

public static string WorkPath { get { return strWorkPath; } }
public static void VerifyDir()
{
try
Expand Down

0 comments on commit ffc6402

Please sign in to comment.