コード例 #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);
            }
        }
コード例 #2
0
        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");
            }
        }
コード例 #3
0
		public AsfExtendedContentDescriptionObject(AsfFile file, long position) : base(file, position)
		{
			if (file != null)
			{
				if (!Guid.Equals(AsfGuid.AsfExtendedContentDescriptionObject))
					throw new TagLibException(TagLibError.AsfObjectGuidIncorrect);

				if (OriginalSize < 26)
					throw new TagLibException(TagLibError.AsfObjectSizeTooSmall);

				short count = file.ReadWord();

				for (short i = 0; i < count; i++)
				{
					AsfContentDescriptor descriptor = new AsfContentDescriptor(file);
					descriptors.Add(descriptor);
				}
			}
		}
コード例 #4
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);
			}
		}
コード例 #5
0
        public AsfExtendedContentDescriptionObject(AsfFile file, long position) : base(file, position)
        {
            if (file != null)
            {
                if (!Guid.Equals(AsfGuid.AsfExtendedContentDescriptionObject))
                {
                    throw new TagLibException(TagLibError.AsfObjectGuidIncorrect);
                }

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

                short count = file.ReadWord();

                for (short i = 0; i < count; i++)
                {
                    AsfContentDescriptor descriptor = new AsfContentDescriptor(file);
                    descriptors.Add(descriptor);
                }
            }
        }
コード例 #6
0
		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");
		}