feat: update to net7
This commit is contained in:
parent
3cab23c592
commit
bae09d2727
2 changed files with 151 additions and 151 deletions
|
|
@ -3,19 +3,20 @@ using System.Net.Http;
|
|||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.IO;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace QuickChart
|
||||
namespace QuickChart;
|
||||
|
||||
internal class QuickChartShortUrlResponse
|
||||
{
|
||||
internal class QuickChartShortUrlResponse
|
||||
{
|
||||
#pragma warning disable IDE1006 // Naming Styles
|
||||
public bool status { get; set; }
|
||||
public string url { get; set; }
|
||||
#pragma warning restore IDE1006 // Naming Styles
|
||||
}
|
||||
}
|
||||
|
||||
public class Chart
|
||||
{
|
||||
public class Chart
|
||||
{
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public double DevicePixelRatio { get; set; }
|
||||
|
|
@ -29,7 +30,7 @@ namespace QuickChart
|
|||
public string Host { 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)
|
||||
{
|
||||
|
|
@ -69,10 +70,10 @@ namespace QuickChart
|
|||
}
|
||||
|
||||
var builder = new StringBuilder();
|
||||
_ = builder.Append("w=").Append(this.Width.ToString());
|
||||
_ = builder.Append("&h=").Append(this.Height.ToString());
|
||||
_ = builder.Append("w=").Append(this.Width);
|
||||
_ = 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("&bkg=").Append(Uri.EscapeDataString(this.BackgroundColor));
|
||||
_ = builder.Append("&c=").Append(Uri.EscapeDataString(this.Config));
|
||||
|
|
@ -97,7 +98,7 @@ namespace QuickChart
|
|||
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
IgnoreNullValues = true
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
|
||||
};
|
||||
|
||||
var json = JsonSerializer.Serialize(new
|
||||
|
|
@ -138,7 +139,7 @@ namespace QuickChart
|
|||
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
IgnoreNullValues = true
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
|
||||
};
|
||||
|
||||
var json = JsonSerializer.Serialize(new
|
||||
|
|
@ -167,13 +168,12 @@ namespace QuickChart
|
|||
|
||||
public void ToFile(string filePath)
|
||||
=> File.WriteAllBytes(filePath, this.ToByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
public class ApiException : Exception
|
||||
{
|
||||
public class ApiException : Exception
|
||||
{
|
||||
public ApiException(string message, HttpResponseMessage response) : base(message)
|
||||
=> this.Response = response;
|
||||
|
||||
public HttpResponseMessage Response { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFrameworks>netcoreapp3.1;netstandard2.0;net472</TargetFrameworks>
|
||||
<TargetFrameworks>net7.0</TargetFrameworks>
|
||||
<PackOnBuild>true</PackOnBuild>
|
||||
<Authors>Ian Webster</Authors>
|
||||
<Copyright>Ian Webster</Copyright>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue