mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 06:38:01 +03:00
Workshop fixes
This commit is contained in:
parent
f51ca35a34
commit
f0e09d4331
@ -58,14 +58,29 @@ namespace Facepunch.Steamworks
|
||||
}
|
||||
|
||||
workshop.OnFileDownloaded += OnFileDownloaded;
|
||||
workshop.OnItemInstalled += OnItemInstalled;
|
||||
UpdateState();
|
||||
Downloading = true;
|
||||
}
|
||||
|
||||
private void OnFileDownloaded( ulong fileid, Callbacks.Result result )
|
||||
{
|
||||
|
||||
workshop.OnFileDownloaded -= OnFileDownloaded;
|
||||
UpdateState();
|
||||
|
||||
if ( result == Callbacks.Result.OK )
|
||||
Downloading = false;
|
||||
}
|
||||
|
||||
private void OnItemInstalled( ulong fileid )
|
||||
{
|
||||
|
||||
workshop.OnItemInstalled -= OnItemInstalled;
|
||||
UpdateState();
|
||||
|
||||
Downloading = false;
|
||||
Installed = true;
|
||||
}
|
||||
|
||||
public ulong BytesDownloaded { get { UpdateDownloadProgress(); return _BytesDownloaded; } }
|
||||
@ -110,19 +125,23 @@ namespace Facepunch.Steamworks
|
||||
|
||||
if ( Installed && Directory == null )
|
||||
{
|
||||
Size = 0;
|
||||
Directory = null;
|
||||
|
||||
ulong sizeOnDisk;
|
||||
string folder;
|
||||
uint timestamp;
|
||||
workshop.ugc.GetItemInstallInfo( Id, out sizeOnDisk, out folder, out timestamp );
|
||||
|
||||
Directory = new DirectoryInfo( folder );
|
||||
Size = sizeOnDisk;
|
||||
|
||||
if ( !Directory.Exists )
|
||||
if ( workshop.ugc.GetItemInstallInfo( Id, out sizeOnDisk, out folder, out timestamp ) )
|
||||
{
|
||||
Size = 0;
|
||||
Directory = null;
|
||||
Installed = false;
|
||||
Directory = new DirectoryInfo( folder );
|
||||
Size = sizeOnDisk;
|
||||
|
||||
if ( !Directory.Exists )
|
||||
{
|
||||
Size = 0;
|
||||
Directory = null;
|
||||
Installed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +89,9 @@ namespace Facepunch.Steamworks.Interop
|
||||
|
||||
private void OnRunCallback( IntPtr ptr )
|
||||
{
|
||||
if ( callbackPin == null ) throw new System.Exception( "Callback wasn't pinned!" );
|
||||
if ( vTablePtr == IntPtr.Zero ) throw new System.Exception( "vTablePtr wasn't pinned!" );
|
||||
|
||||
T data = (T) Marshal.PtrToStructure( ptr, typeof(T) );
|
||||
Function( data );
|
||||
}
|
||||
@ -96,6 +99,7 @@ namespace Facepunch.Steamworks.Interop
|
||||
|
||||
private int GetSize()
|
||||
{
|
||||
Console.WriteLine( "GET SIZE CALLED" );
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
|
@ -5986,14 +5986,13 @@ namespace Valve.Steamworks
|
||||
return result;
|
||||
}
|
||||
|
||||
static System.Text.StringBuilder StringBuffer = new System.Text.StringBuilder(1024 * 16);
|
||||
|
||||
internal override bool GetItemInstallInfo( ulong nPublishedFileID, out ulong punSizeOnDisk, out string pchFolder, out uint punTimeStamp )
|
||||
{
|
||||
CheckIfUsable();
|
||||
punSizeOnDisk = 0;
|
||||
punTimeStamp = 0;
|
||||
|
||||
|
||||
var StringBuffer = new System.Text.StringBuilder(2048);
|
||||
bool result = NativeEntrypoints.SteamAPI_ISteamUGC_GetItemInstallInfo (m_pSteamUGC,nPublishedFileID, out punSizeOnDisk, StringBuffer, (uint)StringBuffer.Capacity, out punTimeStamp );
|
||||
pchFolder = StringBuffer.ToString();
|
||||
return result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user