本文整理汇总了C#中IFileAbstraction类的典型用法代码示例。如果您正苦于以下问题:C# IFileAbstraction类的具体用法?C# IFileAbstraction怎么用?C# IFileAbstraction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFileAbstraction类属于命名空间,在下文中一共展示了IFileAbstraction类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: File
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;
}
示例2: Create
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;
}
示例3: File
/// <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)
{
}
示例4: File
/// <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)
{
}
示例5: File
/// <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;
}
示例6: Create
/// <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;
}
}
示例7: ImageBlockFile
/// <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)
{
}
示例8: BaseTiffFile
/// <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;
}