GetFileDetailsAsync tweak

This commit is contained in:
Garry Newman 2019-04-16 21:57:55 +01:00
parent 573bf39789
commit 5a780c4bc0
3 changed files with 6 additions and 11 deletions

View File

@ -89,10 +89,9 @@ namespace Steamworks
{
var fileinfo = await SteamApps.GetFileDetailsAsync( "hl2.exe" );
Console.WriteLine( $"fileinfo.Found: {fileinfo.Found}" );
Console.WriteLine( $"fileinfo.SizeInBytes: {fileinfo.SizeInBytes}" );
Console.WriteLine( $"fileinfo.Sha1: {fileinfo.Sha1}" );
Console.WriteLine( $"fileinfo.Flags: {fileinfo.Flags}" );
Console.WriteLine( $"fileinfo.SizeInBytes: {fileinfo?.SizeInBytes}" );
Console.WriteLine( $"fileinfo.Sha1: {fileinfo?.Sha1}" );
Console.WriteLine( $"fileinfo.Flags: {fileinfo?.Flags}" );
}
[TestMethod]

View File

@ -235,18 +235,15 @@ namespace Steamworks
/// Asynchronously retrieves metadata details about a specific file in the depot manifest.
/// Currently provides:
/// </summary>
public static async Task<FileDetails> GetFileDetailsAsync( string filename )
public static async Task<FileDetails?> GetFileDetailsAsync( string filename )
{
var r = await Internal.GetFileDetails( filename );
if ( !r.HasValue )
{
throw new System.Exception( "Something went wrong" );
}
if ( !r.HasValue || r.Value.Result != Result.OK )
return null;
return new FileDetails
{
Found = r.Value.Result == Result.OK,
SizeInBytes = r.Value.FileSize,
Flags = r.Value.Flags,
Sha1 = string.Join( "", r.Value.FileSHA.Select( x => x.ToString( "x" ) ) )

View File

@ -8,7 +8,6 @@ namespace Steamworks.Data
{
public struct FileDetails
{
public bool Found;
public ulong SizeInBytes;
public string Sha1;
public uint Flags;