mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-20 10:50:48 +08:00
feat: 优化orm BulkCopy
This commit is contained in:
@@ -16,6 +16,8 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.Common.Extension;
|
namespace ThingsGateway.Common.Extension;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 对象拓展类
|
/// 对象拓展类
|
||||||
@@ -48,113 +50,7 @@ public static class ObjectExtensions
|
|||||||
bool IsTheRawGenericType(Type type) => generic == (type.IsGenericType ? type.GetGenericTypeDefinition() : type);
|
bool IsTheRawGenericType(Type type) => generic == (type.IsGenericType ? type.GetGenericTypeDefinition() : type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将 DateTimeOffset 转换成本地 DateTime
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dateTime"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DateTime ConvertToDateTime(this DateTimeOffset dateTime)
|
|
||||||
{
|
|
||||||
if (dateTime.Offset.Equals(TimeSpan.Zero))
|
|
||||||
return dateTime.UtcDateTime;
|
|
||||||
if (dateTime.Offset.Equals(TimeZoneInfo.Local.GetUtcOffset(dateTime.DateTime)))
|
|
||||||
return dateTime.ToLocalTime().DateTime;
|
|
||||||
else
|
|
||||||
return dateTime.DateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将 DateTimeOffset? 转换成本地 DateTime?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dateTime"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DateTime? ConvertToDateTime(this DateTimeOffset? dateTime)
|
|
||||||
{
|
|
||||||
return dateTime.HasValue ? dateTime.Value.ConvertToDateTime() : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将 DateTime 转换成 DateTimeOffset
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dateTime"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DateTimeOffset ConvertToDateTimeOffset(this DateTime dateTime)
|
|
||||||
{
|
|
||||||
return DateTime.SpecifyKind(dateTime, DateTimeKind.Local);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将 DateTime? 转换成 DateTimeOffset?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dateTime"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DateTimeOffset? ConvertToDateTimeOffset(this DateTime? dateTime)
|
|
||||||
{
|
|
||||||
return dateTime.HasValue ? dateTime.Value.ConvertToDateTimeOffset() : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将流保存到本地磁盘
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="stream"></param>
|
|
||||||
/// <param name="path"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static void CopyToSave(this Stream stream, string path)
|
|
||||||
{
|
|
||||||
// 空检查
|
|
||||||
if (string.IsNullOrWhiteSpace(path)) throw new ArgumentNullException(nameof(path));
|
|
||||||
|
|
||||||
using var fileStream = File.Create(path);
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将字节数组保存到本地磁盘
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bytes"></param>
|
|
||||||
/// <param name="path"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static void CopyToSave(this byte[] bytes, string path)
|
|
||||||
{
|
|
||||||
using var stream = new MemoryStream(bytes);
|
|
||||||
stream.CopyToSave(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将流保存到本地磁盘
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="stream"></param>
|
|
||||||
/// <param name="path">需包含文件名完整路径</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static async Task CopyToSaveAsync(this Stream stream, string path)
|
|
||||||
{
|
|
||||||
// 空检查
|
|
||||||
if (string.IsNullOrWhiteSpace(path))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 文件名判断
|
|
||||||
if (string.IsNullOrWhiteSpace(Path.GetFileName(path)))
|
|
||||||
{
|
|
||||||
throw new ArgumentException("The parameter of <path> parameter must include the complete file name.");
|
|
||||||
}
|
|
||||||
|
|
||||||
using var fileStream = File.Create(path);
|
|
||||||
await stream.CopyToAsync(fileStream).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将字节数组保存到本地磁盘
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bytes"></param>
|
|
||||||
/// <param name="path"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static async Task CopyToSaveAsync(this byte[] bytes, string path)
|
|
||||||
{
|
|
||||||
using var stream = new MemoryStream(bytes);
|
|
||||||
await stream.CopyToSaveAsync(path).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 合并两个字典
|
/// 合并两个字典
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
||||||
using ThingsGateway;
|
using ThingsGateway;
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Reflection;
|
using ThingsGateway.Reflection;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.Hosting;
|
namespace Microsoft.Extensions.Hosting;
|
||||||
|
@@ -20,7 +20,7 @@ using System.Text.RegularExpressions;
|
|||||||
|
|
||||||
using ThingsGateway.NewLife;
|
using ThingsGateway.NewLife;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 对象拓展类
|
/// 对象拓展类
|
||||||
@@ -28,70 +28,10 @@ namespace ThingsGateway.Extensions;
|
|||||||
[SuppressSniffer]
|
[SuppressSniffer]
|
||||||
public static class ObjectExtensions
|
public static class ObjectExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 将 DateTimeOffset 转换成本地 DateTime
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dateTime"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DateTime ConvertToDateTime(this DateTimeOffset dateTime)
|
|
||||||
{
|
|
||||||
if (dateTime.Offset.Equals(TimeSpan.Zero))
|
|
||||||
return dateTime.UtcDateTime;
|
|
||||||
if (dateTime.Offset.Equals(TimeZoneInfo.Local.GetUtcOffset(dateTime.DateTime)))
|
|
||||||
return dateTime.ToLocalTime().DateTime;
|
|
||||||
else
|
|
||||||
return dateTime.DateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将 DateTimeOffset? 转换成本地 DateTime?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dateTime"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DateTime? ConvertToDateTime(this DateTimeOffset? dateTime)
|
|
||||||
{
|
|
||||||
return dateTime.HasValue ? dateTime.Value.ConvertToDateTime() : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将 DateTime 转换成 DateTimeOffset
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dateTime"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DateTimeOffset ConvertToDateTimeOffset(this DateTime dateTime)
|
|
||||||
{
|
|
||||||
return DateTime.SpecifyKind(dateTime, DateTimeKind.Local);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将 DateTime? 转换成 DateTimeOffset?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dateTime"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DateTimeOffset? ConvertToDateTimeOffset(this DateTime? dateTime)
|
|
||||||
{
|
|
||||||
return dateTime.HasValue ? dateTime.Value.ConvertToDateTimeOffset() : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 将时间戳转换为 DateTime
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="timestamp"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
internal static DateTime ConvertToDateTime(this long timestamp)
|
|
||||||
{
|
|
||||||
var timeStampDateTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
|
||||||
var digitCount = (int)Math.Floor(Math.Log10(timestamp) + 1);
|
|
||||||
|
|
||||||
if (digitCount != 13 && digitCount != 10)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Data is not a valid timestamp format.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return (digitCount == 13
|
|
||||||
? timeStampDateTime.AddMilliseconds(timestamp) // 13 位时间戳
|
|
||||||
: timeStampDateTime.AddSeconds(timestamp)).ToLocalTime(); // 10 位时间戳
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 将 IFormFile 转换成 byte[]
|
/// 将 IFormFile 转换成 byte[]
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.AspNetCore;
|
namespace ThingsGateway.AspNetCore;
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.AspNetCore;
|
namespace ThingsGateway.AspNetCore;
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
|
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.AspNetCore;
|
namespace ThingsGateway.AspNetCore;
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ using System.Reflection;
|
|||||||
|
|
||||||
using ThingsGateway;
|
using ThingsGateway;
|
||||||
using ThingsGateway.ConfigurableOptions;
|
using ThingsGateway.ConfigurableOptions;
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.DependencyInjection;
|
namespace Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Templates.Extensions;
|
using ThingsGateway.Templates.Extensions;
|
||||||
|
|
||||||
namespace ThingsGateway.DataValidation;
|
namespace ThingsGateway.DataValidation;
|
||||||
|
@@ -21,7 +21,7 @@ using System.Collections.Concurrent;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.UnifyResult;
|
using ThingsGateway.UnifyResult;
|
||||||
|
|
||||||
namespace ThingsGateway.DynamicApiController;
|
namespace ThingsGateway.DynamicApiController;
|
||||||
|
@@ -17,7 +17,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Templates.Extensions;
|
using ThingsGateway.Templates.Extensions;
|
||||||
|
|
||||||
namespace ThingsGateway.FriendlyException;
|
namespace ThingsGateway.FriendlyException;
|
||||||
|
@@ -16,7 +16,7 @@ using Microsoft.AspNetCore.SignalR;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway;
|
using ThingsGateway;
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.InstantMessaging;
|
using ThingsGateway.InstantMessaging;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Builder;
|
namespace Microsoft.AspNetCore.Builder;
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.Logging;
|
namespace ThingsGateway.Logging;
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ using System.Text.Json;
|
|||||||
|
|
||||||
using ThingsGateway;
|
using ThingsGateway;
|
||||||
using ThingsGateway.DataValidation;
|
using ThingsGateway.DataValidation;
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.FriendlyException;
|
using ThingsGateway.FriendlyException;
|
||||||
using ThingsGateway.JsonSerialization;
|
using ThingsGateway.JsonSerialization;
|
||||||
using ThingsGateway.Logging;
|
using ThingsGateway.Logging;
|
||||||
|
@@ -16,7 +16,7 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Options;
|
using ThingsGateway.Options;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.Options;
|
namespace Microsoft.Extensions.Options;
|
||||||
|
@@ -31,7 +31,7 @@ using System.Xml.Linq;
|
|||||||
using System.Xml.XPath;
|
using System.Xml.XPath;
|
||||||
|
|
||||||
using ThingsGateway.DynamicApiController;
|
using ThingsGateway.DynamicApiController;
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Reflection;
|
using ThingsGateway.Reflection;
|
||||||
|
|
||||||
namespace ThingsGateway.SpecificationDocument;
|
namespace ThingsGateway.SpecificationDocument;
|
||||||
|
@@ -20,7 +20,7 @@ using System.Reflection;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.SpecificationDocument;
|
namespace ThingsGateway.SpecificationDocument;
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.Templates.Extensions;
|
namespace ThingsGateway.Templates.Extensions;
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.UnifyResult;
|
using ThingsGateway.UnifyResult;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc;
|
namespace Microsoft.AspNetCore.Mvc;
|
||||||
|
@@ -22,7 +22,7 @@ using Microsoft.Extensions.Options;
|
|||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.FriendlyException;
|
using ThingsGateway.FriendlyException;
|
||||||
|
|
||||||
namespace ThingsGateway.UnifyResult;
|
namespace ThingsGateway.UnifyResult;
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.Converters.Json;
|
namespace ThingsGateway.Converters.Json;
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="Assembly" /> 拓展类
|
/// <see cref="Assembly" /> 拓展类
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="ConcurrentDictionary{TKey, TValue}" /> 拓展类
|
/// <see cref="ConcurrentDictionary{TKey, TValue}" /> 拓展类
|
||||||
|
@@ -15,7 +15,7 @@ using Microsoft.Extensions.Hosting;
|
|||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 核心模块 <see cref="IServiceCollection" /> 拓展类
|
/// 核心模块 <see cref="IServiceCollection" /> 拓展类
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="DataTable" /> 和 <see cref="DataSet" /> 拓展类
|
/// <see cref="DataTable" /> 和 <see cref="DataSet" /> 拓展类
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 委托拓展类
|
/// 委托拓展类
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 枚举拓展类
|
/// 枚举拓展类
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="EventHandler{TEventArgs}" /> 拓展类
|
/// <see cref="EventHandler{TEventArgs}" /> 拓展类
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="ICollection{T}" /> 拓展类
|
/// <see cref="ICollection{T}" /> 拓展类
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="IDictionary{TKey, TValue}" /> 拓展类
|
/// <see cref="IDictionary{TKey, TValue}" /> 拓展类
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="IEnumerable" /> 拓展类
|
/// <see cref="IEnumerable" /> 拓展类
|
||||||
|
@@ -18,7 +18,7 @@ using System.Text.RegularExpressions;
|
|||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// System.Text.Json 拓展类
|
/// System.Text.Json 拓展类
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="Expression" /> 拓展类
|
/// <see cref="Expression" /> 拓展类
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="MethodInfo" /> 拓展类
|
/// <see cref="MethodInfo" /> 拓展类
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数值类型拓展类
|
/// 数值类型拓展类
|
||||||
|
@@ -17,7 +17,7 @@ using System.Reflection;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="string" /> 拓展类
|
/// <see cref="string" /> 拓展类
|
||||||
|
@@ -15,7 +15,7 @@ using System.Reflection;
|
|||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="Type" /> 拓展类
|
/// <see cref="Type" /> 拓展类
|
||||||
|
@@ -13,7 +13,7 @@ using System.Buffers;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="Utf8JsonReader" /> 拓展类
|
/// <see cref="Utf8JsonReader" /> 拓展类
|
||||||
|
@@ -16,7 +16,7 @@ using System.Text.Json;
|
|||||||
|
|
||||||
using ThingsGateway.Utilities;
|
using ThingsGateway.Utilities;
|
||||||
|
|
||||||
namespace ThingsGateway.Extensions;
|
namespace ThingsGateway.Extension;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="object" /> 拓展类
|
/// <see cref="object" /> 拓展类
|
||||||
|
@@ -13,7 +13,7 @@ using System.Collections.Concurrent;
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.Reflection;
|
namespace ThingsGateway.Reflection;
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ using System.Collections.Concurrent;
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.Reflection;
|
namespace ThingsGateway.Reflection;
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.Utilities;
|
namespace ThingsGateway.Utilities;
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.Utilities;
|
namespace ThingsGateway.Utilities;
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ using Microsoft.Net.Http.Headers;
|
|||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
|
|
||||||
using ThingsGateway.AspNetCore.Extensions;
|
using ThingsGateway.AspNetCore.Extensions;
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
using MediaTypeHeaderValue = System.Net.Http.Headers.MediaTypeHeaderValue;
|
using MediaTypeHeaderValue = System.Net.Http.Headers.MediaTypeHeaderValue;
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Utilities;
|
using ThingsGateway.Utilities;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
@@ -16,7 +16,7 @@ using System.Text;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Utilities;
|
using ThingsGateway.Utilities;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
@@ -16,7 +16,7 @@ using Microsoft.Extensions.Logging;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ using System.Net.Mime;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Utilities;
|
using ThingsGateway.Utilities;
|
||||||
|
|
||||||
using MediaTypeHeaderValue = System.Net.Http.Headers.MediaTypeHeaderValue;
|
using MediaTypeHeaderValue = System.Net.Http.Headers.MediaTypeHeaderValue;
|
||||||
|
@@ -16,7 +16,7 @@ using System.Globalization;
|
|||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
using CacheControlHeaderValue = System.Net.Http.Headers.CacheControlHeaderValue;
|
using CacheControlHeaderValue = System.Net.Http.Headers.CacheControlHeaderValue;
|
||||||
using StringWithQualityHeaderValue = System.Net.Http.Headers.StringWithQualityHeaderValue;
|
using StringWithQualityHeaderValue = System.Net.Http.Headers.StringWithQualityHeaderValue;
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Utilities;
|
using ThingsGateway.Utilities;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Utilities;
|
using ThingsGateway.Utilities;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
@@ -14,7 +14,7 @@ using System.Net.Mime;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Utilities;
|
using ThingsGateway.Utilities;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Utilities;
|
using ThingsGateway.Utilities;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Utilities;
|
using ThingsGateway.Utilities;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
|
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote.Extensions;
|
namespace ThingsGateway.HttpRemote.Extensions;
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ using System.Net.Http.Headers;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Utilities;
|
using ThingsGateway.Utilities;
|
||||||
|
|
||||||
using StringWithQualityHeaderValue = System.Net.Http.Headers.StringWithQualityHeaderValue;
|
using StringWithQualityHeaderValue = System.Net.Http.Headers.StringWithQualityHeaderValue;
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.HttpRemote.Extensions;
|
using ThingsGateway.HttpRemote.Extensions;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@ using Microsoft.Extensions.Options;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@ using Microsoft.Extensions.Options;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ using Microsoft.Extensions.Options;
|
|||||||
|
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Utilities;
|
using ThingsGateway.Utilities;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
@@ -14,7 +14,7 @@ using System.Net.Http.Headers;
|
|||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ using System.Net.Http.Headers;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ using System.Globalization;
|
|||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ using System.Text;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ using System.Net;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
using System.Net.WebSockets;
|
using System.Net.WebSockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.HttpRemote;
|
namespace ThingsGateway.HttpRemote;
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ using System.Net.Mime;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.Shapeless;
|
namespace ThingsGateway.Shapeless;
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ using System.Text.Json.Nodes;
|
|||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.Shapeless;
|
namespace ThingsGateway.Shapeless;
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ using System.Dynamic;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
using ThingsGateway.Shapeless.Extensions;
|
using ThingsGateway.Shapeless.Extensions;
|
||||||
|
|
||||||
using Binder = Microsoft.CSharp.RuntimeBinder.Binder;
|
using Binder = Microsoft.CSharp.RuntimeBinder.Binder;
|
||||||
|
@@ -15,7 +15,7 @@ using System.Dynamic;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.Shapeless;
|
namespace ThingsGateway.Shapeless;
|
||||||
|
|
||||||
|
@@ -155,7 +155,7 @@ public static class DateExtensions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="timestamp"></param>
|
/// <param name="timestamp"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static DateTime ConvertToDateTime(this long timestamp)
|
public static DateTime ConvertToDateTime(this long timestamp)
|
||||||
{
|
{
|
||||||
var timeStampDateTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
var timeStampDateTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
var digitCount = (int)Math.Floor(Math.Log10(timestamp) + 1);
|
var digitCount = (int)Math.Floor(Math.Log10(timestamp) + 1);
|
||||||
@@ -169,4 +169,5 @@ public static class DateExtensions
|
|||||||
? timeStampDateTime.AddMilliseconds(timestamp) // 13 位时间戳
|
? timeStampDateTime.AddMilliseconds(timestamp) // 13 位时间戳
|
||||||
: timeStampDateTime.AddSeconds(timestamp)).ToLocalTime(); // 10 位时间戳
|
: timeStampDateTime.AddSeconds(timestamp)).ToLocalTime(); // 10 位时间戳
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -8,13 +8,14 @@
|
|||||||
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
#endif
|
||||||
|
|
||||||
using ThingsGateway.Extensions;
|
using ThingsGateway.Extension;
|
||||||
|
|
||||||
namespace ThingsGateway.JsonSerialization;
|
namespace ThingsGateway.JsonSerialization;
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ namespace ThingsGateway.JsonSerialization;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal static class Penetrates
|
internal static class Penetrates
|
||||||
{
|
{
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 转换
|
/// 转换
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -35,7 +37,6 @@ internal static class Penetrates
|
|||||||
{
|
{
|
||||||
return longValue.ConvertToDateTime();
|
return longValue.ConvertToDateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
var stringValue = reader.GetString();
|
var stringValue = reader.GetString();
|
||||||
|
|
||||||
// 处理时间戳自动转换
|
// 处理时间戳自动转换
|
||||||
@@ -46,6 +47,9 @@ internal static class Penetrates
|
|||||||
|
|
||||||
return Convert.ToDateTime(stringValue);
|
return Convert.ToDateTime(stringValue);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 转换
|
/// 转换
|
||||||
@@ -69,4 +73,6 @@ internal static class Penetrates
|
|||||||
|
|
||||||
return Convert.ToDateTime(stringValue);
|
return Convert.ToDateTime(stringValue);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
@@ -53,12 +53,16 @@ public static class LinqExtensions
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public static void RemoveWhere<T>(this ICollection<T> @this, Func<T, bool> @where)
|
public static void RemoveWhere<T>(this ICollection<T> @this, Func<T, bool> @where)
|
||||||
{
|
{
|
||||||
foreach (var obj in @this.Where(where).ToList())
|
var del = new List<T>();
|
||||||
|
foreach (var obj in @this.Where(where))
|
||||||
|
{
|
||||||
|
del.Add(obj);
|
||||||
|
}
|
||||||
|
foreach (var obj in del)
|
||||||
{
|
{
|
||||||
@this.Remove(obj);
|
@this.Remove(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public static IEnumerable<T> WhereIf<T>(this IEnumerable<T> thisValue, bool isOk, Func<T, bool> predicate)
|
public static IEnumerable<T> WhereIf<T>(this IEnumerable<T> thisValue, bool isOk, Func<T, bool> predicate)
|
||||||
{
|
{
|
||||||
|
@@ -0,0 +1,34 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
|
||||||
|
// 此代码版权(除特别声明外的代码)归作者本人Diego所有
|
||||||
|
// 源代码使用协议遵循本仓库的开源协议及附加协议
|
||||||
|
// Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
|
||||||
|
// Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
|
||||||
|
// 使用文档:https://thingsgateway.cn/
|
||||||
|
// QQ群:605534569
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ThingsGateway.Foundation;
|
||||||
|
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public class NewtonsoftEncodingConverter : Newtonsoft.Json.JsonConverter<Encoding>
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public override Encoding? ReadJson(JsonReader reader, Type objectType, Encoding? existingValue, bool hasExistingValue, Newtonsoft.Json.JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
// 从 JSON 字符串中读取编码名称,并创建相应的 Encoding 对象
|
||||||
|
string? encodingName = reader.Value as string;
|
||||||
|
return Encoding.GetEncoding(encodingName ?? Encoding.UTF8.WebName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public override void WriteJson(JsonWriter writer, Encoding? value, Newtonsoft.Json.JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
writer.WriteValue(value.WebName);
|
||||||
|
}
|
||||||
|
}
|
@@ -8,6 +8,7 @@
|
|||||||
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
@@ -17,7 +18,6 @@ namespace ThingsGateway.JsonSerialization;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateOnly 类型序列化
|
/// DateOnly 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftJsonDateOnlyJsonConverter : JsonConverter<DateOnly>
|
public class NewtonsoftJsonDateOnlyJsonConverter : JsonConverter<DateOnly>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -72,7 +72,6 @@ public class NewtonsoftJsonDateOnlyJsonConverter : JsonConverter<DateOnly>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateOnly? 类型序列化
|
/// DateOnly? 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftJsonNullableDateOnlyJsonConverter : JsonConverter<DateOnly?>
|
public class NewtonsoftJsonNullableDateOnlyJsonConverter : JsonConverter<DateOnly?>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -123,4 +122,6 @@ public class NewtonsoftJsonNullableDateOnlyJsonConverter : JsonConverter<DateOnl
|
|||||||
if (value == null) writer.WriteNull();
|
if (value == null) writer.WriteNull();
|
||||||
else writer.WriteValue(value.Value.ToString(Format));
|
else writer.WriteValue(value.Value.ToString(Format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@@ -16,7 +16,7 @@ namespace ThingsGateway.JsonSerialization;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateTime 类型序列化
|
/// DateTime 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftJsonDateTimeJsonConverter : JsonConverter<DateTime>
|
public class NewtonsoftJsonDateTimeJsonConverter : JsonConverter<DateTime>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -90,7 +90,7 @@ public class NewtonsoftJsonDateTimeJsonConverter : JsonConverter<DateTime>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateTime 类型序列化
|
/// DateTime 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftNullableJsonDateTimeJsonConverter : JsonConverter<DateTime?>
|
public class NewtonsoftNullableJsonDateTimeJsonConverter : JsonConverter<DateTime?>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
@@ -16,7 +16,6 @@ namespace ThingsGateway.JsonSerialization;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateTimeOffset 类型序列化
|
/// DateTimeOffset 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftJsonDateTimeOffsetJsonConverter : JsonConverter<DateTimeOffset>
|
public class NewtonsoftJsonDateTimeOffsetJsonConverter : JsonConverter<DateTimeOffset>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -90,7 +89,6 @@ public class NewtonsoftJsonDateTimeOffsetJsonConverter : JsonConverter<DateTimeO
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateTimeOffset 类型序列化
|
/// DateTimeOffset 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftJsonNullableDateTimeOffsetJsonConverter : JsonConverter<DateTimeOffset?>
|
public class NewtonsoftJsonNullableDateTimeOffsetJsonConverter : JsonConverter<DateTimeOffset?>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
@@ -8,7 +8,7 @@
|
|||||||
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
@@ -18,7 +18,6 @@ namespace ThingsGateway.JsonSerialization;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="System.Text.Json.Nodes.JsonObject"/> 类型序列化
|
/// <see cref="System.Text.Json.Nodes.JsonObject"/> 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftJsonJsonObjectJsonConverter : JsonConverter<System.Text.Json.Nodes.JsonObject>
|
public class NewtonsoftJsonJsonObjectJsonConverter : JsonConverter<System.Text.Json.Nodes.JsonObject>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -50,7 +49,6 @@ public class NewtonsoftJsonJsonObjectJsonConverter : JsonConverter<System.Text.J
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="System.Text.Json.Nodes.JsonArray"/> 类型序列化
|
/// <see cref="System.Text.Json.Nodes.JsonArray"/> 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftJsonJsonArrayJsonConverter : JsonConverter<System.Text.Json.Nodes.JsonArray>
|
public class NewtonsoftJsonJsonArrayJsonConverter : JsonConverter<System.Text.Json.Nodes.JsonArray>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -77,4 +75,6 @@ public class NewtonsoftJsonJsonArrayJsonConverter : JsonConverter<System.Text.Js
|
|||||||
{
|
{
|
||||||
writer.WriteRawValue(value.ToJsonString());
|
writer.WriteRawValue(value.ToJsonString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@@ -17,7 +17,6 @@ namespace ThingsGateway.JsonSerialization;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解决 long 精度问题
|
/// 解决 long 精度问题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftJsonLongToStringJsonConverter : JsonConverter<long>
|
public class NewtonsoftJsonLongToStringJsonConverter : JsonConverter<long>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -79,7 +78,6 @@ public class NewtonsoftJsonLongToStringJsonConverter : JsonConverter<long>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解决 long? 精度问题
|
/// 解决 long? 精度问题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftJsonNullableLongToStringJsonConverter : JsonConverter<long?>
|
public class NewtonsoftJsonNullableLongToStringJsonConverter : JsonConverter<long?>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
@@ -8,7 +8,7 @@
|
|||||||
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
@@ -17,7 +17,6 @@ namespace ThingsGateway.JsonSerialization;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// TimeOnly 类型序列化
|
/// TimeOnly 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftJsonTimeOnlyJsonConverter : JsonConverter<TimeOnly>
|
public class NewtonsoftJsonTimeOnlyJsonConverter : JsonConverter<TimeOnly>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -72,7 +71,6 @@ public class NewtonsoftJsonTimeOnlyJsonConverter : JsonConverter<TimeOnly>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// TimeOnly? 类型序列化
|
/// TimeOnly? 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class NewtonsoftJsonNullableTimeOnlyJsonConverter : JsonConverter<TimeOnly?>
|
public class NewtonsoftJsonNullableTimeOnlyJsonConverter : JsonConverter<TimeOnly?>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -123,4 +121,6 @@ public class NewtonsoftJsonNullableTimeOnlyJsonConverter : JsonConverter<TimeOnl
|
|||||||
if (value == null) writer.WriteNull();
|
if (value == null) writer.WriteNull();
|
||||||
else writer.WriteValue(value.Value.ToString(Format));
|
else writer.WriteValue(value.Value.ToString(Format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@@ -14,8 +14,6 @@ using System.Text.Json;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace ThingsGateway.Foundation;
|
namespace ThingsGateway.Foundation;
|
||||||
@@ -41,21 +39,3 @@ public class EncodingConverter : System.Text.Json.Serialization.JsonConverter<En
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public class NewtonsoftEncodingConverter : Newtonsoft.Json.JsonConverter<Encoding>
|
|
||||||
{
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override Encoding? ReadJson(JsonReader reader, Type objectType, Encoding? existingValue, bool hasExistingValue, Newtonsoft.Json.JsonSerializer serializer)
|
|
||||||
{
|
|
||||||
// 从 JSON 字符串中读取编码名称,并创建相应的 Encoding 对象
|
|
||||||
string? encodingName = reader.Value as string;
|
|
||||||
return Encoding.GetEncoding(encodingName ?? Encoding.UTF8.WebName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override void WriteJson(JsonWriter writer, Encoding? value, Newtonsoft.Json.JsonSerializer serializer)
|
|
||||||
{
|
|
||||||
writer.WriteValue(value.WebName);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -8,6 +8,7 @@
|
|||||||
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
@@ -17,7 +18,6 @@ namespace ThingsGateway.JsonSerialization;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateOnly 类型序列化
|
/// DateOnly 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class SystemTextJsonDateOnlyJsonConverter : JsonConverter<DateOnly>
|
public class SystemTextJsonDateOnlyJsonConverter : JsonConverter<DateOnly>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -69,7 +69,6 @@ public class SystemTextJsonDateOnlyJsonConverter : JsonConverter<DateOnly>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateOnly? 类型序列化
|
/// DateOnly? 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class SystemTextJsonNullableDateOnlyJsonConverter : JsonConverter<DateOnly?>
|
public class SystemTextJsonNullableDateOnlyJsonConverter : JsonConverter<DateOnly?>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -117,4 +116,6 @@ public class SystemTextJsonNullableDateOnlyJsonConverter : JsonConverter<DateOnl
|
|||||||
if (value == null) writer.WriteNullValue();
|
if (value == null) writer.WriteNullValue();
|
||||||
else writer.WriteStringValue(value.Value.ToString(Format));
|
else writer.WriteStringValue(value.Value.ToString(Format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@@ -8,6 +8,7 @@
|
|||||||
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
@@ -17,7 +18,6 @@ namespace ThingsGateway.JsonSerialization;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateTime 类型序列化
|
/// DateTime 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class SystemTextJsonDateTimeJsonConverter : JsonConverter<DateTime>
|
public class SystemTextJsonDateTimeJsonConverter : JsonConverter<DateTime>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -87,7 +87,6 @@ public class SystemTextJsonDateTimeJsonConverter : JsonConverter<DateTime>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateTime? 类型序列化
|
/// DateTime? 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class SystemTextJsonNullableDateTimeJsonConverter : JsonConverter<DateTime?>
|
public class SystemTextJsonNullableDateTimeJsonConverter : JsonConverter<DateTime?>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -156,4 +155,6 @@ public class SystemTextJsonNullableDateTimeJsonConverter : JsonConverter<DateTim
|
|||||||
writer.WriteStringValue(formatDateTime.ToString(Format));
|
writer.WriteStringValue(formatDateTime.ToString(Format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@@ -8,6 +8,7 @@
|
|||||||
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
@@ -17,7 +18,6 @@ namespace ThingsGateway.JsonSerialization;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateTimeOffset 类型序列化
|
/// DateTimeOffset 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class SystemTextJsonDateTimeOffsetJsonConverter : JsonConverter<DateTimeOffset>
|
public class SystemTextJsonDateTimeOffsetJsonConverter : JsonConverter<DateTimeOffset>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -87,7 +87,6 @@ public class SystemTextJsonDateTimeOffsetJsonConverter : JsonConverter<DateTimeO
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// DateTimeOffset? 类型序列化
|
/// DateTimeOffset? 类型序列化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class SystemTextJsonNullableDateTimeOffsetJsonConverter : JsonConverter<DateTimeOffset?>
|
public class SystemTextJsonNullableDateTimeOffsetJsonConverter : JsonConverter<DateTimeOffset?>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -156,4 +155,5 @@ public class SystemTextJsonNullableDateTimeOffsetJsonConverter : JsonConverter<D
|
|||||||
writer.WriteStringValue(formatDateTime.ToString(Format));
|
writer.WriteStringValue(formatDateTime.ToString(Format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -8,6 +8,7 @@
|
|||||||
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
// 项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。
|
||||||
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
// 许可证的完整文本可以在源代码树根目录中的 LICENSE-APACHE 和 LICENSE-MIT 文件中找到。
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
@@ -17,7 +18,6 @@ namespace ThingsGateway.JsonSerialization;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解决 long 精度问题
|
/// 解决 long 精度问题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class SystemTextJsonLongToStringJsonConverter : JsonConverter<long>
|
public class SystemTextJsonLongToStringJsonConverter : JsonConverter<long>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -75,7 +75,6 @@ public class SystemTextJsonLongToStringJsonConverter : JsonConverter<long>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解决 long? 精度问题
|
/// 解决 long? 精度问题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressSniffer]
|
|
||||||
public class SystemTextJsonNullableLongToStringJsonConverter : JsonConverter<long?>
|
public class SystemTextJsonNullableLongToStringJsonConverter : JsonConverter<long?>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -133,4 +132,5 @@ public class SystemTextJsonNullableLongToStringJsonConverter : JsonConverter<lon
|
|||||||
else writer.WriteStringValue(newValue.ToString());
|
else writer.WriteStringValue(newValue.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user