• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Cecil.CustomAttribute类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Mono.Cecil.CustomAttribute的典型用法代码示例。如果您正苦于以下问题:C# CustomAttribute类的具体用法?C# CustomAttribute怎么用?C# CustomAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CustomAttribute类属于Mono.Cecil命名空间,在下文中一共展示了CustomAttribute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ShowDialog

 public virtual DialogResult ShowDialog(CustomAttribute attribute, CustomAttributeNamedArgument? argument, bool usefields)
 {
     m_selectedargument = argument;
     m_selectedattribute = attribute;
     m_usefields = usefields;
     return base.ShowDialog();
 }
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:7,代码来源:CustomAttributeNamedArgumentForm.cs


示例2: Transform

        /// <summary>
        /// Public translation interface.
        /// Translates the given method to GLSL
        /// </summary>
        /// <param name="s">Shader type definition.</param>
        /// <param name="m">A method representing a shader to translate.</param>
        /// <param name="attr">The shader type as attribute (either FragmentShaderAttribute or VertexShaderAttribute</param>
        /// <param name="type">The shader type as ShaderType</param>
        /// <returns>The translated GLSL shader source</returns>
        public FunctionDescription Transform(TypeDefinition s, MethodDefinition m, CustomAttribute attr,
            ShaderType type)
        {
            if (s == null)
                throw new ArgumentNullException("s");

            if (m == null)
                throw new ArgumentNullException("m");

            if (attr == null)
                throw new ArgumentNullException("attr");

            var ctx = new DecompilerContext(s.Module)
            {
                CurrentType = s,
                CurrentMethod = m,
                CancellationToken = CancellationToken.None
            };

            var d = AstMethodBodyBuilder.CreateMethodBody(m, ctx);

            var glsl = new GlslVisitor(d, attr, ctx);

            _functions.UnionWith(glsl.Functions);

            var entry = (bool)attr.ConstructorArguments.FirstOrDefault().Value;
            var sig = entry ? "void main()" : GlslVisitor.GetSignature(m);

            var code = glsl.Result;
            var desc = new FunctionDescription(entry ? "main" : Shader.GetMethodName(m), sig + code, entry, type);

            _dependencies.UnionWith(glsl.Dependencies);

            return desc;
        }
开发者ID:mono-soc-2011,项目名称:SLSharp,代码行数:44,代码来源:GlslTransform.cs


示例3: AppliedPatchInfo

        public AppliedPatchInfo(CustomAttribute cecilCustomAttribute)
        {
            _cecilCustomAttribute = cecilCustomAttribute;
            Name =  cecilCustomAttribute.Fields.Single(f => f.Name == "Name").Argument.Value.ToString();

            Version = int.Parse(
                cecilCustomAttribute.Fields.Single(f => f.Name == "Version").Argument.Value.ToString()
                );

            var catStr = PatchCategory.Unknown.ToString();
            var catField = cecilCustomAttribute.Fields.SingleOrDefault(f => f.Name == "Category");
            if (catField.Name == "Category")
            {
                catStr = catField.Argument.Value.ToString();
            }

            PatchCategory catTemp = PatchCategory.Unknown;
            Enum.TryParse(catStr, true, out catTemp);
            Category = catTemp;

            var codeBlocksObj = cecilCustomAttribute.Fields.SingleOrDefault(f => f.Name == "CodeBlocks");

            if (codeBlocksObj.Name == "CodeBlocks")
            {
                AppliedCodeBlocks = AppliedCodeBlock.Deserialise(codeBlocksObj.Argument.Value.ToString());
            }
            else
            {
                AppliedCodeBlocks = new List<AppliedCodeBlock>();
            }
        }
开发者ID:nugarin,项目名称:sotsos,代码行数:31,代码来源:AppliedPatchInfo.cs


示例4: Visit

        public void Visit(IBehaviorDefinition method, CustomAttribute attribute)
        {
            ILProcessor processor = method.Body.GetILProcessor();
            string description = attribute.Properties.Where(argument => (argument.Name == "Description")).First().Argument.Value as string;
            Instruction exitInstruction = processor.Create(OpCodes.Callvirt, method.Module.Import(broadcastType.GetMethod("Run", new[] {typeof(object), typeof(string)})));
            var returnValue = new VariableDefinition("retVal", method.Module.Import(typeof(object)));
            var enclosingObject = new VariableDefinition("enclosing", method.Module.Import(typeof(object)));
            method.Body.Variables.Add(enclosingObject);
            method.Body.Variables.Add(returnValue);
            Instruction store = processor.Create(OpCodes.Stloc, returnValue);
            Instruction reload = processor.Create(OpCodes.Ldloc, returnValue);
            var instructions = new List<Instruction>();
            if (!ReturnsVoid(method))
            {
                instructions.Add(store);
            }
            instructions.Add(processor.Create(OpCodes.Newobj, method.Module.Import(broadcastType.GetConstructor(new Type[] { }))));
            instructions.Add(processor.Create(OpCodes.Ldarg_0));
            instructions.Add(processor.Create(OpCodes.Ldstr, description));
            instructions.Add(exitInstruction);
            if (!ReturnsVoid(method))
            {
                instructions.Add(reload);
            }

            new InsertionAtEnd(processor, method).Run(instructions);
        }
开发者ID:asengupta,项目名称:Exo,代码行数:27,代码来源:PublishSelfWeave.cs


示例5: WillRemoveAttribute

        protected override void WillRemoveAttribute(ICustomAttributeProvider provider, CustomAttribute attribute)
        {
            var attr_type = attribute.Constructor.DeclaringType;
            if (attr_type.Namespace == Namespaces.ObjCRuntime) {
                switch (attr_type.Name) {
                case "AvailabilityAttribute":
                case "AvailabilityBaseAttribute":
                case "DeprecatedAttribute":
                case "IntroducedAttribute":
                    var dict = context.Annotations.GetCustomAnnotations ("Availability");
                    List<CustomAttribute> attribs;
                    object attribObjects;
                    if (!dict.TryGetValue (provider, out attribObjects)) {
                        attribs = new List<CustomAttribute> ();
                        dict [provider] = attribs;
                    } else {
                        attribs = (List<CustomAttribute>) attribObjects;
                    }
                    // Make sure the attribute is resolved, since after removing the attribute
                    // it won't be able to do it. The 'CustomAttribute.Resolve' method is private, but fetching
                    // any property will cause it to be called.
                    var dummy = attribute.HasConstructorArguments;
                    attribs.Add (attribute);
                    break;
                }
            }

            base.WillRemoveAttribute (provider, attribute);
        }
开发者ID:yudhitech,项目名称:xamarin-macios,代码行数:29,代码来源:CoreRemoveAttributes.cs


示例6: DomCecilAttribute

		/*CustomAttribute customAttribute;
		
		public CustomAttribute CustomAttribute {
			get {
				return customAttribute;
			}
		}*/
		
		public DomCecilAttribute (CustomAttribute customAttribute)
		{
			//this.customAttribute = customAttribute;
			base.AttributeType = DomCecilMethod.GetReturnType (customAttribute.Constructor);
			base.Name          = customAttribute.Constructor.DeclaringType.FullName;
			
			try {
				foreach (var argument in customAttribute.ConstructorArguments)
					AddPositionalArgument (CreateExpressionFor (argument));
			} catch (Exception e) {
				LoggingService.LogError ("Error reading attributes", e);
			}
			
			try {
				foreach (var namedArgument in customAttribute.Properties)
					AddNamedArgument (namedArgument.Name, CreateExpressionFor (namedArgument.Argument));
			} catch (Exception e) {
				LoggingService.LogError ("Error reading attributes", e);
			}
			
			try {
				foreach (var namedArgument in customAttribute.Fields)
					AddNamedArgument (namedArgument.Name, CreateExpressionFor (namedArgument.Argument));
			} catch (Exception e) {
				LoggingService.LogError ("Error reading attributes", e);
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:35,代码来源:DomCecilAttribute.cs


示例7: Visit

        public void Visit(IBehaviorDefinition behaviorDefinition, CustomAttribute attribute)
        {
            ILProcessor processor = behaviorDefinition.Body.GetILProcessor();
            var pingerDefinition = new VariableDefinition("pinger",
                                                          behaviorDefinition.Module.Import(breakpointType));
            behaviorDefinition.Body.Variables.Add(pingerDefinition);
            var sequencedInstructions =
                behaviorDefinition.Body.Instructions.Where(instruction => instruction.SequencePoint != null).ToList();

            Console.Out.WriteLine(sequencedInstructions.Count);
            //            var extractedInstructions = Specific(sequencedInstructions, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 20, 21);
            var extractedInstructions = Filtered(sequencedInstructions);
            foreach (var instruction in extractedInstructions)
            {
                Type intType = typeof(int);
                var breakPointInstructions = new List<Instruction>
                                       {
                                           processor.Create(OpCodes.Newobj, behaviorDefinition.Module.Import(
                                                                                breakpointType.GetConstructor(new Type[]{}))),
                                           processor.Create(OpCodes.Ldc_I4, instruction.SequencePoint.StartLine),
                                           processor.Create(OpCodes.Ldc_I4, instruction.SequencePoint.StartColumn),
                                           processor.Create(OpCodes.Ldc_I4, instruction.SequencePoint.EndLine),
                                           processor.Create(OpCodes.Ldc_I4, instruction.SequencePoint.EndColumn),
                                           processor.Create(OpCodes.Ldstr, instruction.SequencePoint.Document.Url),
                                           processor.Create(OpCodes.Call,
                                                            behaviorDefinition.Module.Import(breakpointType.GetMethod("Activate",
                                                                                                                      new[] {intType, intType, intType, intType, typeof(string)})))
                                       };
                breakPointInstructions.ForEach(bpr => processor.InsertBefore(instruction, bpr));
                foreach (var i in behaviorDefinition.Body.Instructions)
                {
                    Console.Out.WriteLine("{0}/[{1}]: {2} {3}", i.Offset, Sequence(i.SequencePoint), i.OpCode, i.Operand);
                }
            }
        }
开发者ID:asengupta,项目名称:Exo,代码行数:35,代码来源:DebugWeave.cs


示例8: Visit

        public void Visit(IBehaviorDefinition method, CustomAttribute attribute)
        {
            ILProcessor processor = method.Body.GetILProcessor();
            string description = attribute.Properties.Where(argument => (argument.Name == "Description")).First().Argument.Value as string;
            var listType = typeof(List<object>);
            var listVariable = new VariableDefinition("argumentz", method.Module.Import(listType));
            method.Body.Variables.Add(listVariable);
            var instructions = new List<Instruction>();
            instructions.Add(processor.Create(OpCodes.Newobj, method.Module.Import(listType.GetConstructor(new Type[] { }))));
            instructions.Add(processor.Create(OpCodes.Stloc, listVariable));

            int parameterIndex = 1;
            foreach (var parameter in method.Parameters)
            {
                instructions.Add(processor.Create(OpCodes.Ldloc, listVariable));
                instructions.Add(processor.Create(OpCodes.Ldarg, parameterIndex));
                if (parameter.ParameterType.IsPrimitive || parameter.ParameterType.IsValueType)
                    instructions.Add(processor.Create(OpCodes.Box, parameter.ParameterType));
                instructions.Add(processor.Create(OpCodes.Callvirt, method.Module.Import(listType.GetMethod("Add", new[] { typeof(object) }))));
                ++parameterIndex;
            }
            instructions.Add(processor.Create(OpCodes.Newobj, method.Module.Import(broadcastType.GetConstructor(new Type[] {}))));
            instructions.Add(processor.Create(OpCodes.Ldloc, listVariable));
            instructions.Add(processor.Create(OpCodes.Ldstr, description));
            instructions.Add(processor.Create(OpCodes.Callvirt, method.Module.Import(broadcastType.GetMethod("Run", new[] {listType, typeof(string)}))));

            new InsertionAtStart(processor, method).Run(instructions);
        }
开发者ID:asengupta,项目名称:Exo,代码行数:28,代码来源:PublishArgumentsWeave.cs


示例9: InjectCustomAttribute

        public CustomAttribute InjectCustomAttribute(Mono.Cecil.ICustomAttributeProvider target, CustomAttribute attribute)
        {
            if(module == null)
                throw new ArgumentNullException("module");
            if(target == null)
                throw new ArgumentNullException("target");
            if(attribute == null)
                throw new ArgumentNullException("attribute");

            TypeReference attributeType = ReferenceOrInjectType(attribute.AttributeType);

            // no context required as attributes cannot be generic
            MethodReference constructor = ReferenceOrInjectMethod(attribute.Constructor);

            CustomAttribute newAttribute;

            if((newAttribute = Helper.GetCustomAttribute(target.CustomAttributes, attribute)) != null)
                return newAttribute;

            newAttribute = new CustomAttribute(constructor);//, attr.GetBlob());

            target.CustomAttributes.Add(newAttribute);

            CopyCustomAttributeArguments(attribute.ConstructorArguments, newAttribute.ConstructorArguments);

            CopyCustomAttributeNamedArguments(attribute.Fields, newAttribute.Fields);

            CopyCustomAttributeNamedArguments(attribute.Properties, newAttribute.Properties);

            return newAttribute;
        }
开发者ID:Cadla,项目名称:OBFSCTR,代码行数:31,代码来源:AssemblyBuilder.cs


示例10: IsRemovedAttribute

 protected override bool IsRemovedAttribute(CustomAttribute attribute)
 {
     // note: this also avoid calling FullName (which allocates a string)
     var attr_type = attribute.Constructor.DeclaringType;
     switch (attr_type.Name) {
     case "AdviceAttribute":
     case "FieldAttribute":
     case "PreserveAttribute":	// the ApplyPreserveAttribute substep is executed before this
     case "LinkerSafeAttribute":
         return attr_type.Namespace == Namespaces.Foundation;
     // used for documentation, not at runtime
     case "AvailabilityAttribute":
     case "AvailabilityBaseAttribute":
     case "DeprecatedAttribute":
     case "IntroducedAttribute":
     case "iOSAttribute":
     case "MacAttribute":
     case "LionAttribute":
     case "MountainLionAttribute":
     case "MavericksAttribute":
     case "ObsoletedAttribute":
     case "SinceAttribute":
     case "ThreadSafeAttribute":
     case "UnavailableAttribute":
     case "LinkWithAttribute":
     case "DesignatedInitializerAttribute":
         return attr_type.Namespace == Namespaces.ObjCRuntime;
     default:
         return base.IsRemovedAttribute (attribute);
     }
 }
开发者ID:yudhitech,项目名称:xamarin-macios,代码行数:31,代码来源:CoreRemoveAttributes.cs


示例11: DexImport

 /// <summary>
 /// Default ctor
 /// </summary>
 internal DexImport(string className, TypeDefinition firstType, CustomAttribute attr, string scope)
 {
     this.className = className;
     this.attr = attr;
     this.scope = scope;
     types = new List<TypeDefinition> { firstType };
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:10,代码来源:AssemblyClassLoader.DexImport.cs


示例12: RunTask

        /// <summary>
        /// Runs the specified cloaking task.
        /// </summary>
        /// <param name="context">The running context of this cloak job.</param>
        public void RunTask(ICloakContext context)
        {
            Dictionary<string, AssemblyDefinition> assemblyCache = context.GetAssemblyDefinitions();
            foreach (string assembly in assemblyCache.Keys)
            {
                AssemblyDefinition def = assemblyCache[assembly];
                Type si = typeof (SuppressIldasmAttribute);
                CustomAttribute found = null;
                foreach (CustomAttribute attr in def.CustomAttributes)
                {
                    if (attr.Constructor.DeclaringType.FullName == si.FullName)
                    {
                        found = attr;
                        break;
                    }
                }

                //Only add if it's not there already
                if (found == null)
                {
                    //Add one
                    MethodReference constructor = def.MainModule.Import(typeof (SuppressIldasmAttribute).GetConstructor(Type.EmptyTypes));
                    CustomAttribute attr = new CustomAttribute(constructor);
                    def.CustomAttributes.Add(attr);
                }
            }

        }
开发者ID:modulexcite,项目名称:ncloak,代码行数:32,代码来源:SupressIldasmTask.cs


示例13: Visit

        public void Visit(IBehaviorDefinition behaviorDefinition, CustomAttribute attribute)
        {
            ILProcessor processor = behaviorDefinition.Body.GetILProcessor();
            var pingerDefinition = new VariableDefinition("pinger",
                                                         behaviorDefinition.Module.Import(pingType));
            behaviorDefinition.Body.Variables.Add(pingerDefinition);

            var start = new List<Instruction>
                            {
                                processor.Create(OpCodes.Ldstr, behaviorDefinition.Name),
                                processor.Create(OpCodes.Newobj,
                                                 behaviorDefinition.Module.Import(
                                                     pingType.GetConstructor(new[]{typeof(string)}))),
                                processor.Create(OpCodes.Stloc, pingerDefinition),
                                processor.Create(OpCodes.Ldloc, pingerDefinition),
                                processor.Create(OpCodes.Callvirt,
                                               behaviorDefinition.Module.Import(pingType.GetMethod("Start",
                                                                                                      new Type[] {}))),

                            };
            var end = new List<Instruction>
                          {
                              processor.Create(OpCodes.Ldloc, pingerDefinition),
                              processor.Create(OpCodes.Callvirt,
                                               behaviorDefinition.Module.Import(pingType.GetMethod("End",
                                                                                                      new Type[] {})))
                          };

            new InsertionAtStart(processor, behaviorDefinition).Run(start);
            new InsertionAtEnd(processor, behaviorDefinition).Run(end);
            foreach (var instruction in behaviorDefinition.Body.Instructions)
            {
                Console.Out.WriteLine("{0}/[{1}]: {2} {3}", instruction.Offset, Sequence(instruction.SequencePoint), instruction.OpCode, instruction.Operand);
            }
        }
开发者ID:asengupta,项目名称:Exo,代码行数:35,代码来源:PingWeave.cs


示例14: InjectCustomAttribute

        public static CustomAttribute InjectCustomAttribute(this ICustomAttributeProvider provider, CustomAttribute attribute, ReferenceResolver resolver)
        {
            if (attribute == null)
                throw new ArgumentNullException("attribute");
            if (resolver == null)
                throw new ArgumentNullException("resolver");

            TypeReference attributeType = resolver.ReferenceType(attribute.AttributeType);

            // no context required as attributes cannot be generic
            MethodReference constructor = resolver.ReferenceMethod(attribute.Constructor);

            CustomAttribute newAttribute;
            if ((newAttribute = Helper.GetCustomAttribute(provider.CustomAttributes, attribute)) != null)
                return newAttribute;

            newAttribute = new CustomAttribute(constructor);//, attr.GetBlob());
            provider.CustomAttributes.Add(newAttribute);

            MetadataBuilderHelper.CopyCustomAttributeArguments(attribute.ConstructorArguments, newAttribute.ConstructorArguments, resolver);

            MetadataBuilderHelper.CopyCustomAttributeNamedArguments(attribute.Fields, newAttribute.Fields, resolver);

            MetadataBuilderHelper.CopyCustomAttributeNamedArguments(attribute.Properties, newAttribute.Properties, resolver);

            return newAttribute;
        }
开发者ID:Cadla,项目名称:OBFSCTR,代码行数:27,代码来源:ICustomAttributeProviderExtensions.cs


示例15: Run

		public void Run()
		{
			// Retrieve the target method onto which we want to add the attribute
			var targetType = _module.Types.Single(t => t.Name == "Target");
			var targetMethod = targetType.Methods.Single(m => m.Name == "TargetMethod");

			// Retrieve the type of the attribute
			var decorationAttributeType = _module.Types.Single(t => t.Name == "DecorationAttribute");

			// Create the equivalent of [Decoration("WOW")]
			// All custom attributes are created from a constructor
			var decorationAttributeConstructor = decorationAttributeType
				.Methods
				.Single(m => m.IsConstructor
					&& m.Parameters.Count == 1
					&& m.Parameters[0].ParameterType.MetadataType == MetadataType.String);

			var decorationAttribute = new CustomAttribute(decorationAttributeConstructor);

			decorationAttribute.ConstructorArguments.Add(
				new CustomAttributeArgument(
					type: _module.TypeSystem.String,
					value: "WOW"));

			// Add the custom attribute to the method
			targetMethod.CustomAttributes.Add(decorationAttribute);

			// Write the module with default parameters
			_module.Write(_targetFileName);
		}
开发者ID:transformersprimeabcxyz,项目名称:cecil.samples,代码行数:30,代码来源:Sample.cs


示例16: CreateAppWidgetProviderFile

        /// <summary>
        /// Create app widget provider xml file.
        /// </summary>
        private void CreateAppWidgetProviderFile(string tempFolder, int index, CustomAttribute attr)
        {
            var resourceName = AppWidgetProviderResource.GetResourceName(index);
            var path = Path.Combine(Path.Combine(tempFolder, @"res\xml"), resourceName + ".xml");

            var doc = new XDocument();
            var root = new XElement("appwidget-provider");
            doc.Add(root);

            root.AddAttrIfNotEmpty("minWidth", Namespace, attr.GetValue<string>("MinWidth"));
            root.AddAttrIfNotEmpty("minHeight", Namespace, attr.GetValue<string>("MinHeight"));
            root.AddAttrIfNotDefault("updatePeriodMillis", Namespace, attr.GetValue<long>("UpdatePeriod"), 0L);
            root.AddAttrIfNotEmpty("previewImage", Namespace, attr.GetValue<string>("PreviewImage"), FormatDrawable);
            root.AddAttrIfNotEmpty("initialLayout", Namespace, attr.GetValue<string>("InitialLayout"), FormatLayout);
            var configureActivityType = attr.GetValue<TypeReference>("ConfigureActivity");
            if (configureActivityType != null)
            {
                var configureActivityTypeDef = configureActivityType.Resolve();
                if (configureActivityTypeDef == null)
                    throw new ArgumentException("Cannot resolve " + configureActivityType.FullName);
                root.AddAttr("configure", Namespace, FormatClassName(XBuilder.AsTypeDefinition(module, configureActivityTypeDef)));
            }
            root.AddAttrIfNotDefault("resizeMode", Namespace, attr.GetValue<int>("ResizeMode"), 0, widgetResizeModesOptions.Format);
            root.AddAttrIfNotDefault("widgetCategory", Namespace, attr.GetValue<int>("Category"), 0, widgetCategoriesOptions.Format);
            root.AddAttrIfNotEmpty("initialKeyguardLayout", Namespace, attr.GetValue<string>("InitialKeyguardLayout"), FormatLayout);

            Directory.CreateDirectory(Path.GetDirectoryName(path));
            doc.Save(path);
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:32,代码来源:AppWidgetProvider.cs


示例17: AddXmlSchemaProviderAttribute

        private bool AddXmlSchemaProviderAttribute(CatelType catelType)
        {
            var catelTypeDefinition = catelType.TypeDefinition;

            var methodName = GetXmlSchemaMethodName(catelType);

            var existingCustomAttribute = (from attribute in catelTypeDefinition.CustomAttributes
                                           where string.Equals(attribute.AttributeType.Name, "XmlSchemaProviderAttribute")
                                           select attribute).FirstOrDefault();
            if (existingCustomAttribute != null)
            {
                var constructorArgument = existingCustomAttribute.ConstructorArguments[0];
                if (string.Equals(constructorArgument.Value, methodName))
                {
                    return false;
                }
            }

            var xmlSchemaProviderAttribute = catelTypeDefinition.Module.FindType("System.Xml", "System.Xml.Serialization.XmlSchemaProviderAttribute");

            var attributeConstructor = catelTypeDefinition.Module.Import(xmlSchemaProviderAttribute.Resolve().Constructor(false));
            var customAttribute = new CustomAttribute(attributeConstructor);
            customAttribute.ConstructorArguments.Add(new CustomAttributeArgument(catelTypeDefinition.Module.TypeSystem.String, methodName));

            catelTypeDefinition.CustomAttributes.Add(customAttribute);

            return true;
        }
开发者ID:Catel,项目名称:Catel.Fody,代码行数:28,代码来源:XmlSchemasWeaver.cs


示例18: Clone

 public static CustomAttribute Clone(CustomAttribute custattr, ModuleDefinition context,
     IImportMapper mapper)
 {
     var ca = new CustomAttribute(context.Import(custattr.Constructor, mapper));
     custattr.CopyTo(ca, context, mapper);
     return ca;
 }
开发者ID:MarkusSintonen,项目名称:MNetInjector,代码行数:7,代码来源:CustomAttribute.cs


示例19: IsRemovedAttribute

 protected override bool IsRemovedAttribute(CustomAttribute attribute)
 {
     // note: this also avoid calling FullName (which allocates a string)
     var attr_type = attribute.Constructor.DeclaringType;
     switch (attr_type.Name) {
     case "ObsoleteAttribute":
     // System.Mono*Attribute from mono/mcs/build/common/MonoTODOAttribute.cs
     case "MonoDocumentationNoteAttribute":
     case "MonoExtensionAttribute":
     case "MonoInternalNoteAttribute":
     case "MonoLimitationAttribute":
     case "MonoNotSupportedAttribute":
     case "MonoTODOAttribute":
         return attr_type.Namespace == "System";
     case "MonoFIXAttribute":
         return attr_type.Namespace == "System.Xml";
     // remove debugging-related attributes if we're not linking symbols (i.e. we're building release builds)
     case "DebuggableAttribute":
     case "DebuggerBrowsableAttribute":
     case "DebuggerDisplayAttribute":
     case "DebuggerHiddenAttribute":
     case "DebuggerNonUserCodeAttribute":
     case "DebuggerStepperBoundaryAttribute":
     case "DebuggerStepThroughAttribute":
     case "DebuggerTypeProxyAttribute":
     case "DebuggerVisualizerAttribute":
         return !DebugBuild && attr_type.Namespace == "System.Diagnostics";
     default:
         return false;
     }
 }
开发者ID:yudhitech,项目名称:xamarin-android,代码行数:31,代码来源:RemoveAttributes.cs


示例20: IsPreservedAttribute

		protected virtual bool IsPreservedAttribute (CustomAttribute attribute)
		{
			// [assembly: Preserve (type)] does not preserve all the code in the assembly, in fact it might
			// not preserve anything in _this_ assembly, but something in a separate assembly (reference)
			if (attribute.HasConstructorArguments)
				return false;
			return (attribute.AttributeType.Name == "PreserveAttribute");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:8,代码来源:CustomizeActions.cs



注:本文中的Mono.Cecil.CustomAttribute类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Cecil.CustomAttributeArgument类代码示例发布时间:2022-05-26
下一篇:
C# Cecil.AssemblyNameReference类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap