mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-20 07:34:25 +01:00
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:
parent
cfdff30189
commit
cf223c927c
15 changed files with 309 additions and 60 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue