diff --git a/Facepunch.Steamworks/Client/RemoteStorage.File.cs b/Facepunch.Steamworks/Client/RemoteStorage.File.cs index 80851d5..4b32f59 100644 --- a/Facepunch.Steamworks/Client/RemoteStorage.File.cs +++ b/Facepunch.Steamworks/Client/RemoteStorage.File.cs @@ -290,7 +290,7 @@ namespace Facepunch.Steamworks if ( !remoteStorage.native.FileDelete( FileName ) ) return false; Exists = false; - remoteStorage.InvalidateFiles(); + remoteStorage.FileDeleted( this ); return true; } diff --git a/Facepunch.Steamworks/Client/RemoteStorage.cs b/Facepunch.Steamworks/Client/RemoteStorage.cs index 45bd274..cbb1a2a 100644 --- a/Facepunch.Steamworks/Client/RemoteStorage.cs +++ b/Facepunch.Steamworks/Client/RemoteStorage.cs @@ -76,8 +76,6 @@ namespace Facepunch.Steamworks public RemoteFile CreateFile( string path ) { path = NormalizePath( path ); - - InvalidateFiles(); var existing = Files.FirstOrDefault( x => x.FileName == path ); return existing ?? new RemoteFile( this, path, client.SteamId, -1 ); } @@ -88,8 +86,6 @@ namespace Facepunch.Steamworks public RemoteFile OpenFile( string path ) { path = NormalizePath( path ); - - InvalidateFiles(); var existing = Files.FirstOrDefault( x => x.FileName == path ); return existing; } @@ -163,8 +159,6 @@ namespace Facepunch.Steamworks _files.Add( file ); file.Exists = true; - - InvalidateFiles(); } internal void InvalidateFiles() @@ -172,6 +166,11 @@ namespace Facepunch.Steamworks _filesInvalid = true; } + internal void FileDeleted( RemoteFile file ) + { + _files.Remove( file ); + } + private void UpdateFiles() { if ( !_filesInvalid ) return;