예제 #1
0
        private void detectSDK(bool updatePathBox = true)
        {
            if (!this.steam.isSteamInstalled())
            {
                return;
            }
            InstallationStatus appIdStatus = this.steam.getAppIdStatus(243750, this.steam.getLibraryFolders());

            if (updatePathBox)
            {
                this.sdkPathBox.Text = appIdStatus.getInstallationDirectory() + "\\hl2.exe";
            }
            if (appIdStatus.isInstalled())
            {
                return;
            }
            Process.Start("steam://install/243750");
        }
예제 #2
0
        private void launchButton_Click(object sender, EventArgs e)
        {
            string str = "-steam -game \"" + this.getGamePath() + "\" " + this.paramBox.Text;

            try
            {
                if (this.steam.isSteamInstalled())
                {
                    InstallationStatus appIdStatus = this.steam.getAppIdStatus(243750, this.steam.getLibraryFolders());
                    if (!appIdStatus.isInstalled())
                    {
                        Process.Start("steam://install/243750");
                        this.statusPanel.ForeColor = Color.Red;
                        this.statusPanel.Text      = "Source SDK Base 2013 Multiplayer must be installed to run the game.";
                        return;
                    }
                    if (appIdStatus.isUpdating())
                    {
                        this.statusPanel.ForeColor = Color.Red;
                        this.statusPanel.Text      = "Source SDK Base 2013 Multiplayer is still updating or being installed.";
                        return;
                    }
                }
                if (!this.sdkPathBox.Text.EndsWith("hl2.exe") || !System.IO.File.Exists(this.sdkPathBox.Text))
                {
                    this.statusPanel.ForeColor = Color.Red;
                    this.statusPanel.Text      = "The configured sdk path has to be set to run \"hl2.exe\"! You can press detect in the configuration tab.";
                    if (MessageBox.Show("Your sdk path is configured incorrectly.\nWould you like to try automatically detect this location?", "SDK Path configuration error", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                    {
                        return;
                    }
                    this.detectSDK(true);
                    this.saveConfiguration();
                }
                else if (!System.IO.File.Exists(this.getGamePath() + "\\gameinfo.txt"))
                {
                    this.statusPanel.ForeColor = Color.Red;
                    this.statusPanel.Text      = "This application must be placed in the root directory of the mod in order to function correctly!";
                }
                else
                {
                    if (!new Process()
                    {
                        StartInfo =
                        {
                            FileName  = this.sdkPathBox.Text,
                            Arguments = str
                        }
                    }.Start())
                    {
                        return;
                    }
                    this.Dispose();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                this.statusPanel.ForeColor = Color.Red;
                this.statusPanel.Text      = "A Problem occurred while launching the game!";
            }
        }