Updated manifest-to-text conversion to imitate Steam format

pull/195/head
NicknineTheEagle 5 years ago
parent 6b05a3e8cb
commit b3fb009a41

@ -907,21 +907,7 @@ namespace DepotDownloader
if (Config.DownloadManifestOnly)
{
StringBuilder manifestBuilder = new StringBuilder();
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)
{
if (file.Flags.HasFlag(EDepotFileFlag.Directory))
continue;
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());
DumpManifestToTextFile(depot, newProtoManifest);
return null;
}
@ -1295,5 +1281,48 @@ namespace DepotDownloader
}
}
static void DumpManifestToTextFile( DepotDownloadInfo depot, ProtoManifest manifest )
{
var txtManifest = Path.Combine( depot.installDir, $"manifest_{depot.id}_{depot.manifestId}.txt" );
using ( var sw = new StreamWriter( txtManifest ) )
{
sw.WriteLine( $"Content Manifest for Depot {depot.id}" );
sw.WriteLine();
sw.WriteLine( $"Manifest ID / date : {depot.manifestId} / {manifest.CreationTime}" );
int numFiles = 0, numChunks = 0;
ulong uncompressedSize = 0, compressedSize = 0;
foreach ( var file in manifest.Files )
{
if ( file.Flags.HasFlag( EDepotFileFlag.Directory ) )
continue;
numFiles++;
numChunks += file.Chunks.Count;
foreach ( var chunk in file.Chunks )
{
uncompressedSize += chunk.UncompressedLength;
compressedSize += chunk.CompressedLength;
}
}
sw.WriteLine( $"Total number of files : {numFiles}" );
sw.WriteLine( $"Total number of chunks : {numChunks}" );
sw.WriteLine( $"Total bytes on disk : {uncompressedSize}" );
sw.WriteLine( $"Total bytes compressed : {compressedSize}" );
sw.WriteLine();
sw.WriteLine( " Size Chunks File SHA Flags Name" );
foreach ( var file in manifest.Files )
{
var sha1Hash = BitConverter.ToString( file.FileHash ).Replace( "-", "" );
sw.WriteLine( $"{file.TotalSize,14} {file.Chunks.Count,6} {sha1Hash} {file.Flags,5:D} {file.FileName}" );
}
}
}
}
}

Loading…
Cancel
Save