public async Task Uninstall(IContentInstallationService contentInstallation, IContentAction <IUninstallableContent> uninstallLocalContentAction) { await UninstallInternal(contentInstallation, uninstallLocalContentAction).ConfigureAwait(false); PrepareEvent(new UninstallActionCompleted(uninstallLocalContentAction, this)); }
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); }
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 }; }
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); } }
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)); }
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); }
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(); }
public ContentUsed(Content content, IContentAction <IContent> action) { Content = content; Action = action; }
public UninstallActionCompleted(IContentAction <IUninstallableContent> uninstallLocalContentAction, Game game) { UninstallLocalContentAction = uninstallLocalContentAction; Game = game; }
protected abstract Task UninstallImpl(IContentInstallationService contentInstallation, IContentAction <IUninstallableContent> action);
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; }
UnInstallContentAction GetUninstallAction(IContentAction <IUninstallableContent> action) => new UnInstallContentAction(this, action.Content, action.CancelToken) { Paths = ContentPaths };
protected override Task UninstallImpl(IContentInstallationService contentInstallation, IContentAction <IUninstallableContent> action) => contentInstallation.Uninstall(GetUninstallAction(action));
public void Use(IContentAction <IContent> action) { RecentInfo = new RecentInfo(); PrepareEvent(new ContentUsed(this, action)); }