예제 #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);
        }
예제 #2
0
 async Task HandleSubscription(bool force, ISteamApi api) {
     var isSubscribed = IsSubscribed();
     if (force && isSubscribed) {
         await api.UnsubscribeAndConfirm(Pid).ConfigureAwait(false);
         isSubscribed = false;
     }
     if (!isSubscribed)
         await api.SubscribeAndConfirm(Pid).ConfigureAwait(false);
 }
예제 #3
0
        async Task HandleSubscription(bool force, ISteamApi api)
        {
            var isSubscribed = IsSubscribed();

            if (force && isSubscribed)
            {
                await api.UnsubscribeAndConfirm(Pid).ConfigureAwait(false);

                isSubscribed = false;
            }
            if (!isSubscribed)
            {
                await api.SubscribeAndConfirm(Pid).ConfigureAwait(false);
            }
        }
예제 #4
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;
        }