mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-24 12:38:00 +03:00
GetFileDetailsAsync tweak
This commit is contained in:
parent
573bf39789
commit
5a780c4bc0
@ -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]
|
||||
|
@ -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" ) ) )
|
||||
|
@ -8,7 +8,6 @@ namespace Steamworks.Data
|
||||
{
|
||||
public struct FileDetails
|
||||
{
|
||||
public bool Found;
|
||||
public ulong SizeInBytes;
|
||||
public string Sha1;
|
||||
public uint Flags;
|
||||
|
Loading…
x
Reference in New Issue
Block a user