Random fixes

This commit is contained in:
Natsumi
2025-10-20 13:22:22 +11:00
parent b4cafe2f3d
commit 97ef396ec9
16 changed files with 79 additions and 22 deletions

View File

@@ -143,7 +143,7 @@ namespace VRCX
var output = new Dictionary<string, Dictionary<string, object>>();
using var regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\VRChat\VRChat");
if (regKey == null)
throw new Exception("Nothing to backup.");
throw new Exception("Failed to get VRC registry data");
var keys = regKey.GetValueNames();

View File

@@ -24,6 +24,26 @@ namespace VRCX
var fileName = Path.GetFileNameWithoutExtension(path);
if (!File.Exists(path) || !path.EndsWith(".png") || !fileName.StartsWith("VRChat_"))
return string.Empty;
// check if file is in use and we have permission to write
var success = false;
for (var i = 0; i < 10; i++)
{
try
{
using (File.Open(path, FileMode.Append, FileAccess.Write, FileShare.None))
{
success = true;
break;
}
}
catch (IOException)
{
Thread.Sleep(1000);
}
}
if (!success)
return string.Empty;
if (changeFilename)
{