Esempio n. 1
0
 public Picture(string path)
 {
     if (path == null)
     {
         throw new ArgumentNullException("path");
     }
     Data = ByteVector.FromPath(path);
     FillInMimeFromData();
     Description = path;
 }
Esempio n. 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;
		}
Esempio n. 3
0
        public Picture(string filename)
        {
            if (filename == null)
            {
                throw new ArgumentNullException("filename");
            }

            Data = ByteVector.FromPath(filename);
            FillInMimeFromData();
            Description = filename;
        }
Esempio n. 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();
        }
Esempio n. 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;
        }