From 072ef291a0cee86dc193b548904882d0db1eb49d Mon Sep 17 00:00:00 2001 From: Alexander Storozhuk Date: Sat, 14 Apr 2018 13:42:15 +0300 Subject: [PATCH 1/2] Added documentation for rich presence. Changed SetRichPresence return type to bool. Updated rich presence test. --- .../Client/RichPresenceTest.cs | 6 ++++-- Facepunch.Steamworks/Client/User.cs | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Facepunch.Steamworks.Test/Client/RichPresenceTest.cs b/Facepunch.Steamworks.Test/Client/RichPresenceTest.cs index b261979..ad64ae2 100644 --- a/Facepunch.Steamworks.Test/Client/RichPresenceTest.cs +++ b/Facepunch.Steamworks.Test/Client/RichPresenceTest.cs @@ -26,7 +26,8 @@ public void ReadBackSetKey() { using ( var client = new Steamworks.Client( 252490 ) ) { - client.User.SetRichPresence( "One", "Two" ); + var success = client.User.SetRichPresence( "One", "Two" ); + Assert.IsTrue( success ); var value = client.User.GetRichPresence( "One" ); Assert.IsNotNull( value ); @@ -39,7 +40,8 @@ public void ClearingKeys() { using ( var client = new Steamworks.Client( 252490 ) ) { - client.User.SetRichPresence( "One", "Two" ); + var success = client.User.SetRichPresence( "One", "Two" ); + Assert.IsTrue( success ); var value = client.User.GetRichPresence( "One" ); Assert.IsNotNull( value ); diff --git a/Facepunch.Steamworks/Client/User.cs b/Facepunch.Steamworks/Client/User.cs index daf3363..75f8ffe 100644 --- a/Facepunch.Steamworks/Client/User.cs +++ b/Facepunch.Steamworks/Client/User.cs @@ -25,22 +25,29 @@ public void Dispose() client = null; } + /// + /// Find a rich presence data by key for current user. Will be null if not found. + /// public string GetRichPresence( string key ) { - string val = null; - - if ( richPresence.TryGetValue( key, out val ) ) + if ( richPresence.TryGetValue( key, out var val ) ) return val; return null; } - public void SetRichPresence( string key, string value ) + /// + /// Sets rich presence value by key for current user. + /// + public bool SetRichPresence( string key, string value ) { richPresence[key] = value; - client.native.friends.SetRichPresence( key, value ); + return client.native.friends.SetRichPresence( key, value ); } + /// + /// Clears all of the current user's rich presence data. + /// public void ClearRichPresence() { richPresence.Clear(); From 616fcc400d39c5e5818ddbbbb68eccfd2acfbffc Mon Sep 17 00:00:00 2001 From: Alexander Storozhuk Date: Sat, 14 Apr 2018 14:02:03 +0300 Subject: [PATCH 2/2] Spelling --- Facepunch.Steamworks/Client/User.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Facepunch.Steamworks/Client/User.cs b/Facepunch.Steamworks/Client/User.cs index 75f8ffe..0d23a81 100644 --- a/Facepunch.Steamworks/Client/User.cs +++ b/Facepunch.Steamworks/Client/User.cs @@ -26,7 +26,7 @@ public void Dispose() } /// - /// Find a rich presence data by key for current user. Will be null if not found. + /// Find a rich presence value by key for current user. Will be null if not found. /// public string GetRichPresence( string key ) { @@ -37,7 +37,7 @@ public string GetRichPresence( string key ) } /// - /// Sets rich presence value by key for current user. + /// Sets a rich presence value by key for current user. /// public bool SetRichPresence( string key, string value ) {