mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Random fixes
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user