Example #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);
        }
Example #2
0
 public async Task Uninstall(PublishedFile pf, ISteamApi api,
                             CancellationToken cancelToken = default(CancellationToken))
 {
     if (!await pf.Uninstall(api, Directories.Workshop.ContentPath, cancelToken).ConfigureAwait(false))
     {
         await HandleWorkshopItemMetadataRemoval(pf, cancelToken).ConfigureAwait(false);
     }
 }
 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);
 }
        public InstallCommand(ISteamSessionFactory factory, ISteamDownloader steamDownloader, ISteamApi steamApi)
            : base(factory) {
            _steamDownloader = steamDownloader;
            _steamApi = steamApi;

            IsCommand("install", "Install desired Steam PublishedFile(s) for the specified appid");
            HasFlag("f|force", "Force resubscription", f => Force = f);
            AllowsAnyAdditionalArguments("<publishedfileid> [<publishedfileid2> ...]");
        }
Example #5
0
 public async Task Download(ISteamDownloader steamDownloader, ISteamApi steamApi, PublishedFile pf,
                            Action <long?, double> action, CancellationToken cancelToken = default(CancellationToken), bool force = false)
 {
     if (force)
     {
         await HandleWorkshopItemMetadataRemoval(pf, cancelToken).ConfigureAwait(false);
     }
     await pf.Download(steamDownloader, steamApi, action, cancelToken, force).ConfigureAwait(false);
 }
Example #6
0
        public InstallCommand(ISteamSessionFactory factory, ISteamDownloader steamDownloader, ISteamApi steamApi)
            : base(factory)
        {
            _steamDownloader = steamDownloader;
            _steamApi        = steamApi;

            IsCommand("install", "Install desired Steam PublishedFile(s) for the specified appid");
            HasFlag("f|force", "Force resubscription", f => Force = f);
            AllowsAnyAdditionalArguments("<publishedfileid> [<publishedfileid2> ...]");
        }
        public async Task Download(ISteamDownloader dl, ISteamApi api, Action<long?, double> progressAction = null,
            CancellationToken cancelToken = default(CancellationToken), bool force = false) {
            if (!force && !RequiresDownloading()) {
                progressAction?.Invoke(null, 100);
                return;
            }

            await HandleSubscription(force, api).ConfigureAwait(false);
            await dl.Download(this, progressAction, cancelToken).ConfigureAwait(false);
        }
 public MatchesController(IPlayerRepository playerRepository, IDemoRepository demoRepository,
                          IStrapiApi strapiApi)
 {
     _playerRepository       = playerRepository;
     _demoRepository         = demoRepository;
     _steamApi               = new SteamApi();
     _strapiApi              = strapiApi;
     _mapInfos               = _strapiApi.GetAllMapInfos();
     _matchDummyCacheManager = new DummyCacheManager(new MatchDummyCacheFactory());
 }
Example #9
0
        public async Task Download(ISteamDownloader dl, ISteamApi api, Action <long?, double> progressAction = null,
                                   CancellationToken cancelToken = default(CancellationToken), bool force = false)
        {
            if (!force && !RequiresDownloading())
            {
                progressAction?.Invoke(null, 100);
                return;
            }

            await HandleSubscription(force, api).ConfigureAwait(false);

            await dl.Download(this, progressAction, cancelToken).ConfigureAwait(false);
        }
 public ReviewService(
     IReviewRepository reviewRepository,
     IGameListRepository gameListRepository,
     IGameRepository gameRepository,
     IUserService userService,
     ISteamApi steamApi
     )
 {
     _reviewRepository   = reviewRepository;
     _gameListRepository = gameListRepository;
     _gameRepository     = gameRepository;
     _gameRepository     = gameRepository;
     _userService        = userService;
     _steamApi           = steamApi;
 }
Example #11
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);
            }
        }
        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;
        }
 public GamesController(
     IGameService gameService,
     IUserService userService,
     IGenreService genreService,
     IPlatformService platformService,
     ISeriesService seriesService,
     ICompanyService companyService,
     IStatusService statusService,
     IImageService imageService,
     ILanguageService languageService,
     ITagService tagService,
     IImageTypeService imageTypeService,
     IArticleService articleService,
     IReviewService reviewService,
     IGameListService gameListService,
     IUserListService userListService,
     ISteamApi steamApi
     )
 {
     _gameService      = gameService;
     _userService      = userService;
     _genreService     = genreService;
     _platformService  = platformService;
     _seriesService    = seriesService;
     _companyService   = companyService;
     _statusService    = statusService;
     _imageService     = imageService;
     _languageService  = languageService;
     _tagService       = tagService;
     _imageTypeService = imageTypeService;
     _articleService   = articleService;
     _reviewService    = reviewService;
     _gameListService  = gameListService;
     _userListService  = userListService;
     _steamApi         = steamApi;
 }
Example #14
0
 public UninstallCommand(ISteamSessionFactory factory, ISteamApi steamApi) : base(factory)
 {
     _steamApi = steamApi;
     IsCommand("uninstall", "Uninstall desired Steam PublishedFile(s) for the specified appid");
     AllowsAnyAdditionalArguments("<publishedfileid> [<publishedfileid2> ...]");
 }
Example #15
0
 public SteamApiClient(ISteamApi api)
 {
     _api = api;
 }
Example #16
0
 public SteamDownloader(ISteamApi api)
 {
     _api = api;
 }
Example #17
0
 public HomeController(IPlayerRepository playerRepository)
 {
     _playerRepository = playerRepository;
     _steamApi         = new SteamApi();
 }
Example #18
0
 public ProtobufConverter(ISteamApi steamApi)
 {
     _steamApi = steamApi;
 }
Example #19
0
 public static async Task <ServerBrowser> CreateServerBrowser(ISteamApi steamApi)
 => new ServerBrowser(await steamApi.CreateMatchmakingServiceWrap().ConfigureAwait(false),
                      async ep =>
                      new ServerInfoRulesFetcher(ep, await steamApi.CreateRulesManagerWrap().ConfigureAwait(false),
                                                 await steamApi.CreateMatchmakingServiceWrap().ConfigureAwait(false)));
Example #20
0
 public async Task Uninstall(PublishedFile pf, ISteamApi api,
     CancellationToken cancelToken = default(CancellationToken)) {
     if (!await pf.Uninstall(api, Directories.Workshop.ContentPath, cancelToken).ConfigureAwait(false))
         await HandleWorkshopItemMetadataRemoval(pf, cancelToken).ConfigureAwait(false);
 }
Example #21
0
 public async Task Download(ISteamDownloader steamDownloader, ISteamApi steamApi, PublishedFile pf,
     Action<long?, double> action, CancellationToken cancelToken = default(CancellationToken), bool force = false) {
     if (force)
         await HandleWorkshopItemMetadataRemoval(pf, cancelToken).ConfigureAwait(false);
     await pf.Download(steamDownloader, steamApi, action, cancelToken, force).ConfigureAwait(false);
 }
 public UninstallCommand(ISteamSessionFactory factory, ISteamApi steamApi) : base(factory) {
     _steamApi = steamApi;
     IsCommand("uninstall", "Uninstall desired Steam PublishedFile(s) for the specified appid");
     AllowsAnyAdditionalArguments("<publishedfileid> [<publishedfileid2> ...]");
 }