Beispiel #1
0
        void DownloadSteamVRRuntime(SteamVRVersion ver, string name, SteamVRDepot depot)
        {
            var dir = string.Format("steamvr-{0}\\{1}", ver.Version, name);

            Console.WriteLine("Working on {0}", dir);
            var dl = new Downloadable();

            dl.AppId      = ver.AppId;
            dl.DepotId    = depot.DepotId;
            dl.ManifestId = depot.ManifestId;
            Download(dir, dl);
        }
Beispiel #2
0
 void Download(string dir, Downloadable dl)
 {
     if (!Started)
     {
         if (!Start())
         {
             return;
         }
     }
     ContentDownloader.Config.InstallDirectory = dir;
     ContentDownloader.Config.ManifestId       = dl.ManifestId;
     ContentDownloader.DownloadApp(dl.AppId, dl.DepotId, dl.Branch, dl.ForceDepot);
 }
Beispiel #3
0
        void GetSteamVRWin()
        {
            var steamvr = new SteamVR();
            var dl      = new Downloadable();

            dl.AppId   = steamvr.AppId;
            dl.DepotId = steamvr.Win32DepotId;

            foreach (var pair in steamvr.LegacyWindowsVersions)
            {
                Console.WriteLine("Working on {0}", pair.Key);
                var dir = string.Format("steamvr-win32-{0}", pair.Key);
                dl.ManifestId = pair.Value;
                Download(dir, dl);
            }
            Console.WriteLine("Shutting down...");
            Shutdown();
        }
Beispiel #4
0
        void DoGetSteamVRBranch(string branch = "Public")
        {
            var            steamvr = new SteamVR();
            SteamVRVersion ver;

            {
                /// Get the current version
                Console.WriteLine("Getting current release 'version number'");
                var dl = new Downloadable();
                dl.AppId   = steamvr.AppId;
                dl.DepotId = steamvr.ContentDepotId;
                dl.Branch  = branch;
                ContentDownloader.Config = new DownloadConfig();
                ContentDownloader.Config.FilesToDownload = new List <string>();
                ContentDownloader.Config.FilesToDownload.Add(steamvr.ContentDepotVersionPath);
                ContentDownloader.Config.UsingFileList = true;
                var dir = "steamvr-work";
                Download(dir, dl);
                var verString = File.ReadAllText(string.Format("{0}\\{1}", dir, steamvr.ContentDepotVersionPath)).Trim();
                Console.WriteLine("Current {1} SteamVR version is known as v{0}", verString, branch);

                ContentDownloader.Config.UsingFileList = false;
                ContentDownloader.Config.FilesToDownload.Clear();
                Console.WriteLine("Retrieving other metadata...");
                ver = SteamVR.PopulateVersion(branch, verString);
            }

            {
                var fn = string.Format("steamvr-{0}.xml", ver.Version);
                Console.WriteLine("Writing metadata to {0}...", fn);
                // Write out metadata file
                try
                {
                    FileStream    stream = new FileStream(fn, FileMode.CreateNew);
                    XmlSerializer ser    = new XmlSerializer(ver.GetType());
                    XmlTextWriter text   = new XmlTextWriter(stream, Encoding.UTF8);
                    ser.Serialize(text, ver);
                    stream.Close();
                }
                catch (IOException e)
                {
                    if (IsExceptionAlreadyExists(e))
                    {
                        Console.WriteLine("Metadata file {0} already exists, continuing...", fn);
                    }
                    else
                    {
                        Console.WriteLine("Warning: Metadata file could not be opened: {0}", e.ToString());
                    }
                }
                var branchFn = string.Format("steamvr-{0}.{1}.xml", ver.Version, branch);

                try
                {
                    File.Copy(fn, branchFn);
                }
                catch (IOException e)
                {
                    if (IsExceptionAlreadyExists(e))
                    {
                        Console.WriteLine("B ranch-specific filename copy ({0} to {1}) already exists, continuing...", fn, branchFn);
                    }
                    else
                    {
                        Console.WriteLine("Warning: Could not copy metadata file to branch-specific filename ({0} to {1}): {2}", fn, branchFn, e.ToString());
                    }
                }
            }

            ContentDownloader.Config.DownloadAllPlatforms = true;
            DownloadSteamVRRuntime(ver, "Win32", ver.Win32);
            DownloadSteamVRRuntime(ver, "OSX", ver.OSX);
            DownloadSteamVRRuntime(ver, "Linux", ver.Linux);
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                PrintUsage();
                return;
            }
            Program instance = new Program();

            DebugLog.Enabled = false;

            ConfigStore.LoadFromFile(Path.Combine(Environment.CurrentDirectory, "DepotDownloader.config"));

            instance.ParseOrPromptUserAndPassword(args);
            ParseGeneralContentDownloaderParams(args);
            ParseFileList(args);

            if (HasParameter(args, "-steamvrwin"))
            {
                instance.GetSteamVRWin();
                return;
            }
            if (HasParameter(args, "-steamvr"))
            {
                instance.GetSteamVR();
                return;
            }

            ContentDownloader.Config.DownloadManifestOnly = HasParameter(args, "-manifest-only");
            ContentDownloader.Config.BetaPassword         = GetParameter <string>(args, "-betapassword");

            var dir = GetParameter <string>(args, "-dir");


            var dl = new Downloadable();

            dl.AppId      = GetParameter <uint>(args, "-app", dl.AppId);
            dl.DepotId    = GetParameter <uint>(args, "-depot", dl.DepotId);
            dl.Branch     = GetBranch(args);
            dl.ManifestId = GetParameter <ulong>(args, "-manifest", dl.ManifestId);

            if (dl.AppId == ContentDownloader.INVALID_APP_ID)
            {
                Console.WriteLine("Error: -app not specified!");
                return;
            }

            if (dl.DepotId == ContentDownloader.INVALID_DEPOT_ID && dl.ManifestId != ContentDownloader.INVALID_MANIFEST_ID)
            {
                Console.WriteLine("Error: -manifest requires -depot to be specified");
                return;
            }

            dl.ForceDepot = HasParameter(args, "-force-depot");

            if (instance.Start())
            {
                instance.Download(dir, dl);
                instance.Shutdown();
            }
        }