Skip to content

Commit

Permalink
节点版本匹配时,支持runtime的大于小于
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Nov 18, 2024
1 parent 3998e38 commit 99a22f6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Stardust.Data/Nodes/节点版本.Biz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,24 @@ public String MatchResult(Node node)
var runtime = node.Runtime;
if (runtime.IsNullOrEmpty() || !vs.Any(e => e.IsMatch(runtime))) return $"[{runtime}] not Match {vs.Join(",")}";
}
else if (Rules.TryGetValue("runtime>", out vs))
{
var str = node.Runtime;
if (str.IsNullOrEmpty()) return "Version is null";
if (!System.Version.TryParse(str, out var ver1)) return $"Runtime=[{str}] is invalid";
if (!System.Version.TryParse(vs[0], out var ver2)) return $"vs[0]=[{vs[0]}] is invalid";

if (ver1 < ver2) return $"Runtime=[{ver1}] < {ver2}";
}
else if (Rules.TryGetValue("runtime<", out vs))
{
var str = node.Runtime;
if (str.IsNullOrEmpty()) return "Version is null";
if (!System.Version.TryParse(str, out var ver1)) return $"Runtime=[{str}] is invalid";
if (!System.Version.TryParse(vs[0], out var ver2)) return $"vs[0]=[{vs[0]}] is invalid";

if (ver1 > ver2) return $"Runtime=[{ver1}] > {ver2}";
}

if (Rules.TryGetValue("framework", out vs))
{
Expand Down

0 comments on commit 99a22f6

Please sign in to comment.