Exemple #1
0
        public async Task Uninstall(IContentInstallationService contentInstallation,
                                    IContentAction <IUninstallableContent> uninstallLocalContentAction)
        {
            await UninstallInternal(contentInstallation, uninstallLocalContentAction).ConfigureAwait(false);

            PrepareEvent(new UninstallActionCompleted(uninstallLocalContentAction, this));
        }
Exemple #2
0
        private IContent HandleContentAction(IContentAction <IContent> action)
        {
            var content = action.Content.Count == 1
                ? action.Content.First().Content
                : FindOrCreateLocalCollection(action);

            // TODO: it would probably be better to have rewritten the action content, so we dont again create a temporary collection further down the line..
            return(content);
        }
Exemple #3
0
 protected override InstallContentAction GetInstallAction(
     IContentAction<IInstallableContent> action) {
     return new InstallContentAction(action.Content, action.CancelToken) {
         RemoteInfo = RemoteInfo,
         Paths = ContentPaths,
         Game = this,
         CheckoutType = CheckoutType.CheckoutWithoutRemoval,
         GlobalWorkingPath = InstalledState.WorkingDirectory,
         Cleaning = ContentCleaning
     };
 }
Exemple #4
0
        async Task UninstallInternal(IContentInstallationService contentInstallation,
                                     IContentAction <IUninstallableContent> uninstallContentAction)
        {
            //ConfirmUninstall()
            await UninstallImpl(contentInstallation, uninstallContentAction).ConfigureAwait(false);

            foreach (var c in uninstallContentAction.Content.Select(x => x.Content).OfType <Content>())
            {
                Contents.Remove(c);
            }
        }
Exemple #5
0
 protected override Task UninstallImpl(IContentInstallationService installationService,
                                       IContentAction <IUninstallableContent> action)
 {
     foreach (var m in action.Content.OfType <ModNetworkContent>())
     {
         m.RegisterAdditionalPreUninstallTask(async processed => {
             if (processed)
             {
                 await UninstallMod(m).ConfigureAwait(false);
             }
         });
     }
     return(base.UninstallImpl(installationService, action));
 }
Exemple #6
0
        LocalCollection FindOrCreateLocalCollection(IContentAction <IContent> action)
        {
            var contents = action.Content.Select(x => new ContentSpec((Content)x.Content, x.Constraint)).ToList();
            var existing =
                Collections.OfType <LocalCollection>().FirstOrDefault(x => x.Contents.SequenceEqual(contents));

            if (existing != null)
            {
                return(existing);
            }
            var isNotUpdateAll = (action.Name != "Update all") && (action.Name != "Available updates");
            var name           = isNotUpdateAll
                ? $"{action.Name ?? "Playlist"} {DateTime.UtcNow.ToString(Tools.GenericTools.DefaultDateFormat)}"
                : action.Name;
            var localCollection = new LocalCollection(Id, name, contents);

            if (isNotUpdateAll)
            {
                Contents.Add(localCollection);
            }
            return(localCollection);
        }
Exemple #7
0
 protected override async Task InstallImpl(IContentInstallationService installationService,
     IContentAction<IInstallableContent> content) {
     await base.InstallImpl(installationService, content).ConfigureAwait(false);
     await new GtaPackager(InstalledState.Directory).HandlePackages().ConfigureAwait(false);
     HandleBackups();
 }
Exemple #8
0
 public ContentUsed(Content content, IContentAction <IContent> action)
 {
     Content = content;
     Action  = action;
 }
Exemple #9
0
 public UninstallActionCompleted(IContentAction <IUninstallableContent> uninstallLocalContentAction,
                                 Game game)
 {
     UninstallLocalContentAction = uninstallLocalContentAction;
     Game = game;
 }
Exemple #10
0
 protected abstract Task UninstallImpl(IContentInstallationService contentInstallation,
                                       IContentAction <IUninstallableContent> action);
Exemple #11
0
        public void UseContent(IContentAction <IContent> action)
        {
            var content = HandleContentAction(action);

            action.Use(content);
        }
 public XElementActionModification(IContentAction modification, string attributeName)
     : this(modification)
 {
     XAttributeName = attributeName;
 }
 public XElementActionModification(IContentAction modification)
 {
     _action = modification;
 }
Exemple #14
0
 UnInstallContentAction GetUninstallAction(IContentAction <IUninstallableContent> action)
 => new UnInstallContentAction(this, action.Content, action.CancelToken)
 {
     Paths = ContentPaths
 };
Exemple #15
0
 protected override Task UninstallImpl(IContentInstallationService contentInstallation,
                                       IContentAction <IUninstallableContent> action)
 => contentInstallation.Uninstall(GetUninstallAction(action));
Exemple #16
0
 public void Use(IContentAction <IContent> action)
 {
     RecentInfo = new RecentInfo();
     PrepareEvent(new ContentUsed(this, action));
 }