static async Task DownloadWorkshopItem(Options opt) { if (string.IsNullOrEmpty(opt.TargetDirectory)) { Console.WriteLine("Error: Please specify a target directory."); Environment.Exit(101); } if (!opt.WorkshopFileId.HasValue) { Console.WriteLine("Error: Please specify a workshop item id."); Environment.Exit(102); } if (string.IsNullOrEmpty(opt.Branch)) { opt.Branch = "public"; //Console.WriteLine($"Warning: No branch was specified, using default branch = {opt.Branch}"); } Stopwatch sw = Stopwatch.StartNew(); try { SteamOs steamOs = new SteamOs(opt.OS); if (opt.SyncTargetDeleteEnabled) { if (!opt.ManifestId.HasValue) { opt.ManifestId = (await _steamContentClient.GetPublishedFileDetailsAsync(opt.WorkshopFileId.Value)).hcontent_file; } Manifest manifest = await _steamContentClient.GetManifestAsync(opt.AppId.Value, opt.AppId.Value, opt.ManifestId.Value); SyncDeleteRemovedFiles(opt, manifest); } Console.Write($"Attempting to start download of item {opt.WorkshopFileId.Value}... "); var downloadHandler = await _steamContentClient.GetPublishedFileDataAsync( opt.WorkshopFileId.Value, opt.ManifestId, opt.Branch, opt.BranchPassword, steamOs); await Download(downloadHandler, opt); } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}{(ex.InnerException != null ? $" Inner Exception: {ex.InnerException.Message}" : "")}"); Environment.Exit(110); } sw.Stop(); Console.WriteLine($"Download completed, it took {sw.Elapsed:hh\\:mm\\:ss}"); }
static async Task DownloadApp(Options opt) { if (string.IsNullOrEmpty(opt.TargetDirectory)) { Console.WriteLine("Error: Please specify a target directory."); Environment.Exit(201); } if (!opt.AppId.HasValue) { Console.WriteLine("Error: Please specify an app id."); Environment.Exit(202); } if (!opt.AppId.HasValue) { Console.WriteLine("Error: Please specify an app id."); Environment.Exit(202); } if (!opt.DepotId.HasValue) { Console.WriteLine("Error: Please specify a depot id."); Environment.Exit(203); } if (string.IsNullOrEmpty(opt.OS)) { opt.OS = _steamClient.GetSteamOs().Identifier; Console.WriteLine($"Warning: No OS was specified, defaulting to current OS = {opt.OS}"); } if (string.IsNullOrEmpty(opt.Branch)) { opt.Branch = "public"; Console.WriteLine($"Warning: No branch was specified, defaulting to branch = {opt.Branch}"); } Stopwatch sw = Stopwatch.StartNew(); try { SteamOs steamOs = new SteamOs(opt.OS); if (opt.SyncTargetDeleteEnabled) { if (!opt.ManifestId.HasValue) { opt.ManifestId = await _steamContentClient.GetDepotDefaultManifestIdAsync(opt.AppId.Value, opt.DepotId.Value, opt.Branch, opt.BranchPassword); } Manifest manifest = await _steamContentClient.GetManifestAsync(opt.AppId.Value, opt.DepotId.Value, opt.ManifestId.Value); SyncDeleteRemovedFiles(opt, manifest); } Console.Write($"Attempting to start download of app {opt.AppId.Value}, depot {opt.DepotId}... "); var downloadHandler = await _steamContentClient.GetAppDataAsync(opt.AppId.Value, opt.DepotId.Value, opt.ManifestId, opt.Branch, opt.BranchPassword, opt.OS); await Download(downloadHandler, opt); } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}{(ex.InnerException != null ? $" Inner Exception: {ex.InnerException.Message}" : "")}"); Environment.Exit(210); } sw.Stop(); Console.WriteLine($"Download completed, it took {sw.Elapsed:hh\\:mm\\:ss}"); }
public SteamOsNotSupportedByAppException(AppId appId, DepotId depotId, ManifestId manifestId, SteamOs targetOs, IEnumerable <string> availableOs) : base($"App id = {appId}, depot id = {depotId}, manifest id = {manifestId} only supports OS {string.Join(", ", availableOs)} but not {targetOs}") { }