Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
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);
        }