📄 assemblyclscompliantrule.cs
字号:
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krueger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.IO;
using System.Reflection;
namespace ICSharpCode.AssemblyAnalyser.Rules
{
/// <summary>
/// Description of AssemblyStrongName.
/// </summary>
public class AssemblyClsCompliantRule : AbstractReflectionRule, IAssemblyRule
{
public override string Description {
get {
return "${res:ICSharpCode.AssemblyAnalyser.Rules.AssemblyClsCompliantRule.Description}";
}
}
public override string Details {
get {
return "${res:ICSharpCode.AssemblyAnalyser.Rules.AssemblyClsCompliantRule.Details}";
}
}
public AssemblyClsCompliantRule()
{
certainty = 99;
}
public Resolution Check(Assembly assembly)
{
object[] attributes = assembly.GetCustomAttributes(typeof(System.CLSCompliantAttribute), true);
if (attributes == null || attributes.Length == 0) {
return new Resolution(this, "${res:ICSharpCode.AssemblyAnalyser.Rules.AssemblyClsCompliantRule.Resolution1}", assembly.Location, new string[,] { {"AssemblyName", Path.GetFileName(assembly.Location)} });
} else {
foreach (CLSCompliantAttribute attr in attributes) {
if (!attr.IsCompliant) {
return new Resolution(this, "${res:ICSharpCode.AssemblyAnalyser.Rules.AssemblyClsCompliantRule.Resolution2}", assembly.Location, new string[,] { {"AssemblyName", Path.GetFileName(assembly.Location)} });
}
}
}
return null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -