diff options
| author | Bond_009 <bond.009@outlook.com> | 2019-01-18 20:40:08 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2019-01-20 19:40:37 +0100 |
| commit | 35d97dc949a40f4768e20107862096e17f6b201b (patch) | |
| tree | 4a8176762da9804237afd8412d780508c21696d7 /Emby.Server.Implementations/IO/ManagedFileSystem.cs | |
| parent | 3a5e3ade01ab4b4fccca03ba2da969f03d5564f1 (diff) | |
Minor improvements to library scan code
Diffstat (limited to 'Emby.Server.Implementations/IO/ManagedFileSystem.cs')
| -rw-r--r-- | Emby.Server.Implementations/IO/ManagedFileSystem.cs | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index ae1470190..573333e79 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -445,10 +445,7 @@ namespace Emby.Server.Implementations.IO } public Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, FileOpenOptions fileOpenOptions) - { - var defaultBufferSize = 4096; - return new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), defaultBufferSize, GetFileOptions(fileOpenOptions)); - } + => new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), 4096, GetFileOptions(fileOpenOptions)); private static FileOptions GetFileOptions(FileOpenOptions mode) { @@ -759,18 +756,13 @@ namespace Emby.Server.Implementations.IO // Only include drives in the ready state or this method could end up being very slow, waiting for drives to timeout return DriveInfo.GetDrives().Where(d => d.IsReady).Select(d => new FileSystemMetadata { - Name = GetName(d), + Name = d.Name, FullName = d.RootDirectory.FullName, IsDirectory = true }).ToList(); } - private static string GetName(DriveInfo drive) - { - return drive.Name; - } - public IEnumerable<FileSystemMetadata> GetDirectories(string path, bool recursive = false) { var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; @@ -846,17 +838,6 @@ namespace Emby.Server.Implementations.IO return File.OpenRead(path); } - private void CopyFileUsingStreams(string source, string target, bool overwrite) - { - using (var sourceStream = OpenRead(source)) - { - using (var targetStream = GetFileStream(target, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) - { - sourceStream.CopyTo(targetStream); - } - } - } - public void CopyFile(string source, string target, bool overwrite) { File.Copy(source, target, overwrite); |
