Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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 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);
        }
Exemplo n.º 3
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            GlobalUpdateCheck.Instance.BeginCheckedNotification(m_UpdateCheckNotification);

            if (0 < GlobalConfig.Instance.Settings.UpdateCheck)
            {
                this.menuAutoUpdateCheck.Checked = true;
                StartUpdateCheck();
            }
            else if (0 == GlobalConfig.Instance.Settings.UpdateCheck)
            {
                this.stripEnableUpdateCheck.Visible = true;
            }

            // init AfxGoldSrc:
            m_AfxGoldSrc = new Afx.AfxGoldSrc(this);

            // start up public remoting system (if requested):
            if (Globals.EnableHlaeRemote)
            {
                m_HlaeRemoting = new hlae.remoting.HlaeRemoting(this);
            }

            // start-up CS:GO if requested (i.e. by command line)
            if (Globals.AutoStartCsgo)
            {
                LaunchCsgo.Launch(GlobalConfig.Instance.Settings.LauncherCsgo);
            }

            // start-up AfxHookGoldSrc if requested (i.e. by command line)
            if (Globals.AutoStartAfxHookGoldSrc)
            {
                CfgLauncher cfg = new CfgLauncher();

                cfg.CopyFrom(GlobalConfig.Instance.Settings.Launcher);

                Afx.AfxGoldSrc.StartSettings settings = cfg.MakeStartSettings();

                m_AfxGoldSrc.Start(settings);
            }

            // start-up CustomLoader if requested (i.e. by command line)
            if (Globals.AutoStartCustomLoader)
            {
                bool bOk = AfxCppCli.AfxHook.LauchAndHook(GlobalConfig.Instance.Settings.CustomLoader.ProgramPath, GlobalConfig.Instance.Settings.CustomLoader.CmdLine, GlobalConfig.Instance.Settings.CustomLoader.HookDllPath);

                if (!bOk)
                {
                    MessageBox.Show("CustomLoader failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 4
0
 private void menuLaunchCSGO_Click(object sender, EventArgs e)
 {
     LaunchCsgo.RunLauncherDialog(this);
 }
Exemplo n.º 5
0
        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);
        }