Beispiel #1
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);
                }
            }
        }
Beispiel #2
0
        public static bool RunLauncherDialog(IWin32Window dialogOwner)
        {
            bool bOk;

            using (LauncherForm frm = new LauncherForm())
            {
                frm.Icon          = Program.Icon;
                frm.ShowInTaskbar = false;

                CfgLauncher cfg = new CfgLauncher();

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

                frm.ReadFromConfig(cfg);

                if (DialogResult.OK == frm.ShowDialog(dialogOwner))
                {
                    frm.WriteToConfig(cfg);

                    if (cfg.RememberChanges)
                    {
                        GlobalConfig.Instance.Settings.Launcher.CopyFrom(cfg);
                        GlobalConfig.Instance.BackUp();
                    }

                    bOk = Launch(cfg);

                    if (!bOk)
                    {
                        MessageBox.Show("Launching failed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    bOk = true;
                }
            }

            return(bOk);
        }
Beispiel #3
0
    public static bool RunLauncher(IWin32Window dialogOwner, Afx.AfxGoldSrc afxGoldSrc)
    {
        bool bOk;

        using (LauncherForm frm = new LauncherForm())
        {
            frm.Icon = Program.Icon;
            frm.ShowInTaskbar = false;

            CfgLauncher cfg = new CfgLauncher();

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

            frm.ReadFromConfig(cfg);

            if (DialogResult.OK == frm.ShowDialog(dialogOwner))
            {
                frm.WriteToConfig(cfg);

                bOk = afxGoldSrc.Start(cfg.MakeStartSettings());

                if (!bOk)
                    MessageBox.Show("Launching failed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                if (cfg.RememberChanges)
                {
                    GlobalConfig.Instance.Settings.Launcher.CopyFrom(cfg);
                    GlobalConfig.Instance.BackUp();
                }
            }
            else
                bOk = true;

        }

        return bOk;

    }
Beispiel #4
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 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);
            }
        }
Beispiel #5
0
	bool IHlaeRemote_1.LaunchEx(String OverrideCustomArgs)
	{
        Func<bool> start = delegate
        {
            // first check if HL.exe is already running:
            CfgLauncher cfg = new CfgLauncher();

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

            cfg.CustomCmdLine = OverrideCustomArgs;

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

            return m_MainForm.AfxGoldSrc.Start(settings);
        };

        return (bool)m_MainForm.Invoke(start);
	}