File tree Expand file tree Collapse file tree 2 files changed +6
-14
lines changed
src/Shared/runtime/Quic/Interop Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change 1
1
// Licensed to the .NET Foundation under one or more agreements.
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
- using System . Runtime . InteropServices ;
5
-
6
4
namespace System . Net . Quic . Implementations . MsQuic . Internal
7
5
{
8
6
internal static class MsQuicStatusCodes
9
7
{
10
- internal static readonly uint Success = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? Windows . Success : Linux . Success ;
11
- internal static readonly uint Pending = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? Windows . Pending : Linux . Pending ;
12
- internal static readonly uint InternalError = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? Windows . InternalError : Linux . InternalError ;
8
+ internal static uint Success => OperatingSystem . IsWindows ( ) ? Windows . Success : Linux . Success ;
9
+ internal static uint Pending => OperatingSystem . IsWindows ( ) ? Windows . Pending : Linux . Pending ;
10
+ internal static uint InternalError => OperatingSystem . IsWindows ( ) ? Windows . InternalError : Linux . InternalError ;
13
11
14
12
// TODO return better error messages here.
15
- public static string GetError ( uint status )
16
- {
17
- return RuntimeInformation . IsOSPlatform ( OSPlatform . Windows )
18
- ? Windows . GetError ( status ) : Linux . GetError ( status ) ;
19
- }
13
+ public static string GetError ( uint status ) => OperatingSystem . IsWindows ( ) ? Windows . GetError ( status ) : Linux . GetError ( status ) ;
20
14
21
15
private static class Windows
22
16
{
Original file line number Diff line number Diff line change 1
1
// Licensed to the .NET Foundation under one or more agreements.
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
- using System . Runtime . InteropServices ;
5
-
6
4
namespace System . Net . Quic . Implementations . MsQuic . Internal
7
5
{
8
6
internal static class MsQuicStatusHelper
9
7
{
10
8
internal static bool SuccessfulStatusCode ( uint status )
11
9
{
12
- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
10
+ if ( OperatingSystem . IsWindows ( ) )
13
11
{
14
12
return status < 0x80000000 ;
15
13
}
16
14
17
- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
15
+ if ( OperatingSystem . IsLinux ( ) )
18
16
{
19
17
return ( int ) status <= 0 ;
20
18
}
You can’t perform that action at this time.
0 commit comments