Esempio n. 1
0
        static OpenVRConfig GetOpenVRConfig()
        {
            string jsonPath = Path.Combine(Environment.GetEnvironmentVariable("LocalAppData"), "openvr", "openvrpaths.vrpath");

            if (!File.Exists(jsonPath))
            {
                Console.WriteLine("Cannot find OpenVR Path File in " + jsonPath + ". Have you ever run SteamVR on this PC before?");
                return(null);
            }

            OpenVRConfig configData = JsonConvert.DeserializeObject <OpenVRConfig>(File.ReadAllText(jsonPath));

            if (configData.configPaths == null || configData.configPaths.Count == 0)
            {
                Console.WriteLine("Cannot find a config path entry in OpenVR Paths file.");
                return(null);
            }

            if (!automated || !didFindConfig)
            {
                Console.WriteLine("Found Config Path: " + configData.configPaths[0]);
            }

            didFindConfig = true;

            return(configData);
        }
Esempio n. 2
0
        static void CloseSteamVR()
        {
            Clear();

            OpenVRConfig config = GetOpenVRConfig();

            Console.WriteLine("Closing SteamVR... please wait");
            RunBatch("stopsteamvr.bat", config.runtimePaths[0]);

            if (!automated)
            {
                Console.WriteLine("Success, press enter to continue...");
                Console.ReadLine();
            }
        }
Esempio n. 3
0
        static void PrintDebug()
        {
            Clear();
            Console.WriteLine("LocalAppData: " + Environment.GetEnvironmentVariable("LocalAppData"));
            OpenVRConfig ovr = GetOpenVRConfig();

            if (ovr == null)
            {
                Console.WriteLine("OpenVR Path File: Not Found");
            }
            else
            {
                foreach (string s in ovr.configPaths)
                {
                    Console.WriteLine("OpenVR Config Path: " + s);
                }

                foreach (string s in ovr.logPaths)
                {
                    Console.WriteLine("OpenVR Log Path: " + s);
                }

                foreach (string s in ovr.runtimePaths)
                {
                    Console.WriteLine("OpenVR Runtime Path: " + s);
                }

                foreach (string s in ovr.externalDrivers)
                {
                    Console.WriteLine("OpenVR External Drivers: " + s);
                }
            }

            Console.WriteLine("========");
            Console.WriteLine("Press Enter to return to the main menu");
            Console.ReadLine();
        }
Esempio n. 4
0
        static void RestoreMenu()
        {
            Clear();

            string[] maps = Directory.GetFiles("maps", "*.rcfg");

            OpenVRConfig openVRConfig = GetOpenVRConfig();

            if (openVRConfig == null)
            {
                Console.WriteLine("OpenVR Data not found!");

                if (!automated)
                {
                    Console.WriteLine("Press Enter to return to the main menu");
                    Console.ReadLine();
                }
                else
                {
                    Environment.Exit(1);
                }

                return;
            }

            string chaperonePath    = GetChaperonePath(openVRConfig);
            string lighthouseDbPath = GetLighthousePath(openVRConfig);

            if (maps.Length == 0)
            {
                Console.WriteLine("No room setups found in the maps folder!");

                if (!automated)
                {
                    Console.WriteLine("Press Enter to return to the main menu");
                    Console.ReadLine();
                }
                else
                {
                    Exit(1);
                }

                return;
            }

            bool correct = false;

            while (!correct)
            {
                string filename = null;

                if (!automated)
                {
                    Console.WriteLine("The following maps have been found:");

                    int i = 1;

                    foreach (string m in maps)
                    {
                        Console.WriteLine(i + ") " + m.Substring(5, m.Length - 10));
                        i++;
                    }

                    Console.Write("Enter the number corresponding to the map you wish to restore on this PC: ");
                    string input = Console.ReadLine();

                    int inputInt;

                    if (!int.TryParse(input, out inputInt) || inputInt > maps.Length)
                    {
                        Console.WriteLine("Invalid input, please try again.");
                        continue;
                    }

                    inputInt--;

                    Console.Write("Map '" + maps[inputInt] + " selected, is this correct? (Y/N): ");

                    string confirmation = Console.ReadLine();

                    if (confirmation.Trim().ToLower() != "y")
                    {
                        continue;
                    }

                    Console.Write("WARNING: This will overwrite your existing room setup, are you sure you wish to proceed? (Y/N): ");
                    confirmation = Console.ReadLine();

                    if (confirmation.Trim().ToLower() != "y")
                    {
                        continue;
                    }

                    filename = maps[inputInt];
                }
                else
                {
                    filename = "maps/" + (loadFilename.ToLower().EndsWith(".rcfg") ? loadFilename : loadFilename + ".rcfg");
                }

                if (UnzipConfig(filename, chaperonePath, lighthouseDbPath))
                {
                    Console.WriteLine("Room Setup extracted successfully, your universes are now in-sync!");

                    if (!automated)
                    {
                        Console.WriteLine("Press enter to return to the main menu.");
                        Console.ReadLine();
                    }

                    return;
                }
                else
                {
                    Console.WriteLine("Failed to extract room setup");

                    if (!automated)
                    {
                        Console.WriteLine("Press Enter to return to the main menu.");
                        Console.ReadLine();
                    }
                    else
                    {
                        Environment.Exit(1);
                    }

                    return;
                }
            }
        }
Esempio n. 5
0
        static void SaveMenu()
        {
            Clear();
            OpenVRConfig openVRConfig = GetOpenVRConfig();

            if (openVRConfig == null)
            {
                Console.WriteLine("OpenVR Data not found!");

                if (!automated)
                {
                    Console.WriteLine("Press Enter to return to the main menu");
                    Console.ReadLine();
                }
                else
                {
                    Environment.Exit(1);
                }

                return;
            }

            string chaperonePath    = GetChaperonePath(openVRConfig);
            string lighthouseDbPath = GetLighthousePath(openVRConfig);

            bool validFilename = false;

            string filename = "";

            while (!validFilename)
            {
                if (automated)
                {
                    filename = saveFilename.ToLower().EndsWith(".rcfg") ? saveFilename : saveFilename + ".rcfg";
                }
                else
                {
                    Console.Write("Please enter a name for the saved room setup config: ");
                    filename = Console.ReadLine().Trim() + ".rcfg";

                    if (filename == ".rcfg")
                    {
                        Console.WriteLine("No filename provided, please try again.");
                        validFilename = false;
                        continue;
                    }
                }

                if (!automated)
                {
                    if (File.Exists(Path.Combine("maps", filename)))
                    {
                        Console.Write("The file maps/" + filename + " already exists, are you sure you wish to overwrite it? (Y/N): ");
                        string confirmation = Console.ReadLine();

                        if (confirmation.Trim().ToLower() == "y")
                        {
                            validFilename = true;
                        }
                    }
                    else
                    {
                        validFilename = true;
                    }
                }
                else
                {
                    validFilename = true;
                }
            }

            if (ZipConfig(Path.Combine("maps", filename), chaperonePath, lighthouseDbPath))
            {
                Console.WriteLine("Room Setup saved to " + "maps/" + filename);

                if (!automated)
                {
                    Console.WriteLine("Press Enter to return to the main menu");
                    Console.ReadLine();
                }

                return;
            }
            else
            {
                Console.WriteLine("Error saving room setup!");

                if (!automated)
                {
                    Console.WriteLine("Press Enter to return to the main menu");
                    Console.ReadLine();
                }
                else
                {
                    Exit(1);
                }

                return;
            }
        }
Esempio n. 6
0
 static string GetLighthousePath(OpenVRConfig config)
 {
     return(Path.Combine(config.configPaths[0], "lighthouse", LighthouseFilename));
 }
Esempio n. 7
0
 static string GetChaperonePath(OpenVRConfig config)
 {
     return(Path.Combine(config.configPaths[0], ChaperoneFilename));
 }