diff --git a/Facepunch.Steamworks.Test/Client/UtilsTest.cs b/Facepunch.Steamworks.Test/Client/UtilsTest.cs new file mode 100644 index 0000000..5475a67 --- /dev/null +++ b/Facepunch.Steamworks.Test/Client/UtilsTest.cs @@ -0,0 +1,117 @@ +using System; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Steamworks +{ + [TestClass] + [DeploymentItem( "steam_api64.dll" )] + public class UtilsTest + { + [TestMethod] + public void SecondsSinceAppActive() + { + var time = Utils.SecondsSinceAppActive; + Console.WriteLine( $"{time}" ); + } + + [TestMethod] + public void SecondsSinceComputerActive() + { + var time = Utils.SecondsSinceComputerActive; + Console.WriteLine( $"{time}" ); + } + + [TestMethod] + public void ConnectedUniverse() + { + var u = Utils.ConnectedUniverse; + Console.WriteLine( $"{u}" ); + } + + [TestMethod] + public void SteamServerTime() + { + var time = Utils.SteamServerTime; + Console.WriteLine( $"{time}" ); + } + + [TestMethod] + public void IpCountry() + { + var cnt = Utils.IpCountry; + Console.WriteLine( $"{cnt}" ); + } + + [TestMethod] + public void UsingBatteryPower() + { + var cnt = Utils.UsingBatteryPower; + Console.WriteLine( $"{cnt}" ); + } + + [TestMethod] + public void CurrentBatteryPower() + { + var cnt = Utils.CurrentBatteryPower; + Console.WriteLine( $"{cnt}" ); + } + + [TestMethod] + public void AppId() + { + var cnt = Utils.AppId; + + Assert.IsTrue( cnt.Value > 0 ); + + Console.WriteLine( $"{cnt.Value}" ); + } + + [TestMethod] + public void IsOverlayEnabled() + { + var cnt = Utils.IsOverlayEnabled; + Console.WriteLine( $"{cnt}" ); + } + + [TestMethod] + public async Task CheckFileSignature() + { + var sig = await Utils.CheckFileSignature( "hl2.exe" ); + Console.WriteLine( $"{sig}" ); + } + + [TestMethod] + public void SteamUILanguage() + { + var cnt = Utils.SteamUILanguage; + Console.WriteLine( $"{cnt}" ); + } + + [TestMethod] + public void IsSteamRunningInVR() + { + var cnt = Utils.IsSteamRunningInVR; + Console.WriteLine( $"{cnt}" ); + } + + [TestMethod] + public void IsSteamInBigPictureMode() + { + var cnt = Utils.IsSteamInBigPictureMode; + Console.WriteLine( $"{cnt}" ); + } + + [TestMethod] + public void VrHeadsetStreaming() + { + var cnt = Utils.VrHeadsetStreaming; + Console.WriteLine( $"{cnt}" ); + } + + } + +} diff --git a/Facepunch.Steamworks.Test/Facepunch.Steamworks.Test.csproj b/Facepunch.Steamworks.Test/Facepunch.Steamworks.Test.csproj index 24f643c..0695875 100644 --- a/Facepunch.Steamworks.Test/Facepunch.Steamworks.Test.csproj +++ b/Facepunch.Steamworks.Test/Facepunch.Steamworks.Test.csproj @@ -89,6 +89,7 @@ + diff --git a/Facepunch.Steamworks/Redux/Utils.cs b/Facepunch.Steamworks/Redux/Utils.cs index 8f6b2c3..35862ff 100644 --- a/Facepunch.Steamworks/Redux/Utils.cs +++ b/Facepunch.Steamworks/Redux/Utils.cs @@ -53,9 +53,14 @@ internal static void InstallEvents() /// public static event Action OnGamepadTextInputDismissed; - + /// + /// Returns the number of seconds since the application was active + /// public static uint SecondsSinceAppActive => steamutils.GetSecondsSinceAppActive(); + /// + /// Returns the number of seconds since the user last moved the mouse etc + /// public static uint SecondsSinceComputerActive => steamutils.GetSecondsSinceComputerActive(); // the universe this client is connecting to @@ -104,7 +109,7 @@ public static byte[] GetImageRGBA( int image ) /// /// Returns true if we're using a battery (ie, a laptop not plugged in) /// - public static bool UsingBatteryPower => steamutils.GetCurrentBatteryPower() == 255; + public static bool UsingBatteryPower => steamutils.GetCurrentBatteryPower() != 255; /// /// Returns battery power [0-1] @@ -134,8 +139,8 @@ public static NotificationPosition OverlayNotificationPosition } /// - /// Returns true if the overlay is running & the user can access it. The overlay process could take a few seconds to - /// start & hook the game process, so this function will initially return false while the overlay is loading. + /// Returns true if the overlay is running and the user can access it. The overlay process could take a few seconds to + /// start and hook the game process, so this function will initially return false while the overlay is loading. /// public static bool IsOverlayEnabled => steamutils.IsOverlayEnabled();