示例#1
0
        public int LaunchGame(GameLaunchSpec spec)
        {
            if (!(!string.IsNullOrWhiteSpace(spec.GamePath)))
            {
                throw new ArgumentNullException("!string.IsNullOrWhiteSpace(spec.GamePath)");
            }
            if (!(!string.IsNullOrWhiteSpace(spec.WorkingDirectory)))
            {
                throw new ArgumentNullException("!string.IsNullOrWhiteSpace(spec.WorkingDirectory)");
            }

            _steamError     = false;
            _isSteamRunning = false;
            _spec           = spec;

            PrepareSteamState();
            if (_spec.LegacyLaunch && _isSteamGameAndAvailable)
            {
                LegacySteamLaunch();
            }
            else
            {
                ModernLaunch();
            }

            using (_launchedGame) {
                if (_launchedGame == null)
                {
                    return(-1);
                }
                PostProcessLaunch();
                return(_launchedGame.Id);
            }
        }
示例#2
0
        public int LaunchGame(GameLaunchSpec spec) {
            Contract.Requires<ArgumentNullException>(!string.IsNullOrWhiteSpace(spec.GamePath));
            Contract.Requires<ArgumentNullException>(!string.IsNullOrWhiteSpace(spec.WorkingDirectory));

            _steamError = false;
            _isSteamRunning = false;
            _spec = spec;

            PrepareSteamState();
            if (_spec.LegacyLaunch && _isSteamGameAndAvailable)
                LegacySteamLaunch();
            else
                ModernLaunch();

            using (_launchedGame) {
                if (_launchedGame == null)
                    return -1;
                PostProcessLaunch();
                return _launchedGame.Id;
            }
        }