/// <summary>
        /// Called when the application is run with debugging support. Otherwise it will just launch.
        /// </summary>
        /// <param name="grfLaunch"></param>
        /// <returns></returns>
        public int DebugLaunch(uint grfLaunch)
        {
            var port = NetworkHelper.GetAvailablePort(17615, 18000);

            var startArgs = new SoftDebuggerConnectArgs("CRYENGINE", IPAddress.Loopback, port)
            {
                MaxConnectionAttempts = 10
            };

            var startInfo = new CryEngineStartInfo(startArgs, null, _baseProject, CryEngineProjectData.GetProjectData(_baseProject), _launcherType);
            var session   = new CryEngineDebuggerSession();

            IDebugLauncher debugLauncher = new CryEngineDebugLauncher();
            var            progress      = new Progress <string>();

            progress.ProgressChanged += OnProgressChanged;
            var launcher = new MonoDebuggerLauncher(progress, debugLauncher);

            launcher.StartSession(startInfo, session);

            return(VSConstants.S_OK);
        }