@@ -96,7 +96,7 @@ private static async Task<int> Main(string[] args)
9696 var versionInfo = await versionTracker . LoadAsync ( ) ;
9797
9898 var redistUpdater = new RedistUpdater ( managedDirectory , redistPath ) ;
99- var updatedFiles = await redistUpdater . UpdateAsync ( ) ;
99+ var ( updatedFiles , manifests ) = await redistUpdater . UpdateAsync ( ) ;
100100 if ( updatedFiles . Count == 0 )
101101 {
102102 Console . WriteLine ( "No files were updated - either no changes or something went wrong." ) ;
@@ -109,22 +109,23 @@ private static async Task<int> Main(string[] args)
109109 return 1 ;
110110 }
111111 Console . WriteLine ( $ "{ updatedFiles . Count } Unturned's file(s) were updated") ;
112- var combinedHash = CreateCombinedHash ( updatedFiles ) ;
112+ var combinedHash = CreateCombinedHash ( manifests ) ;
113113 Console . WriteLine ( $ "Combined hash of updated files: { combinedHash } ") ;
114+ Console . WriteLine ( $ "Old Combined hash of updated files: { versionInfo ? . FilesHash } ") ;
114115 var versionToUse = DetermineVersionToUse ( newVersion , newBuildId , currentNuspecVersion , versionInfo , combinedHash , preview ) ;
115116 Console . WriteLine ( $ "New Version: { newVersion } ") ;
116117 Console . WriteLine ( $ "New Build Id: { newBuildId } ") ;
117118 Console . WriteLine ( $ "Version to use: { versionToUse } ") ;
118119 if ( versionToUse == currentNuspecVersion )
119120 {
120- Console . WriteLine ( "Files haven't changed since last publish, skipping.. ." ) ;
121+ Console . WriteLine ( "Skip. nuspec and version to use are same ." ) ;
121122 return 0 ;
122123 }
123124 await versionTracker . SaveAsync ( new VersionInfo
124125 {
125126 GameVersion = newVersion ,
126127 BuildId = newBuildId ,
127- NugetVersion = versionToUse ,
128+ NuGetVersion = versionToUse ,
128129 FilesHash = combinedHash ,
129130 LastUpdated = DateTime . UtcNow
130131 } ) ;
@@ -133,9 +134,12 @@ await versionTracker.SaveAsync(new VersionInfo
133134 nuspecHandler . Save ( ) ;
134135
135136 Console . WriteLine ( $ "Updated { updatedFiles . Count } File(s)") ;
136- foreach ( var ( filePath , sha256 ) in updatedFiles )
137+ foreach ( var ( fromPath , toPath ) in updatedFiles )
137138 {
138- Console . WriteLine ( $ "Updated File \" { filePath } \" (SHA256: { sha256 [ ..8 ] } ...)") ;
139+ var fileName = Path . GetFileName ( toPath ) ;
140+ if ( ! manifests . TryGetValue ( fileName , out var sha256 ) )
141+ continue ;
142+ Console . WriteLine ( $ "{ fileName } (SHA256: { sha256 [ ..8 ] } ...)") ;
139143 }
140144
141145 await new CommitFileWriter ( ) . WriteAsync ( unturnedPath , versionToUse , newBuildId , force ) ;
@@ -174,13 +178,13 @@ string GetUnturnedDataDirectoryName()
174178 }
175179 }
176180
177- private static string CreateCombinedHash ( Dictionary < string , string > updatedFiles )
181+ private static string CreateCombinedHash ( Dictionary < string , string > manifests )
178182 {
179- var sortedFiles = updatedFiles . OrderBy ( kvp => kvp . Key ) . ToList ( ) ;
183+ var sortedFiles = manifests . OrderBy ( kvp => kvp . Key ) . ToList ( ) ;
180184 var combinedData = new StringBuilder ( ) ;
181- foreach ( var ( filePath , fileHash ) in sortedFiles )
185+ foreach ( var ( fileName , fileHash ) in sortedFiles )
182186 {
183- combinedData . Append ( $ "{ Path . GetFileName ( filePath ) } :{ fileHash } ") ;
187+ combinedData . Append ( $ "{ fileName } :{ fileHash } ") ;
184188 }
185189 return Convert . ToHexString ( SHA256 . HashData ( Encoding . UTF8 . GetBytes ( combinedData . ToString ( ) ) ) ) ;
186190 }
0 commit comments