Try to fix actor redrawing stalling again, some fixes for collections not correctly reloading metadata or changing wrong collection. Added hidden debug tab that can be activated by /penumbra debug (and is active when compiled in debug mode by default).

This commit is contained in:
Ottermandias 2021-07-10 22:20:18 +02:00
parent cfdff30189
commit cf223c927c
15 changed files with 309 additions and 60 deletions

View file

@ -1,16 +1,17 @@
using System.IO;
using System.Linq;
namespace Penumbra.Util
{
public static class TempFile
{
public static FileInfo TempFileName( DirectoryInfo baseDir )
public static FileInfo TempFileName( DirectoryInfo baseDir, string suffix = "")
{
const uint maxTries = 15;
for( var i = 0; i < maxTries; ++i )
{
var name = Path.GetRandomFileName();
var path = new FileInfo( Path.Combine( baseDir.FullName, name ) );
var path = new FileInfo( Path.Combine( baseDir.FullName, suffix.Any() ? name.Substring( 0, name.LastIndexOf( '.' ) ) + suffix : name ) );
if( !path.Exists )
{
return path;
@ -20,9 +21,9 @@ namespace Penumbra.Util
throw new IOException();
}
public static FileInfo WriteNew( DirectoryInfo baseDir, byte[] data )
public static FileInfo WriteNew( DirectoryInfo baseDir, byte[] data, string suffix = "" )
{
var fileName = TempFileName( baseDir );
var fileName = TempFileName( baseDir, suffix );
File.WriteAllBytes( fileName.FullName, data );
fileName.Refresh();
return fileName;