The Free Software Media System - Server Backend & API
Unwrapped `MoveDirectory`, `DirectoryExists`, `FileExists` & removed `MoveFile`
Erwin de Haan581a7fe07800
diff --git a/BDInfo/BDROM.cs b/BDInfo/BDROM.csindex 85ea7b5773..4360ff1d42 100644--- a/BDInfo/BDROM.cs+++ b/BDInfo/BDROM.cs@@ -150,7 +150,7 @@ namespace BDInfoIs3D = true;}- if (_fileSystem.FileExists(Path.Combine(DirectoryRoot.FullName, "FilmIndex.xml")))+ if (File.Exists(Path.Combine(DirectoryRoot.FullName, "FilmIndex.xml"))){IsDBOX = true;}diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.csindex c873802185..4901561ebc 100644--- a/Emby.Drawing/ImageProcessor.cs+++ b/Emby.Drawing/ImageProcessor.cs@@ -244,7 +244,7 @@ namespace Emby.Drawingtry{- if (!_fileSystem.FileExists(cacheFilePath))+ if (!File.Exists(cacheFilePath)){if (options.CropWhiteSpace && !SupportsTransparency(originalImagePath)){@@ -626,7 +626,7 @@ namespace Emby.Drawingtry{// Check again in case of contention- if (_fileSystem.FileExists(enhancedImagePath))+ if (File.Exists(enhancedImagePath)){return (enhancedImagePath, treatmentRequiresTransparency);}diff --git a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.csindex a3ba6f7df8..c5564fd61f 100644--- a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs+++ b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs@@ -214,7 +214,7 @@ namespace IsoMounter{string path = test.Trim();- if (!string.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name)))+ if (!string.IsNullOrEmpty(path) && File.Exists(path = Path.Combine(path, name))){return Path.GetFullPath(path);}diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.csindex b9f0701a67..a921859941 100644--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs@@ -197,7 +197,7 @@ namespace Emby.Server.Implementations.AppBase&& !string.Equals(CommonConfiguration.CachePath ?? string.Empty, newPath)){// Validate- if (!FileSystem.DirectoryExists(newPath))+ if (!Directory.Exists(newPath)){throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));}diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex 60cc19db70..454e266f78 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -1008,7 +1008,7 @@ namespace Emby.Server.Implementationstry{- if (!FileSystemManager.FileExists(certificateLocation))+ if (!File.Exists(certificateLocation)){return null;}@@ -1434,7 +1434,7 @@ namespace Emby.Server.Implementations//if (generateCertificate)//{- // if (!FileSystemManager.FileExists(certPath))+ // if (!File.Exists(certPath))// {// FileSystemManager.CreateDirectory(FileSystemManager.GetDirectoryName(certPath));diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.csindex 1bed658167..c8b8229704 100644--- a/Emby.Server.Implementations/Collections/CollectionManager.cs+++ b/Emby.Server.Implementations/Collections/CollectionManager.cs@@ -359,7 +359,7 @@ namespace Emby.Server.Implementations.Collections{var path = _collectionManager.GetCollectionsFolderPath();- if (_fileSystem.DirectoryExists(path))+ if (Directory.Exists(path)){try{diff --git a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.csindex ab2e1c9a96..18e279c2f0 100644--- a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs+++ b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs@@ -148,7 +148,7 @@ namespace Emby.Server.Implementations.Configuration&& !string.Equals(Configuration.CertificatePath ?? string.Empty, newPath)){// Validate- if (!FileSystem.FileExists(newPath))+ if (!File.Exists(newPath)){throw new FileNotFoundException(string.Format("Certificate file '{0}' does not exist.", newPath));}@@ -168,7 +168,7 @@ namespace Emby.Server.Implementations.Configuration&& !string.Equals(Configuration.MetadataPath ?? string.Empty, newPath)){// Validate- if (!FileSystem.DirectoryExists(newPath))+ if (!Directory.Exists(newPath)){throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));}diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.csindex 1958ae83b7..e94a649bfb 100644--- a/Emby.Server.Implementations/Devices/DeviceManager.cs+++ b/Emby.Server.Implementations/Devices/DeviceManager.cs@@ -431,7 +431,7 @@ namespace Emby.Server.Implementations.Devices{var path = _deviceManager.GetUploadsPath();- if (_fileSystem.DirectoryExists(path))+ if (Directory.Exists(path)){try{diff --git a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.csindex cf12a8294e..79a42f294b 100644--- a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs+++ b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs@@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.FFMpegvar prebuiltFolder = _appPaths.ProgramSystemPath;var prebuiltffmpeg = Path.Combine(prebuiltFolder, downloadInfo.FFMpegFilename);var prebuiltffprobe = Path.Combine(prebuiltFolder, downloadInfo.FFProbeFilename);- if (_fileSystem.FileExists(prebuiltffmpeg) && _fileSystem.FileExists(prebuiltffprobe))+ if (File.Exists(prebuiltffmpeg) && File.Exists(prebuiltffprobe)){return new FFMpegInfo{@@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.FFMpegvar excludeFromDeletions = new List<string> { versionedDirectoryPath };- if (!_fileSystem.FileExists(info.ProbePath) || !_fileSystem.FileExists(info.EncoderPath))+ if (!File.Exists(info.ProbePath) || !File.Exists(info.EncoderPath)){// ffmpeg not present. See if there's an older version we can start withvar existingVersion = GetExistingVersion(info, rootEncoderPath);diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.csindex af0c0a6a6c..12532a4971 100644--- a/Emby.Server.Implementations/IO/FileRefresher.cs+++ b/Emby.Server.Implementations/IO/FileRefresher.cs@@ -195,7 +195,7 @@ namespace Emby.Server.Implementations.IOif (item != null){// If the item has been deleted find the first valid parent that still exists- while (!_fileSystem.DirectoryExists(item.Path) && !_fileSystem.FileExists(item.Path))+ while (!Directory.Exists(item.Path) && !File.Exists(item.Path)){item = item.GetOwner() ?? item.GetParent();diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.csindex 45d8104f75..dad81c195c 100644--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs@@ -277,7 +277,7 @@ namespace Emby.Server.Implementations.IO/// <param name="path">The path.</param>private void StartWatchingPath(string path){- if (!_fileSystem.DirectoryExists(path))+ if (!Directory.Exists(path)){// Seeing a crash in the mono runtime due to an exception being thrown on a different threadLogger.LogInformation("Skipping realtime monitor for {0} because the path does not exist", path);diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.csindex 7b6372fe80..bf74048243 100644--- a/Emby.Server.Implementations/Library/LibraryManager.cs+++ b/Emby.Server.Implementations/Library/LibraryManager.cs@@ -2863,7 +2863,7 @@ namespace Emby.Server.Implementations.Libraryvar rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;var virtualFolderPath = Path.Combine(rootFolderPath, name);- while (_fileSystem.DirectoryExists(virtualFolderPath))+ while (Directory.Exists(virtualFolderPath)){name += "1";virtualFolderPath = Path.Combine(rootFolderPath, name);@@ -2872,7 +2872,7 @@ namespace Emby.Server.Implementations.Libraryvar mediaPathInfos = options.PathInfos;if (mediaPathInfos != null){- var invalidpath = mediaPathInfos.FirstOrDefault(i => !_fileSystem.DirectoryExists(i.Path));+ var invalidpath = mediaPathInfos.FirstOrDefault(i => !Directory.Exists(i.Path));if (invalidpath != null){throw new ArgumentException("The specified path does not exist: " + invalidpath.Path + ".");@@ -2935,7 +2935,7 @@ namespace Emby.Server.Implementations.Library// // We can't validate protocol-based paths, so just allow them// if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) == -1)// {- // return _fileSystem.DirectoryExists(path);+ // return Directory.Exists(path);// }//}@@ -2963,7 +2963,7 @@ namespace Emby.Server.Implementations.Librarythrow new ArgumentNullException(nameof(path));}- if (!_fileSystem.DirectoryExists(path))+ if (!Directory.Exists(path)){throw new FileNotFoundException("The path does not exist.");}@@ -2980,7 +2980,7 @@ namespace Emby.Server.Implementations.Libraryvar lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);- while (_fileSystem.FileExists(lnk))+ while (File.Exists(lnk)){shortcutFilename += "1";lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);@@ -3073,7 +3073,7 @@ namespace Emby.Server.Implementations.Libraryvar path = Path.Combine(rootFolderPath, name);- if (!_fileSystem.DirectoryExists(path))+ if (!Directory.Exists(path)){throw new FileNotFoundException("The media folder does not exist");}@@ -3145,7 +3145,7 @@ namespace Emby.Server.Implementations.Libraryvar rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);- if (!_fileSystem.DirectoryExists(virtualFolderPath))+ if (!Directory.Exists(virtualFolderPath)){throw new FileNotFoundException(string.Format("The media collection {0} does not exist", virtualFolderName));}diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.csindex 762509e749..6a2a46c9f7 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs@@ -1427,7 +1427,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVtimer.RetryCount++;_timerProvider.AddOrUpdate(timer);}- else if (_fileSystem.FileExists(recordPath))+ else if (File.Exists(recordPath)){timer.RecordingPath = recordPath;timer.Status = RecordingStatus.Completed;@@ -1573,7 +1573,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV.Where(i => i.Status == RecordingStatus.Completed && !string.IsNullOrWhiteSpace(i.RecordingPath)).Where(i => string.Equals(i.SeriesTimerId, seriesTimerId, StringComparison.OrdinalIgnoreCase)).OrderByDescending(i => i.EndDate)- .Where(i => _fileSystem.FileExists(i.RecordingPath))+ .Where(i => File.Exists(i.RecordingPath)).Skip(seriesTimer.KeepUpTo - 1).ToList();@@ -1595,7 +1595,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVDtoOptions = new DtoOptions(true)}))- .Where(i => i.IsFileProtocol && _fileSystem.FileExists(i.Path))+ .Where(i => i.IsFileProtocol && File.Exists(i.Path)).Skip(seriesTimer.KeepUpTo - 1).ToList();@@ -1689,7 +1689,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVprivate bool FileExists(string path, string timerId){- if (_fileSystem.FileExists(path))+ if (File.Exists(path)){return true;}@@ -1961,7 +1961,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{var nfoPath = Path.Combine(seriesPath, "tvshow.nfo");- if (_fileSystem.FileExists(nfoPath))+ if (File.Exists(nfoPath)){return;}@@ -2023,7 +2023,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{var nfoPath = Path.ChangeExtension(recordingPath, ".nfo");- if (_fileSystem.FileExists(nfoPath))+ if (File.Exists(nfoPath)){return;}@@ -2688,7 +2688,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar defaultFolder = RecordingPath;var defaultName = "Recordings";- if (_fileSystem.DirectoryExists(defaultFolder))+ if (Directory.Exists(defaultFolder)){list.Add(new VirtualFolderInfo{@@ -2698,7 +2698,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV}var customPath = GetConfiguration().MovieRecordingPath;- if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && _fileSystem.DirectoryExists(customPath))+ if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && Directory.Exists(customPath)){list.Add(new VirtualFolderInfo{@@ -2709,7 +2709,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV}customPath = GetConfiguration().SeriesRecordingPath;- if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && _fileSystem.DirectoryExists(customPath))+ if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && Directory.Exists(customPath)){list.Add(new VirtualFolderInfo{diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.csindex dccff65439..f152ac4652 100644--- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs@@ -61,7 +61,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listingsstring cacheFilename = DateTime.UtcNow.DayOfYear.ToString(CultureInfo.InvariantCulture) + "-" + DateTime.UtcNow.Hour.ToString(CultureInfo.InvariantCulture) + ".xml";string cacheFile = Path.Combine(_config.ApplicationPaths.CachePath, "xmltv", cacheFilename);- if (_fileSystem.FileExists(cacheFile))+ if (File.Exists(cacheFile)){return UnzipIfNeeded(path, cacheFile);}@@ -255,7 +255,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listingspublic Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings){// Assume all urls are valid. check files for existence- if (!info.Path.StartsWith("http", StringComparison.OrdinalIgnoreCase) && !_fileSystem.FileExists(info.Path))+ if (!info.Path.StartsWith("http", StringComparison.OrdinalIgnoreCase) && !File.Exists(info.Path)){throw new FileNotFoundException("Could not find the XmlTv file specified:", info.Path);}diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.csindex 32be5648d5..6b8afcb7f2 100644--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs@@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.Playlistsprivate string GetTargetPath(string path){- while (_fileSystem.DirectoryExists(path))+ while (Directory.Exists(path)){path += "1";}diff --git a/Jellyfin.Drawing.Skia/SkiaEncoder.cs b/Jellyfin.Drawing.Skia/SkiaEncoder.csindex 5f33b7ad8e..f1b886ec64 100644--- a/Jellyfin.Drawing.Skia/SkiaEncoder.cs+++ b/Jellyfin.Drawing.Skia/SkiaEncoder.cs@@ -257,7 +257,7 @@ namespace Jellyfin.Drawing.Skiainternal static SKBitmap Decode(string path, bool forceCleanBitmap, IFileSystem fileSystem, ImageOrientation? orientation, out SKEncodedOrigin origin){- if (!fileSystem.FileExists(path))+ if (!File.Exists(path)){throw new FileNotFoundException("File not found", path);}diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.csindex 366e9308eb..57e3da7ff6 100644--- a/MediaBrowser.Api/EnvironmentService.cs+++ b/MediaBrowser.Api/EnvironmentService.cs@@ -137,14 +137,14 @@ namespace MediaBrowser.Api{if (request.IsFile.Value){- if (!_fileSystem.FileExists(request.Path))+ if (!File.Exists(request.Path)){throw new FileNotFoundException("File not found", request.Path);}}else{- if (!_fileSystem.DirectoryExists(request.Path))+ if (Directory.Exists(request.Path)){throw new FileNotFoundException("File not found", request.Path);}@@ -153,7 +153,7 @@ namespace MediaBrowser.Apielse{- if (!_fileSystem.FileExists(request.Path) && !_fileSystem.DirectoryExists(request.Path))+ if (!File.Exists(request.Path) && Directory.Exists(request.Path)){throw new FileNotFoundException("Path not found", request.Path);}diff --git a/MediaBrowser.Api/Images/ImageByNameService.cs b/MediaBrowser.Api/Images/ImageByNameService.csindex 3ac576b0f2..fdf5842772 100644--- a/MediaBrowser.Api/Images/ImageByNameService.cs+++ b/MediaBrowser.Api/Images/ImageByNameService.cs@@ -185,7 +185,7 @@ namespace MediaBrowser.Api.Imagesvar paths = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(_appPaths.GeneralPath, request.Name, filename + i)).ToList();- var path = paths.FirstOrDefault(_fileSystem.FileExists) ?? paths.FirstOrDefault();+ var path = paths.FirstOrDefault(File.Exists) ?? paths.FirstOrDefault();return _resultFactory.GetStaticFileResult(Request, path);}@@ -199,11 +199,11 @@ namespace MediaBrowser.Api.Images{var themeFolder = Path.Combine(_appPaths.RatingsPath, request.Theme);- if (_fileSystem.DirectoryExists(themeFolder))+ if (Directory.Exists(themeFolder)){var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(themeFolder, request.Name + i))- .FirstOrDefault(_fileSystem.FileExists);+ .FirstOrDefault(File.Exists);if (!string.IsNullOrEmpty(path)){@@ -213,14 +213,14 @@ namespace MediaBrowser.Api.Imagesvar allFolder = Path.Combine(_appPaths.RatingsPath, "all");- if (_fileSystem.DirectoryExists(allFolder))+ if (Directory.Exists(allFolder)){// Avoid implicitly captured closurevar currentRequest = request;var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, currentRequest.Name + i))- .FirstOrDefault(_fileSystem.FileExists);+ .FirstOrDefault(File.Exists);if (!string.IsNullOrEmpty(path)){@@ -240,10 +240,10 @@ namespace MediaBrowser.Api.Images{var themeFolder = Path.Combine(_appPaths.MediaInfoImagesPath, request.Theme);- if (_fileSystem.DirectoryExists(themeFolder))+ if (Directory.Exists(themeFolder)){var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(themeFolder, request.Name + i))- .FirstOrDefault(_fileSystem.FileExists);+ .FirstOrDefault(File.Exists);if (!string.IsNullOrEmpty(path)){@@ -253,13 +253,13 @@ namespace MediaBrowser.Api.Imagesvar allFolder = Path.Combine(_appPaths.MediaInfoImagesPath, "all");- if (_fileSystem.DirectoryExists(allFolder))+ if (Directory.Exists(allFolder)){// Avoid implicitly captured closurevar currentRequest = request;var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, currentRequest.Name + i))- .FirstOrDefault(_fileSystem.FileExists);+ .FirstOrDefault(File.Exists);if (!string.IsNullOrEmpty(path)){diff --git a/MediaBrowser.Api/Images/RemoteImageService.cs b/MediaBrowser.Api/Images/RemoteImageService.csindex 3a1ebced52..49b382e343 100644--- a/MediaBrowser.Api/Images/RemoteImageService.cs+++ b/MediaBrowser.Api/Images/RemoteImageService.cs@@ -222,7 +222,7 @@ namespace MediaBrowser.Api.Images{contentPath = _fileSystem.ReadAllText(pointerCachePath);- if (_fileSystem.FileExists(contentPath))+ if (File.Exists(contentPath)){return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);}diff --git a/MediaBrowser.Api/ItemLookupService.cs b/MediaBrowser.Api/ItemLookupService.csindex eaf2d1e1b0..ae3f280e80 100644--- a/MediaBrowser.Api/ItemLookupService.cs+++ b/MediaBrowser.Api/ItemLookupService.cs@@ -267,7 +267,7 @@ namespace MediaBrowser.Api{contentPath = _fileSystem.ReadAllText(pointerCachePath);- if (_fileSystem.FileExists(contentPath))+ if (File.Exists(contentPath)){return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);}diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.csindex 3be6b29dde..c95a068051 100644--- a/MediaBrowser.Api/Library/LibraryStructureService.cs+++ b/MediaBrowser.Api/Library/LibraryStructureService.cs@@ -255,12 +255,12 @@ namespace MediaBrowser.Api.Libraryvar currentPath = Path.Combine(rootFolderPath, request.Name);var newPath = Path.Combine(rootFolderPath, request.NewName);- if (!_fileSystem.DirectoryExists(currentPath))+ if (Directory.Exists(currentPath)){throw new FileNotFoundException("The media collection does not exist");}- if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && _fileSystem.DirectoryExists(newPath))+ if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && Directory.Exists(newPath)){throw new ArgumentException("Media library already exists at " + newPath + ".");}@@ -273,11 +273,11 @@ namespace MediaBrowser.Api.Libraryif (string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase)){var tempPath = Path.Combine(rootFolderPath, Guid.NewGuid().ToString("N"));- _fileSystem.MoveDirectory(currentPath, tempPath);+ Directory.Move(currentPath, tempPath);currentPath = tempPath;}- _fileSystem.MoveDirectory(currentPath, newPath);+ Directory.Move(currentPath, newPath);}finally{diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.csindex 07e84536fc..4ed83baadb 100644--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs@@ -290,7 +290,7 @@ namespace MediaBrowser.Api.Playbacknew JobLogger(Logger).StartStreamingLog(state, process.StandardError.BaseStream, state.LogFileStream);// Wait for the file to exist before proceeeding- while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)+ while (!File.Exists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited){await Task.Delay(100, cancellationTokenSource.Token).ConfigureAwait(false);}diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.csindex 3c41226d0c..08a2183f83 100644--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs@@ -83,13 +83,13 @@ namespace MediaBrowser.Api.Playback.HlsTranscodingJob job = null;var playlist = state.OutputFilePath;- if (!FileSystem.FileExists(playlist))+ if (!File.Exists(playlist)){var transcodingLock = ApiEntryPoint.Instance.GetTranscodingLock(playlist);await transcodingLock.WaitAsync(cancellationTokenSource.Token).ConfigureAwait(false);try{- if (!FileSystem.FileExists(playlist))+ if (!File.Exists(playlist)){// If the playlist doesn't already exist, startup ffmpegtrydiff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.csindex c30ad67ecd..0a3633178a 100644--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs@@ -164,7 +164,7 @@ namespace MediaBrowser.Api.Playback.HlsTranscodingJob job = null;- if (FileSystem.FileExists(segmentPath))+ if (File.Exists(segmentPath)){job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);return await GetSegmentResult(state, playlistPath, segmentPath, segmentExtension, requestedIndex, job, cancellationToken).ConfigureAwait(false);@@ -177,7 +177,7 @@ namespace MediaBrowser.Api.Playback.Hlstry{- if (FileSystem.FileExists(segmentPath))+ if (File.Exists(segmentPath)){job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);transcodingLock.Release();@@ -433,7 +433,7 @@ namespace MediaBrowser.Api.Playback.HlsTranscodingJob transcodingJob,CancellationToken cancellationToken){- var segmentFileExists = FileSystem.FileExists(segmentPath);+ var segmentFileExists = File.Exists(segmentPath);// If all transcoding has completed, just return immediatelyif (transcodingJob != null && transcodingJob.HasExited && segmentFileExists)@@ -465,7 +465,7 @@ namespace MediaBrowser.Api.Playback.Hls{if (!segmentFileExists){- segmentFileExists = FileSystem.FileExists(segmentPath);+ segmentFileExists = File.Exists(segmentPath);}if (segmentFileExists){diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.csindex bb21fe5ae1..621d1ff88d 100644--- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs+++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs@@ -1,6 +1,7 @@using System;using System.Collections.Generic;using System.Globalization;+using System.IO;using System.Threading;using System.Threading.Tasks;using MediaBrowser.Common.Net;@@ -153,7 +154,7 @@ namespace MediaBrowser.Api.Playback.Progressive}var outputPath = state.OutputFilePath;- var outputPathExists = FileSystem.FileExists(outputPath);+ var outputPathExists = File.Exists(outputPath);var transcodingJob = ApiEntryPoint.Instance.GetTranscodingJob(outputPath, TranscodingJobType.Progressive);var isTranscodeCached = outputPathExists && transcodingJob != null;@@ -377,7 +378,7 @@ namespace MediaBrowser.Api.Playback.Progressive{TranscodingJob job;- if (!FileSystem.FileExists(outputPath))+ if (!File.Exists(outputPath)){job = await StartFfMpeg(state, outputPath, cancellationTokenSource).ConfigureAwait(false);}diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.csindex 096cc7016e..ab9458187d 100644--- a/MediaBrowser.Controller/Entities/BaseItem.cs+++ b/MediaBrowser.Controller/Entities/BaseItem.cs@@ -1,6 +1,7 @@using System;using System.Collections.Generic;using System.Globalization;+using System.IO;using System.Linq;using System.Text;using System.Threading;@@ -2343,7 +2344,7 @@ namespace MediaBrowser.Controller.Entitiesvar newImagePaths = images.Select(i => i.FullName).ToList();var deleted = existingImages- .Where(i => i.IsLocalFile && !newImagePaths.Contains(i.Path, StringComparer.OrdinalIgnoreCase) && !FileSystem.FileExists(i.Path))+ .Where(i => i.IsLocalFile && !newImagePaths.Contains(i.Path, StringComparer.OrdinalIgnoreCase) && !File.Exists(i.Path)).ToList();if (deleted.Count > 0)diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.csindex ea2ea9a506..06bae92112 100644--- a/MediaBrowser.Controller/Entities/User.cs+++ b/MediaBrowser.Controller/Entities/User.cs@@ -168,14 +168,14 @@ namespace MediaBrowser.Controller.Entitiesvar oldConfigurationDirectory = ConfigurationDirectoryPath;// Exceptions will be thrown if these paths already exist- if (FileSystem.DirectoryExists(newConfigDirectory))+ if (Directory.Exists(newConfigDirectory)){Directory.Delete(newConfigDirectory, true);}- if (FileSystem.DirectoryExists(oldConfigurationDirectory))+ if (Directory.Exists(oldConfigurationDirectory)){- FileSystem.MoveDirectory(oldConfigurationDirectory, newConfigDirectory);+ Directory.Move(oldConfigurationDirectory, newConfigDirectory);}else{diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.csindex 968e3dbcb5..fc2b8f9c9b 100644--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs@@ -434,7 +434,7 @@ namespace MediaBrowser.Controller.MediaEncodingif (string.Equals(Path.GetExtension(subtitlePath), ".sub", StringComparison.OrdinalIgnoreCase)){var idxFile = Path.ChangeExtension(subtitlePath, ".idx");- if (_fileSystem.FileExists(idxFile))+ if (File.Exists(idxFile)){subtitlePath = idxFile;}@@ -542,7 +542,7 @@ namespace MediaBrowser.Controller.MediaEncoding// var fallbackFontPath = Path.Combine(_appPaths.ProgramDataPath, "fonts", "DroidSansFallback.ttf");// string fallbackFontParam = string.Empty;- // if (!_fileSystem.FileExists(fallbackFontPath))+ // if (!File.Exists(fallbackFontPath))// {// _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fallbackFontPath));// using (var stream = _assemblyInfo.GetManifestResourceStream(GetType(), GetType().Namespace + ".DroidSansFallback.ttf"))diff --git a/MediaBrowser.MediaEncoding/Configuration/EncodingConfigurationFactory.cs b/MediaBrowser.MediaEncoding/Configuration/EncodingConfigurationFactory.csindex 1af4146bc8..c20d73dc73 100644--- a/MediaBrowser.MediaEncoding/Configuration/EncodingConfigurationFactory.cs+++ b/MediaBrowser.MediaEncoding/Configuration/EncodingConfigurationFactory.cs@@ -46,7 +46,7 @@ namespace MediaBrowser.MediaEncoding.Configuration&& !string.Equals(oldEncodingConfig.TranscodingTempPath ?? string.Empty, newPath)){// Validate- if (!_fileSystem.DirectoryExists(newPath))+ if (Directory.Exists(newPath)){throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));}diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.csindex 2d43b82562..d3c44f5ebe 100644--- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs+++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs@@ -137,7 +137,7 @@ namespace MediaBrowser.MediaEncoding.Encodernew JobLogger(Logger).StartStreamingLog(encodingJob, process.StandardError.BaseStream, encodingJob.LogFileStream);// Wait for the file to exist before proceeeding- while (!FileSystem.FileExists(encodingJob.OutputFilePath) && !encodingJob.HasExited)+ while (!File.Exists(encodingJob.OutputFilePath) && !encodingJob.HasExited){await Task.Delay(100, cancellationToken).ConfigureAwait(false);}diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.csindex 92e091dc0a..7bcb1e38af 100644--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs@@ -214,7 +214,7 @@ namespace MediaBrowser.MediaEncoding.Encoderthrow new ArgumentNullException(nameof(path));}- if (!FileSystem.FileExists(path) && !FileSystem.DirectoryExists(path))+ if (!File.Exists(path) && Directory.Exists(path)){throw new ResourceNotFoundException();}@@ -288,12 +288,12 @@ namespace MediaBrowser.MediaEncoding.Encoderif (!string.IsNullOrWhiteSpace(appPath)){- if (FileSystem.DirectoryExists(appPath))+ if (Directory.Exists(appPath)){return GetPathsFromDirectory(appPath);}- if (FileSystem.FileExists(appPath))+ if (File.Exists(appPath)){return new Tuple<string, string>(appPath, GetProbePathFromEncoderPath(appPath));}@@ -336,7 +336,7 @@ namespace MediaBrowser.MediaEncoding.Encodervar ffmpegPath = files.FirstOrDefault(i => string.Equals(Path.GetFileNameWithoutExtension(i), "ffmpeg", StringComparison.OrdinalIgnoreCase) && !excludeExtensions.Contains(Path.GetExtension(i) ?? string.Empty));var ffprobePath = files.FirstOrDefault(i => string.Equals(Path.GetFileNameWithoutExtension(i), "ffprobe", StringComparison.OrdinalIgnoreCase) && !excludeExtensions.Contains(Path.GetExtension(i) ?? string.Empty));- if (string.IsNullOrWhiteSpace(ffmpegPath) || !FileSystem.FileExists(ffmpegPath))+ if (string.IsNullOrWhiteSpace(ffmpegPath) || !File.Exists(ffmpegPath)){files = FileSystem.GetFilePaths(path, true);diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.csindex 849548699b..eb62b2b8f1 100644--- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs+++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs@@ -386,7 +386,7 @@ namespace MediaBrowser.MediaEncoding.Subtitlestry{- if (!_fileSystem.FileExists(outputPath))+ if (!File.Exists(outputPath)){await ConvertTextSubtitleToSrtInternal(inputPath, language, inputProtocol, outputPath, cancellationToken).ConfigureAwait(false);}@@ -481,7 +481,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles{failed = true;- if (_fileSystem.FileExists(outputPath))+ if (File.Exists(outputPath)){try{@@ -494,7 +494,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles}}}- else if (!_fileSystem.FileExists(outputPath))+ else if (!File.Exists(outputPath)){failed = true;}@@ -537,7 +537,7 @@ namespace MediaBrowser.MediaEncoding.Subtitlestry{- if (!_fileSystem.FileExists(outputPath))+ if (!File.Exists(outputPath)){await ExtractTextSubtitleInternal(_mediaEncoder.GetInputArgument(inputFiles, protocol), subtitleStreamIndex, outputCodec, outputPath, cancellationToken).ConfigureAwait(false);}@@ -634,7 +634,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles_logger.LogError(ex, "Error deleting extracted subtitle {Path}", outputPath);}}- else if (!_fileSystem.FileExists(outputPath))+ else if (!File.Exists(outputPath)){failed = true;}diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.csindex c2e53ae6c4..493c97b6ec 100644--- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs+++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs@@ -387,7 +387,7 @@ namespace MediaBrowser.Providers.Managervar existing = item.GetImageInfo(type, 0);if (existing != null){- if (existing.IsLocalFile && !_fileSystem.FileExists(existing.Path))+ if (existing.IsLocalFile && !File.Exists(existing.Path)){item.RemoveImage(existing);changed = true;diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.csindex 65364ad679..eda5163f00 100644--- a/MediaBrowser.Providers/Manager/ProviderManager.cs+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs@@ -703,7 +703,7 @@ namespace MediaBrowser.Providers.Manager// Manual edit occurred// Even if save local is off, save locally anyway if the metadata file already exists- if (fileSaver == null || !_fileSystem.FileExists(fileSaver.GetSavePath(item)))+ if (fileSaver == null || !File.Exists(fileSaver.GetSavePath(item))){return false;}diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.csindex 40237bb968..61a8a122b9 100644--- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs+++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs@@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.MediaInfo{var path = GetAudioImagePath(item);- if (!_fileSystem.FileExists(path))+ if (!File.Exists(path)){Directory.CreateDirectory(Path.GetDirectoryName(path));diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.csindex 8da6d45230..fcdea33d01 100644--- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs+++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs@@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.TV}// Check this in order to avoid logging an exception due to directory not existing- if (!_fileSystem.DirectoryExists(seriesDataPath))+ if (Directory.Exists(seriesDataPath)){return false;}diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.csindex c65fed440f..496e0bb72d 100644--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs@@ -1526,7 +1526,7 @@ namespace MediaBrowser.Providers.TVvar file = Path.Combine(seriesDataPath, string.Format("episode-{0}-{1}.xml", seasonNumber, episodeNumber));// Only save the file if not already there, or if the episode has changed- if (hasEpisodeChanged || !_fileSystem.FileExists(file))+ if (hasEpisodeChanged || !File.Exists(file)){using (var fileStream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true)){@@ -1546,7 +1546,7 @@ namespace MediaBrowser.Providers.TVfile = Path.Combine(seriesDataPath, string.Format("episode-abs-{0}.xml", absoluteNumber));// Only save the file if not already there, or if the episode has changed- if (hasEpisodeChanged || !_fileSystem.FileExists(file))+ if (hasEpisodeChanged || !File.Exists(file)){using (var fileStream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true)){@@ -1567,7 +1567,7 @@ namespace MediaBrowser.Providers.TVfile = Path.Combine(seriesDataPath, string.Format("episode-dvd-{0}-{1}.xml", dvdSeasonNumber, dvdEpisodeNumber));// Only save the file if not already there, or if the episode has changed- if (hasEpisodeChanged || !_fileSystem.FileExists(file))+ if (hasEpisodeChanged || !File.Exists(file)){using (var fileStream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true)){diff --git a/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.csindex 102fba70b4..5246bec023 100644--- a/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs+++ b/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs@@ -36,7 +36,7 @@ namespace MediaBrowser.XbmcMetadata.Saversreturn false;}- return updateType >= MinimumUpdateType || (updateType >= ItemUpdateType.MetadataImport && FileSystem.FileExists(GetSavePath(item)));+ return updateType >= MinimumUpdateType || (updateType >= ItemUpdateType.MetadataImport && File.Exists(GetSavePath(item)));}protected override void WriteCustomElements(BaseItem item, XmlWriter writer)