Exemple #1
0
        protected override async Task <Process> LaunchImpl(IGameLauncherFactory factory,
                                                           ILaunchContentAction <IContent> action)
        {
            var launcher     = factory.Create <IRealVirtualityLauncher>(this);
            var launchAction = _shouldLaunchAsDedicatedServer.Value
                ? LaunchAction.LaunchAsDedicatedServer
                : action.Action;
            var ls = new LaunchState(GetLaunchExecutable(launchAction), GetExecutable(launchAction),
                                     await GetStartupParameters(launcher, action, launchAction).ConfigureAwait(false), launchAction);

            if (launchAction.IsAsServer())
            {
                Tools.FileUtil.Ops.CreateDirectoryAndSetACLWithFallbackAndRetry(KeysPath);
            }

            var launchables = action.GetLaunchables()
                              .OfType <IModContent>()
                              .Select(c => new RvMod(this, c));

            foreach (var mod in launchables)
            {
                await mod.PreLaunch(action.Action).ConfigureAwait(false);
            }
            return(await InitiateLaunch(launcher, ls).ConfigureAwait(false));
        }
Exemple #2
0
        public override async Task <int> Launch(IGameLauncherFactory factory)
        {
            var launchHandler = factory.Create(this);
            var p             = await launchHandler.Launch(LaunchParameters(launchHandler)).ConfigureAwait(false);

            return(await RegisterLaunchIf(p, launchHandler).ConfigureAwait(false));
        }
Exemple #3
0
 public Task <int> Launch(IGameLauncherFactory factory)
 {
     if (factory == null)
     {
         throw new ArgumentNullException(nameof(factory));
     }
     return(default(Task <int>));
 }
Exemple #4
0
        // TODO: Enter content into LAUNCHING state, then once completed, back to the content's state.
        public async Task <int> Launch(IGameLauncherFactory factory,
                                       ILaunchContentAction <Content> launchContentAction)
        {
            var pid = await LaunchInternal(factory, launchContentAction).ConfigureAwait(false);

            PrepareEvent(new LaunchActionCompleted(this, pid));
            return(pid);
        }
Exemple #5
0
        async Task <int> PlayInternal(IGameLauncherFactory factory, IContentInstallationService contentInstallation,
                                      IPlayContentAction <IContent> action)
        {
            ConfirmPlay();
            await InstallInternal(contentInstallation, action.ToInstall()).ConfigureAwait(false);

            return(await LaunchInternal(factory, action).ConfigureAwait(false));
        }
Exemple #6
0
        public override async Task <int> Launch(IGameLauncherFactory factory)
        {
            var launchHandler = factory.Create(this);

            await PreLaunch(launchHandler).ConfigureAwait(false);

            return(await PerformLaunch(launchHandler).ConfigureAwait(false));
        }
Exemple #7
0
        protected override Task <Process> LaunchImpl(IGameLauncherFactory factory,
                                                     ILaunchContentAction <IContent> action)
        {
            var launcher = factory.Create(this);

            return(InitiateLaunch(launcher,
                                  new LaunchState(GetLaunchExecutable(action.Action), GetExecutable(action.Action),
                                                  GetStartupParameters(action).ToArray(), action.Action)));
        }
Exemple #8
0
        public override async Task <int> Launch(IGameLauncherFactory factory)
        {
            var launchHandler = factory.Create(this);

            await PreLaunch(launchHandler).ConfigureAwait(false);

            if (IsLaunchingSteamApp())
            {
                return(await LaunchSteam(launchHandler).ConfigureAwait(false));
            }
            return(await LaunchBasic(launchHandler).ConfigureAwait(false));
        }
 public LaunchManager(IContentManager cm, IGameContext gameContext,
                      UserSettings settings, IProcessManager processManager, IGameLauncherFactory gameLaunchFactory,
                      IEventAggregator eventBus, IDialogManager dialogManager)
 {
     _contentManager    = cm;
     _gameContext       = gameContext;
     _settings          = settings;
     _processManager    = processManager;
     _gameLaunchFactory = gameLaunchFactory;
     _eventBus          = eventBus;
     _dialogManager     = dialogManager;
     TryHandleServerAddress();
     _listTimer = new TimerWithElapsedCancellation(CheckRunningInterval, CheckRunningTimerElapsed);
 }
Exemple #10
0
        async Task <int> LaunchInternal(IGameLauncherFactory factory, ILaunchContentAction <IContent> action)
        {
            ConfirmLaunch();

            await BeforeLaunch(action).ConfigureAwait(false);

            int id;

            using (var p = await LaunchImpl(factory, action).ConfigureAwait(false))
                id = p?.Id ?? -1;
            LastPlayed = Tools.Generic.GetCurrentUtcDateTime;
            PrepareEvent(new GameLaunched(this, id));

            if (Metadata.AfterLaunchDelay.HasValue)
            {
                await Task.Delay(Metadata.AfterLaunchDelay.Value, action.CancelToken).ConfigureAwait(false);
            }

            return(id);
        }
Exemple #11
0
 public LaunchGameHandler(IDbContextLocator dbContextLocator, IGameLauncherFactory launcherFactory)
     : base(dbContextLocator)
 {
     _launcherFactory = launcherFactory;
 }
 public Task<int> Launch(IGameLauncherFactory factory) {
     Contract.Requires<ArgumentNullException>(factory != null);
     return default(Task<int>);
 }
Exemple #13
0
 protected abstract Task <Process> LaunchImpl(IGameLauncherFactory factory,
                                              ILaunchContentAction <IContent> action);
Exemple #14
0
 public abstract Task <int> Launch(IGameLauncherFactory factory);
Exemple #15
0
 public override Task <IReadOnlyCollection <string> > ShortcutLaunchParameters(IGameLauncherFactory factory, string identifier)
 {
     throw new NotImplementedException();
 }
Exemple #16
0
 public override Task <int> Launch(IGameLauncherFactory factory) => LaunchBasic(factory.Create(this));
Exemple #17
0
 public override async Task <IReadOnlyCollection <string> > ShortcutLaunchParameters(IGameLauncherFactory factory,
                                                                                     string identifier) => null;
Exemple #18
0
 public abstract Task <IReadOnlyCollection <string> > ShortcutLaunchParameters(IGameLauncherFactory factory,
                                                                               string identifier);
Exemple #19
0
        public override async Task <IReadOnlyCollection <string> > ShortcutLaunchParameters(IGameLauncherFactory factory,
                                                                                            string identifier)
        {
            var launchHandler         = factory.Create(this);
            var parametersForShortcut =
                await BuildStartupParametersForShortcut(launchHandler, identifier).ConfigureAwait(false);

            return(parametersForShortcut.ToArray());
        }
Exemple #20
0
 public override Task <int> Launch(IGameLauncherFactory factory)
 {
     throw new NotImplementedException();
 }
Exemple #21
0
 public Task <int> Play(IGameLauncherFactory factory,
                        IContentInstallationService contentInstallation, IPlayContentAction <Content> action)
 => PlayInternal(factory, contentInstallation, action);
Exemple #22
0
 public PlayContentHandler(IDbContextLocator gameContext, IGameLauncherFactory factory,
                           IContentInstallationService contentInstallation) : base(gameContext)
 {
     _factory             = factory;
     _contentInstallation = contentInstallation;
 }
Exemple #23
0
 public LaunchContentHandler(IDbContextLocator gameContext, IGameLauncherFactory factory) : base(gameContext)
 {
     _factory = factory;
 }