Ejemplo 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);
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 4
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> ...]");
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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> ...]");
        }
Ejemplo n.º 7
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 MatchesController(IPlayerRepository playerRepository, IDemoRepository demoRepository,
                          IStrapiApi strapiApi)
 {
     _playerRepository       = playerRepository;
     _demoRepository         = demoRepository;
     _steamApi               = new SteamApi();
     _strapiApi              = strapiApi;
     _mapInfos               = _strapiApi.GetAllMapInfos();
     _matchDummyCacheManager = new DummyCacheManager(new MatchDummyCacheFactory());
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 10
0
 public ReviewService(
     IReviewRepository reviewRepository,
     IGameListRepository gameListRepository,
     IGameRepository gameRepository,
     IUserService userService,
     ISteamApi steamApi
     )
 {
     _reviewRepository   = reviewRepository;
     _gameListRepository = gameListRepository;
     _gameRepository     = gameRepository;
     _gameRepository     = gameRepository;
     _userService        = userService;
     _steamApi           = steamApi;
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 12
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;
        }
Ejemplo n.º 13
0
 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;
 }
Ejemplo n.º 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> ...]");
 }
Ejemplo n.º 15
0
 public SteamApiClient(ISteamApi api)
 {
     _api = api;
 }
Ejemplo n.º 16
0
 public SteamDownloader(ISteamApi api)
 {
     _api = api;
 }
Ejemplo n.º 17
0
 public HomeController(IPlayerRepository playerRepository)
 {
     _playerRepository = playerRepository;
     _steamApi         = new SteamApi();
 }
Ejemplo n.º 18
0
 public ProtobufConverter(ISteamApi steamApi)
 {
     _steamApi = steamApi;
 }
Ejemplo n.º 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)));
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 22
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> ...]");
 }