feat: update to net7

This commit is contained in:
Mira 2023-09-21 17:13:21 +02:00
parent 3cab23c592
commit bae09d2727
Signed by untrusted user who does not match committer: Xorog
GPG key ID: 983798ED9C3E7C36
2 changed files with 151 additions and 151 deletions

View file

@ -3,9 +3,10 @@ using System.Net.Http;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.IO; using System.IO;
using System.Text.Json.Serialization;
namespace QuickChart;
namespace QuickChart
{
internal class QuickChartShortUrlResponse internal class QuickChartShortUrlResponse
{ {
#pragma warning disable IDE1006 // Naming Styles #pragma warning disable IDE1006 // Naming Styles
@ -29,7 +30,7 @@ namespace QuickChart
public string Host { get; set; } public string Host { get; set; }
public int Port { get; set; } public int Port { get; set; }
private static readonly HttpClient Client = new HttpClient(); private static readonly HttpClient Client = new();
public Chart(string scheme = null, string host = null, int? port = null) public Chart(string scheme = null, string host = null, int? port = null)
{ {
@ -69,10 +70,10 @@ namespace QuickChart
} }
var builder = new StringBuilder(); var builder = new StringBuilder();
_ = builder.Append("w=").Append(this.Width.ToString()); _ = builder.Append("w=").Append(this.Width);
_ = builder.Append("&h=").Append(this.Height.ToString()); _ = builder.Append("&h=").Append(this.Height);
_ = builder.Append("&devicePixelRatio=").Append(this.DevicePixelRatio.ToString()); _ = builder.Append("&devicePixelRatio=").Append(this.DevicePixelRatio);
_ = builder.Append("&f=").Append(this.Format); _ = builder.Append("&f=").Append(this.Format);
_ = builder.Append("&bkg=").Append(Uri.EscapeDataString(this.BackgroundColor)); _ = builder.Append("&bkg=").Append(Uri.EscapeDataString(this.BackgroundColor));
_ = builder.Append("&c=").Append(Uri.EscapeDataString(this.Config)); _ = builder.Append("&c=").Append(Uri.EscapeDataString(this.Config));
@ -97,7 +98,7 @@ namespace QuickChart
var options = new JsonSerializerOptions var options = new JsonSerializerOptions
{ {
IgnoreNullValues = true DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
}; };
var json = JsonSerializer.Serialize(new var json = JsonSerializer.Serialize(new
@ -138,7 +139,7 @@ namespace QuickChart
var options = new JsonSerializerOptions var options = new JsonSerializerOptions
{ {
IgnoreNullValues = true DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
}; };
var json = JsonSerializer.Serialize(new var json = JsonSerializer.Serialize(new
@ -176,4 +177,3 @@ namespace QuickChart
public HttpResponseMessage Response { get; private set; } public HttpResponseMessage Response { get; private set; }
} }
}

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<TargetFrameworks>netcoreapp3.1;netstandard2.0;net472</TargetFrameworks> <TargetFrameworks>net7.0</TargetFrameworks>
<PackOnBuild>true</PackOnBuild> <PackOnBuild>true</PackOnBuild>
<Authors>Ian Webster</Authors> <Authors>Ian Webster</Authors>
<Copyright>Ian Webster</Copyright> <Copyright>Ian Webster</Copyright>