Unstable 0.17.0.0
This commit is contained in:
@@ -69,19 +69,13 @@ namespace Steamworks.Ugc
|
||||
public Editor WithContent( System.IO.DirectoryInfo t ) { this.ContentFolder = t; return this; }
|
||||
public Editor WithContent( string folderName ) { return WithContent( new System.IO.DirectoryInfo( folderName ) ); }
|
||||
|
||||
RemoteStoragePublishedFileVisibility? Visibility;
|
||||
public Visibility? Visibility;
|
||||
|
||||
public Editor WithPublicVisibility() { Visibility = RemoteStoragePublishedFileVisibility.Public; return this; }
|
||||
public Editor WithFriendsOnlyVisibility() { Visibility = RemoteStoragePublishedFileVisibility.FriendsOnly; return this; }
|
||||
public Editor WithPrivateVisibility() { Visibility = RemoteStoragePublishedFileVisibility.Private; return this; }
|
||||
public Editor WithVisibility(Visibility visibility) { Visibility = visibility; return this; }
|
||||
|
||||
public List<string> Tags { get; private set; }
|
||||
Dictionary<string, List<string>> KeyValueTags;
|
||||
HashSet<string> KeyValueTagsToRemove;
|
||||
|
||||
public bool IsPublic => Visibility == RemoteStoragePublishedFileVisibility.Public;
|
||||
public bool IsFriendsOnly => Visibility == RemoteStoragePublishedFileVisibility.FriendsOnly;
|
||||
public bool IsPrivate => Visibility == RemoteStoragePublishedFileVisibility.Private;
|
||||
Dictionary<string, List<string>> keyValueTags;
|
||||
HashSet<string> keyValueTagsToRemove;
|
||||
|
||||
public Editor WithTag( string tag )
|
||||
{
|
||||
@@ -117,13 +111,13 @@ namespace Steamworks.Ugc
|
||||
/// </summary>
|
||||
public Editor AddKeyValueTag(string key, string value)
|
||||
{
|
||||
if (KeyValueTags == null)
|
||||
KeyValueTags = new Dictionary<string, List<string>>();
|
||||
if (keyValueTags == null)
|
||||
keyValueTags = new Dictionary<string, List<string>>();
|
||||
|
||||
if ( KeyValueTags.TryGetValue( key, out var list ) )
|
||||
if ( keyValueTags.TryGetValue( key, out var list ) )
|
||||
list.Add( value );
|
||||
else
|
||||
KeyValueTags[key] = new List<string>() { value };
|
||||
keyValueTags[key] = new List<string>() { value };
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -135,10 +129,10 @@ namespace Steamworks.Ugc
|
||||
/// </summary>
|
||||
public Editor RemoveKeyValueTags(string key)
|
||||
{
|
||||
if (KeyValueTagsToRemove == null)
|
||||
KeyValueTagsToRemove = new HashSet<string>();
|
||||
if (keyValueTagsToRemove == null)
|
||||
keyValueTagsToRemove = new HashSet<string>();
|
||||
|
||||
KeyValueTagsToRemove.Add(key);
|
||||
keyValueTagsToRemove.Add(key);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -207,7 +201,7 @@ namespace Steamworks.Ugc
|
||||
if ( Language != null ) SteamUGC.Internal.SetItemUpdateLanguage( handle, Language );
|
||||
if ( ContentFolder != null ) SteamUGC.Internal.SetItemContent( handle, ContentFolder.FullName );
|
||||
if ( PreviewFile != null ) SteamUGC.Internal.SetItemPreview( handle, PreviewFile );
|
||||
if ( Visibility.HasValue ) SteamUGC.Internal.SetItemVisibility( handle, Visibility.Value );
|
||||
if ( Visibility.HasValue ) SteamUGC.Internal.SetItemVisibility( handle, (RemoteStoragePublishedFileVisibility)Visibility.Value );
|
||||
if ( Tags != null && Tags.Count > 0 )
|
||||
{
|
||||
using ( var a = SteamParamStringArray.From( Tags.ToArray() ) )
|
||||
@@ -217,15 +211,15 @@ namespace Steamworks.Ugc
|
||||
}
|
||||
}
|
||||
|
||||
if ( KeyValueTagsToRemove != null)
|
||||
if ( keyValueTagsToRemove != null)
|
||||
{
|
||||
foreach ( var key in KeyValueTagsToRemove )
|
||||
foreach ( var key in keyValueTagsToRemove )
|
||||
SteamUGC.Internal.RemoveItemKeyValueTags( handle, key );
|
||||
}
|
||||
|
||||
if ( KeyValueTags != null )
|
||||
if ( keyValueTags != null )
|
||||
{
|
||||
foreach ( var keyWithValues in KeyValueTags )
|
||||
foreach ( var keyWithValues in keyValueTags )
|
||||
{
|
||||
var key = keyWithValues.Key;
|
||||
foreach ( var value in keyWithValues.Value )
|
||||
|
||||
@@ -9,6 +9,14 @@ using QueryType = Steamworks.Ugc.Query;
|
||||
|
||||
namespace Steamworks.Ugc
|
||||
{
|
||||
public enum Visibility : int
|
||||
{
|
||||
Public = 0,
|
||||
FriendsOnly = 1,
|
||||
Private = 2,
|
||||
Unlisted = 3,
|
||||
}
|
||||
|
||||
public struct Item
|
||||
{
|
||||
internal SteamUGCDetails_t details;
|
||||
@@ -74,20 +82,20 @@ namespace Steamworks.Ugc
|
||||
/// </summary>
|
||||
public DateTime Updated => Epoch.ToDateTime( details.TimeUpdated );
|
||||
|
||||
/// <summary>
|
||||
/// True if this is publically visible
|
||||
/// </summary>
|
||||
public bool IsPublic => details.Visibility == RemoteStoragePublishedFileVisibility.Public;
|
||||
public DateTime LatestUpdateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
var created = Created;
|
||||
var updated = Updated;
|
||||
return created > updated ? created : updated;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if this item is only visible by friends of the creator
|
||||
/// The item's visibility, i.e. public, friends-only, unlisted or private
|
||||
/// </summary>
|
||||
public bool IsFriendsOnly => details.Visibility == RemoteStoragePublishedFileVisibility.FriendsOnly;
|
||||
|
||||
/// <summary>
|
||||
/// True if this is only visible to the creator
|
||||
/// </summary>
|
||||
public bool IsPrivate => details.Visibility == RemoteStoragePublishedFileVisibility.Private;
|
||||
public Visibility Visibility => (Visibility)details.Visibility;
|
||||
|
||||
/// <summary>
|
||||
/// True if this item has been banned
|
||||
@@ -122,22 +130,11 @@ namespace Steamworks.Ugc
|
||||
ulong size = 0;
|
||||
uint ts = 0;
|
||||
|
||||
if ( !SteamUGC.Internal.GetItemInstallInfo( Id, ref size, out var strVal, ref ts ) )
|
||||
return null;
|
||||
|
||||
return strVal;
|
||||
if (SteamUGC.Internal.GetItemInstallInfo(Id, ref size, out var strVal, ref ts)) { return strVal; }
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start downloading this item.
|
||||
/// If this returns false the item isn't getting downloaded.
|
||||
/// </summary>
|
||||
public bool Download( Action onInstalled = null, bool highPriority = false )
|
||||
{
|
||||
return SteamUGC.Download( Id, onInstalled, highPriority );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If we're downloading, how big the total download is
|
||||
/// </summary>
|
||||
@@ -146,7 +143,7 @@ namespace Steamworks.Ugc
|
||||
get
|
||||
{
|
||||
if ( !NeedsUpdate )
|
||||
return SizeBytes;
|
||||
return InstalledSize;
|
||||
|
||||
ulong downloaded = 0;
|
||||
ulong total = 0;
|
||||
@@ -165,7 +162,7 @@ namespace Steamworks.Ugc
|
||||
get
|
||||
{
|
||||
if ( !NeedsUpdate )
|
||||
return SizeBytes;
|
||||
return InstalledSize;
|
||||
|
||||
ulong downloaded = 0;
|
||||
ulong total = 0;
|
||||
@@ -179,7 +176,7 @@ namespace Steamworks.Ugc
|
||||
/// <summary>
|
||||
/// If we're installed, how big is the install
|
||||
/// </summary>
|
||||
public long SizeBytes
|
||||
public long InstalledSize
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -195,6 +192,13 @@ namespace Steamworks.Ugc
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// File size as returned by Steamworks,
|
||||
/// no download/install required
|
||||
/// </summary>
|
||||
public long SizeOfFileInBytes
|
||||
=> details.FileSize;
|
||||
|
||||
/// <summary>
|
||||
/// If we're downloading our current progress as a delta betwen 0-1
|
||||
/// </summary>
|
||||
@@ -204,17 +208,19 @@ namespace Steamworks.Ugc
|
||||
{
|
||||
//changed from NeedsUpdate as it's false when validating and redownloading ugc
|
||||
//possibly similar properties should also be changed
|
||||
if ( !IsDownloading ) return 1;
|
||||
|
||||
ulong downloaded = 0;
|
||||
ulong total = 0;
|
||||
if ( SteamUGC.Internal.GetItemDownloadInfo( Id, ref downloaded, ref total ) && total > 0 )
|
||||
if (SteamUGC.Internal.GetItemDownloadInfo(Id, ref downloaded, ref total) && total > 0)
|
||||
{
|
||||
return (float)((double)downloaded / (double)total);
|
||||
}
|
||||
|
||||
if ( NeedsUpdate || !IsInstalled || IsDownloading )
|
||||
if (NeedsUpdate || !IsInstalled || IsDownloading)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return IsDownloadPending || IsDownloading ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace Steamworks.Ugc
|
||||
AppId consumerApp;
|
||||
AppId creatorApp;
|
||||
string searchText;
|
||||
bool returnLongDescription;
|
||||
|
||||
public Query( UgcType type ) : this()
|
||||
{
|
||||
@@ -106,18 +105,6 @@ namespace Steamworks.Ugc
|
||||
}
|
||||
#endregion
|
||||
|
||||
public Query WithLongDescription()
|
||||
{
|
||||
returnLongDescription = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query WithSummaryDescription()
|
||||
{
|
||||
returnLongDescription = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public async Task<ResultPage?> GetPageAsync( int page )
|
||||
{
|
||||
if ( page <= 0 ) throw new System.Exception( "page should be > 0" );
|
||||
@@ -255,8 +242,6 @@ namespace Steamworks.Ugc
|
||||
{
|
||||
SteamUGC.Internal.SetSearchText( handle, searchText );
|
||||
}
|
||||
|
||||
SteamUGC.Internal.SetReturnLongDescription( handle, returnLongDescription );
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user