aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/IO/ManagedFileSystem.cs
diff options
context:
space:
mode:
authorAndrew Rabert <6550543+nvllsvm@users.noreply.github.com>2019-01-20 18:13:49 -0500
committerGitHub <noreply@github.com>2019-01-20 18:13:49 -0500
commit803bf563d74754139ff92810364262e3181e399d (patch)
tree0bf6765b612a7cc7930076eda9961b960cf70aa7 /Emby.Server.Implementations/IO/ManagedFileSystem.cs
parentd16f38dbe19c7cf43b3b8efa6413294c3a7e4586 (diff)
parent35d97dc949a40f4768e20107862096e17f6b201b (diff)
Merge pull request #621 from Bond-009/perf
Minor improvements to library scan code
Diffstat (limited to 'Emby.Server.Implementations/IO/ManagedFileSystem.cs')
-rw-r--r--Emby.Server.Implementations/IO/ManagedFileSystem.cs23
1 files changed, 2 insertions, 21 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
index 1c7b0d46b..3e7774abf 100644
--- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
@@ -450,10 +450,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)
{
@@ -764,18 +761,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;
@@ -851,17 +843,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);