aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.MediaEncoding/BdInfo/BdInfoFileInfo.cs
blob: de9d7cb78409a6ded4beaa6e34a47a9f92e2e858 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using MediaBrowser.Model.IO;

namespace MediaBrowser.MediaEncoding.BdInfo
{
    class BdInfoFileInfo : BDInfo.IO.IFileInfo
    {
        IFileSystem _fileSystem = null;

        FileSystemMetadata _impl = null;

        public string Name => _impl.Name;

        public string FullName => _impl.FullName;

        public string Extension => _impl.Extension;

        public long Length => _impl.Length;

        public bool IsDir => _impl.IsDirectory;

        public BdInfoFileInfo(IFileSystem fileSystem, FileSystemMetadata impl)
        {
            _fileSystem = fileSystem;
            _impl = impl;
        }

        public System.IO.Stream OpenRead()
        {
            return _fileSystem.GetFileStream(FullName,
                FileOpenMode.Open,
                FileAccessMode.Read,
                FileShareMode.Read);
        }

        public System.IO.StreamReader OpenText()
        {
            return new System.IO.StreamReader(OpenRead());
        }
    }
}