Ejemplo n.º 1
0
        //////////////////////////////////////////////////////////////////////////
        // public methods
        //////////////////////////////////////////////////////////////////////////
        public AsfStreamPropertiesObject(AsfFile file, long position) : base(file, position)
        {
            if (file != null)
            {
                if (!Guid.Equals(AsfGuid.AsfStreamPropertiesObject))
                {
                    throw new TagLibException(TagLibError.AsfObjectGuidIncorrect);
                }

                if (OriginalSize < 78)
                {
                    throw new TagLibException(TagLibError.AsfObjectSizeTooSmall);
                }

                stream_type           = file.ReadGuid();
                error_correction_type = file.ReadGuid();
                time_offset           = file.ReadQWord();
                int type_specific_data_length    = (int)file.ReadDWord();
                int error_correction_data_length = (int)file.ReadDWord();
                flags                 = file.ReadWord();
                reserved              = file.ReadDWord();
                type_specific_data    = file.ReadBlock(type_specific_data_length);
                error_correction_data = file.ReadBlock(error_correction_data_length);
            }
        }
      //////////////////////////////////////////////////////////////////////////
      // public methods
      //////////////////////////////////////////////////////////////////////////
		public AsfStreamPropertiesObject (AsfFile file, long position) : base (file, position)
		{
			if (file != null)
			{
				if (!Guid.Equals (AsfGuid.AsfStreamPropertiesObject))
					throw new TagLibException(TagLibError.AsfObjectGuidIncorrect);
         
				if (OriginalSize < 78)
					throw new TagLibException(TagLibError.AsfObjectSizeTooSmall);
         
				stream_type = file.ReadGuid();
				error_correction_type = file.ReadGuid();
				time_offset = file.ReadQWord ();
				int type_specific_data_length = (int)file.ReadDWord();
				int error_correction_data_length = (int)file.ReadDWord();
				flags = file.ReadWord();
				reserved = file.ReadDWord();
				type_specific_data = file.ReadBlock(type_specific_data_length);
				error_correction_data = file.ReadBlock(error_correction_data_length);
			}
		}
Ejemplo n.º 3
0
		public AsfHeaderObject(AsfFile file, long position) : base(file, position)
		{
			if (!Guid.Equals(AsfGuid.AsfHeaderObject))
				throw new TagLibException(TagLibError.AsfObjectGuidIncorrect);
			
			uint childCount = file.ReadDWord();
			
			children = new List<AsfObject>((int)childCount);

			reserved = file.ReadBlock(2);
			foreach(AsfObject childObject in file.ReadObjects(childCount, file.Tell))
				children.Add(childObject);
			
			//children.AddRange(file.ReadObjects(childCount, file.Tell));
		}
        protected bool Parse(AsfFile file)
        {
            if (file != null)
            {
                int size = file.ReadWord();
                name = file.ReadUnicode(size);

                type = (AsfDataType)file.ReadWord();
                size = file.ReadWord();

                switch (type)
                {
                case AsfDataType.Word:
                    lValue = file.ReadWord();
                    break;

                case AsfDataType.Bool:
                    lValue = file.ReadDWord();
                    break;

                case AsfDataType.DWord:
                    lValue = file.ReadDWord();
                    break;

                case AsfDataType.QWord:
                    lValue = file.ReadQWord();
                    break;

                case AsfDataType.Unicode:
                    sValue = file.ReadUnicode(size);
                    break;

                case AsfDataType.Bytes:
                    bvValue = file.ReadBlock(size);
                    break;

                default:
                    return(false);
                }

                return(true);
            }
            else
            {
                throw new ArgumentNullException("file");
            }
        }
Ejemplo n.º 5
0
        public AsfHeaderObject(AsfFile file, long position) : base(file, position)
        {
            if (!Guid.Equals(AsfGuid.AsfHeaderObject))
            {
                throw new TagLibException(TagLibError.AsfObjectGuidIncorrect);
            }

            uint childCount = file.ReadDWord();

            children = new List <AsfObject>((int)childCount);

            reserved = file.ReadBlock(2);
            foreach (AsfObject childObject in file.ReadObjects(childCount, file.Tell))
            {
                children.Add(childObject);
            }

            //children.AddRange(file.ReadObjects(childCount, file.Tell));
        }
		protected bool Parse(AsfFile file)
		{
			if (file != null)
			{
				int size = file.ReadWord();
				name = file.ReadUnicode(size);

				type = (AsfDataType)file.ReadWord();
				size = file.ReadWord();

				switch (type)
				{
					case AsfDataType.Word:
						lValue = file.ReadWord();
						break;

					case AsfDataType.Bool:
						lValue = file.ReadDWord();
						break;

					case AsfDataType.DWord:
						lValue = file.ReadDWord();
						break;

					case AsfDataType.QWord:
						lValue = file.ReadQWord();
						break;

					case AsfDataType.Unicode:
						sValue = file.ReadUnicode(size);
						break;

					case AsfDataType.Bytes:
						bvValue = file.ReadBlock(size);
						break;

					default:
						return false;
				}

				return true;
			}
			else throw new ArgumentNullException("file");
		}