/// <summary>
        /// Tries to launch specified tool
        /// </summary>
        /// <param name="app">Application to launch</param>
        public static void TryLaunchTool(SDKApplication app)
        {
            try
            {
                //Get selected profile id
                int SelectedProfileId = Config.TryReadInt("SelectedProfileId");

                if (SelectedProfileId < 0)
                {
                    //Tell user what went wrong
                    MessageBox.Show("You need to select profile in settings and/or create new one", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //Cancel execution of an application
                    return;
                }

                //Get selected profile
                Profile SelectedProfile = Managers.DataManagers.ProfileManager.Objects[SelectedProfileId];
                //Launch application
                Launcher.Launch(SelectedProfile, app);
            }
            catch (Exception ex)
            {
                //Inform user that something unexpected happened
                MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        public void GenerateDefaultConfig(SDKApplication app)
        {
            application = app;

            Info             = GetToolStartInfo(application);
            Info.DisplayText = GetDisplayText();
            Info.Icon        = GetIcon();
        }
Example #3
0
        public override bool Configure()
        {
            var dialog = new BasicAppConfigurationDialog(application);

            if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return(false);
            }

            application = dialog.SelectedApplication;
            UpdateInfo();

            return(true);
        }
Example #4
0
        string GetToolPath(SDKApplication app)
        {
            switch (app)
            {
            case SDKApplication.FacePoser:
                return(Path.Combine("{GameBinDir}", "hlfaceposer.exe"));

            case SDKApplication.HLMV:
                return(Path.Combine("{GameBinDir}", "hlmv.exe"));

            default:
                return(Path.Combine("{GameBinDir}", "hammer.exe"));
            }
        }
Example #5
0
        /// <summary>
        /// Gets path to executable file of specified tool
        /// </summary>
        /// <param name="g">Selected game</param>
        /// <param name="app">App to launch</param>
        /// <returns>Path to executable of specified tool</returns>
        static string GetToolPath(Game g, SDKApplication app)
        {
            switch (app)
            {
            case SDKApplication.Hammer:
                return(Path.Combine(g.GetBinDirectory(), "hammer.exe"));

            case SDKApplication.HLMV:
                return(Path.Combine(g.GetBinDirectory(), "hlmv.exe"));

            case SDKApplication.FacePoser:
                return(Path.Combine(g.GetBinDirectory(), "hlfaceposer.exe"));
            }

            return(string.Empty);
        }
Example #6
0
        AppInfo GetToolStartInfo(SDKApplication app)
        {
            AppInfo info = new AppInfo();

            info.Path = GetToolPath(app);

            info.UseCustomWorkingDirectory = true;
            info.CustomWorkingDirectory    = Path.Combine("{GameDir}", "{GameinfoDir}");

            info.UseCustomArguments = true;
            if (app != SDKApplication.HLMV)
            {
                info.Arguments = "-nop4 ";
            }
            info.Arguments += string.Format("-game {0}{1}{0}", '"', Path.Combine("{GameDir}", "{GameinfoDir}"));

            return(info);
        }
Example #7
0
        public static void Launch(Game p, SDKApplication app)
        {
            GameChecker checker   = new GameChecker(p);
            string      filename  = string.Empty;
            string      arguments = string.Empty;

            if (!checker.IsValid())
            {
                MessageBoxes.Error(BuildFullErrorMessage(checker.LastErrorMessage));
                return;
            }

            //Select configuration
            switch (app)
            {
            case SDKApplication.Hammer:
                filename  = GetToolPath(p, app);
                arguments = "-nop4 ";
                break;

            case SDKApplication.HLMV:
                filename = GetToolPath(p, app);
                break;

            case SDKApplication.FacePoser:
                filename  = GetToolPath(p, app);
                arguments = "-nop4 ";
                break;
            }

            //Add gamedir to arguments
            arguments += string.Format("-game {0}{1}{0}", '"', p.GetGameinfoDirectory());

            //Create process
            Process proc = new Process();

            proc.StartInfo.WorkingDirectory = p.GetBinDirectory();
            proc.StartInfo.FileName         = filename;
            proc.StartInfo.Arguments        = arguments;
            //Start process
            proc.Start();
        }
        /// <summary>
        /// Tries to launch specified tool
        /// </summary>
        /// <param name="app">Application to launch</param>
        public static void TryLaunchTool(SDKApplication app)
        {
            try
            {
                int SelectedGameId = Config.TryReadInt("SelectedProfileId");

                if (SelectedGameId < 0)
                {
                    MessageBox.Show("You need to select game in settings and/or create new one", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                Game SelectedGame = Managers.DataManagers.GameManager.Objects[SelectedGameId];
                Launcher.Launch(SelectedGame, app);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public static void Launch(Profile p, SDKApplication app)
        {
            //Create strings
            string filename  = string.Empty;
            string arguments = string.Empty;

            //Select configuration
            switch (app)
            {
            case SDKApplication.Hammer:
                filename  = GetToolPath(p, app);
                arguments = "-nop4 ";
                break;

            case SDKApplication.HLMV:
                filename = GetToolPath(p, app);
                break;

            case SDKApplication.FacePoser:
                filename  = GetToolPath(p, app);
                arguments = "-nop4 ";
                break;
            }

            //Add gamedir to arguments
            arguments += string.Format("-game {0}{1}{0}", '"', p.GetGameinfoDirectory());

            //Create process
            Process proc = new Process();

            proc.StartInfo.WorkingDirectory = p.GetBinDirectory();
            proc.StartInfo.FileName         = filename;
            proc.StartInfo.Arguments        = arguments;
            //Start process
            proc.Start();
        }
 public BasicAppTemplate()
 {
     Application = SDKApplication.None;
 }