mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
FileDetails SHA1
This commit is contained in:
parent
d9da40c0e8
commit
fe0d934bfc
@ -66,7 +66,10 @@ public async Task GetFileDetails()
|
||||
{
|
||||
var fileinfo = await Apps.GetFileDetails( "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}" );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -211,20 +212,19 @@ public static DownloadProgress DlcDownloadProgress( AppId appid )
|
||||
/// </summary>
|
||||
public static async Task<FileDetails> GetFileDetails( string filename )
|
||||
{
|
||||
var call = steamapps.GetFileDetails( filename );
|
||||
var r = await steamapps.GetFileDetails( filename );
|
||||
|
||||
while ( !call.IsComplete() )
|
||||
{
|
||||
await Task.Delay( 1 );
|
||||
}
|
||||
|
||||
var r = call.GetResult();
|
||||
if ( !r.HasValue )
|
||||
throw new System.Exception( "Something went wrong" );
|
||||
{
|
||||
throw new System.Exception( "Something went wrong" );
|
||||
}
|
||||
|
||||
return new FileDetails
|
||||
{
|
||||
SizeInBytes = r.Value.FileSize
|
||||
Found = r.Value.Result == SteamNative.Result.OK,
|
||||
SizeInBytes = r.Value.FileSize,
|
||||
Flags = r.Value.Flags,
|
||||
Sha1 = string.Join( "", r.Value.FileSHA.Select( x => x.ToString( "x" ) ) )
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,9 @@ namespace Steamworks
|
||||
{
|
||||
public struct FileDetails
|
||||
{
|
||||
public bool Found;
|
||||
public ulong SizeInBytes;
|
||||
public string Sha1;
|
||||
public ulong BytesTotal;
|
||||
public uint Flags;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user