diff --git a/Dotnet/AppApi/Cef/AppApiCef.cs b/Dotnet/AppApi/Cef/AppApiCef.cs index 49ec8729..4986b26b 100644 --- a/Dotnet/AppApi/Cef/AppApiCef.cs +++ b/Dotnet/AppApi/Cef/AppApiCef.cs @@ -116,7 +116,7 @@ namespace VRCX { StartInfo = new ProcessStartInfo { - FileName = Path.Combine(Program.BaseDirectory, "VRCX.exe"), + FileName = Path.Join(Program.BaseDirectory, "VRCX.exe"), Arguments = string.Join(' ', args), UseShellExecute = true, WorkingDirectory = Program.BaseDirectory @@ -128,7 +128,7 @@ namespace VRCX public override bool CheckForUpdateExe() { - return File.Exists(Path.Combine(Program.AppDataDirectory, "update.exe")); + return File.Exists(Path.Join(Program.AppDataDirectory, "update.exe")); } public override void ExecuteAppFunction(string function, string json) diff --git a/Dotnet/AppApi/Cef/AppApiVr.cs b/Dotnet/AppApi/Cef/AppApiVr.cs index 7adfc950..0b0eebc3 100644 --- a/Dotnet/AppApi/Cef/AppApiVr.cs +++ b/Dotnet/AppApi/Cef/AppApiVr.cs @@ -75,7 +75,7 @@ namespace VRCX public string CustomVrScriptPath() { var output = string.Empty; - var filePath = Path.Combine(Program.AppDataDirectory, "customvr.js"); + var filePath = Path.Join(Program.AppDataDirectory, "customvr.js"); if (File.Exists(filePath)) output = filePath; return output; diff --git a/Dotnet/AppApi/Cef/Folders.cs b/Dotnet/AppApi/Cef/Folders.cs index cf9cbe76..4fc76970 100644 --- a/Dotnet/AppApi/Cef/Folders.cs +++ b/Dotnet/AppApi/Cef/Folders.cs @@ -35,7 +35,7 @@ namespace VRCX } } - return Path.Combine(GetVRChatAppDataLocation(), "Cache-WindowsPlayer"); + return Path.Join(GetVRChatAppDataLocation(), "Cache-WindowsPlayer"); } public override string GetVRChatPhotosLocation() @@ -54,7 +54,7 @@ namespace VRCX } } - return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "VRChat"); + return Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "VRChat"); } public override string GetUGCPhotoLocation(string path = "") @@ -81,7 +81,7 @@ namespace VRCX private string GetSteamUserdataPathFromRegistry() { - string steamUserdataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @"Steam\userdata"); + string steamUserdataPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @"Steam\userdata"); try { @@ -92,7 +92,7 @@ namespace VRCX object o = key.GetValue("InstallPath"); if (o != null) { - steamUserdataPath = Path.Combine(o.ToString(), @"userdata"); + steamUserdataPath = Path.Join(o.ToString(), @"userdata"); } } } @@ -117,7 +117,7 @@ namespace VRCX var steamUserDirs = Directory.GetDirectories(steamUserdataPath); foreach (var steamUserDir in steamUserDirs) { - var screenshotDir = Path.Combine(steamUserDir, @"760\remote\438100\screenshots"); + var screenshotDir = Path.Join(steamUserDir, @"760\remote\438100\screenshots"); if (!Directory.Exists(screenshotDir)) continue; @@ -184,7 +184,7 @@ namespace VRCX public override bool OpenCrashVrcCrashDumps() { - var path = Path.Combine(Path.GetTempPath(), "VRChat", "VRChat", "Crashes"); + var path = Path.Join(Path.GetTempPath(), "VRChat", "VRChat", "Crashes"); if (!Directory.Exists(path)) return false; diff --git a/Dotnet/AppApi/Cef/GameHandler.cs b/Dotnet/AppApi/Cef/GameHandler.cs index 1e62fa0f..7b8f4b4a 100644 --- a/Dotnet/AppApi/Cef/GameHandler.cs +++ b/Dotnet/AppApi/Cef/GameHandler.cs @@ -30,7 +30,7 @@ namespace VRCX if (Wine.GetIfWine()) { - var wineTmpPath = Path.Combine(Program.AppDataDirectory, "wine.tmp"); + var wineTmpPath = Path.Join(Program.AppDataDirectory, "wine.tmp"); if (File.Exists(wineTmpPath)) { var wineTmp = File.ReadAllText(wineTmpPath); @@ -122,7 +122,7 @@ namespace VRCX public override bool StartGameFromPath(string path, string arguments) { if (!path.EndsWith(".exe")) - path = Path.Combine(path, "launch.exe"); + path = Path.Join(path, "launch.exe"); if (!path.EndsWith("launch.exe") || !File.Exists(path)) return false; diff --git a/Dotnet/AppApi/Cef/Screenshot.cs b/Dotnet/AppApi/Cef/Screenshot.cs index f3a5531e..d3e55021 100644 --- a/Dotnet/AppApi/Cef/Screenshot.cs +++ b/Dotnet/AppApi/Cef/Screenshot.cs @@ -28,7 +28,7 @@ namespace VRCX if (changeFilename) { var newFileName = $"{fileName}_{worldId}"; - var newPath = Path.Combine(Path.GetDirectoryName(path), newFileName + Path.GetExtension(path)); + var newPath = Path.Join(Path.GetDirectoryName(path), newFileName + Path.GetExtension(path)); File.Move(path, newPath); path = newPath; } diff --git a/Dotnet/AppApi/Common/AppApiCommon.cs b/Dotnet/AppApi/Common/AppApiCommon.cs index 12e98a20..8c2f0298 100644 --- a/Dotnet/AppApi/Common/AppApiCommon.cs +++ b/Dotnet/AppApi/Common/AppApiCommon.cs @@ -83,7 +83,7 @@ namespace VRCX public string CustomCssPath() { var output = string.Empty; - var filePath = Path.Combine(Program.AppDataDirectory, "custom.css"); + var filePath = Path.Join(Program.AppDataDirectory, "custom.css"); if (File.Exists(filePath)) output = filePath; return output; @@ -92,7 +92,7 @@ namespace VRCX public string CustomScriptPath() { var output = string.Empty; - var filePath = Path.Combine(Program.AppDataDirectory, "custom.js"); + var filePath = Path.Join(Program.AppDataDirectory, "custom.js"); if (File.Exists(filePath)) output = filePath; return output; diff --git a/Dotnet/AppApi/Common/ImageSaving.cs b/Dotnet/AppApi/Common/ImageSaving.cs index 9ed42e5a..29d2e6b7 100644 --- a/Dotnet/AppApi/Common/ImageSaving.cs +++ b/Dotnet/AppApi/Common/ImageSaving.cs @@ -171,7 +171,7 @@ namespace VRCX public async Task CropAllPrints(string ugcFolderPath) { - var folder = Path.Combine(GetUGCPhotoLocation(ugcFolderPath), "Prints"); + var folder = Path.Join(GetUGCPhotoLocation(ugcFolderPath), "Prints"); var files = Directory.GetFiles(folder, "*.png", SearchOption.AllDirectories); foreach (var file in files) { @@ -210,9 +210,9 @@ namespace VRCX public async Task SavePrintToFile(string url, string ugcFolderPath, string monthFolder, string fileName) { - var folder = Path.Combine(GetUGCPhotoLocation(ugcFolderPath), "Prints", MakeValidFileName(monthFolder)); + var folder = Path.Join(GetUGCPhotoLocation(ugcFolderPath), "Prints", MakeValidFileName(monthFolder)); Directory.CreateDirectory(folder); - var filePath = Path.Combine(folder, MakeValidFileName(fileName)); + var filePath = Path.Join(folder, MakeValidFileName(fileName)); if (File.Exists(filePath)) return null; @@ -223,9 +223,9 @@ namespace VRCX public async Task SaveStickerToFile(string url, string ugcFolderPath, string monthFolder, string fileName) { - var folder = Path.Combine(GetUGCPhotoLocation(ugcFolderPath), "Stickers", MakeValidFileName(monthFolder)); + var folder = Path.Join(GetUGCPhotoLocation(ugcFolderPath), "Stickers", MakeValidFileName(monthFolder)); Directory.CreateDirectory(folder); - var filePath = Path.Combine(folder, MakeValidFileName(fileName)); + var filePath = Path.Join(folder, MakeValidFileName(fileName)); if (File.Exists(filePath)) return null; diff --git a/Dotnet/AppApi/Common/LocalPlayerModerations.cs b/Dotnet/AppApi/Common/LocalPlayerModerations.cs index 71f2681b..de753192 100644 --- a/Dotnet/AppApi/Common/LocalPlayerModerations.cs +++ b/Dotnet/AppApi/Common/LocalPlayerModerations.cs @@ -12,7 +12,7 @@ namespace VRCX { // 004 = hideAvatar // 005 = showAvatar - var filePath = Path.Combine(GetVRChatAppDataLocation(), @$"LocalPlayerModerations\{currentUserId}-show-hide-user.vrcset"); + var filePath = Path.Join(GetVRChatAppDataLocation(), @$"LocalPlayerModerations\{currentUserId}-show-hide-user.vrcset"); if (!File.Exists(filePath)) return null; @@ -35,7 +35,7 @@ namespace VRCX public short GetVRChatUserModeration(string currentUserId, string userId) { - var filePath = Path.Combine(GetVRChatAppDataLocation(), @$"LocalPlayerModerations\{currentUserId}-show-hide-user.vrcset"); + var filePath = Path.Join(GetVRChatAppDataLocation(), @$"LocalPlayerModerations\{currentUserId}-show-hide-user.vrcset"); if (!File.Exists(filePath)) return 0; @@ -58,7 +58,7 @@ namespace VRCX public bool SetVRChatUserModeration(string currentUserId, string userId, int type) { - var filePath = Path.Combine(GetVRChatAppDataLocation(), @$"LocalPlayerModerations\{currentUserId}-show-hide-user.vrcset"); + var filePath = Path.Join(GetVRChatAppDataLocation(), @$"LocalPlayerModerations\{currentUserId}-show-hide-user.vrcset"); if (!File.Exists(filePath)) return false; diff --git a/Dotnet/AppApi/Common/VrcConfigFile.cs b/Dotnet/AppApi/Common/VrcConfigFile.cs index 8cd61b2b..86b92730 100644 --- a/Dotnet/AppApi/Common/VrcConfigFile.cs +++ b/Dotnet/AppApi/Common/VrcConfigFile.cs @@ -8,7 +8,7 @@ namespace VRCX public string ReadConfigFile() { var path = GetVRChatAppDataLocation(); - var configFile = Path.Combine(path, "config.json"); + var configFile = Path.Join(path, "config.json"); if (!Directory.Exists(path) || !File.Exists(configFile)) { return string.Empty; @@ -21,7 +21,7 @@ namespace VRCX public void WriteConfigFile(string json) { var path = GetVRChatAppDataLocation(); - var configFile = Path.Combine(path, "config.json"); + var configFile = Path.Join(path, "config.json"); File.WriteAllText(configFile, json); } } diff --git a/Dotnet/AppApi/Electron/Folders.cs b/Dotnet/AppApi/Electron/Folders.cs index 4a1ba3f3..c8ddb8f5 100644 --- a/Dotnet/AppApi/Electron/Folders.cs +++ b/Dotnet/AppApi/Electron/Folders.cs @@ -24,16 +24,16 @@ namespace VRCX { const string vrchatAppid = "438100"; _homeDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); - _steamPath = Path.Combine(_homeDirectory, ".local/share/Steam"); - var flatpakSteamPath = Path.Combine(_homeDirectory, ".var/app/com.valvesoftware.Steam/.local/share/Steam"); + _steamPath = Path.Join(_homeDirectory, ".local/share/Steam"); + var flatpakSteamPath = Path.Join(_homeDirectory, ".var/app/com.valvesoftware.Steam/.local/share/Steam"); if (!Directory.Exists(_steamPath) && Directory.Exists(flatpakSteamPath)) { logger.Info("Flatpak Steam detected."); _steamPath = flatpakSteamPath; } - _steamUserdataPath = Path.Combine(_homeDirectory, ".steam/steam/userdata"); + _steamUserdataPath = Path.Join(_homeDirectory, ".steam/steam/userdata"); - var libraryFoldersVdfPath = Path.Combine(_steamPath, "config/libraryfolders.vdf"); + var libraryFoldersVdfPath = Path.Join(_steamPath, "config/libraryfolders.vdf"); var vrcLibraryPath = GetLibraryWithAppId(libraryFoldersVdfPath, vrchatAppid); if (string.IsNullOrEmpty(vrcLibraryPath)) { @@ -41,8 +41,8 @@ namespace VRCX vrcLibraryPath = _steamPath; } logger.Info($"Using steam library path {vrcLibraryPath}"); - _vrcPrefixPath = Path.Combine(vrcLibraryPath, $"steamapps/compatdata/{vrchatAppid}/pfx"); - _vrcAppDataPath = Path.Combine(_vrcPrefixPath, "drive_c/users/steamuser/AppData/LocalLow/VRChat/VRChat"); + _vrcPrefixPath = Path.Join(vrcLibraryPath, $"steamapps/compatdata/{vrchatAppid}/pfx"); + _vrcAppDataPath = Path.Join(_vrcPrefixPath, "drive_c/users/steamuser/AppData/LocalLow/VRChat/VRChat"); } private static string? GetLibraryWithAppId(string libraryFoldersVdfPath, string appId) @@ -91,12 +91,12 @@ namespace VRCX } } - return Path.Combine(GetVRChatAppDataLocation(), "Cache-WindowsPlayer"); + return Path.Join(GetVRChatAppDataLocation(), "Cache-WindowsPlayer"); } public override string GetVRChatPhotosLocation() { - return Path.Combine(_vrcPrefixPath, "drive_c/users/steamuser/Pictures/VRChat"); + return Path.Join(_vrcPrefixPath, "drive_c/users/steamuser/Pictures/VRChat"); } public override string GetUGCPhotoLocation(string path = "") @@ -138,7 +138,7 @@ namespace VRCX public override string GetVRChatScreenshotsLocation() { // program files steam userdata screenshots - return Path.Combine(_steamUserdataPath, "760/remote/438100/screenshots"); + return Path.Join(_steamUserdataPath, "760/remote/438100/screenshots"); } public override bool OpenVrcxAppDataFolder() diff --git a/Dotnet/AppApi/Electron/GameHandler.cs b/Dotnet/AppApi/Electron/GameHandler.cs index b06a5be4..22ae8d9a 100644 --- a/Dotnet/AppApi/Electron/GameHandler.cs +++ b/Dotnet/AppApi/Electron/GameHandler.cs @@ -79,7 +79,7 @@ namespace VRCX return false; } - var steamExecutable = Path.Combine(steamPath, "steam.sh"); + var steamExecutable = Path.Join(steamPath, "steam.sh"); if (!File.Exists(steamExecutable)) { logger.Error("Steam executable not found."); @@ -105,7 +105,7 @@ namespace VRCX public override bool StartGameFromPath(string path, string arguments) { if (!path.EndsWith(".exe")) - path = Path.Combine(path, "launch.exe"); + path = Path.Join(path, "launch.exe"); if (!path.EndsWith("launch.exe") || !File.Exists(path)) return false; diff --git a/Dotnet/AppApi/Electron/RegistryPlayerPrefs.cs b/Dotnet/AppApi/Electron/RegistryPlayerPrefs.cs index 0639d914..ec13111a 100644 --- a/Dotnet/AppApi/Electron/RegistryPlayerPrefs.cs +++ b/Dotnet/AppApi/Electron/RegistryPlayerPrefs.cs @@ -85,7 +85,7 @@ namespace VRCX private static string GetSteamVdfCompatTool() { string steamPath = _steamPath; - string configVdfPath = Path.Combine(steamPath, "config", "config.vdf"); + string configVdfPath = Path.Join(steamPath, "config", "config.vdf"); if (!File.Exists(configVdfPath)) { logger.Error("config.vdf not found"); @@ -240,14 +240,14 @@ namespace VRCX } string steamPath = _steamPath; - string steamAppsCommonPath = Path.Combine(steamPath, "steamapps", "common"); - string compatabilityToolsPath = Path.Combine(steamPath, "compatibilitytools.d"); - string protonPath = Path.Combine(steamAppsCommonPath, compatTool); - string compatToolPath = Path.Combine(compatabilityToolsPath, compatTool); + string steamAppsCommonPath = Path.Join(steamPath, "steamapps", "common"); + string compatabilityToolsPath = Path.Join(steamPath, "compatibilitytools.d"); + string protonPath = Path.Join(steamAppsCommonPath, compatTool); + string compatToolPath = Path.Join(compatabilityToolsPath, compatTool); string winePath = ""; if (Directory.Exists(compatToolPath)) { - winePath = Path.Combine(compatToolPath, "files", "bin", "wine"); + winePath = Path.Join(compatToolPath, "files", "bin", "wine"); if (!File.Exists(winePath)) { Console.WriteLine("Wine not found in CompatTool path"); @@ -256,7 +256,7 @@ namespace VRCX } else if (Directory.Exists(protonPath)) { - winePath = Path.Combine(protonPath, "dist", "bin", "wine"); + winePath = Path.Join(protonPath, "dist", "bin", "wine"); if (!File.Exists(winePath)) { logger.Error("Wine not found in Proton path"); @@ -270,7 +270,7 @@ namespace VRCX { if (dir.Contains(compatTool)) { - winePath = Path.Combine(dir, "files", "bin", "wine"); + winePath = Path.Join(dir, "files", "bin", "wine"); if (File.Exists(winePath)) { break; @@ -338,7 +338,7 @@ namespace VRCX private string GetWineRegCommandEx(string regCommand) { string winePrefix = _vrcPrefixPath; - string filePath = Path.Combine(winePrefix, "user.reg"); + string filePath = Path.Join(winePrefix, "user.reg"); if (!File.Exists(filePath)) throw new FileNotFoundException($"Registry file not found at {filePath}"); diff --git a/Dotnet/AppApi/Electron/Screenshot.cs b/Dotnet/AppApi/Electron/Screenshot.cs index 29def813..a5087b54 100644 --- a/Dotnet/AppApi/Electron/Screenshot.cs +++ b/Dotnet/AppApi/Electron/Screenshot.cs @@ -16,7 +16,7 @@ namespace VRCX { var winePrefix = Path.Join(_vrcPrefixPath, "drive_c"); var winePath = path.Substring(3).Replace("\\", "/"); - path = Path.Combine(winePrefix, winePath); + path = Path.Join(winePrefix, winePath); var fileName = Path.GetFileNameWithoutExtension(path); if (!File.Exists(path) || !path.EndsWith(".png") || !fileName.StartsWith("VRChat_")) @@ -25,7 +25,7 @@ namespace VRCX if (changeFilename) { var newFileName = $"{fileName}_{worldId}"; - var newPath = Path.Combine(Path.GetDirectoryName(path), newFileName + Path.GetExtension(path)); + var newPath = Path.Join(Path.GetDirectoryName(path), newFileName + Path.GetExtension(path)); File.Move(path, newPath); path = newPath; } diff --git a/Dotnet/AssetBundleManager.cs b/Dotnet/AssetBundleManager.cs index 48f7b6f5..8213c147 100644 --- a/Dotnet/AssetBundleManager.cs +++ b/Dotnet/AssetBundleManager.cs @@ -102,16 +102,16 @@ namespace VRCX { var cachePath = GetVRChatCacheLocation(); var idHash = GetAssetId(id, variant); - var topDir = Path.Combine(cachePath, idHash); + var topDir = Path.Join(cachePath, idHash); var versionLocation = GetAssetVersion(version, variantVersion); if (!Directory.Exists(topDir)) - return Path.Combine(topDir, versionLocation); + return Path.Join(topDir, versionLocation); var versionSearchPattern = string.Concat("*", versionLocation.AsSpan(8)); var dirs = Directory.GetDirectories(topDir, versionSearchPattern); if (dirs.Length > 0) return dirs.OrderByDescending(dir => ReverseHexToDecimal(Path.GetFileName(dir)).Item2).First(); - return Path.Combine(topDir, versionLocation); + return Path.Join(topDir, versionLocation); } /// @@ -130,7 +130,7 @@ namespace VRCX if (!Directory.Exists(fullLocation)) fullLocation = GetVRChatCacheFullLocation(id, version, variant, variantVersion); - var fileLocation = Path.Combine(fullLocation, "__data"); + var fileLocation = Path.Join(fullLocation, "__data"); var cachePath = string.Empty; if (File.Exists(fileLocation)) { @@ -138,7 +138,7 @@ namespace VRCX FileInfo data = new FileInfo(fileLocation); fileSize = data.Length; } - if (File.Exists(Path.Combine(fullLocation, "__lock"))) + if (File.Exists(Path.Join(fullLocation, "__lock"))) { isLocked = true; } @@ -204,7 +204,7 @@ namespace VRCX if (index == versionDirectories.Length - 1) continue; // skip last version - if (File.Exists(Path.Combine(versionDirectory.FullName, "__lock"))) + if (File.Exists(Path.Join(versionDirectory.FullName, "__lock"))) continue; // skip locked version versionDirectory.Delete(true); diff --git a/Dotnet/AutoAppLaunchManager.cs b/Dotnet/AutoAppLaunchManager.cs index 00fa7681..595c9354 100644 --- a/Dotnet/AutoAppLaunchManager.cs +++ b/Dotnet/AutoAppLaunchManager.cs @@ -64,7 +64,7 @@ namespace VRCX public AutoAppLaunchManager() { - AppShortcutDirectory = Path.Combine(Program.AppDataDirectory, "startup"); + AppShortcutDirectory = Path.Join(Program.AppDataDirectory, "startup"); if (!Directory.Exists(AppShortcutDirectory)) { diff --git a/Dotnet/Cef/CefService.cs b/Dotnet/Cef/CefService.cs index a2fee14e..7c211ace 100644 --- a/Dotnet/Cef/CefService.cs +++ b/Dotnet/Cef/CefService.cs @@ -19,11 +19,11 @@ namespace VRCX internal void Init() { - var userDataDir = Path.Combine(Program.AppDataDirectory, "userdata"); + var userDataDir = Path.Join(Program.AppDataDirectory, "userdata"); var cefSettings = new CefSettings { RootCachePath = userDataDir, - CachePath = Path.Combine(userDataDir, "cache"), + CachePath = Path.Join(userDataDir, "cache"), LogSeverity = LogSeverity.Disable, WindowlessRenderingEnabled = true, PersistSessionCookies = true, @@ -37,7 +37,7 @@ namespace VRCX SchemeName = "file", DomainName = "vrcx", SchemeHandlerFactory = new FolderSchemeHandlerFactory( - Path.Combine(Program.BaseDirectory, "html"), + Path.Join(Program.BaseDirectory, "html"), "file", defaultPage: "index.html" ), diff --git a/Dotnet/Cef/SubProcess.cs b/Dotnet/Cef/SubProcess.cs index 516f1713..827744c0 100644 --- a/Dotnet/Cef/SubProcess.cs +++ b/Dotnet/Cef/SubProcess.cs @@ -31,10 +31,10 @@ public class BrowserSubprocess return; } - var browserSubprocessDllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CefSharp.BrowserSubprocess.Core.dll"); + var browserSubprocessDllPath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "CefSharp.BrowserSubprocess.Core.dll"); if (!File.Exists(browserSubprocessDllPath)) { - browserSubprocessDllPath = Path.Combine(Path.GetDirectoryName(typeof(CefSharp.Core.BrowserSettings).Assembly.Location), "CefSharp.BrowserSubprocess.Core.dll"); + browserSubprocessDllPath = Path.Join(Path.GetDirectoryName(typeof(CefSharp.Core.BrowserSettings).Assembly.Location), "CefSharp.BrowserSubprocess.Core.dll"); } var browserSubprocessDll = System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(browserSubprocessDllPath); var browserSubprocessExecutableType = browserSubprocessDll.GetType("CefSharp.BrowserSubprocess.BrowserSubprocessExecutable"); diff --git a/Dotnet/ImageCache.cs b/Dotnet/ImageCache.cs index 72930201..26e4b903 100644 --- a/Dotnet/ImageCache.cs +++ b/Dotnet/ImageCache.cs @@ -22,7 +22,7 @@ internal static class ImageCache static ImageCache() { - cacheLocation = Path.Combine(Program.AppDataDirectory, "ImageCache"); + cacheLocation = Path.Join(Program.AppDataDirectory, "ImageCache"); var httpClientHandler = new HttpClientHandler(); if (WebApi.ProxySet) httpClientHandler.Proxy = WebApi.Proxy; @@ -33,8 +33,8 @@ internal static class ImageCache public static async Task GetImage(string url, string fileId, string version) { - var directoryLocation = Path.Combine(cacheLocation, fileId); - var fileLocation = Path.Combine(directoryLocation, $"{version}.png"); + var directoryLocation = Path.Join(cacheLocation, fileId); + var fileLocation = Path.Join(directoryLocation, $"{version}.png"); if (File.Exists(fileLocation)) { diff --git a/Dotnet/Overlay/VRCXVR.cs b/Dotnet/Overlay/VRCXVR.cs index 33b53071..31b2e956 100644 --- a/Dotnet/Overlay/VRCXVR.cs +++ b/Dotnet/Overlay/VRCXVR.cs @@ -561,7 +561,7 @@ namespace VRCX return err; } - var iconPath = Path.Combine(Program.BaseDirectory, "VRCX.png"); + var iconPath = Path.Join(Program.BaseDirectory, "VRCX.png"); err = overlay.SetOverlayFromFile(thumbnailHandle, iconPath); if (err != EVROverlayError.None) { diff --git a/Dotnet/Overlay/VRCXVRLegacy.cs b/Dotnet/Overlay/VRCXVRLegacy.cs index 996cb4b2..d2067d03 100644 --- a/Dotnet/Overlay/VRCXVRLegacy.cs +++ b/Dotnet/Overlay/VRCXVRLegacy.cs @@ -489,7 +489,7 @@ namespace VRCX return err; } - var iconPath = Path.Combine(Program.BaseDirectory, "VRCX.png"); + var iconPath = Path.Join(Program.BaseDirectory, "VRCX.png"); err = overlay.SetOverlayFromFile(thumbnailHandle, iconPath); if (err != EVROverlayError.None) { diff --git a/Dotnet/Overlay/VRForm.cs b/Dotnet/Overlay/VRForm.cs index e49d4ff6..b65c567e 100644 --- a/Dotnet/Overlay/VRForm.cs +++ b/Dotnet/Overlay/VRForm.cs @@ -22,7 +22,7 @@ namespace VRCX InitializeComponent(); _browser1 = new ChromiumWebBrowser( - Path.Combine(Program.BaseDirectory, "html/vr.html?1") + Path.Join(Program.BaseDirectory, "html/vr.html?1") ) { DragHandler = new CefNoopDragHandler(), @@ -34,7 +34,7 @@ namespace VRCX }; _browser2 = new ChromiumWebBrowser( - Path.Combine(Program.BaseDirectory, "html/vr.html?2") + Path.Join(Program.BaseDirectory, "html/vr.html?2") ) { DragHandler = new CefNoopDragHandler(), diff --git a/Dotnet/PWI/WorldDBManager.cs b/Dotnet/PWI/WorldDBManager.cs index 937a4883..d08536ec 100644 --- a/Dotnet/PWI/WorldDBManager.cs +++ b/Dotnet/PWI/WorldDBManager.cs @@ -34,7 +34,7 @@ namespace VRCX listener = new HttpListener(); listener.Prefixes.Add(WorldDBServerUrl); - worldDB = new WorldDatabase(Path.Combine(Program.AppDataDirectory, "VRCX-WorldData.db")); + worldDB = new WorldDatabase(Path.Join(Program.AppDataDirectory, "VRCX-WorldData.db")); } public void Init() diff --git a/Dotnet/Program.cs b/Dotnet/Program.cs index 488422f1..ba611328 100644 --- a/Dotnet/Program.cs +++ b/Dotnet/Program.cs @@ -30,39 +30,39 @@ namespace VRCX private static void SetProgramDirectories() { if (string.IsNullOrEmpty(AppDataDirectory)) - AppDataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + AppDataDirectory = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "VRCX"); BaseDirectory = AppDomain.CurrentDomain.BaseDirectory; - ConfigLocation = Path.Combine(AppDataDirectory, "VRCX.sqlite3"); + ConfigLocation = Path.Join(AppDataDirectory, "VRCX.sqlite3"); if (!Directory.Exists(AppDataDirectory)) { Directory.CreateDirectory(AppDataDirectory); // Migrate config to AppData - if (File.Exists(Path.Combine(BaseDirectory, "VRCX.json"))) + if (File.Exists(Path.Join(BaseDirectory, "VRCX.json"))) { - File.Move(Path.Combine(BaseDirectory, "VRCX.json"), Path.Combine(AppDataDirectory, "VRCX.json")); - File.Copy(Path.Combine(AppDataDirectory, "VRCX.json"), - Path.Combine(AppDataDirectory, "VRCX-backup.json")); + File.Move(Path.Join(BaseDirectory, "VRCX.json"), Path.Join(AppDataDirectory, "VRCX.json")); + File.Copy(Path.Join(AppDataDirectory, "VRCX.json"), + Path.Join(AppDataDirectory, "VRCX-backup.json")); } - if (File.Exists(Path.Combine(BaseDirectory, "VRCX.sqlite3"))) + if (File.Exists(Path.Join(BaseDirectory, "VRCX.sqlite3"))) { - File.Move(Path.Combine(BaseDirectory, "VRCX.sqlite3"), - Path.Combine(AppDataDirectory, "VRCX.sqlite3")); - File.Copy(Path.Combine(AppDataDirectory, "VRCX.sqlite3"), - Path.Combine(AppDataDirectory, "VRCX-backup.sqlite3")); + File.Move(Path.Join(BaseDirectory, "VRCX.sqlite3"), + Path.Join(AppDataDirectory, "VRCX.sqlite3")); + File.Copy(Path.Join(AppDataDirectory, "VRCX.sqlite3"), + Path.Join(AppDataDirectory, "VRCX-backup.sqlite3")); } } // Migrate cache to userdata for Cef 115 update - var oldCachePath = Path.Combine(AppDataDirectory, "cache"); - var newCachePath = Path.Combine(AppDataDirectory, "userdata", "cache"); + var oldCachePath = Path.Join(AppDataDirectory, "cache"); + var newCachePath = Path.Join(AppDataDirectory, "userdata", "cache"); if (Directory.Exists(oldCachePath) && !Directory.Exists(newCachePath)) { - Directory.CreateDirectory(Path.Combine(AppDataDirectory, "userdata")); + Directory.CreateDirectory(Path.Join(AppDataDirectory, "userdata")); Directory.Move(oldCachePath, newCachePath); } } @@ -73,7 +73,7 @@ namespace VRCX try { - Version = $"{buildName} {File.ReadAllText(Path.Combine(BaseDirectory, "Version"))}"; + Version = $"{buildName} {File.ReadAllText(Path.Join(BaseDirectory, "Version"))}"; } catch (Exception) { @@ -89,12 +89,12 @@ namespace VRCX { var fileTarget = new FileTarget("fileTarget") { - FileName = Path.Combine(AppDataDirectory, "logs", "VRCX.log"), + FileName = Path.Join(AppDataDirectory, "logs", "VRCX.log"), //Layout = "${longdate} [${level:uppercase=true}] ${logger} - ${message} ${exception:format=tostring}", // Layout with padding between the level/logger and message so that the message always starts at the same column Layout = "${longdate} [${level:uppercase=true:padding=-5}] ${logger:padding=-20} - ${message} ${exception:format=tostring}", - ArchiveFileName = Path.Combine(AppDataDirectory, "logs", "VRCX.{#}.log"), + ArchiveFileName = Path.Join(AppDataDirectory, "logs", "VRCX.{#}.log"), ArchiveNumbering = ArchiveNumberingMode.DateAndSequence, ArchiveEvery = FileArchivePeriod.Day, MaxArchiveFiles = 4, diff --git a/Dotnet/ScreenshotMetadata/ScreenshotHelper.cs b/Dotnet/ScreenshotMetadata/ScreenshotHelper.cs index b8fff74f..4827a781 100644 --- a/Dotnet/ScreenshotMetadata/ScreenshotHelper.cs +++ b/Dotnet/ScreenshotMetadata/ScreenshotHelper.cs @@ -14,7 +14,7 @@ namespace VRCX internal static class ScreenshotHelper { private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - private static readonly ScreenshotMetadataDatabase cacheDatabase = new ScreenshotMetadataDatabase(Path.Combine(Program.AppDataDirectory, "metadataCache.db")); + private static readonly ScreenshotMetadataDatabase cacheDatabase = new ScreenshotMetadataDatabase(Path.Join(Program.AppDataDirectory, "metadataCache.db")); private static readonly Dictionary metadataCache = new Dictionary(); public enum ScreenshotSearchType diff --git a/Dotnet/Update.cs b/Dotnet/Update.cs index 54db1435..7bf45cfa 100644 --- a/Dotnet/Update.cs +++ b/Dotnet/Update.cs @@ -23,10 +23,10 @@ namespace VRCX public class Update { private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - private static readonly string VrcxSetupExecutable = Path.Combine(Program.AppDataDirectory, "VRCX_Setup.exe"); - private static readonly string UpdateExecutable = Path.Combine(Program.AppDataDirectory, "update.exe"); - private static readonly string TempDownload = Path.Combine(Program.AppDataDirectory, "tempDownload"); - private static readonly string HashLocation = Path.Combine(Program.AppDataDirectory, "sha256sum.txt"); + private static readonly string VrcxSetupExecutable = Path.Join(Program.AppDataDirectory, "VRCX_Setup.exe"); + private static readonly string UpdateExecutable = Path.Join(Program.AppDataDirectory, "update.exe"); + private static readonly string TempDownload = Path.Join(Program.AppDataDirectory, "tempDownload"); + private static readonly string HashLocation = Path.Join(Program.AppDataDirectory, "sha256sum.txt"); private static readonly HttpClient httpClient; private static CancellationToken _cancellationToken; public static int UpdateProgress; @@ -138,9 +138,9 @@ namespace VRCX throw new Exception($"Failed to download the file. Status code: {response.StatusCode}"); var fileName = GetFileNameFromContentDisposition(response); - var tempPath = Path.Combine(Path.GetTempPath(), "VRCX"); + var tempPath = Path.Join(Path.GetTempPath(), "VRCX"); Directory.CreateDirectory(tempPath); - var filePath = Path.Combine(tempPath, fileName); + var filePath = Path.Join(tempPath, fileName); await using var fileStream = File.Create(filePath); await response.Content.CopyToAsync(fileStream, cancellationToken); return filePath; diff --git a/Dotnet/VRCXStorage.cs b/Dotnet/VRCXStorage.cs index 46c3c5c9..0b5da997 100644 --- a/Dotnet/VRCXStorage.cs +++ b/Dotnet/VRCXStorage.cs @@ -17,7 +17,7 @@ namespace VRCX public static readonly VRCXStorage Instance; private static readonly ReaderWriterLockSlim m_Lock = new ReaderWriterLockSlim(); private static Dictionary m_Storage = new Dictionary(); - private static readonly string m_JsonPath = Path.Combine(Program.AppDataDirectory, "VRCX.json"); + private static readonly string m_JsonPath = Path.Join(Program.AppDataDirectory, "VRCX.json"); private static bool m_Dirty; static VRCXStorage()