From 5d23345955ba9dcb06853230830a56603364bd13 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Fri, 21 Oct 2016 09:36:26 +0100 Subject: [PATCH 1/3] Making a release --- Facepunch.Steamworks/Facepunch.Steamworks.csproj | 3 +-- Facepunch.Steamworks/Properties/AssemblyInfo.cs | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Facepunch.Steamworks/Facepunch.Steamworks.csproj b/Facepunch.Steamworks/Facepunch.Steamworks.csproj index b28786b..9d8961c 100644 --- a/Facepunch.Steamworks/Facepunch.Steamworks.csproj +++ b/Facepunch.Steamworks/Facepunch.Steamworks.csproj @@ -30,8 +30,7 @@ TRACE prompt 4 - - + bin\Release\Facepunch.Steamworks.XML true diff --git a/Facepunch.Steamworks/Properties/AssemblyInfo.cs b/Facepunch.Steamworks/Properties/AssemblyInfo.cs index 2229fc4..2988e93 100644 --- a/Facepunch.Steamworks/Properties/AssemblyInfo.cs +++ b/Facepunch.Steamworks/Properties/AssemblyInfo.cs @@ -8,9 +8,9 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("Facepunch.Steamworks")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Facepunch Studios Ltd")] [assembly: AssemblyProduct("Facepunch.Steamworks")] -[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("1.0.0.0")] From b4c48242cb2e1d02d1ce144cb54c08056d3ac60c Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Fri, 21 Oct 2016 11:00:24 +0100 Subject: [PATCH 2/3] Null ref checks on dispose --- Facepunch.Steamworks/BaseSteamworks.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Facepunch.Steamworks/BaseSteamworks.cs b/Facepunch.Steamworks/BaseSteamworks.cs index ee06870..daff08e 100644 --- a/Facepunch.Steamworks/BaseSteamworks.cs +++ b/Facepunch.Steamworks/BaseSteamworks.cs @@ -25,14 +25,23 @@ namespace Facepunch.Steamworks } Disposables.Clear(); - Workshop.Dispose(); - Workshop = null; + if ( Workshop != null ) + { + Workshop.Dispose(); + Workshop = null; + } - Inventory.Dispose(); - Inventory = null; + if ( Inventory != null ) + { + Inventory.Dispose(); + Inventory = null; + } - Networking.Dispose(); - Networking = null; + if ( Networking != null ) + { + Networking.Dispose(); + Networking = null; + } if ( native != null ) { From a92d680443d806cb3ee1243714a95920f07045a4 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Fri, 21 Oct 2016 14:51:43 +0100 Subject: [PATCH 3/3] Added Workshop.Item.OwnerName --- Facepunch.Steamworks/Client.cs | 2 ++ .../Interfaces/Workshop.Item.cs | 36 +++++++++++++++++++ .../Interfaces/Workshop.Query.cs | 1 + Facepunch.Steamworks/Interfaces/Workshop.cs | 5 ++- 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Facepunch.Steamworks/Client.cs b/Facepunch.Steamworks/Client.cs index 587bc8e..b5f0a80 100644 --- a/Facepunch.Steamworks/Client.cs +++ b/Facepunch.Steamworks/Client.cs @@ -56,6 +56,8 @@ namespace Facepunch.Steamworks // Voice = new Voice( this ); + Workshop.friends = Friends; + // // Cache common, unchanging info diff --git a/Facepunch.Steamworks/Interfaces/Workshop.Item.cs b/Facepunch.Steamworks/Interfaces/Workshop.Item.cs index 6e1deab..39cf4d9 100644 --- a/Facepunch.Steamworks/Interfaces/Workshop.Item.cs +++ b/Facepunch.Steamworks/Interfaces/Workshop.Item.cs @@ -153,14 +153,27 @@ namespace Facepunch.Steamworks } + private int YourVote = 0; + + public void VoteUp() { + if ( YourVote == 1 ) return; + if ( YourVote == -1 ) VotesDown--; + + VotesUp++; workshop.ugc.SetUserItemVote( Id, true ); + YourVote = 1; } public void VoteDown() { + if ( YourVote == -1 ) return; + if ( YourVote == 1 ) VotesUp--; + + VotesDown++; workshop.ugc.SetUserItemVote( Id, false ); + YourVote = -1; } public Editor Edit() @@ -188,6 +201,29 @@ namespace Facepunch.Steamworks public int WebsiteViews { get; internal set; } public int ReportScore { get; internal set; } public string PreviewImageUrl { get; internal set; } + + string _ownerName = null; + + public string OwnerName + { + get + { + if ( _ownerName == null && workshop.friends != null ) + { + _ownerName = workshop.friends.GetName( OwnerId ); + if ( _ownerName == "[unknown]" ) + { + _ownerName = null; + return string.Empty; + } + } + + if ( _ownerName == null ) + return string.Empty; + + return _ownerName; + } + } } } } diff --git a/Facepunch.Steamworks/Interfaces/Workshop.Query.cs b/Facepunch.Steamworks/Interfaces/Workshop.Query.cs index c193b43..8819ef8 100644 --- a/Facepunch.Steamworks/Interfaces/Workshop.Query.cs +++ b/Facepunch.Steamworks/Interfaces/Workshop.Query.cs @@ -52,6 +52,7 @@ namespace Facepunch.Steamworks public int PerPage { get; set; } = SteamResponseSize; internal Workshop workshop; + internal Friends friends; private int _resultPage = 0; private int _resultsRemain = 0; diff --git a/Facepunch.Steamworks/Interfaces/Workshop.cs b/Facepunch.Steamworks/Interfaces/Workshop.cs index ccb1321..7ec4b0c 100644 --- a/Facepunch.Steamworks/Interfaces/Workshop.cs +++ b/Facepunch.Steamworks/Interfaces/Workshop.cs @@ -10,6 +10,7 @@ namespace Facepunch.Steamworks internal const ulong InvalidHandle = 0xffffffffffffffff; internal ISteamUGC ugc; + internal Friends friends; internal BaseSteamworks steamworks; internal ISteamRemoteStorage remoteStorage; @@ -31,6 +32,7 @@ namespace Facepunch.Steamworks ugc = null; steamworks = null; remoteStorage = null; + friends = null; OnFileDownloaded = null; OnItemInstalled = null; @@ -53,7 +55,8 @@ namespace Facepunch.Steamworks return new Query() { AppId = steamworks.AppId, - workshop = this + workshop = this, + friends = friends }; }