Skip to content

Commit

Permalink
1. 调整65进制以上的字符关系
Browse files Browse the repository at this point in the history
2. 调整雪花id
ldqk committed Aug 31, 2023
1 parent 2648f7d commit f59dec8
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Masuit.Tools.Abstractions/Strings/NumberFormater.cs
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ public NumberFormater(byte @base, byte offset = 0)
{
<= 2 => "01",
> 2 and < 65 => "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/".Substring(0, @base),
>= 65 and <= 95 => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._!@$#%*+?&()/\\,-:;<=>?[]^`{|}~'\"".Substring(0, @base),
>= 65 and <= 95 => "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-!~'*()@$#%+?&/\\,:;<=>?[]^`{|}\"".Substring(0, @base),
_ => throw new ArgumentException("默认进制最大支持91进制")
};

5 changes: 4 additions & 1 deletion Masuit.Tools.Abstractions/Systems/SnowFlake.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Masuit.Tools.DateTimeExt;
using Masuit.Tools.Strings;
using System;
using System.Linq;
using System.Net.NetworkInformation;

namespace Masuit.Tools.Systems
{
@@ -49,7 +51,8 @@ public static SnowFlake GetInstance()
/// </summary>
public SnowFlake()
{
Snowflakes(0);
var bytes = NetworkInterface.GetAllNetworkInterfaces().FirstOrDefault().GetPhysicalAddress().GetAddressBytes();
Snowflakes(bytes[4] << 4 | bytes[5]);
}

/// <summary>

0 comments on commit f59dec8

Please sign in to comment.