Skip to content

Commit 8c5e686

Browse files
committed
Code improvements for NETCORE 3.1 compilation; Updated the editor config
1 parent 991f392 commit 8c5e686

File tree

8 files changed

+121
-5
lines changed

8 files changed

+121
-5
lines changed

src/.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ dotnet_style_prefer_inferred_anonymous_type_member_names = true
7070
dotnet_style_prefer_inferred_tuple_names = true
7171
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
7272
dotnet_style_prefer_simplified_boolean_expressions = true
73-
dotnet_style_prefer_simplified_interpolation = true
73+
dotnet_style_prefer_simplified_interpolation = false
7474

7575
# Field preferences
7676
dotnet_style_readonly_field = true

src/WGet.NET/Builder/WinGetAdminSettingBuilder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ public void AddRawContent(string rawContent)
4747
if (_hasShortenedContent)
4848
{
4949
// Remove the char at the end of the shortened content.
50+
#if NETCOREAPP3_1_OR_GREATER
51+
_rawContent = rawContent[..^1];
52+
#elif NETSTANDARD2_0
5053
_rawContent = rawContent.Remove(rawContent.Length - 1);
54+
#endif
5155
}
5256
else
5357
{

src/WGet.NET/Builder/WinGetDirectoryBuilder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ public void AddRawContent(string rawContent)
5050
if (_hasShortenedContent)
5151
{
5252
// Remove the char at the end of the shortened content.
53+
#if NETCOREAPP3_1_OR_GREATER
54+
_rawContent = rawContent[..^1];
55+
#elif NETSTANDARD2_0
5356
_rawContent = rawContent.Remove(rawContent.Length - 1);
57+
#endif
5458
}
5559
else
5660
{

src/WGet.NET/Builder/WinGetLinkBuilder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ public void AddRawContent(string rawContent)
4949
if (_hasShortenedContent)
5050
{
5151
// Remove the char at the end of the shortened content.
52+
#if NETCOREAPP3_1_OR_GREATER
53+
_rawContent = rawContent[..^1];
54+
#elif NETSTANDARD2_0
5255
_rawContent = rawContent.Remove(rawContent.Length - 1);
56+
#endif
5357
}
5458
else
5559
{

src/WGet.NET/Builder/WinGetPackageBuilder.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// https://github.com/basicx-StrgV/ //
44
//--------------------------------------------------//
55
using System;
6-
using WGetNET.Parser;
76
using WGetNET.Abstractions;
7+
using WGetNET.Parser;
88

99
namespace WGetNET.Builder
1010
{
@@ -56,7 +56,11 @@ public void AddId(string id)
5656
if (_hasShortenedId)
5757
{
5858
// Remove the char at the end of the shortened id.
59+
#if NETCOREAPP3_1_OR_GREATER
60+
_id = id[..^1];
61+
#elif NETSTANDARD2_0
5962
_id = id.Remove(id.Length - 1);
63+
#endif
6064
}
6165
else
6266
{

src/WGet.NET/Builder/WinGetPinnedPackageBuilder.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// https://github.com/basicx-StrgV/ //
44
//--------------------------------------------------//
55
using System;
6-
using WGetNET.Parser;
76
using WGetNET.Abstractions;
7+
using WGetNET.Parser;
88

99
namespace WGetNET.Builder
1010
{
@@ -89,7 +89,11 @@ public void AddId(string id)
8989
if (_hasShortenedId)
9090
{
9191
// Remove the char at the end of the shortened id.
92+
#if NETCOREAPP3_1_OR_GREATER
93+
_id = id[..^1];
94+
#elif NETSTANDARD2_0
9295
_id = id.Remove(id.Length - 1);
96+
#endif
9397
}
9498
else
9599
{

src/WGet.NET/Helper/PathHelper.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ public static string TrimLastPathPart(string path, PathType type)
5757

5858
if (lastSeparatorIndex > -1)
5959
{
60+
#if NETCOREAPP3_1_OR_GREATER
61+
return path[..lastSeparatorIndex];
62+
#elif NETSTANDARD2_0
6063
return path.Remove(lastSeparatorIndex);
64+
#endif
6165
}
6266

6367
return path;

src/WGet.NET/XmlDocumentation/WGet.NET.xml

Lines changed: 94 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)