@@ -27,13 +27,10 @@ public RedistUpdater(string managedDir, string redistPath, List<string> publiciz
2727 if ( managedFiles . Length == 0 )
2828 throw new InvalidOperationException ( $ "{ _managedDir } is empty") ;
2929
30- // If updateFiles is empty, process all files
31- // If updateFiles has items, only process those files
3230 var filesToProcess = _updateFiles . Count > 0
3331 ? managedFiles . Where ( f => _updateFiles . Contains ( f . Name ) ) . ToArray ( )
3432 : managedFiles ;
3533
36- // Only validate if updateFiles has items
3734 if ( _updateFiles . Count > 0 )
3835 {
3936 var existingFileNames = managedFiles . Select ( f => f . Name ) . ToHashSet ( ) ;
@@ -69,8 +66,30 @@ public RedistUpdater(string managedDir, string redistPath, List<string> publiciz
6966 }
7067 updatedFiles [ managedFilePath ] = redistFilePath ;
7168 }
69+
70+ var completeManifest = await CreateCompleteManifestAsync ( ) ;
7271 var manifestPath = Path . Combine ( _redistPath , "manifest.sha256.json" ) ;
73- await File . WriteAllTextAsync ( manifestPath , JsonSerializer . Serialize ( manifests , ManifestJsonSerializerOptions ) ) ;
72+ await File . WriteAllTextAsync ( manifestPath , JsonSerializer . Serialize ( completeManifest , ManifestJsonSerializerOptions ) ) ;
7473 return ( updatedFiles , manifests ) ;
7574 }
75+
76+ private Task < Dictionary < string , string > > CreateCompleteManifestAsync ( )
77+ {
78+ var completeManifest = new Dictionary < string , string > ( ) ;
79+ var redistDirectory = new DirectoryInfo ( _redistPath ) ;
80+
81+ // Only include files that are specified in updateFiles list
82+ // These are the files that can actually be updated from Unturned
83+ var relevantFiles = redistDirectory . GetFiles ( )
84+ . Where ( f => f . Name != "manifest.sha256.json" && _updateFiles . Contains ( f . Name ) )
85+ . ToArray ( ) ;
86+
87+ foreach ( var file in relevantFiles )
88+ {
89+ var fileHash = HashHelper . GetFileHash ( file . FullName ) ;
90+ completeManifest [ file . Name ] = fileHash ;
91+ }
92+
93+ return Task . FromResult ( completeManifest ) ;
94+ }
7695}
0 commit comments