Exemplo n.º 1
0
        public async Task <bool> Uninstall(ISteamApi api, IAbsoluteDirectoryPath workshopPath,
                                           CancellationToken cancelToken = default(CancellationToken))
        {
            ItemInstallInfo info = null;

            if (IsInstalled())
            {
                info = api.GetItemInstallInfo(Pid);
                MainLog.Logger.Debug($"IsInstalled! {info}");
            }

            var path = info?.GetLocation(IsLegacy()) ?? GetPath(workshopPath);

            if (IsSubscribed())
            {
                await api.UnsubscribeAndConfirm(Pid).ConfigureAwait(false);

                // We delete the path anyway, because Steam will normally wait until the program exits otherwise
                // and since we're a tool and not the game, we don't have to wait!
                path.DeleteIfExists(true);
                return(true);
            }
            path.DeleteIfExists(true);
            return(false);
        }
Exemplo n.º 2
0
        public async Task<bool> Uninstall(ISteamApi api, IAbsoluteDirectoryPath workshopPath,
            CancellationToken cancelToken = default(CancellationToken)) {
            ItemInstallInfo info = null;
            if (IsInstalled()) {
                info = api.GetItemInstallInfo(Pid);
                MainLog.Logger.Debug($"IsInstalled! {info}");
            }

            var path = info?.GetLocation(IsLegacy()) ?? GetPath(workshopPath);
            if (IsSubscribed()) {
                await api.UnsubscribeAndConfirm(Pid).ConfigureAwait(false);
                // We delete the path anyway, because Steam will normally wait until the program exits otherwise
                // and since we're a tool and not the game, we don't have to wait!
                path.DeleteIfExists(true);
                return true;
            }
            path.DeleteIfExists(true);
            return false;
        }