From f1dd4462f2e89e7d25a288b7cecb51c95c039d23 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Mon, 24 Oct 2016 15:25:02 +0100 Subject: [PATCH] Added Workshop.itemHandle --- Facepunch.Steamworks/Interfaces/Workshop.Item.cs | 11 +++++++++++ Facepunch.Steamworks/Interfaces/Workshop.cs | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/Facepunch.Steamworks/Interfaces/Workshop.Item.cs b/Facepunch.Steamworks/Interfaces/Workshop.Item.cs index bdab8f0..b915fe5 100644 --- a/Facepunch.Steamworks/Interfaces/Workshop.Item.cs +++ b/Facepunch.Steamworks/Interfaces/Workshop.Item.cs @@ -50,6 +50,17 @@ internal static Item From( SteamNative.SteamUGCDetails_t details, Workshop works return item; } + internal static Item FromId( ulong id, Workshop workshop ) + { + var item = new Item(); + + item.workshop = workshop; + item.Id = id; + item.UpdateState(); + + return item; + } + public void Download( bool highPriority = true ) { UpdateState(); diff --git a/Facepunch.Steamworks/Interfaces/Workshop.cs b/Facepunch.Steamworks/Interfaces/Workshop.cs index e886957..6bb2a53 100644 --- a/Facepunch.Steamworks/Interfaces/Workshop.cs +++ b/Facepunch.Steamworks/Interfaces/Workshop.cs @@ -59,6 +59,16 @@ public Query CreateQuery() }; } + /// + /// Returns a class representing this ItemId. We don't query + /// item name, description etc. We don't verify that item exists. + /// We don't verify that this item belongs to your app. + /// + public Item ItemHandle( ulong ItemId ) + { + return Item.FromId( ItemId, this ); + } + public Editor CreateItem( ItemType type ) { return new Editor() { workshop = this, Type = type };