Example #1
0
 private void button12_Click(object sender, EventArgs e)
 {
     Launcher.LaunchGame_Debug(Launcher.GameType.None);
 }
Example #2
0
 private void button13_Click(object sender, EventArgs e)
 {
     Launcher.ShowGameInfo(Launcher.GameType.CSNEO);
 }
Example #3
0
 private void button5_Click(object sender, EventArgs e)
 {
     Launcher.ShowGameInfo(Launcher.GameType.L4DS);
 }
Example #4
0
 private void button17_Click(object sender, EventArgs e)
 {
     Launcher.LaunchGame_Debug(Launcher.GameType.CyberDiver_v1_20j);
 }
Example #5
0
 private void button4_Click(object sender, EventArgs e)
 {
     Launcher.ShowGameInfo(Launcher.GameType.CyberDiver_Main);
 }
Example #6
0
        //on load
        void MainFormLoad(object sender, EventArgs e)
        {
            #region core launcher settings
            label20.Text = "v" + Properties.Settings.Default.Version.ToString();
            var versionInfo = FileVersionInfo.GetVersionInfo(Application.ExecutablePath);
            label21.Text              = label20.Text + "." + versionInfo.ProductBuildPart.ToString() + "." + versionInfo.ProductPrivatePart.ToString();
            checkBox5.Checked         = Settings.ReadBool("CloseWhenGameLaunches");
            checkBox3.Checked         = Settings.ReadBool("DiscordIntegration");
            tabControl1.SelectedIndex = Properties.Settings.Default.LastSelectedTabIndex;
            #endregion

            #region hl2 survivor load settings
            textBox4.Text     = Settings.ReadString("HL2S_LaunchOptions");
            checkBox1.Checked = Settings.ReadBool("HL2S_ArcadeMenu_Toggle");
            checkBox2.Checked = Settings.ReadBool("HL2S_CustomNESYSHostIP_Toggle");
            textBox5.Text     = Settings.ReadString("HL2S_CustomNESYSHostIP");

            if (checkBox1.Checked == false)
            {
                if (textBox4.Text.Contains(" -ac"))
                {
                    textBox4.Text = textBox4.Text.Replace(" -ac", "");
                }
            }
            else if (checkBox1.Checked == true)
            {
                if (!textBox4.Text.Contains(" -ac"))
                {
                    textBox4.Text = textBox4.Text + " -ac";
                }
            }
            #endregion

            #region cyberdiver load settings
            textBox7.Text = Settings.ReadString("CyberDiver_LaunchOptions");
            #endregion

            #region l4d survivors load settings
            textBox6.Text = Settings.ReadString("L4DS_LaunchOptions");
            #endregion

            #region csneo load settings
            textBox1.Text     = Settings.ReadString("CSNEO_InstallDir");
            checkBox4.Checked = Settings.ReadBool("CSNEO_ShowTab");

            if (!Settings.ReadBool("CSNEO_ShowTab"))
            {
                tabControl1.TabPages.Remove(tabPage4);
            }
            #endregion

            if (GlobalVars.isDebug == true)
            {
                button8.Visible  = true;
                button9.Visible  = true;
                button10.Visible = true;
                button11.Visible = true;
                button12.Visible = true;
                button17.Visible = true;
                button16.Visible = true;
            }
            else
            {
                tabControl1.Height = 305;
            }

            //check for the games.
            bool hl2acAvailable = Launcher.CreateGame(Launcher.GameType.HL2S).ValidateGamePath();
            if (!hl2acAvailable)
            {
                tabControl1.TabPages.Remove(tabPage1);
            }
            else
            {
                if (!GlobalVars.HL2SAvail)
                {
                    tabControl1.TabPages.Remove(tabPage1);
                }
            }

            bool cdv1Available  = Launcher.CreateGame(Launcher.GameType.CyberDiver_v1_00).ValidateGamePath();
            bool cdv12Available = Launcher.CreateGame(Launcher.GameType.CyberDiver_v1_20j).ValidateGamePath();
            if (!cdv1Available)
            {
                if (!cdv12Available)
                {
                    tabControl1.TabPages.Remove(tabPage2);
                }
            }

            if (cdv1Available || cdv12Available)
            {
                if (!GlobalVars.CDAvail)
                {
                    tabControl1.TabPages.Remove(tabPage2);
                }
            }

            bool l4dsAvailable = Launcher.CreateGame(Launcher.GameType.L4DS).ValidateGamePath();
            if (!l4dsAvailable)
            {
                tabControl1.TabPages.Remove(tabPage3);
            }
            else
            {
                if (!GlobalVars.L4DSAvail)
                {
                    tabControl1.TabPages.Remove(tabPage3);
                }
            }

            if (tabControl1.TabPages.Count <= 0)
            {
                MessageBox.Show("There are no GENESYS games installed or there are no valid requirements. The launcher will now close.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
            }

            tabControl1.TabPages[0].Select();

            switchImage();
            GlobalVars.isConsole = false;
            init = false;

            try
            {
                // Discord Functionality
                if (File.Exists(GlobalVars.DiscordDllPath) && Properties.Settings.Default.DiscordIntegration)
                {
                    Console.WriteLine("DISCORD: Loaded!");
                    GlobalVars.discord = new Discord.Discord(Properties.Settings.Default.DiscordAppID, (System.UInt64)Discord.CreateFlags.NoRequireDiscord);
                    GlobalVars.discord.SetLogHook(Discord.LogLevel.Debug, (level, message) =>
                    {
                        Console.WriteLine("Log[{0}] {1}", level, message);
                    });

                    // Pump the event look to ensure all callbacks continue to get fired.
                    //https://stackoverflow.com/questions/17142842/infinite-while-loop-with-form-application-c-sharp
                    continueDiscordThreadLoop = true;
                    discordThread             = new Thread(() =>
                    {
                        Launcher.UpdateActivity(Launcher.GameType.None);

                        try
                        {
                            while (continueDiscordThreadLoop)
                            {
                                GlobalVars.discord.RunCallbacks();
                                Thread.Sleep(1000 / 60);
                            }
                        }
                        finally
                        {
                            GlobalVars.discord.Dispose();
                        }
                    });
                    discordThread.IsBackground = true;
                    discordThread.Start();
                }
            }
            catch (Exception)
            {
            }
        }