Beispiel #1
0
        public TAttributes(BinaryReader Reader, TConstantPool ConstantPool)
        {
            FReader = Reader;

            FMaxItems = Common.ReadWord(FReader) - 1;
            FItems = new ArrayList();
            int count = 0;

            // goes from 1 -> attributescount - 1
            while (count <= FMaxItems)
            {
                ushort NameIndex = Common.ReadWord(FReader);
                NameIndex--;
                ConstantUtf8Info Name = (ConstantUtf8Info)ConstantPool.Item(NameIndex);

                switch (Name.Value)
                {
                    case AttributeType.Code:
                        {
                            CodeAttributeInfo ai = new CodeAttributeInfo(NameIndex, FReader, ConstantPool);

                            FItems.Add(ai);
                            break;
                        }
                    case AttributeType.ConstantValue:
                        {
                            ConstantValueAttributeInfo ai = new ConstantValueAttributeInfo(NameIndex, FReader, ConstantPool);

                            FItems.Add(ai);
                            break;
                        }
                    case AttributeType.Deprecated:
                        {
                            DeprecatedAttributeInfo ai = new DeprecatedAttributeInfo(NameIndex, FReader, ConstantPool);

                            FItems.Add(ai);
                            break;
                        }
                    case AttributeType.Exceptions:
                        {
                            ExceptionsAttributeInfo ai = new ExceptionsAttributeInfo(NameIndex, FReader, ConstantPool);

                            FItems.Add(ai);
                            break;
                        }
                    case AttributeType.InnerClasses:
                        {
                            InnerClassesAttributeInfo ai = new InnerClassesAttributeInfo(NameIndex, FReader, ConstantPool);

                            FItems.Add(ai);
                            break;
                        }
                    case AttributeType.LineNumberTable:
                        {
                            LineNumberAttributeInfo ai = new LineNumberAttributeInfo(NameIndex, FReader, ConstantPool);

                            FItems.Add(ai);
                            break;
                        }
                    case AttributeType.LocalVariableTable:
                        {
                            LocalVariablesAttributeInfo ai = new LocalVariablesAttributeInfo(NameIndex, FReader, ConstantPool);

                            FItems.Add(ai);
                            break;
                        }
                    case AttributeType.SourceFile:
                        {
                            SourceFileAttributeInfo ai = new SourceFileAttributeInfo(NameIndex, FReader, ConstantPool);

                            FItems.Add(ai);
                            break;
                        }
                    case AttributeType.Synthetic:
                        {
                            SyntheticAttributeInfo ai = new SyntheticAttributeInfo(NameIndex, FReader, ConstantPool);

                            FItems.Add(ai);
                            break;
                        }

                    default:
                        {
                            AttributeInfo ai = new UnknownAttributeInfo(NameIndex, FReader, ConstantPool);

                            FItems.Add(ai);
                            break;
                        }
                }

                count++;
            }
        }
Beispiel #2
0
		public TAttributes(BinaryReader Reader, TConstantPool ConstantPool)
		{
			FReader = Reader;

			FMaxItems = Common.ReadWord(FReader) - 1;
			FItems = new ArrayList();
			int count = 0;

			// goes from 1 -> attributescount - 1
			while (count <= FMaxItems)
			{
				ushort NameIndex = Common.ReadWord(FReader);
				NameIndex--;
				ConstantUtf8Info Name = (ConstantUtf8Info)ConstantPool.Item(NameIndex);

				switch (Name.Value)
				{
					case AttributeType.Code:
						{
							CodeAttributeInfo ai = new CodeAttributeInfo(NameIndex, FReader, ConstantPool);

							FItems.Add(ai);
							break;
						}
					case AttributeType.ConstantValue:
						{
							ConstantValueAttributeInfo ai = new ConstantValueAttributeInfo(NameIndex, FReader, ConstantPool);

							FItems.Add(ai);
							break;
						}
					case AttributeType.Deprecated:
						{
							DeprecatedAttributeInfo ai = new DeprecatedAttributeInfo(NameIndex, FReader, ConstantPool);

							FItems.Add(ai);
							break;
						}
					case AttributeType.Exceptions:
						{
							ExceptionsAttributeInfo ai = new ExceptionsAttributeInfo(NameIndex, FReader, ConstantPool);

							FItems.Add(ai);
							break;
						}
					case AttributeType.InnerClasses:
						{
							InnerClassesAttributeInfo ai = new InnerClassesAttributeInfo(NameIndex, FReader, ConstantPool);

							FItems.Add(ai);
							break;
						}
					case AttributeType.LineNumberTable:
						{
							LineNumberAttributeInfo ai = new LineNumberAttributeInfo(NameIndex, FReader, ConstantPool);

							FItems.Add(ai);
							break;
						}
					case AttributeType.LocalVariableTable:
						{
							LocalVariablesAttributeInfo ai = new LocalVariablesAttributeInfo(NameIndex, FReader, ConstantPool);

							FItems.Add(ai);
							break;
						}
					case AttributeType.SourceFile:
						{
							SourceFileAttributeInfo ai = new SourceFileAttributeInfo(NameIndex, FReader, ConstantPool);

							FItems.Add(ai);
							break;
						}
					case AttributeType.Synthetic:
						{
							SyntheticAttributeInfo ai = new SyntheticAttributeInfo(NameIndex, FReader, ConstantPool);

							FItems.Add(ai);
							break;
						}

					default:
						{
							AttributeInfo ai = new UnknownAttributeInfo(NameIndex, FReader, ConstantPool);

							FItems.Add(ai);
							break;
						}
				}

				count++;
			}
		}