新增非法字段检查

This commit is contained in:
2024-02-06 15:37:21 +08:00
parent 719cd2d8e7
commit d58c9d5177
8 changed files with 102 additions and 31 deletions

View File

@@ -1,4 +1,5 @@
using System.Text.RegularExpressions;
using System.Text.Json;
using System.Text.RegularExpressions;
using ZstdSharp;
namespace MesETL.App.Helpers;
@@ -121,5 +122,17 @@ public static partial class DumpDataHelper
var reader = new StreamReader(ds);
return await reader.ReadToEndAsync();
}
public static bool IsJson(string str)
{
try
{
JsonDocument.Parse(str);
return true;
}
catch (JsonException)
{
return false;
}
}
}