Various manifest related improvements (#94)

* Changed saved manifest name format for better clarity
* Expanded manifest-to-text conversion
pull/115/head
NicknineTheEagle 6 years ago committed by GitHub
parent 05d6da9662
commit 4299c23bed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -654,7 +654,7 @@ namespace DepotDownloader
} }
else else
{ {
var newManifestFileName = Path.Combine( configDir, string.Format( "{0}.bin", depot.manifestId ) ); var newManifestFileName = Path.Combine( configDir, string.Format( "{0}_{1}.bin", depot.id, depot.manifestId ) );
if ( newManifestFileName != null ) if ( newManifestFileName != null )
{ {
byte[] expectedChecksum, currentChecksum; byte[] expectedChecksum, currentChecksum;
@ -738,10 +738,13 @@ namespace DepotDownloader
newProtoManifest.Files.Sort( ( x, y ) => string.Compare( x.FileName, y.FileName, StringComparison.Ordinal ) ); newProtoManifest.Files.Sort( ( x, y ) => string.Compare( x.FileName, y.FileName, StringComparison.Ordinal ) );
Console.WriteLine( "Manifest {0} ({1})", depot.manifestId, newProtoManifest.CreationTime );
if ( Config.DownloadManifestOnly ) if ( Config.DownloadManifestOnly )
{ {
StringBuilder manifestBuilder = new StringBuilder(); StringBuilder manifestBuilder = new StringBuilder();
string txtManifest = Path.Combine( depot.installDir, string.Format( "manifest_{0}.txt", depot.id ) ); string txtManifest = Path.Combine( depot.installDir, string.Format( "manifest_{0}_{1}.txt", depot.id, depot.manifestId ) );
manifestBuilder.Append( string.Format( "{0}\n\n", newProtoManifest.CreationTime ) );
foreach ( var file in newProtoManifest.Files ) foreach ( var file in newProtoManifest.Files )
{ {
@ -749,6 +752,8 @@ namespace DepotDownloader
continue; continue;
manifestBuilder.Append( string.Format( "{0}\n", file.FileName ) ); manifestBuilder.Append( string.Format( "{0}\n", file.FileName ) );
manifestBuilder.Append( string.Format( "\t{0}\n", file.TotalSize ) );
manifestBuilder.Append( string.Format( "\t{0}\n", BitConverter.ToString( file.FileHash ).Replace( "-", "" ) ) );
} }
File.WriteAllText( txtManifest, manifestBuilder.ToString() ); File.WriteAllText( txtManifest, manifestBuilder.ToString() );

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
@ -20,6 +21,7 @@ namespace DepotDownloader
{ {
sourceManifest.Files.ForEach(f => Files.Add(new FileData(f))); sourceManifest.Files.ForEach(f => Files.Add(new FileData(f)));
ID = id; ID = id;
CreationTime = sourceManifest.CreationTime;
} }
[ProtoContract()] [ProtoContract()]
@ -117,6 +119,9 @@ namespace DepotDownloader
[ProtoMember(2)] [ProtoMember(2)]
public ulong ID { get; private set; } public ulong ID { get; private set; }
[ProtoMember(3)]
public DateTime CreationTime { get; private set; }
public static ProtoManifest LoadFromFile(string filename, out byte[] checksum) public static ProtoManifest LoadFromFile(string filename, out byte[] checksum)
{ {
if (!File.Exists(filename)) if (!File.Exists(filename))

Loading…
Cancel
Save