mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-05 14:26:06 +02:00
Random fixes
This commit is contained in:
@@ -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