protected virtual bool ReadModuleDependency(ICSharpCode.NRefactory.CSharp.Attribute attr, string name, ResolveResult resolveResult) { if ((name == (Translator.Bridge_ASSEMBLY + ".ModuleDependency")) || (resolveResult != null && resolveResult.Type != null && resolveResult.Type.FullName == (Translator.Bridge_ASSEMBLY + ".ModuleDependencyAttribute"))) { if (attr.Arguments.Count > 0) { ModuleDependency dependency = new ModuleDependency(); object nameObj = this.GetAttributeArgumentValue(attr, resolveResult, 0); if (nameObj is string) { dependency.DependencyName = nameObj.ToString(); } nameObj = this.GetAttributeArgumentValue(attr, resolveResult, 1); if (nameObj is string) { dependency.VariableName = nameObj.ToString(); } this.AssemblyInfo.Dependencies.Add(dependency); } return true; } return false; }
public virtual void CheckModuleDependenies(TypeDefinition type, ITranslator translator) { if (type.HasCustomAttributes) { var attr = this.GetAttribute(type.CustomAttributes, Translator.Bridge_ASSEMBLY + ".ModuleDependencyAttribute"); if (attr != null) { var typeInfo = this.EnsureTypeInfo(type, translator); if (attr.ConstructorArguments.Count > 0) { ModuleDependency dependency = new ModuleDependency(); var obj = this.GetAttributeArgumentValue(attr, 0); dependency.DependencyName = obj is string ? obj.ToString() : ""; if (attr.ConstructorArguments.Count > 1) { obj = this.GetAttributeArgumentValue(attr, 1); dependency.VariableName = obj is string ? obj.ToString() : ""; } typeInfo.Dependencies.Add(dependency); } } } }