protected File(string path) { this.invariant_start_position = -1L; this.invariant_end_position = -1L; if (path == null) { throw new ArgumentNullException("path"); } this.file_abstraction = new LocalFileAbstraction(path); }
protected File(IFileAbstraction abstraction) { this.invariant_start_position = -1L; this.invariant_end_position = -1L; if (abstraction == null) { throw new ArgumentNullException("abstraction"); } this.file_abstraction = abstraction; }
public static TagLib.File Create(IFileAbstraction abstraction, string mimetype, ReadStyle propertiesStyle) { TagLib.File file3; if (mimetype == null) { string str = string.Empty; int startIndex = abstraction.Name.LastIndexOf(".") + 1; if ((startIndex >= 1) && (startIndex < abstraction.Name.Length)) { str = abstraction.Name.Substring(startIndex, abstraction.Name.Length - startIndex); } mimetype = "taglib/" + str.ToLower(CultureInfo.InvariantCulture); } foreach (FileTypeResolver resolver in file_type_resolvers) { TagLib.File file = resolver(abstraction, mimetype, propertiesStyle); if (file != null) { return file; } } if (!FileTypes.AvailableTypes.ContainsKey(mimetype)) { object[] args = new object[] { abstraction.Name, mimetype }; throw new UnsupportedFormatException(string.Format(CultureInfo.InvariantCulture, "{0} ({1})", args)); } Type type = FileTypes.AvailableTypes[mimetype]; try { object[] objArray2 = new object[] { abstraction, propertiesStyle }; TagLib.File file2 = (TagLib.File) Activator.CreateInstance(type, objArray2); file2.MimeType = mimetype; file3 = file2; } catch (TargetInvocationException exception) { throw exception.InnerException; } return file3; }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction. /// </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 (IFileAbstraction abstraction) { if (abstraction == null) throw new ArgumentNullException ("abstraction"); file_abstraction = abstraction; }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified path in the local file /// system. /// </summary> /// <param name="path"> /// A <see cref="string" /> object containing the path of the /// file to use in the new instance. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="path" /> is <see langword="null" />. /// </exception> protected File (string path) { if (path == null) throw new ArgumentNullException ("path"); file_abstraction = new LocalFileAbstraction (path); }
/// <summary> /// Creates a new instance of a <see cref="File" /> subclass /// for a specified file abstraction, mime-type, and read /// style. /// </summary> /// <param name="abstraction"> /// A <see cref="IFileAbstraction" /> object to use when /// reading to and writing from the current instance. /// </param> /// <param name="mimetype"> /// A <see cref="string" /> object containing the mime-type /// to use when selecting the appropriate class to use, or /// <see langword="null" /> if the extension in <paramref /// name="abstraction" /> is to be used. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying the level of /// detail to use when reading the media information from the /// new instance. /// </param> /// <returns> /// A new instance of <see cref="File" /> as read from the /// specified abstraction. /// </returns> /// <exception cref="CorruptFileException"> /// The file could not be read due to corruption. /// </exception> /// <exception cref="UnsupportedFormatException"> /// The file could not be read because the mime-type could /// not be resolved or the library does not support an /// internal feature of the file crucial to its reading. /// </exception> public static File Create (IFileAbstraction abstraction, string mimetype, ReadStyle propertiesStyle) { if(mimetype == null) { string ext = String.Empty; int index = abstraction.Name.LastIndexOf (".") + 1; if(index >= 1 && index < abstraction.Name.Length) ext = abstraction.Name.Substring (index, abstraction.Name.Length - index); mimetype = "taglib/" + ext.ToLower( CultureInfo.InvariantCulture); } foreach (FileTypeResolver resolver in file_type_resolvers) { File file = resolver(abstraction, mimetype, propertiesStyle); if(file != null) return file; } if (!FileTypes.AvailableTypes.ContainsKey(mimetype)) throw new UnsupportedFormatException ( String.Format ( CultureInfo.InvariantCulture, "{0} ({1})", abstraction.Name, mimetype)); Type file_type = FileTypes.AvailableTypes[mimetype]; try { File file = (File) Activator.CreateInstance( file_type, new object [] {abstraction, propertiesStyle}); file.MimeType = mimetype; return file; } catch (System.Reflection.TargetInvocationException e) { throw e.InnerException; } }
/// <summary> /// Creates a new instance of a <see cref="File" /> subclass /// for a specified file abstraction and read style, guessing /// the mime-type from the file's extension. /// </summary> /// <param name="abstraction"> /// A <see cref="IFileAbstraction" /> object to use when /// reading to and writing from the current instance. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying the level of /// detail to use when reading the media information from the /// new instance. /// </param> /// <returns> /// A new instance of <see cref="File" /> as read from the /// specified abstraction. /// </returns> /// <exception cref="CorruptFileException"> /// The file could not be read due to corruption. /// </exception> /// <exception cref="UnsupportedFormatException"> /// The file could not be read because the mime-type could /// not be resolved or the library does not support an /// internal feature of the file crucial to its reading. /// </exception> public static File Create (IFileAbstraction abstraction, ReadStyle propertiesStyle) { return Create(abstraction, null, propertiesStyle); }
/// <summary> /// Creates a new instance of a <see cref="File" /> subclass /// for a specified file abstraction, guessing the mime-type /// from the file's extension and using the average read /// style. /// </summary> /// <param name="abstraction"> /// A <see cref="IFileAbstraction" /> object to use when /// reading to and writing from the current instance. /// </param> /// <returns> /// A new instance of <see cref="File" /> as read from the /// specified abstraction. /// </returns> /// <exception cref="CorruptFileException"> /// The file could not be read due to corruption. /// </exception> /// <exception cref="UnsupportedFormatException"> /// The file could not be read because the mime-type could /// not be resolved or the library does not support an /// internal feature of the file crucial to its reading. /// </exception> public static File Create (IFileAbstraction abstraction) { return Create(abstraction, null, ReadStyle.Average); }
/// <summary> /// Constructs and initializes a new instance for a specified /// file abstraction. /// </summary> /// <param name="abstraction"> /// A <see cref="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> protected ImageBlockFile(IFileAbstraction abstraction) : base(abstraction) { }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction. /// </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(IFileAbstraction abstraction) : this(abstraction, ReadStyle.Average) { }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction. /// </summary> /// <param name="abstraction"> /// A <see cref="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> protected File(IFileAbstraction abstraction) : base(abstraction) { }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction. /// </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> protected File(IFileAbstraction abstraction) { file_abstraction = abstraction ?? throw new ArgumentNullException("abstraction"); }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction. /// </summary> /// <param name="abstraction"> /// A <see cref="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> protected BaseTiffFile(IFileAbstraction abstraction) : base(abstraction) { Magic = 42; }
/// <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(IFileAbstraction abstraction) : this(abstraction, ReadStyle.Average) { }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction. /// </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(IFileAbstraction abstraction) : this(abstraction, ReadStyle.Average) { }
/// <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(IFileAbstraction abstraction) : base(abstraction) { }
/// <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="TagLib.File.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(IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction, propertiesStyle) { }
/// <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="TagLib.File.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(IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction) { Read(propertiesStyle); }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction. /// </summary> /// <param name="abstraction"> /// A <see cref="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> protected File (IFileAbstraction abstraction) : base (abstraction) { }
/// <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="TagLib.File.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(IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction) { Magic = 85; // Panasonic uses 0x55 Read(propertiesStyle); }