Cilador.Fody.Core.ModuleWeaver.GetWeaverFor C# (CSharp) Метод

GetWeaverFor() приватный Метод

Finds the weave that corresponds to a given weave attribute for a type
No weave is found that corresponds to the
private GetWeaverFor ( Mono.Cecil.TypeDefinition targetType, CustomAttribute weaveAttribute ) : IWeave
targetType Mono.Cecil.TypeDefinition Type that is the target for the command
weaveAttribute Mono.Cecil.CustomAttribute Attribute to find command for
Результат IWeave
        private IWeave GetWeaverFor(TypeDefinition targetType, CustomAttribute weaveAttribute)
        {
            Contract.Requires(targetType != null);
            Contract.Requires(weaveAttribute != null);
            Contract.Ensures(Contract.Result<IWeave>() != null);

            var weaveAttributeType = weaveAttribute.AttributeType.Resolve();
            try
            {
                return this.Weaves.First(command =>
                    this.ModuleDefinition.Import(command.Metadata.AttributeType).Resolve() == weaveAttributeType &&
                    command.Value.IsInitialized).Value;
            }
            catch(Exception e)
            {
                throw new InvalidOperationException(
                    string.Format("Cannot find a configured weave for type [{0}] and weave attribute [{1}]", targetType.FullName, weaveAttributeType.FullName),
                    e);
            }
        }