mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-24 20:48:03 +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" );
|
var fileinfo = await SteamApps.GetFileDetailsAsync( "hl2.exe" );
|
||||||
|
|
||||||
Console.WriteLine( $"fileinfo.Found: {fileinfo.Found}" );
|
Console.WriteLine( $"fileinfo.SizeInBytes: {fileinfo?.SizeInBytes}" );
|
||||||
Console.WriteLine( $"fileinfo.SizeInBytes: {fileinfo.SizeInBytes}" );
|
Console.WriteLine( $"fileinfo.Sha1: {fileinfo?.Sha1}" );
|
||||||
Console.WriteLine( $"fileinfo.Sha1: {fileinfo.Sha1}" );
|
Console.WriteLine( $"fileinfo.Flags: {fileinfo?.Flags}" );
|
||||||
Console.WriteLine( $"fileinfo.Flags: {fileinfo.Flags}" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
@ -235,18 +235,15 @@ namespace Steamworks
|
|||||||
/// Asynchronously retrieves metadata details about a specific file in the depot manifest.
|
/// Asynchronously retrieves metadata details about a specific file in the depot manifest.
|
||||||
/// Currently provides:
|
/// Currently provides:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async Task<FileDetails> GetFileDetailsAsync( string filename )
|
public static async Task<FileDetails?> GetFileDetailsAsync( string filename )
|
||||||
{
|
{
|
||||||
var r = await Internal.GetFileDetails( filename );
|
var r = await Internal.GetFileDetails( filename );
|
||||||
|
|
||||||
if ( !r.HasValue )
|
if ( !r.HasValue || r.Value.Result != Result.OK )
|
||||||
{
|
return null;
|
||||||
throw new System.Exception( "Something went wrong" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return new FileDetails
|
return new FileDetails
|
||||||
{
|
{
|
||||||
Found = r.Value.Result == Result.OK,
|
|
||||||
SizeInBytes = r.Value.FileSize,
|
SizeInBytes = r.Value.FileSize,
|
||||||
Flags = r.Value.Flags,
|
Flags = r.Value.Flags,
|
||||||
Sha1 = string.Join( "", r.Value.FileSHA.Select( x => x.ToString( "x" ) ) )
|
Sha1 = string.Join( "", r.Value.FileSHA.Select( x => x.ToString( "x" ) ) )
|
||||||
|
@ -8,7 +8,6 @@ namespace Steamworks.Data
|
|||||||
{
|
{
|
||||||
public struct FileDetails
|
public struct FileDetails
|
||||||
{
|
{
|
||||||
public bool Found;
|
|
||||||
public ulong SizeInBytes;
|
public ulong SizeInBytes;
|
||||||
public string Sha1;
|
public string Sha1;
|
||||||
public uint Flags;
|
public uint Flags;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user