public override bool IsUpdateNeeded() { DepotConfigStore.LoadFromFile(Path.Combine(Game.Path, ".DepotDownloader", "depot.config")); if (DepotConfigStore.Instance.InstalledManifestIDs.TryGetValue(DepotId, out var installedManifest)) { if (IsPreObfuscation) { if (installedManifest == PreObfuscationManifest) { return(false); } } else { if (ContentDownloader.steam3 == null) { ContentDownloader.InitializeSteam3(); } ContentDownloader.steam3 !.RequestAppInfo(AppId); var depots = ContentDownloader.GetSteam3AppSection(AppId, EAppInfoSection.Depots); if (installedManifest == depots[DepotId.ToString()]["manifests"][ContentDownloader.DEFAULT_BRANCH].AsUnsignedLong()) { return(false); } } } return(true); }
internal ValidatorWindow(Mod Mod, bool DoValidate) { this.DoValidate = DoValidate; this.Mod = Mod; InitializeComponent(); if (LocCulture == "pt" || LocCulture == "el") { Button.FontSize = 12D; } if (LocCulture == "ar") { foreach (Panel Stack in ValidationBlock.Children) { Stack.FlowDirection = FlowDirection.RightToLeft; } } string Name = Mod.OriginID == 0UL ? Mod.Details.Status == 1 ? Mod.Details.Name : Mod.Name : Mod.OriginDetails.Status == 1 ? Mod.OriginDetails.Name : Mod.Name; if (Name.Length > 25) { Name = Name.Substring(0, 25); } TitleBlock.Text = Title = string.Format(LocString(LocCode.ModValidator), Name); ProgressBar.ProgressUpdated += ProgressUpdatedHandler; Downloader = new ContentDownloader(Mod.OriginID == 0UL ? 480U : 346110U, FinishHandler, SetStatus, ProgressBar); }
static bool InitializeSteam(string username, string password) { if (username != null && password == null && (!ContentDownloader.Config.RememberPassword || !AccountSettingsStore.Instance.LoginKeys.ContainsKey(username))) { do { Console.Write("Enter account password for \"{0}\": ", username); if (Console.IsInputRedirected) { password = Console.ReadLine(); } else { // Avoid console echoing of password password = Util.ReadPassword(); } Console.WriteLine(); } while (String.Empty == password); } else if (username == null) { Console.WriteLine("No username given. Using anonymous account with dedicated server subscription."); } // capture the supplied password in case we need to re-use it after checking the login key ContentDownloader.Config.SuppliedPassword = password; return(ContentDownloader.InitializeSteam3(username, password)); }
private async Task StartDownload(string targetFolder) { Console.WriteLine("Starting download..."); Globals.AppState.DownloadState.Downloading = true; Globals.AppState.DownloadState.DownloadPercentageComplete = 0; ContentDownloader.Config.InstallDirectory = targetFolder; ContentDownloader.Config.CellID = (int)Globals.SteamSession.Client.CellID; try { await ContentDownloader.DownloadAppAsync(Globals.AppState.SelectedApp.Id, Globals.AppState.SelectedDepot.Id, Globals.AppState.SelectedManifest.Id, downloadTaskCancellationSource.Token); } catch (OperationCanceledException) { // ignored } catch (Exception ex) { MessageBox.Show($"An error occured: {ex.Message}", "Download error"); } Globals.AppState.DownloadState.Downloading = false; Globals.AppState.DownloadState.DownloadPercentageComplete = 0; Globals.AppState.DownloadState.CancellingDownload = false; Globals.AppState.DownloadState.TotalBytes = 0; Globals.AppState.DownloadState.DownloadedBytes = 0; Globals.AppState.DownloadState.BytesPerSecond = 0; Console.WriteLine("Completed"); }
internal ModInstallerPage() { InitializeComponent(); if (LocCulture == "ar") { StatusStack.FlowDirection = SpacewarStack.FlowDirection = ARKStack.FlowDirection = FlowDirection.RightToLeft; } Downloader = new ContentDownloader(346110U, FinishHandler, SetStatus, ProgressBar); }
public override void Setup() { if (ContentDownloader.steam3 != null && ContentDownloader.steam3.bConnected) { return; } AccountSettingsStore.LoadFromFile("account.config"); var environmentVariable = Environment.GetEnvironmentVariable("STEAM"); if (environmentVariable != null) { var split = environmentVariable.Split(":"); if (!ContentDownloader.InitializeSteam3(split[0], split[1])) { throw new ProviderConnectionException(this, "Incorrect credentials."); } } else { ContentDownloader.Config.RememberPassword = true; Console.Write("Steam username: "******"Steam password: "******"Incorrect credentials."); } } if (ContentDownloader.steam3 == null || !ContentDownloader.steam3.bConnected) { throw new ProviderConnectionException(this, "Unable to initialize Steam3 session."); } ContentDownloader.Config.UsingFileList = true; ContentDownloader.Config.FilesToDownload = new List <string> { "GameAssembly.dll" }; ContentDownloader.Config.FilesToDownloadRegex = new List <Regex> { new Regex("^Among Us_Data/il2cpp_data/Metadata/global-metadata.dat$".Replace("/", "[\\\\|/]"), RegexOptions.Compiled | RegexOptions.IgnoreCase), new Regex("^Among Us_Data/globalgamemanagers$".Replace("/", "[\\\\|/]"), RegexOptions.Compiled | RegexOptions.IgnoreCase) }; }
public void CreateDownloadTask(string DownloadName, DownloadConfig Dc, bool AdvancedConfig, bool IsRestore) { DownloadProgressBar Dpb = new DownloadProgressBar(); Dc.OnReportProgressEvent += Dpb.OnDownloadProgress; Dc.OnDownloadFinishedEvent += Dpb.OnDownloadFinished; Dc.OnStateChangedEvent += Dpb.OnStateChanged; var TargetDownloader = new ContentDownloader(); Program.DownloaderInstances.Add(TargetDownloader); Dpb.RestartDownload += TargetDownloader.RestartDownload; Dpb.StopDownload += TargetDownloader.StopDownload; Dpb.CancelDownload += this.CancelDownload; Dpb.OnDownloadFinishedReport += this.OnDownloadFinished; Dpb.InitDownloading(DownloadName, Dc.AppID, Dc.DepotID, Dc.Branch); this.panelDownloading.Controls.Add(Dpb); RegroupDownloadProgressControl(); if (!IsRestore) { DownloadRecord Dr = new DownloadRecord(); Dr.AppID = Dc.AppID; Dr.DepotID = Dc.DepotID; Dr.BranchName = Dc.Branch; Dr.FileToDownload = AllowFileList; Dr.InstallDir = InstallDir; Dr.NoForceDepot = !Dc.ForceDepot; Dr.DownloadName = DownloadName; Dr.MaxDownload = Dc.MaxDownloads; Dr.MaxServer = Dc.MaxServers; Dr.AllPlatforms = Dc.DownloadAllPlatforms; Dr.AdvancedConfig = AdvancedConfig; Dr.ManifestID = Dc.ManifestId; if (Dc.FilesToDownloadRegex != null) { Dr.FileRegex = new List <string>(); foreach (System.Text.RegularExpressions.Regex Fileregex in Dc.FilesToDownloadRegex) { Dr.FileRegex.Add(Fileregex.ToString()); } } ConfigStore.TheConfig.DownloadRecord.Add(Dr); ConfigStore.Save(); } TargetDownloader.Config = Dc; if (!IsRestore) { TargetDownloader.RestartDownload(); } else { Dpb.Downloading = false; } }
static async Task Main(string[] args) { ContentDownloader.Config.RememberPassword = true; ContentDownloader.Config.DownloadAllLanguages = true; ContentDownloader.Config.DownloadAllPlatforms = true; ContentDownloader.Config.UsingFileList = true; ContentDownloader.Config.FilesToDownload = new List <string>(); ContentDownloader.Config.FilesToDownloadRegex = new List <Regex>(); ContentDownloader.Config.FilesToDownload.Add("GameAssembly.dll"); ContentDownloader.Config.InstallDirectory = "Download"; if (OperatingSystem.IsWindows()) { ContentDownloader.Config.FilesToDownload.Add("Among Us_Data\\il2cpp_data\\Metadata\\global-metadata.dat"); } else { ContentDownloader.Config.FilesToDownload.Add("Among Us_Data/il2cpp_data/Metadata/global-metadata.dat"); } ContentDownloader.Config.MaxServers = 20; ContentDownloader.Config.MaxDownloads = 8; ContentDownloader.Config.MaxServers = Math.Max(ContentDownloader.Config.MaxServers, ContentDownloader.Config.MaxDownloads); AccountSettingsStore.LoadFromFile("account.config"); if (DepotDownloader.Program.InitializeSteam(Settings.PSettings.SteamUsername, Settings.PSettings.SteamPassword)) { uint appID = 945360; uint DepotID = 945361; ContentDownloader.steam3.RequestAppInfo(appID); var LatestmanifestID = ContentDownloader.GetSteam3DepotManifest(DepotID, appID, "public"); if (LatestmanifestID != ulong.Parse(Settings.PSettings.latestManifestDownloaded)) //New update { List <(uint, ulong)> depotManifestIds = new List <(uint, ulong)>(); depotManifestIds.Add((DepotID, LatestmanifestID)); await ContentDownloader.DownloadAppAsync(appID, depotManifestIds, "public", null, null, null, false, false).ConfigureAwait(false); } AccountSettingsStore.Save(); string GameAssemblyPath = Path.Join(ContentDownloader.Config.InstallDirectory, ContentDownloader.Config.FilesToDownload[0]); string MetadataPath = Path.Join(ContentDownloader.Config.InstallDirectory, ContentDownloader.Config.FilesToDownload[1]); System.IO.Directory.CreateDirectory("Dumped"); Il2CppDumper.Il2CppDumper.PerformDump(GameAssemblyPath, MetadataPath, "Dumped\\", new Il2CppDumper.Config(), ReportProgressAction); ContentDownloader.ShutdownSteam3(); } Console.ReadKey(); }
private void ButtonGen_Click(object sender, EventArgs e) { string PendingExportStr = ""; PendingExportStr = "\"AppState\"\n{\n"; PendingExportStr += "\t\"appid\"\t\t\"" + this.mAppID.ToString() + "\"\n"; PendingExportStr += "\t\"Universe\"\t\t\"1\"\n"; PendingExportStr += "\t\"StateFlags\"\t\t\"4\"\n"; PendingExportStr += "\t\"installdir\"\t\t\"" + this.textBoxInstallDir.Text + "\"\n"; PendingExportStr += "\t\"LastUpdated\"\t\t\"" + ConvertDateTimeInt(DateTime.Now).ToString() + "\"\n"; PendingExportStr += "\t\"UpdateResult\"\t\t\"0\"\n"; PendingExportStr += "\t\"SizeOnDisk\"\t\t\"1\"\n"; PendingExportStr += "\t\"buildid\"\t\t\"1\"\n"; PendingExportStr += "\t\"BytesToDownload\"\t\t\"1\"\n"; PendingExportStr += "\t\"BytesDownloaded\"\t\t\"1\"\n"; PendingExportStr += "\t\"AutoUpdateBehavior\"\t\t\"1\"\n"; PendingExportStr += "\t\"AllowOtherDownloadsWhileRunning\"\t\t\"0\"\n"; PendingExportStr += "\t\"ScheduledAutoUpdate\"\t\t\"0\"\n"; PendingExportStr += "\t\"InstalledDepots\"\n\t{\n"; for (int i = 0; i < this.checkedListBoxDepots.Items.Count; i++) { if (this.checkedListBoxDepots.GetItemChecked(i)) { string Password = ""; PendingExportStr += "\t\t\"" + DepotList[i].ToString() + "\"\n\t\t{\n"; PendingExportStr += "\t\t\t\"manifest\"\t\t\"" + ContentDownloader.GetSteam3DepotManifestStatic(DepotList[i], mAppID, "public", ref Password) + "\"\n\t\t}\n"; } } PendingExportStr += "\t}\n\t\"MountedDepots\"\n\t{\n"; for (int i = 0; i < this.checkedListBoxDepots.Items.Count; i++) { if (this.checkedListBoxDepots.GetItemChecked(i)) { string Password = ""; PendingExportStr += "\t\t\"" + DepotList[i].ToString() + "\""; PendingExportStr += "\t\t\"" + ContentDownloader.GetSteam3DepotManifestStatic(DepotList[i], mAppID, "public", ref Password) + "\"\n"; } } PendingExportStr += "\t}\n}"; this.saveFileDialog1.FileName = "appmanifest_" + mAppID.ToString() + ".acf"; if (this.saveFileDialog1.ShowDialog() == DialogResult.OK) { System.IO.File.WriteAllText(this.saveFileDialog1.FileName, PendingExportStr); } }
static void Main(string[] args) { string videoName = null; if (args.Length != 0) { videoName = args[0]; } DiscoveryBeacon.Start(); string hmoServer = DiscoveryBeacon.GetServer(tivoName, TimeSpan.FromSeconds(65)); using (TivoConnection connection = new TivoConnection(hmoServer, mak)) { connection.Open(); var query = connection.CreateContainerQuery("/NowPlaying") .Recurse(); var container = query.Execute(); if (videoName == null) // no name, so just download the first video that can be downloaded { var video = (from v in container.TivoItems.OfType <TivoVideo>() where v.CustomIcon == null || v.CustomIcon.Uri.AbsoluteUri != "urn:tivo:image:in-progress-recording" select v).First(); connection.GetDownloader(video).DownloadFile("downloaded.tivo"); } else { ContentDownloader downloader = null; while (downloader == null) { var namedVideos = from video in container.TivoItems.OfType <TivoVideo>() where video.Name == videoName select video; if (namedVideos.Any()) { downloader = connection.GetDownloader(namedVideos.First()); } else { query = query.Skip(container.ItemStart + container.ItemCount); container = query.Execute(); } } downloader.DownloadFile("downloaded.tivo"); } } }
static void Main(string[] args) { TimeSpan startTimeSpan = TimeSpan.Zero; TimeSpan periodTimeSpan = TimeSpan.FromMinutes(15); NewContentChecker contentChecker = new NewContentChecker(); ContentDownloader contentDownloader = new ContentDownloader(); contentChecker.Attach(contentDownloader); var timer = new Timer((e) => { contentChecker.CheckNewContent(); }, null, startTimeSpan, periodTimeSpan); Console.ReadLine(); }
public async Task SetupAsync(bool setupSteam, bool setupItch) { var steam = setupSteam && Steam.Provider.IsUpdateNeeded(); var itch = setupItch && Itch.Provider.IsUpdateNeeded(); if (steam || itch) { ContentDownloader.ShutdownSteam3(); if (steam) { await Steam.DownloadAsync(); Console.WriteLine($"Downloaded {nameof(Steam)} ({Steam.Version})"); } if (itch) { await Itch.DownloadAsync(); Console.WriteLine($"Downloaded {nameof(Itch)} ({Itch.Version})"); } } ContentDownloader.ShutdownSteam3(); if (setupSteam) { Steam.UpdateVersion(); } if (setupItch) { Itch.UpdateVersion(); } if (setupSteam) { Steam.Dump(); } if (setupItch) { Itch.Dump(); } }
internal ModsFixerWindow(ModRecord[] Mods) { InitializeComponent(); if (LocCulture == "pt" || LocCulture == "el") { Button.FontSize = 12D; } if (LocCulture == "ar") { foreach (Panel Stack in ValidationBlock.Children) { Stack.FlowDirection = FlowDirection.RightToLeft; } } ProgressBar.ProgressUpdated += ProgressUpdatedHandler; Downloader = new ContentDownloader(480U, FinishHandler, SetStatus, ProgressBar); this.Mods = Mods; }
public const ulong ManifestId = 5200448423569257054; // 2021.3.5s public override async Task RunAsync(BuildContext context) { AccountSettingsStore.LoadFromFile("account.config"); var steam = context.EnvironmentVariable <string>("STEAM", null).Split(":"); context.Information("Logging into steam"); ContentDownloader.InitializeSteam3(steam[0], steam[1]); ContentDownloader.Config.InstallDirectory = context.AmongUsPath; context.Information("Downloading the game from steam"); await ContentDownloader.DownloadAppAsync(AppId, DepotId, ManifestId); ContentDownloader.ShutdownSteam3(); var bepinexZip = context.DownloadFile("https://github.com/NuclearPowered/BepInEx/releases/download/6.0.0-reactor.16/BepInEx-6.0.0-reactor.16.zip"); context.Unzip(bepinexZip, Path.Combine(context.AmongUsPath)); }
public SettingsPage() { InitializeComponent(); if (LocCulture == "es" || LocCulture == "fr" || LocCulture == "pt") { foreach (Panel Stack in LPGrid.Children) { foreach (CheckBox Checkbox in Stack.Children) { Checkbox.FontSize = 18D; } } } if (LocCulture == "fr" || LocCulture == "el") { foreach (Button Button in OptionsGrid.Children) { Button.FontSize = 16D; } } if (LocCulture == "ar") { StatusStack.FlowDirection = FlowDirection.RightToLeft; foreach (Panel Stack in ValidationBlock.Children) { Stack.FlowDirection = FlowDirection.RightToLeft; } } UseGlobalFonts.IsChecked = Settings.UseGlobalFonts; foreach (Panel Stack in LPGrid.Children) { foreach (CheckBox Checkbox in Stack.Children) { Checkbox.IsChecked = LaunchParameters.ParameterExists((string)Checkbox.Tag); Checkbox.Checked += CheckParameter; Checkbox.Unchecked += UncheckParameter; } } UpdateButton.Content = LocString(Settings.DowngradeMode ? LocCode.Downgrade : LocCode.Update); ProgressBar.ProgressUpdated += ProgressUpdatedHandler; Downloader = new Downloader(ProgressBar.Progress); SteamDownloader = new ContentDownloader(346111U, FinishHandler, SetStatus, ProgressBar); }
private void pictureAvatar_Click(object sender, EventArgs e) { if (ContentDownloader.Steam3 != null) { if (ContentDownloader.Steam3.IsConnected == false) { ContentDownloader.ShutdownSteam3(); (new Login()).ShowDialog(); return; } if (MessageBox.Show(Properties.Resources.LogoutQuestion, "SteamDepotDownloader-GUI", MessageBoxButtons.YesNo) == DialogResult.Yes) { ContentDownloader.ShutdownSteam3(); } } else { (new Login()).ShowDialog(); } }
private void ClosingHandler(object Sender, CancelEventArgs Args) { ContentDownloader Downloader = SettingsPage?.SteamDownloader; if ((Downloader?.IsValidating ?? false) || (Downloader?.IsDownloading ?? false) || (ModInstallerPage?.IsInstalling ?? false) || Current.Windows.OfType <ValidatorWindow>().Any()) { if (ShowOptions("Warning", LocString(LocCode.LauncherClosePrompt))) { Current.Shutdown(); } else { Args.Cancel = true; } } else if (!Update) { Current.Shutdown(); } }
public override bool IsUpdateNeeded() { try { DepotConfigStore.LoadFromFile(Path.Combine(Game.Path, ".DepotDownloader", "depot.config")); if (DepotConfigStore.Instance.InstalledManifestIDs.TryGetValue(DepotId, out var installedManifest)) { if (installedManifest == Manifest) { return(false); } } } finally { ContentDownloader.ShutdownSteam3(); } return(true); }
public static void Run(string[] id) { MongoCRUD db = new MongoCRUD("SportService_Database"); channel catalog1 = default; int number_of_rss = 8; for (int i = 0; i < number_of_rss; i++) { string path = AppDomain.CurrentDomain.BaseDirectory + "\\Updates\\Update__done_" + id[i] + ".xml"; string xml = File.ReadAllText(path); catalog1 = xml.ParseXML <channel>(); for (int j = 0; j < 50; j++) { catalog1.item[j].link = ContentDownloader.DownloadContent(catalog1.item[j].link); } // DeserializationTest(catalog1); var a = db.LoadRecord <ChanelMongoDatabesPatern>("channels"); bool IsRepeatability = false; foreach (var item in a) { if (item.title == catalog1.title) { IsRepeatability = true; } } if (IsRepeatability) { db.UpsertRecord("channels", catalog1.title, catalog1); } else { db.InsertRecord("channels", catalog1); } } }
internal ValidatorWindow(DLC DLC, bool DoValidate) { this.DoValidate = DoValidate; this.DLC = DLC; InitializeComponent(); if (LocCulture == "pt" || LocCulture == "el") { Button.FontSize = 12D; } if (LocCulture == "ar") { foreach (Panel Stack in ValidationBlock.Children) { Stack.FlowDirection = FlowDirection.RightToLeft; } } TitleBlock.Text = Title = string.Format(LocString(LocCode.DLCValidator), DLC.Name); ProgressBar.ProgressUpdated += ProgressUpdatedHandler; LastStatus = DLC.Status; DLC.SetStatus(ARK.Status.Updating); Downloader = new ContentDownloader(DLC.DepotID, FinishHandler, SetStatus, ProgressBar); }
public override async Task RunAsync(BuildContext context) { Console.WriteLine("Test"); AccountSettingsStore.LoadFromFile("account.config"); Console.WriteLine("Test"); var steam = context.EnvironmentVariable <string>("STEAM", null).Split(":"); Console.WriteLine("Test"); context.Information("Logging into steam"); ContentDownloader.InitializeSteam3(steam[0], steam[1]); ContentDownloader.Config.InstallDirectory = context.AmongUsPath; context.Information("Downloading the game from steam"); await ContentDownloader.DownloadAppAsync(AppId, DepotId); ContentDownloader.ShutdownSteam3(); var bepinexZip = context.DownloadFile("https://www.dropbox.com/s/3mjml7cexxbq2tp/BepInEx_UnityIL2CPP_x86_8f5bfe4_6.0.0-reactor.17.zip?dl=1"); context.Unzip(bepinexZip, Path.Combine(context.AmongUsPath)); }
public override Task DownloadAsync() { ContentDownloader.Config.InstallDirectory = Game.Path; return(ContentDownloader.DownloadAppAsync(AppId, DepotId, IsPreObfuscation ? PreObfuscationManifest : ContentDownloader.INVALID_MANIFEST_ID)); }
private async void FileSelector_LoadAsync(object sender, EventArgs e) { string Title = this.Text; string Password = ""; if(ManifestID==ContentDownloader.INVALID_MANIFEST_ID) ManifestID = ContentDownloader.GetSteam3DepotManifestStatic(DepotID, AppID, Branch,ref Password); if (ManifestID == ContentDownloader.INVALID_MANIFEST_ID) { MessageBox.Show(Properties.Resources.NoManifestID, "FileSelector", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } this.labelManifestID.Text = "ManifestID:" + ManifestID.ToString(); System.IO.Directory.CreateDirectory(Program.CacheDir); var localProtoManifest = DepotDownloader.ProtoManifest.LoadFromFile(string.Format("{0}/{1}.bin",Program.CacheDir, ManifestID)); if (localProtoManifest!=null) { depotManifest = localProtoManifest; } else { this.Text = "Downloading File List..."; this.Refresh(); ContentDownloader.Steam3.RequestDepotKey(DepotID,AppID); if(!ContentDownloader.Steam3.DepotKeys.ContainsKey(DepotID)) { MessageBox.Show(Properties.Resources.NoDepotKey, "FileSelector",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); //return; //User may still need to use FileRegex Close(); return; } byte[] depotKey = ContentDownloader.Steam3.DepotKeys[DepotID]; //ContentDownloader.Steam3.RequestAppTicket(AppID); ContentDownloader.Steam3.RequestAppTicket(DepotID); var client = await DepotDownloader.ContentDownloader.GlobalCDNPool.GetConnectionForDepotAsync(AppID, DepotID, depotKey, System.Threading.CancellationToken.None).ConfigureAwait(true); var SteamKitdepotManifest = await client.DownloadManifestAsync(DepotID, ManifestID).ConfigureAwait(true); if (SteamKitdepotManifest != null) { localProtoManifest = new ProtoManifest(SteamKitdepotManifest, ManifestID); localProtoManifest.SaveToFile(string.Format("{0}/{1}.bin", Program.CacheDir, ManifestID)); depotManifest = localProtoManifest; } } if(depotManifest!=null) { foreach (var file in localProtoManifest.Files) { //Process Dir var FilePathSplited = file.FileName.Split('\\'); List<string> FilePathList = new List<string>(FilePathSplited); TreeNode LastNode=null; TreeNodeCollection FileNodes = this.treeViewFileList.Nodes; while (FilePathList.Count != 0) { TreeNode TargetNode = null; foreach (TreeNode Tn in FileNodes) { if (Tn.Text == FilePathList[0]) { TargetNode = Tn; break; } } if (TargetNode == null) { LastNode = FileNodes.Add(FilePathList[0]); FileNodes = LastNode.Nodes; } else { FileNodes = TargetNode.Nodes; } FilePathList.RemoveAt(0); } if(file.Flags!=SteamKit2.EDepotFileFlag.Directory) { DepotMaxSize += file.TotalSize; //if(LastNode!=null) LastNode.Tag = file.TotalSize; } } float TargetSize = DepotMaxSize / 1024f; if(TargetSize<1024) { SizeDivisor = 1024f; UnitStr = "KB"; } else if(TargetSize/1024f<1024) { SizeDivisor = 1024 * 1024f; UnitStr = "MB"; } else { SizeDivisor = 1024 * 1024 * 1024f; UnitStr = "GB"; } this.labelSize.Text = string.Format("{0}{1}/{2}{1}", 0.ToString("#0.00"), UnitStr, (DepotMaxSize / SizeDivisor).ToString("#0.00")); } this.Text = Title; }
public override Task DownloadAsync() { ContentDownloader.Config.InstallDirectory = Game.Path; return(ContentDownloader.DownloadAppAsync(AppId, DepotId, Manifest)); }
private void SteamDepotDownloaderForm_FormClosed(object sender, FormClosedEventArgs e) { ContentDownloader.ShutdownSteam3(); Application.Exit(); }
public void Attach(ContentDownloader downloader) { OnNewContentUpdate += new StatusDownloadNewQuotes(downloader.DownloadNewQuotes); }
private async Task startDownloadBtn_ClickAsync() { string [] args = argsText.Text.Split(' '); try { AccountSettingsStore.LoadFromFile("account.config"); } catch (Exception er) { Console.WriteLine(er.Message); } string username = usernameText.Text; string password = passwordText.Text; ContentDownloader.Config.RememberPassword = HasParameter(args, "-remember-password"); ContentDownloader.Config.DownloadManifestOnly = HasParameter(args, "-manifest-only"); int cellId = GetParameter <int>(args, "-cellid", -1); if (cellId == -1) { cellId = 0; } ContentDownloader.Config.CellID = cellId; string fileList = GetParameter <string>(args, "-filelist"); string[] files = null; if (fileList != null) { try { string fileListData = File.ReadAllText(fileList); files = fileListData.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); ContentDownloader.Config.UsingFileList = true; ContentDownloader.Config.FilesToDownload = new List <string>(); ContentDownloader.Config.FilesToDownloadRegex = new List <Regex>(); var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); foreach (var fileEntry in files) { try { string fileEntryProcessed; if (isWindows) { // On Windows, ensure that forward slashes can match either forward or backslashes in depot paths fileEntryProcessed = fileEntry.Replace("/", "[\\\\|/]"); } else { // On other systems, treat / normally fileEntryProcessed = fileEntry; } Regex rgx = new Regex(fileEntryProcessed, RegexOptions.Compiled | RegexOptions.IgnoreCase); ContentDownloader.Config.FilesToDownloadRegex.Add(rgx); } catch { // For anything that can't be processed as a Regex, allow both forward and backward slashes to match // on Windows if (isWindows) { ContentDownloader.Config.FilesToDownload.Add(fileEntry.Replace("/", "\\")); } ContentDownloader.Config.FilesToDownload.Add(fileEntry); continue; } } Console.WriteLine("Using filelist: '{0}'.", fileList); } catch (Exception ex) { Console.WriteLine("Warning: Unable to load filelist: {0}", ex.ToString()); } } ContentDownloader.Config.InstallDirectory = GetParameter <string> (args, "-dir"); ContentDownloader.Config.VerifyAll = HasParameter(args, "-verify-all") || HasParameter(args, "-verify_all") || HasParameter(args, "-validate"); ContentDownloader.Config.MaxServers = GetParameter <int>(args, "-max-servers", 20); ContentDownloader.Config.MaxDownloads = GetParameter <int>(args, "-max-downloads", 8); ContentDownloader.Config.MaxServers = Math.Max(ContentDownloader.Config.MaxServers, ContentDownloader.Config.MaxDownloads); ContentDownloader.Config.LoginID = HasParameter(args, "-loginid") ? (uint?)GetParameter <uint>(args, "-loginid") : null; uint appId = GetParameter <uint>(args, "-app", ContentDownloader.INVALID_APP_ID); if (appId == ContentDownloader.INVALID_APP_ID) { Console.WriteLine("Error: -app not specified!"); } ulong pubFile = GetParameter <ulong>(args, "-pubfile", ContentDownloader.INVALID_MANIFEST_ID); ulong ugcId = GetParameter <ulong>(args, "-ugc", ContentDownloader.INVALID_MANIFEST_ID); if (pubFile != ContentDownloader.INVALID_MANIFEST_ID) { #region Pubfile Downloading if (InitializeSteam(username, password)) { try { await ContentDownloader.DownloadPubfileAsync(appId, pubFile).ConfigureAwait(false); } catch (Exception ex) when( ex is ContentDownloaderException || ex is OperationCanceledException) { Console.WriteLine(ex.Message); } catch (Exception er) { Console.WriteLine("Download failed to due to an unhandled exception: {0}", er.Message); throw; } finally { ContentDownloader.ShutdownSteam3(); } } else { Console.WriteLine("Error: InitializeSteam failed"); } #endregion } else if (ugcId != ContentDownloader.INVALID_MANIFEST_ID) { #region UGC Downloading if (InitializeSteam(username, password)) { try { await ContentDownloader.DownloadUGCAsync(appId, ugcId).ConfigureAwait(false); } catch (Exception ex) when( ex is ContentDownloaderException || ex is OperationCanceledException) { Console.WriteLine(ex.Message); } catch (Exception er) { Console.WriteLine("Download failed to due to an unhandled exception: {0}", er.Message); throw; } finally { ContentDownloader.ShutdownSteam3(); } } else { Console.WriteLine("Error: InitializeSteam failed"); } #endregion } else { #region App downloading string branch = GetParameter <string>(args, "-branch") ?? GetParameter <string>(args, "-beta") ?? ContentDownloader.DEFAULT_BRANCH; ContentDownloader.Config.BetaPassword = GetParameter <string>(args, "-betapassword"); ContentDownloader.Config.DownloadAllPlatforms = HasParameter(args, "-all-platforms"); string os = GetParameter <string>(args, "-os", null); if (ContentDownloader.Config.DownloadAllPlatforms && !String.IsNullOrEmpty(os)) { Console.WriteLine("Error: Cannot specify -os when -all-platforms is specified."); } string arch = GetParameter <string>(args, "-osarch", null); ContentDownloader.Config.DownloadAllLanguages = HasParameter(args, "-all-languages"); string language = GetParameter <string>(args, "-language", null); if (ContentDownloader.Config.DownloadAllLanguages && !String.IsNullOrEmpty(language)) { Console.WriteLine("Error: Cannot specify -language when -all-languages is specified."); } bool lv = HasParameter(args, "-lowviolence"); List <(uint, ulong)> depotManifestIds = new List <(uint, ulong)>(); bool isUGC = false; List <uint> depotIdList = GetParameterList <uint>(args, "-depot"); List <ulong> manifestIdList = GetParameterList <ulong>(args, "-manifest"); if (manifestIdList.Count > 0) { if (depotIdList.Count != manifestIdList.Count) { Console.WriteLine("Error: -manifest requires one id for every -depot specified"); } var zippedDepotManifest = depotIdList.Zip(manifestIdList, (depotId, manifestId) => (depotId, manifestId)); depotManifestIds.AddRange(zippedDepotManifest); } else { depotManifestIds.AddRange(depotIdList.Select(depotId => (depotId, ContentDownloader.INVALID_MANIFEST_ID))); } if (InitializeSteam(username, password)) { try { await ContentDownloader.DownloadAppAsync(appId, depotManifestIds, branch, os, arch, language, lv, isUGC).ConfigureAwait(false); } catch (Exception ex) when( ex is ContentDownloaderException || ex is OperationCanceledException) { Console.WriteLine(ex.Message); } catch (Exception er) { Console.WriteLine("Download failed to due to an unhandled exception: {0}", er.Message); throw; } finally { ContentDownloader.ShutdownSteam3(); } } else { Console.WriteLine("Error: InitializeSteam failed"); } } }
public async Task SetupAsync(bool setupSteam, bool setupItch) { var preObfuscation = PreObfuscation.Provider.IsUpdateNeeded(); var steam = setupSteam && Steam.Provider.IsUpdateNeeded(); var itch = setupItch && Itch.Provider.IsUpdateNeeded(); if (preObfuscation || steam || itch) { ContentDownloader.ShutdownSteam3(); if (preObfuscation) { await PreObfuscation.DownloadAsync(); Console.WriteLine($"Downloaded {nameof(PreObfuscation)} ({PreObfuscation.Version})"); } if (steam) { await Steam.DownloadAsync(); Console.WriteLine($"Downloaded {nameof(Steam)} ({Steam.Version})"); } if (itch) { await Itch.DownloadAsync(); Console.WriteLine($"Downloaded {nameof(Itch)} ({Itch.Version})"); } } ContentDownloader.ShutdownSteam3(); PreObfuscation.UpdateVersion(); if (setupSteam) { Steam.UpdateVersion(); } if (setupItch) { Itch.UpdateVersion(); } if (PreObfuscation.Version != "2020.9.9") { throw new ArgumentException("Pre obfuscation version is invalid"); } PreObfuscation.Dump(); if (setupSteam) { Steam.Dump(); } if (setupItch) { Itch.Dump(); } }