mirror of
https://github.com/tribufu/proxmox-sharp
synced 2026-05-06 06:47:29 +00:00
Add support to net472
This commit is contained in:
parent
9faee52854
commit
9d4aaf6692
8 changed files with 1983 additions and 1985 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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="\" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue