Skip to content

Commit 531697a

Browse files
committed
NetStandard 1.3 support
1 parent bb2a3fe commit 531697a

File tree

5 files changed

+32
-2
lines changed

5 files changed

+32
-2
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<NetTargetFrameworks>net6.0;net5.0;netstandard2.0</NetTargetFrameworks>
3+
<NetTargetFrameworks>net6.0;net5.0;netstandard2.0;netstandard1.3</NetTargetFrameworks>
44
<LangVersion>latest</LangVersion>
55
<Nullable>enable</Nullable>
66
</PropertyGroup>

XConsole.Demo/Program.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
namespace Demo
1+
#if NET5_0
2+
#pragma warning disable CA1416 // Validate platform compatibility
3+
#endif
4+
5+
namespace Demo
26
{
37
using Console = XConsole;
48

@@ -37,7 +41,11 @@ public static async Task Main()
3741

3842
//Console.SetCursorPosition(0, 8950);
3943

44+
#if !NETSTANDARD1_3
4045
var sysFolder = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.System));
46+
#else
47+
var sysFolder = new DirectoryInfo(@"C:\Windows\System32");
48+
#endif
4149
var files = sysFolder.GetFiles("*.exe");
4250
var fileIndex = 0;
4351
Console.Pin(() => new[] { "m`This is pin!\n", $"g`Number of files: ", $"W`{fileIndex}" });

XConsole/XConsole.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
using System.IO;
44
using System.Text;
55

6+
#if NETSTANDARD
7+
#pragma warning disable CS8604 // Possible null reference argument.
8+
#endif
9+
610
namespace System
711
{
812
#if !NETSTANDARD
@@ -1087,15 +1091,21 @@ public static void MoveBufferArea(
10871091

10881092
public static Stream OpenStandardError() => Console.OpenStandardError();
10891093

1094+
#if !NETSTANDARD1_3
10901095
public static Stream OpenStandardError(int bufferSize) => Console.OpenStandardError(bufferSize: bufferSize);
1096+
#endif
10911097

10921098
public static Stream OpenStandardInput() => Console.OpenStandardInput();
10931099

1100+
#if !NETSTANDARD1_3
10941101
public static Stream OpenStandardInput(int bufferSize) => Console.OpenStandardInput(bufferSize: bufferSize);
1102+
#endif
10951103

10961104
public static Stream OpenStandardOutput() => Console.OpenStandardOutput();
10971105

1106+
#if !NETSTANDARD1_3
10981107
public static Stream OpenStandardOutput(int bufferSize) => Console.OpenStandardOutput(bufferSize: bufferSize);
1108+
#endif
10991109

11001110
public static int Read()
11011111
{

XConsole/XConsole.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,8 @@
2222
<None Include="..\README.md" Link="Pack\README.md" Pack="true" PackagePath="" />
2323
</ItemGroup>
2424

25+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
26+
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
27+
</ItemGroup>
28+
2529
</Project>

XConsole/XConsolePosition.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
namespace System
22
{
3+
#if !NETSTANDARD
4+
using System.Runtime.Versioning;
5+
[SupportedOSPlatform("windows")]
6+
[UnsupportedOSPlatform("android")]
7+
[UnsupportedOSPlatform("browser")]
8+
[UnsupportedOSPlatform("ios")]
9+
[UnsupportedOSPlatform("tvos")]
10+
#endif
311
public struct XConsolePosition
412
{
513
public readonly int Left;

0 commit comments

Comments
 (0)