ClassLibraryWeiBao/QR二维码/Masking/Scoring/PenaltyFactory.cs
(完整代码) 942Busing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Gma.QrCodeNet.Encoding.Masking.Scoring
{
/// <summary>
/// Description of PenaltyFactory.
/// </summary>
internal class PenaltyFactory
{
internal Penalty CreateByRule(PenaltyRules penaltyRule)
{
switch(penaltyRule)
{
case PenaltyRules.Rule01:
return new Penalty1();
case PenaltyRules.Rule02:
return new Penalty2();
case PenaltyRules.Rule03:
return new Penalty3();
case PenaltyRules.Rule04:
return new Penalty4();
default:
throw new ArgumentException(string.Format("Unsupport penalty rule : {0}", penaltyRule), "penaltyRule");
}
}
internal IEnumerable<Penalty> AllRules()
{
foreach(PenaltyRules penaltyRule in Enum.GetValues(typeof(PenaltyRules)))
{
yield return CreateByRule(penaltyRule);
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。