Skip to content

Commit

Permalink
有些标识符刚好带有大括号,导致误判以为是未解析变量
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Oct 24, 2024
1 parent edf6d26 commit 848cbb9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Stardust.Server/Services/NodeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,19 @@ private String BuildCode(NodeInfo di, String productCode, StarServerSetting set)
}
span?.AppendTag($"uid={uid}");

if (uid.Contains('{') || uid.Contains('}')) XTrace.WriteLine("节点编码公式有误,存在未解析变量,uid={0}", uid);
var p1 = uid.IndexOf('{');
if (p1 > 0)
{
var p2 = uid.IndexOf('}', p1 + 1);
if (p2 > 0)
{
// 有些标识符刚好带有大括号,导致误判以为是未解析变量
var len = p2 - p1 - 1;
if (len >= 2 && len < 10)
XTrace.WriteLine("节点编码公式有误,存在未解析变量,uid={0}", uid);
}
}
//if (uid.Contains('{') || uid.Contains('}')) XTrace.WriteLine("节点编码公式有误,存在未解析变量,uid={0}", uid);
if (!uid.IsNullOrEmpty())
{
XTrace.WriteLine("生成节点编码 uid={0} alg={1}", uid, ss[0]);
Expand Down

0 comments on commit 848cbb9

Please sign in to comment.