baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
Executable
+30
@@ -0,0 +1,30 @@
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public static class TraceUtility
|
||||
{
|
||||
public static string GenerateAgentId()
|
||||
{
|
||||
var host = IpHelper.GetIPv4().NullOrEmpty2Default("127.0.0.1");
|
||||
if (!IPAddress.TryParse(host, out var address))
|
||||
{
|
||||
address = Dns.GetHostEntry(host).AddressList.First();
|
||||
}
|
||||
var hashValue = new MD5CryptoServiceProvider().ComputeHash(Encoding.Default.GetBytes(Shared.Constants.AppNames.Self));
|
||||
var builder = new StringBuilder();
|
||||
for (int index = 0; index < hashValue.Length; index++)
|
||||
{
|
||||
builder.Append(hashValue[index].ToString("x").PadLeft(1, '0'));
|
||||
}
|
||||
var appName = builder.ToString();
|
||||
var start = appName.Length > 6 ? appName.Length - 6 : 0;
|
||||
var length = appName.Length < 6 ? appName.Length : 6;
|
||||
return $"{address}_{appName.Substring(start, length)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user