diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-05-26 19:18:27 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-05-26 19:18:27 -0500 |
| commit | 002a2295241bbbc3e823bc1aa18d64651a10ce74 (patch) | |
| tree | 43ab82e33e775a2b05b11db9791e1820680c6104 /src/slskd/Common/Compute.cs | |
| parent | def6a3a05f02a53b814821ab6b9692e89c2df693 (diff) | |
| download | slskd-002a2295241bbbc3e823bc1aa18d64651a10ce74.tar.gz | |
add compute.OSPlatform()
Diffstat (limited to 'src/slskd/Common/Compute.cs')
| -rw-r--r-- | src/slskd/Common/Compute.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/slskd/Common/Compute.cs b/src/slskd/Common/Compute.cs index 8d7c1ceb..dc565806 100644 --- a/src/slskd/Common/Compute.cs +++ b/src/slskd/Common/Compute.cs @@ -33,6 +33,7 @@ namespace slskd { using System; + using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; @@ -64,5 +65,25 @@ namespace slskd using var sha256 = SHA256.Create(); return BitConverter.ToString(sha256.ComputeHash(Encoding.UTF8.GetBytes(str))).Replace("-", string.Empty); } + + public static OSPlatform OSPlatform() + { + if (OperatingSystem.IsWindows()) + { + return System.Runtime.InteropServices.OSPlatform.Windows; + } + + if (OperatingSystem.IsMacOS()) + { + return System.Runtime.InteropServices.OSPlatform.OSX; + } + + if (OperatingSystem.IsFreeBSD()) + { + return System.Runtime.InteropServices.OSPlatform.FreeBSD; + } + + return System.Runtime.InteropServices.OSPlatform.Linux; + } } }
\ No newline at end of file |
