Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 3
0
 public Task <int> Launch(IGameLauncherFactory factory)
 {
     if (factory == null)
     {
         throw new ArgumentNullException(nameof(factory));
     }
     return(default(Task <int>));
 }
Esempio n. 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);
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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)));
        }
Esempio n. 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));
        }
Esempio n. 9
0
 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);
 }
Esempio n. 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);
        }
Esempio n. 11
0
 public LaunchGameHandler(IDbContextLocator dbContextLocator, IGameLauncherFactory launcherFactory)
     : base(dbContextLocator)
 {
     _launcherFactory = launcherFactory;
 }
Esempio n. 12
0
 public Task<int> Launch(IGameLauncherFactory factory) {
     Contract.Requires<ArgumentNullException>(factory != null);
     return default(Task<int>);
 }
Esempio n. 13
0
 protected abstract Task <Process> LaunchImpl(IGameLauncherFactory factory,
                                              ILaunchContentAction <IContent> action);
Esempio n. 14
0
 public abstract Task <int> Launch(IGameLauncherFactory factory);
Esempio n. 15
0
 public override Task <IReadOnlyCollection <string> > ShortcutLaunchParameters(IGameLauncherFactory factory, string identifier)
 {
     throw new NotImplementedException();
 }
Esempio n. 16
0
 public override Task <int> Launch(IGameLauncherFactory factory) => LaunchBasic(factory.Create(this));
Esempio n. 17
0
 public override async Task <IReadOnlyCollection <string> > ShortcutLaunchParameters(IGameLauncherFactory factory,
                                                                                     string identifier) => null;
Esempio n. 18
0
 public abstract Task <IReadOnlyCollection <string> > ShortcutLaunchParameters(IGameLauncherFactory factory,
                                                                               string identifier);
Esempio n. 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());
        }
Esempio n. 20
0
 public override Task <int> Launch(IGameLauncherFactory factory)
 {
     throw new NotImplementedException();
 }
Esempio n. 21
0
 public Task <int> Play(IGameLauncherFactory factory,
                        IContentInstallationService contentInstallation, IPlayContentAction <Content> action)
 => PlayInternal(factory, contentInstallation, action);
Esempio n. 22
0
 public PlayContentHandler(IDbContextLocator gameContext, IGameLauncherFactory factory,
                           IContentInstallationService contentInstallation) : base(gameContext)
 {
     _factory             = factory;
     _contentInstallation = contentInstallation;
 }
Esempio n. 23
0
 public LaunchContentHandler(IDbContextLocator gameContext, IGameLauncherFactory factory) : base(gameContext)
 {
     _factory = factory;
 }