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