旧存档的假卡补上风扇数、供电口破绽

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Sonnet 5.5 committed 2026-11-04 22:24:19 +08:00
1 parent 39ab7822ba
commit c10cf1ea19
3 files changed
+36 -1

No files matched your search

+13
View File
@@ -63,6 +63,19 @@ namespace Decentralized.Domain
/// <summary>六位数字,存在物品标签上:风扇、金手指、挡板、丝印、封条、序列号。</summary>
public string Encode() => $"{Fan}{Fingers}{Bracket}{Print}{Sticker}{Serial}{CountBad}{PinBad}";
/// <summary>
/// 旧版存档的外观只有 5 或 6 位(没有风扇数、供电口两位):旧规则里假卡的风扇数和供电口只要档次不同就一定对不上。
/// 这里按旧规则补上,旧存档里的假卡仍然露出同样的破绽。新格式(8 位)不动。
/// </summary>
public static CardLook Legacy(string encoded, CardLook look, string label, string chip)
{
if (encoded == null || encoded.Length >= 8 || string.IsNullOrEmpty(chip) || chip == label) return look;
var l = Hardware.Specs[label]; var c = Hardware.Specs[chip];
look.CountBad = Hardware.FanCount[l.Tier] != Hardware.FanCount[c.Tier] ? 1 : 0;
look.PinBad = Hardware.PinClass[l.Tier] != Hardware.PinClass[c.Tier] ? 1 : 0;
return look;
}
public static CardLook Decode(string s)
{
if (s == null || s.Length < 5 || s.Length > 8) return default;