Add support to net472

This commit is contained in:
Guilherme Werner 2025-12-16 19:19:53 -03:00
parent 9faee52854
commit 9d4aaf6692
8 changed files with 1983 additions and 1985 deletions

View file

@ -3,11 +3,11 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="dotenv.net" Version="3.2.0" />
<PackageVersion Include="dotenv.net" Version="4.0.0" />
<PackageVersion Include="JsonSubTypes" Version="2.0.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<PackageVersion Include="Polly" Version="8.1.0" />
<PackageVersion Include="RestSharp" Version="112.1.0" />
<PackageVersion Include="RestSharp" Version="113.0.0" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
</ItemGroup>
</Project>

View file

@ -7,7 +7,7 @@ java -jar ./vendor/openapi-generator/openapi-generator-cli.jar generate `
-g csharp `
-o . `
--global-property apis,models,supportingFiles,apiDocs=false,modelDocs=false,apiTests=false,modelTests=false `
--additional-properties=packageName=ProxmoxSharp,library=restsharp,zeroBasedEnums=true,nullableReferenceTypes=true `
--additional-properties=targetFramework=net47,packageName=ProxmoxSharp,library=restsharp,zeroBasedEnums=true `
--openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=ProxmoxGenerated `
--type-mappings Any=object `
--skip-validate-spec

File diff suppressed because it is too large Load diff

View file

@ -23,6 +23,7 @@ using System.Text;
using System.Threading;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using RestSharp;

View file

@ -101,12 +101,6 @@ namespace ProxmoxSharp.Client
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
// For example: 2009-06-15T13:45:30.0000000
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
if (obj is DateOnly dateOnly)
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
// For example: 2009-06-15
return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
if (obj is bool boolean)
return boolean ? "true" : "false";
if (obj is ICollection collection) {

View file

@ -35,7 +35,7 @@ namespace ProxmoxSharp
/// // Environment variable PROXMOX_API_KEY must be set
/// var api = ProxmoxApi.FromEnv();
/// </example>
public static ProxmoxApi? FromEnv()
public static ProxmoxApi FromEnv()
{
var baseUrl = Environment.GetEnvironmentVariable("PROXMOX_URL");
var tokenId = Environment.GetEnvironmentVariable("PROXMOX_TOKEN_ID");
@ -65,8 +65,8 @@ namespace ProxmoxSharp
{
var version = GetVersion();
var frameworkDescription = RuntimeInformation.FrameworkDescription.Trim();
var runtimeIdentifier = RuntimeInformation.RuntimeIdentifier.Trim();
return $"Proxmox/{version} ({frameworkDescription}; {runtimeIdentifier})";
//var runtimeIdentifier = RuntimeInformation.RuntimeIdentifier.Trim();
return $"ProxmoxSharp/{version} ({frameworkDescription})";
}
/// <summary>

View file

@ -11,14 +11,18 @@ namespace ProxmoxSharp
/// </remarks>
public static class ProxmoxApiSingleton
{
private static ProxmoxApi? _instance = null;
private static ProxmoxApi _instance = null;
/// <summary>
/// Get the singleton instance of <see cref="ProxmoxApi"/>.
/// </summary>
public static ProxmoxApi GetInstance()
{
//_instance ??= ProxmoxApi.FromEnvOrDefault();
if (_instance == null)
{
_instance = ProxmoxApi.FromEnv();
}
return _instance;
}

View file

@ -9,9 +9,8 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPublishable>false</IsPublishable>
<Nullable>annotations</Nullable>
<OutputType>Library</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net472;net5.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />