Add .NET standard and .NET framework targets. v2.0
Use nuget System.Text.Json and System.Net.Http deps, switch "Protocol" to "Scheme", and bump version to 2.0
This commit is contained in:
parent
6969c66df7
commit
2a93ad3680
2 changed files with 21 additions and 17 deletions
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Web;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
@ -25,7 +23,7 @@ namespace QuickChart
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
public string Config { get; set; }
|
public string Config { get; set; }
|
||||||
|
|
||||||
public string Protocol { get; set; }
|
public string Scheme { get; set; }
|
||||||
public string Host { get; set; }
|
public string Host { get; set; }
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
|
@ -38,7 +36,7 @@ namespace QuickChart
|
||||||
DevicePixelRatio = 1.0;
|
DevicePixelRatio = 1.0;
|
||||||
BackgroundColor = "transparent";
|
BackgroundColor = "transparent";
|
||||||
|
|
||||||
Protocol = "https";
|
Scheme = "https";
|
||||||
Host = "quickchart.io";
|
Host = "quickchart.io";
|
||||||
Port = 443;
|
Port = 443;
|
||||||
}
|
}
|
||||||
|
|
@ -50,18 +48,19 @@ namespace QuickChart
|
||||||
throw new NullReferenceException("You must set Config on the QuickChart object before generating a URL");
|
throw new NullReferenceException("You must set Config on the QuickChart object before generating a URL");
|
||||||
}
|
}
|
||||||
|
|
||||||
NameValueCollection queryString = HttpUtility.ParseQueryString(string.Empty);
|
StringBuilder builder = new StringBuilder();
|
||||||
queryString.Add("w", Width.ToString());
|
builder.Append("w=").Append(Width.ToString());
|
||||||
queryString.Add("h", Height.ToString());
|
builder.Append("&h=").Append(Height.ToString());
|
||||||
queryString.Add("devicePixelRatio", DevicePixelRatio.ToString());
|
|
||||||
queryString.Add("bkg", BackgroundColor);
|
builder.Append("&devicePixelRatio=").Append(DevicePixelRatio.ToString());
|
||||||
queryString.Add("c", Config);
|
builder.Append("&bkg=").Append(Uri.EscapeDataString(BackgroundColor));
|
||||||
|
builder.Append("&c=").Append(Uri.EscapeDataString(Config));
|
||||||
if (!string.IsNullOrEmpty(Key))
|
if (!string.IsNullOrEmpty(Key))
|
||||||
{
|
{
|
||||||
queryString.Add("key", Key);
|
builder.Append("&key=").Append(Uri.EscapeDataString(Key));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $"{Protocol}://{Host}:{Port}/chart?{queryString}";
|
return $"{Scheme}://{Host}:{Port}/chart?{builder}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetShortUrl()
|
public string GetShortUrl()
|
||||||
|
|
@ -84,7 +83,7 @@ namespace QuickChart
|
||||||
key = Key,
|
key = Key,
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
string url = $"{Protocol}://{Host}:{Port}/chart/create";
|
string url = $"{Scheme}://{Host}:{Port}/chart/create";
|
||||||
|
|
||||||
HttpResponseMessage response = Client.PostAsync(
|
HttpResponseMessage response = Client.PostAsync(
|
||||||
url,
|
url,
|
||||||
|
|
@ -121,7 +120,7 @@ namespace QuickChart
|
||||||
key = Key,
|
key = Key,
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
string url = $"{Protocol}://{Host}:{Port}/chart";
|
string url = $"{Scheme}://{Host}:{Port}/chart";
|
||||||
|
|
||||||
HttpResponseMessage response = Client.PostAsync(
|
HttpResponseMessage response = Client.PostAsync(
|
||||||
url,
|
url,
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,24 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFrameworks>netcoreapp3.1;netstandard2.0;net472</TargetFrameworks>
|
||||||
<PackOnBuild>true</PackOnBuild>
|
<PackOnBuild>true</PackOnBuild>
|
||||||
<Authors>Ian Webster</Authors>
|
<Authors>Ian Webster</Authors>
|
||||||
<Copyright>Ian Webster 2020</Copyright>
|
<Copyright>Ian Webster 2020</Copyright>
|
||||||
<PackageLicenseUrl>https://github.com/typpo/quickchart-csharp/blob/main/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/typpo/quickchart-csharp/blob/main/LICENSE</PackageLicenseUrl>
|
||||||
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<Owners>QuickChart</Owners>
|
<Owners>QuickChart</Owners>
|
||||||
<PackageProjectUrl>https://github.com/typpo/quickchart-csharp</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/typpo/quickchart-csharp</PackageProjectUrl>
|
||||||
<Summary>Client library for the QuickChart Chart API, used to generate chart images.</Summary>
|
<Summary>Client library for the QuickChart Chart API, used to generate chart images.</Summary>
|
||||||
<PackageTags>chart image, chart api, chart, charts</PackageTags>
|
<PackageTags>chart image, chart api, chart, charts, image charts</PackageTags>
|
||||||
<Title>QuickChart</Title>
|
<Title>QuickChart</Title>
|
||||||
<Description>Client library for the QuickChart Chart API, used to generate chart images.</Description>
|
<Description>Client library for the QuickChart Chart API, used to generate chart images.</Description>
|
||||||
<PackageVersion>1.0.0</PackageVersion>
|
<PackageVersion>2.0.0</PackageVersion>
|
||||||
<PackageId>QuickChart</PackageId>
|
<PackageId>QuickChart</PackageId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.Text.Json" Version="5.0.0" />
|
||||||
|
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue