示例#1
0
        private static void AddAnnotations(ClassFileWriter writer, IAttributeOwner target, MemberInfo source)
        {
#if !FIRST_PASS && !STUB_GENERATOR
            if (source != null)
            {
                RuntimeVisibleAnnotationsAttribute attr = null;
                foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(source))
                {
                    object[] ann = GetAnnotation(cad);
                    if (ann != null)
                    {
                        if (attr == null)
                        {
                            attr = new RuntimeVisibleAnnotationsAttribute(writer);
                        }
                        attr.Add(UnpackArray((IList <CustomAttributeTypedArgument>)cad.ConstructorArguments[0].Value));
                    }
                }
                if (attr != null)
                {
                    target.AddAttribute(attr);
                }
            }
#endif
        }
示例#2
0
        private static void AddAnnotations(ClassFileWriter writer, IAttributeOwner target, MemberInfo source)
        {
#if !FIRST_PASS && !STUB_GENERATOR
#if !WINRT
            if (source != null)
            {
                RuntimeVisibleAnnotationsAttribute attr = null;
                foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(source))
                {
                    object[] ann = GetAnnotation(cad);
                    if (ann != null)
                    {
                        if (attr == null)
                        {
                            attr = new RuntimeVisibleAnnotationsAttribute(writer);
                        }
                        attr.Add(ann);
                    }
                }
                if (attr != null)
                {
                    target.AddAttribute(attr);
                }
            }
#else
            throw new NotImplementedException();
#endif
#endif
        }
示例#3
0
        // Add this attribute to any movies that don't yet have it.
        public override void AfterCommit()
        {
            base.AfterCommit();

            List <DatabaseTable> dbObjs = DBManager.Get(Table, null);

            foreach (DatabaseTable currObj in dbObjs)
            {
                IAttributeOwner currOwner = (IAttributeOwner)currObj;

                bool needsThisAttr = true;
                foreach (DBAttribute currAttr in currOwner.Attributes)
                {
                    if (currAttr.Description != null && currAttr.Description.ID == this.ID)
                    {
                        needsThisAttr = false;
                        break;
                    }
                }

                if (needsThisAttr)
                {
                    DBAttribute newAttr = new DBAttribute();
                    newAttr.Description = this;

                    currOwner.Attributes.Add(newAttr);
                    currOwner.Attributes.Commit();
                }
            }
        }
示例#4
0
        public static string GetAttributeValueOrDie(this IAttributeOwner tag, string name)
        {
            var attribute = GetAttributeValueOrNull(tag, name);

            if (attribute == null)
            {
                throw new InvalidOperationException($"Could not find attribute by name {name} in tag {tag}");
            }
            return(attribute);
        }
示例#5
0
        public virtual void Initialize(Scene parentScene, IAttributeOwner attrParent)
        {
            this.ParentScene = parentScene;
            this.attrParent  = attrParent;

            foreach (string attrName in this.AttributeNames)
            {
                this.Attributes[attrName] = this.GetAttribute(attrName, this).Clone();
            }
        }
示例#6
0
 public override void Initialize(Scene parentScene, IAttributeOwner attrParent)
 {
     base.Initialize(parentScene, attrParent);
     this.spinProgress = this.attr("spinProgress");
     if (this.attr("growth") > 0)
     {
         this.diameter = 0;
     }
     else
     {
         this.diameter = this.attr("diameter");
     }
 }
示例#7
0
        public override void Initialize(Scene parentScene, IAttributeOwner parentPool)
        {
            base.Initialize(parentScene, parentPool);
            this.spinProgress = this.attr("spinProgress");

            int len = (int)this.attr("numBullets");

            if (!this.isInitialized)
            {
                this.bullets = new BulletStationary[len];

                for (int i = 0; i < len; i++)
                {
                    this.bullets[i] = new BulletStationary();
                    this.bullets[i].LoadContent();
                    this.bullets[i].Initialize(parentScene, this);
                    this.bullets[i].CurrentAnimation.CurrentFrame = this.CurrentAnimation.CurrentFrame;
                    this.bullets[i].SetHitbox("hitbox", this.GetHitbox("hitbox"));
                }

                this.isInitialized = true;
            }
        }
示例#8
0
        private static void AddTypeAnnotations(ClassFileWriter writer, IAttributeOwner target, TypeWrapper tw, byte[] typeAnnotations)
        {
#if !FIRST_PASS && !STUB_GENERATOR
            if (typeAnnotations != null)
            {
                typeAnnotations = (byte[])typeAnnotations.Clone();
                object[] constantPool = tw.GetConstantPool();
                try
                {
                    int    pos             = 0;
                    ushort num_annotations = ReadUInt16BE(typeAnnotations, ref pos);
                    for (int i = 0; i < num_annotations; i++)
                    {
                        FixupTypeAnnotationConstantPoolIndexes(writer, typeAnnotations, constantPool, ref pos);
                    }
                }
                catch (IndexOutOfRangeException)
                {
                    // if the attribute is malformed, we add it anyway and hope the Java parser will agree and throw the right error
                }
                target.AddAttribute(new RuntimeVisibleTypeAnnotationsAttribute(writer, typeAnnotations));
            }
#endif
        }
示例#9
0
 private static void AddAnnotations(ClassFileWriter writer, IAttributeOwner target, MemberInfo source)
 {
     #if !FIRST_PASS && !STUB_GENERATOR
     if (source != null)
     {
         RuntimeVisibleAnnotationsAttribute attr = null;
         foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(source))
         {
             object[] ann = GetAnnotation(cad);
             if (ann != null)
             {
                 if (attr == null)
                 {
                     attr = new RuntimeVisibleAnnotationsAttribute(writer);
                 }
                 attr.Add(ann);
             }
         }
         if (attr != null)
         {
             target.AddAttribute(attr);
         }
     }
     #endif
 }
示例#10
0
 public static string GetAttributeValueOrNull(this IAttributeOwner tag, string name)
 {
     return(tag.Attributes.SingleOrDefault(a => a.Name.GetName().EqualsIgnoringCase(name))?.Value);
 }
示例#11
0
		private static void AddTypeAnnotations(ClassFileWriter writer, IAttributeOwner target, TypeWrapper tw, byte[] typeAnnotations)
		{
#if !FIRST_PASS && !STUB_GENERATOR
			if (typeAnnotations != null)
			{
				typeAnnotations = (byte[])typeAnnotations.Clone();
				object[] constantPool = tw.GetConstantPool();
				try
				{
					int pos = 0;
					ushort num_annotations = ReadUInt16BE(typeAnnotations, ref pos);
					for (int i = 0; i < num_annotations; i++)
					{
						FixupTypeAnnotationConstantPoolIndexes(writer, typeAnnotations, constantPool, ref pos);
					}
				}
				catch (IndexOutOfRangeException)
				{
					// if the attribute is malformed, we add it anyway and hope the Java parser will agree and throw the right error
				}
				target.AddAttribute(new RuntimeVisibleTypeAnnotationsAttribute(writer, typeAnnotations));
			}
#endif
		}
示例#12
0
 private static void AddAnnotations(ClassFileWriter writer, IAttributeOwner target, MemberInfo source)
 {
     #if !FIRST_PASS && !STUB_GENERATOR
     if (source != null)
     {
         RuntimeVisibleAnnotationsAttribute attr = null;
         foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(source))
         {
             object[] ann = GetAnnotation(cad);
             if (ann != null)
             {
                 if (attr == null)
                 {
                     attr = new RuntimeVisibleAnnotationsAttribute(writer);
                 }
                 attr.Add(UnpackArray((IList<CustomAttributeTypedArgument>)cad.ConstructorArguments[0].Value));
             }
         }
         if (attr != null)
         {
             target.AddAttribute(attr);
         }
     }
     #endif
 }