static int Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); m_BaseDir = System.Windows.Forms.Application.StartupPath; m_Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath); GlobalConfig.Instance = Config.LoadOrCreate(String.Concat(m_BaseDir, "\\hlaeconfig.xml")); GlobalUpdateCheck.Instance = new UpdateCheck(); ProcessCommandLine(); //// bool bOk = true; // start-up CS:GO if requested (i.e. by command line) if (Globals.AutoStartCsgo) { if (!LaunchCsgo.Launch(GlobalConfig.Instance.Settings.LauncherCsgo)) { bOk = false; } } // start-up AfxHookGoldSrc if requested (i.e. by command line) if (Globals.AutoStartAfxHookGoldSrc) { if (!Launcher.Launch(GlobalConfig.Instance.Settings.Launcher)) { bOk = false; } } // start-up CustomLoader if requested (i.e. by command line) if (Globals.AutoStartCustomLoader) { if (!AfxCppCli.AfxHook.LauchAndHook(GlobalConfig.Instance.Settings.CustomLoader.ProgramPath, GlobalConfig.Instance.Settings.CustomLoader.CmdLine, GlobalConfig.Instance.Settings.CustomLoader.HookDllPath)) { bOk = false; } } //// if (!Globals.NoGui) { Application.Run(new MainForm()); } GlobalConfig.Instance.BackUp(); GlobalUpdateCheck.Instance.Dispose(); return(bOk ? 0 : 1); }
static int Main() { ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; // Force TLS v1.2 (Will only work where .NET 4.5 is installed). // Use default system proxy in case we use WebRequest (which we don't) atm: System.Net.WebRequest.DefaultWebProxy = System.Net.WebRequest.GetSystemWebProxy(); System.Net.WebRequest.DefaultWebProxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); m_BaseDir = System.IO.Path.GetFullPath(System.Windows.Forms.Application.StartupPath).TrimEnd('\\', '/'); m_AppDataDir = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "HLAE"); try { m_SteamInstallPath = Microsoft.Win32.Registry.LocalMachine.GetValue("Computer\\HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Valve\\Steam") as string; } catch { m_SteamInstallPath = null; } if (null == m_SteamInstallPath) { m_SteamInstallPath = "C:\\Program Files(x86)\\Steam"; } if (!System.IO.Directory.Exists(m_AppDataDir)) { System.IO.Directory.CreateDirectory(m_AppDataDir); } m_Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath); GlobalConfig.Instance = Config.LoadOrCreate(System.IO.Path.Combine(m_AppDataDir, "hlaeconfig.xml"), System.IO.Path.Combine(m_BaseDir, "hlaeconfig.xml")); GlobalUpdateCheck.Instance = new UpdateCheck(); ProcessCommandLine(); //// bool bOk = true; // start-up CS:GO if requested (i.e. by command line) if (Globals.AutoStartCsgo) { if (!LaunchCsgo.Launch(GlobalConfig.Instance.Settings.LauncherCsgo)) { bOk = false; } } // start-up AfxHookGoldSrc if requested (i.e. by command line) if (Globals.AutoStartAfxHookGoldSrc) { if (!Launcher.Launch(GlobalConfig.Instance.Settings.Launcher)) { bOk = false; } } // start-up CustomLoader if requested (i.e. by command line) if (Globals.AutoStartCustomLoader) { List <Loader.GetHookPathDelegate> getHookPaths = new List <Loader.GetHookPathDelegate>(); foreach (CfgInjectDll dll in GlobalConfig.Instance.Settings.CustomLoader.InjectDlls) { getHookPaths.Add(isProcess64Bit => dll.FullPath); } string[] envVars = GlobalConfig.Instance.Settings.CustomLoader.AddEnvironmentVars.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); string environment = null; foreach (string line in envVars) { if (null == environment) { environment = ""; foreach (System.Collections.DictionaryEntry kv in Environment.GetEnvironmentVariables()) { environment += kv.Key + "=" + kv.Value + "\0"; } } environment += line + "\0"; } if (null != environment) { environment += "\0\0"; } if (!Loader.Load(getHookPaths, GlobalConfig.Instance.Settings.CustomLoader.ProgramPath, GlobalConfig.Instance.Settings.CustomLoader.CmdLine, environment)) { bOk = false; } } //// if (!Globals.NoGui) { Application.Run(new MainForm()); } GlobalConfig.Instance.BackUp(); GlobalUpdateCheck.Instance.Dispose(); return(bOk ? 0 : 1); }
static int Main() { ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; // Force TLS v1.2 (Will only work where .NET 4.5 is installed). Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); m_BaseDir = System.Windows.Forms.Application.StartupPath; m_Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath); GlobalConfig.Instance = Config.LoadOrCreate(String.Concat(m_BaseDir, "\\hlaeconfig.xml")); GlobalUpdateCheck.Instance = new UpdateCheck(); ProcessCommandLine(); //// bool bOk = true; // start-up CS:GO if requested (i.e. by command line) if (Globals.AutoStartCsgo) { if (!LaunchCsgo.Launch(GlobalConfig.Instance.Settings.LauncherCsgo)) { bOk = false; } } // start-up AfxHookGoldSrc if requested (i.e. by command line) if (Globals.AutoStartAfxHookGoldSrc) { if (!Launcher.Launch(GlobalConfig.Instance.Settings.Launcher)) { bOk = false; } } // start-up CustomLoader if requested (i.e. by command line) if (Globals.AutoStartCustomLoader) { List <Loader.GetHookPathDelegate> getHookPaths = new List <Loader.GetHookPathDelegate>(); foreach (CfgInjectDll dll in GlobalConfig.Instance.Settings.CustomLoader.InjectDlls) { getHookPaths.Add(isProcess64Bit => dll.Path); } if (!Loader.Load(getHookPaths, GlobalConfig.Instance.Settings.CustomLoader.ProgramPath, GlobalConfig.Instance.Settings.CustomLoader.CmdLine)) { bOk = false; } } //// if (!Globals.NoGui) { Application.Run(new MainForm()); } GlobalConfig.Instance.BackUp(); GlobalUpdateCheck.Instance.Dispose(); return(bOk ? 0 : 1); }