コード例 #1
0
 /// <summary>
 ///    Constructs and initializes a new instance of <see
 ///    cref="File" /> for a specified file abstraction and
 ///    specified read style.
 /// </summary>
 /// <param name="abstraction">
 ///    A <see cref="IFileAbstraction" /> object to use when
 ///    reading from and writing to the file.
 /// </param>
 /// <param name="propertiesStyle">
 ///    A <see cref="ReadStyle" /> value specifying at what level
 ///    of accuracy to read the media properties, or <see
 ///    cref="ReadStyle.None" /> to ignore the properties.
 /// </param>
 /// <exception cref="ArgumentNullException">
 ///    <paramref name="abstraction" /> is <see langword="null"
 ///    />.
 /// </exception>
 public File(File.IFileAbstraction abstraction,
             ReadStyle propertiesStyle) : base(abstraction, propertiesStyle)
 {
 }
コード例 #2
0
 /// <summary>
 ///    Constructs and initializes a new instance of <see
 ///    cref="File" /> for a specified file abstraction with an
 ///    average read style.
 /// </summary>
 /// <param name="abstraction">
 ///    A <see cref="IFileAbstraction" /> object to use when
 ///    reading from and writing to the file.
 /// </param>
 /// <exception cref="ArgumentNullException">
 ///    <paramref name="abstraction" /> is <see langword="null"
 ///    />.
 /// </exception>
 public File(File.IFileAbstraction abstraction)
     : this(abstraction, ReadStyle.Average)
 {
 }
コード例 #3
0
 /// <summary>
 ///    Constructs and initializes a new instance of <see
 ///    cref="File" /> for a specified file abstraction with an
 ///    average read style.
 /// </summary>
 /// <param name="abstraction">
 ///    A <see cref="TagLib.File.IFileAbstraction" /> object to use when
 ///    reading from and writing to the file.
 /// </param>
 /// <exception cref="ArgumentNullException">
 ///    <paramref name="abstraction" /> is <see langword="null"
 ///    />.
 /// </exception>
 public File(File.IFileAbstraction abstraction)
     : base(abstraction)
 {
 }
コード例 #4
0
 public static Picture CreateFromFile(File.IFileAbstraction abstraction)
 {
     return(new Picture(abstraction));
 }
コード例 #5
0
ファイル: File.cs プロジェクト: juschubut/kenos
 /// <summary>
 ///    Constructs and initializes a new instance of <see
 ///    cref="File" /> for a specified file abstraction and
 ///    specified read style.
 /// </summary>
 /// <param name="abstraction">
 ///    A <see cref="IFileAbstraction" /> object to use when
 ///    reading from and writing to the file.
 /// </param>
 /// <param name="propertiesStyle">
 ///    A <see cref="ReadStyle" /> value specifying at what level
 ///    of accuracy to read the media properties, or <see
 ///    cref="ReadStyle.None" /> to ignore the properties.
 /// </param>
 /// <exception cref="ArgumentNullException">
 ///    <paramref name="abstraction" /> is <see langword="null"
 ///    />.
 /// </exception>
 public File(File.IFileAbstraction abstraction,
             ReadStyle propertiesStyle) : base(abstraction)
 {
     ImageTag = new CombinedImageTag(TagTypes.XMP);
 }
コード例 #6
0
        /// <summary>
        /// Load the picture data from the file,
        /// if not done yet.
        /// </summary>
        public void Load()
        {
            // Already loaded ?
            if (file == null)
            {
                return;
            }

            // Load the picture from the stream

            Stream     stream = null;
            ByteVector data   = null;

            try
            {
                if (stream_size == 0)
                {
                    data = new ByteVector();
                }
                else if (stream_size > 0)
                {
                    stream = file.ReadStream;
                    stream.Seek(stream_offset, SeekOrigin.Begin);

                    int    count = 0, read = 0, needed = (int)stream_size;
                    byte[] buffer = new byte[needed];

                    do
                    {
                        count = stream.Read(buffer, read, needed);

                        read   += count;
                        needed -= count;
                    } while (needed > 0 && count != 0);


                    data = new ByteVector(buffer, read);
                }
                else
                {
                    stream = file.ReadStream;
                    stream.Seek(stream_offset, SeekOrigin.Begin);

                    data = ByteVector.FromStream(stream);
                }
            }
            finally
            {
                // Free the resources
                if (stream != null)
                {
                    file.CloseStream(stream);
                }

                file = null;
            }

            // Decode the raw data if required, by using FieldData
            raw_data = FieldData(data, -(int)FrameHeader.Size(raw_version), raw_version);

            // Get the actual data
            ParseRawData();
        }
コード例 #7
0
 public static ByteVector FromFile(File.IFileAbstraction abstraction)
 {
     byte[] tmp_out;
     return(FromFile(abstraction, out tmp_out, false));
 }
コード例 #8
0
 /// <summary>
 ///    Constructs and initializes a new instance of <see
 ///    cref="Attachment" /> by reading in the contents of a
 ///    specified file abstraction.
 /// </summary>
 /// <param name="abstraction">
 ///    A <see cref="TagLib.File.IFileAbstraction"/> object containing
 ///    abstraction of the file to read.
 /// </param>
 /// <param name="offset">
 ///    The position in bytes where the picture is located in the
 ///    <see cref="T:File.IFileAbstraction"/>.
 /// </param>
 /// <param name="size">
 ///    The size in bytes of the picture in the
 ///    <see cref="T:File.IFileAbstraction"/> (default: read all).
 /// </param>
 /// <exception cref="ArgumentNullException">
 ///    <paramref name="abstraction" /> is <see langword="null"
 ///    />.
 /// </exception>
 public Attachment(File.IFileAbstraction abstraction, long offset = 0, long size = -1) : base(abstraction, offset, size)
 {
 }
コード例 #9
0
ファイル: File.cs プロジェクト: juschubut/kenos
 /// <summary>
 ///    Constructs and initializes a new instance of <see
 ///    cref="File" /> for a specified file abstraction with an
 ///    average read style.
 /// </summary>
 /// <param name="abstraction">
 ///    A <see cref="IFileAbstraction" /> object to use when
 ///    reading from and writing to the file.
 /// </param>
 /// <exception cref="ArgumentNullException">
 ///    <paramref name="abstraction" /> is <see langword="null"
 ///    />.
 /// </exception>
 protected File(File.IFileAbstraction abstraction)
     : this(abstraction, ReadStyle.Average)
 {
 }
コード例 #10
0
ファイル: File.cs プロジェクト: juschubut/kenos
 /// <summary>
 ///    Constructs and initializes a new instance of <see
 ///    cref="File" /> for a specified file abstraction and
 ///    specified read style.
 /// </summary>
 /// <param name="abstraction">
 ///    A <see cref="IFileAbstraction" /> object to use when
 ///    reading from and writing to the file.
 /// </param>
 /// <param name="propertiesStyle">
 ///    A <see cref="ReadStyle" /> value specifying at what level
 ///    of accuracy to read the media properties, or <see
 ///    cref="ReadStyle.None" /> to ignore the properties.
 /// </param>
 /// <exception cref="ArgumentNullException">
 ///    <paramref name="abstraction" /> is <see langword="null"
 ///    />.
 /// </exception>
 protected File(File.IFileAbstraction abstraction,
                ReadStyle propertiesStyle)
     : base(abstraction)
 {
     Read(propertiesStyle);
 }