예제 #1
0
 public Picture(string path)
 {
     if (path == null)
     {
         throw new ArgumentNullException("path");
     }
     Data = ByteVector.FromPath(path);
     FillInMimeFromData();
     Description = path;
 }
예제 #2
0
		/// <summary>
		///    Constructs and initializes a new instance of <see
		///    cref="Picture" /> by reading in the contents of a
		///    specified file.
		/// </summary>
		/// <param name="path">
		///    A <see cref="string"/> object containing the path of the
		///    file to read.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///    <paramref name="path" /> is <see langword="null" />.
		/// </exception>
		public Picture (string path)
		{
			if (path == null)
				throw new ArgumentNullException ("path");
			
			Data = ByteVector.FromPath (path);
			filename = System.IO.Path.GetFileName(path);
			description = filename;
			mime_type = GetMimeFromExtension(filename);
			type = mime_type.StartsWith("image/") ? PictureType.FrontCover : PictureType.NotAPicture;
		}
예제 #3
0
        public Picture(string filename)
        {
            if (filename == null)
            {
                throw new ArgumentNullException("filename");
            }

            Data = ByteVector.FromPath(filename);
            FillInMimeFromData();
            Description = filename;
        }
예제 #4
0
        /// <summary>
        ///    Constructs and initializes a new instance of <see
        ///    cref="Picture" /> by reading in the contents of a
        ///    specified file.
        /// </summary>
        /// <param name="path">
        ///    A <see cref="string"/> object containing the path of the
        ///    file to read.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="path" /> is <see langword="null" />.
        /// </exception>
        public Picture(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            Data        = ByteVector.FromPath(path);
            filename    = System.IO.Path.GetFileName(path);
            description = filename;
            FillInMimeFromExt();
        }
예제 #5
0
        /// <summary>
        ///    Constructs and initializes a new instance of <see
        ///    cref="Picture" /> by reading in the contents of a
        ///    specified file.
        /// </summary>
        /// <param name="path">
        ///    A <see cref="string"/> object containing the path of the
        ///    file to read.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="path" /> is <see langword="null" />.
        /// </exception>
        public Picture(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            Data        = ByteVector.FromPath(path);
            Filename    = System.IO.Path.GetFileName(path);
            Description = Filename;
            MimeType    = GetMimeFromExtension(Filename);
            Type        = MimeType.StartsWith("image/") ? PictureType.FrontCover : PictureType.NotAPicture;
        }