Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alastairlundy/runtimeextensions
Adds Windows, macOS, Linux, and FreeBSD detection methods to the System.OperatingSystem class via extension methods.
https://github.com/alastairlundy/runtimeextensions
Last synced: about 2 months ago
JSON representation
Adds Windows, macOS, Linux, and FreeBSD detection methods to the System.OperatingSystem class via extension methods.
- Host: GitHub
- URL: https://github.com/alastairlundy/runtimeextensions
- Owner: alastairlundy
- License: mit
- Created: 2024-04-13T16:33:20.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-11-09T20:51:45.000Z (about 2 months ago)
- Last Synced: 2024-11-09T21:30:31.743Z (about 2 months ago)
- Language: C#
- Homepage:
- Size: 102 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# RuntimeExtensions (formerly known as PlatformKit.Extensions.OperatingSystem)
## Features:
Runtime Extensions adds .NET Standard 2.0 & 2.1 compatible ways of getting:
* OS Detection support
* programmatic Runtime Identifier (RID) detectionIt also adds some support for programmatically determining the .NET Target Framework Moniker (TFM) being used.
## Usage
To get OS Detection support, RuntimeExtensions needs to replace the reference to the existing OperatingSystem class in a .NET Standard 2.0 project with RuntimeExtensions' equivalent class.This can be easily done with a using namespace.
To target only .NET Standard 2.0 use:
```csharp
#if NETSTANDARD2_0
using OperatingSystem = AlastairLundy.Extensions.Runtime.OperatingSystemExtensions;
#endif
```To target .NET Standard 2.0 and 2.1 use:
```csharp
#if NETSTANDARD2_0 || NETSTANDARD2_1
using OperatingSystem = AlastairLundy.Extensions.Runtime.OperatingSystemExtensions;
#endif
```## Compatibility
The following tables indicate Operating Systems that are capable of being detected with this library.Although "Mac Catalyst" as a target is not explicitly supported, implicit support can be indirectly detected.
You can use:
```csharpif(OperatingSystem.IsMacOS()){
if(OperatingSystem.IsAtLeastVersion(10, 15)){
// Mac Catalyst specific code goes here
}
}
```### Desktop Operating Systems
| Operating System Target | Support Status | Required Library Version |
|-------------------------|-------------------------------|-------------------------------|
| Windows | :white_check_mark:, Supported | Any |
| Linux | :white_check_mark:, Supported | Any |
| FreeBSD | :white_check_mark:, Supported | Any |
| macOS | :white_check_mark:, Supported | Any |
| Mac Catalyst | :x:, Not Explicitly Supported | N/A, Not Explicitly Supported |### Mobile Operating Systems
| Operating System | Support Status | Required Library Version |
|------------------|------------------------|--------------------------|
| IOS | :white_check_mark: | 1.5.0 or newer |
| tvOS | :white_check_mark: | 1.5.2 or newer | |
| watchOS | :white_check_mark: | 1.5.0 or newer |
| Android | :white_check_mark: | 1.5.0 or newer |
| Fire OS | :x:, Not Yet Supported | N/A Not Supported |
| Android TV | :x:, Not Supported | N/A Not Supported |
| wearOS | :white_check_mark: | 1.5.1 or newer |
| Tizen | :white_check_mark: | 2.0.0 or newer |## License
RuntimeExtensions is licensed under the MIT license.