2023-02-03 17:49:23 +00:00
|
|
|
using System.IO;
|
|
|
|
using MediaBrowser.Model.IO;
|
|
|
|
|
2023-02-18 13:42:35 +00:00
|
|
|
namespace MediaBrowser.MediaEncoding.BdInfo;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Class BdInfoFileInfo.
|
|
|
|
/// </summary>
|
|
|
|
public class BdInfoFileInfo : BDInfo.IO.IFileInfo
|
2023-02-03 17:49:23 +00:00
|
|
|
{
|
2023-10-07 22:40:58 +00:00
|
|
|
private readonly FileSystemMetadata _impl;
|
2023-02-03 17:49:23 +00:00
|
|
|
|
2023-02-18 13:42:35 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="BdInfoFileInfo" /> class.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="impl">The <see cref="FileSystemMetadata" />.</param>
|
|
|
|
public BdInfoFileInfo(FileSystemMetadata impl)
|
|
|
|
{
|
|
|
|
_impl = impl;
|
|
|
|
}
|
2023-02-03 17:49:23 +00:00
|
|
|
|
2023-02-18 13:42:35 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the name.
|
|
|
|
/// </summary>
|
|
|
|
public string Name => _impl.Name;
|
2023-02-03 17:49:23 +00:00
|
|
|
|
2023-02-18 13:42:35 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the full name.
|
|
|
|
/// </summary>
|
|
|
|
public string FullName => _impl.FullName;
|
2023-02-03 17:49:23 +00:00
|
|
|
|
2023-02-18 13:42:35 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the extension.
|
|
|
|
/// </summary>
|
|
|
|
public string Extension => _impl.Extension;
|
2023-02-03 17:49:23 +00:00
|
|
|
|
2023-02-18 13:42:35 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the length.
|
|
|
|
/// </summary>
|
|
|
|
public long Length => _impl.Length;
|
2023-02-03 17:49:23 +00:00
|
|
|
|
2023-02-18 13:42:35 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets a value indicating whether this is a directory.
|
|
|
|
/// </summary>
|
|
|
|
public bool IsDir => _impl.IsDirectory;
|
2023-02-03 17:49:23 +00:00
|
|
|
|
2023-02-18 13:42:35 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets a file as file stream.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>A <see cref="FileStream" /> for the file.</returns>
|
|
|
|
public Stream OpenRead()
|
|
|
|
{
|
|
|
|
return new FileStream(
|
|
|
|
FullName,
|
|
|
|
FileMode.Open,
|
|
|
|
FileAccess.Read,
|
|
|
|
FileShare.Read);
|
|
|
|
}
|
2023-02-03 17:49:23 +00:00
|
|
|
|
2023-02-18 13:42:35 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets a files's content with a stream reader.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>A <see cref="StreamReader" /> for the file's content.</returns>
|
|
|
|
public StreamReader OpenText()
|
|
|
|
{
|
|
|
|
return new StreamReader(OpenRead());
|
2023-02-03 17:49:23 +00:00
|
|
|
}
|
|
|
|
}
|