The Free Software Media System - Server Backend & API
Unwrapped all /(Write|Read)All(Text|Bytes)/ functions.
Erwin de Haanb9a111432a8c
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.csindex a921859941..ec3ca8ead1 100644--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs@@ -210,7 +210,8 @@ namespace Emby.Server.Implementations.AppBase{var file = Path.Combine(path, Guid.NewGuid().ToString());- FileSystem.WriteAllText(file, string.Empty);+ string text = string.Empty;+ File.WriteAllText(file, text);FileSystem.DeleteFile(file);}diff --git a/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs b/Emby.Server.Implementations/AppBase/ConfigurationHelper.csindex b9af663a95..3faad76e7d 100644--- a/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs+++ b/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs@@ -29,7 +29,7 @@ namespace Emby.Server.Implementations.AppBase// Use try/catch to avoid the extra file system lookup using File.Existstry{- buffer = fileSystem.ReadAllBytes(path);+ buffer = File.ReadAllBytes(path);configuration = xmlSerializer.DeserializeFromBytes(type, buffer);}@@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.AppBaseDirectory.CreateDirectory(Path.GetDirectoryName(path));// Save it after load in case we got new items- fileSystem.WriteAllBytes(path, newBytes);+ File.WriteAllBytes(path, newBytes);}return configuration;diff --git a/Emby.Server.Implementations/Devices/DeviceId.cs b/Emby.Server.Implementations/Devices/DeviceId.csindex 9640e7abb1..866bd137ff 100644--- a/Emby.Server.Implementations/Devices/DeviceId.cs+++ b/Emby.Server.Implementations/Devices/DeviceId.cs@@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Deviceslock (_syncLock){- _fileSystem.WriteAllText(path, id, Encoding.UTF8);+ File.WriteAllText(path, id, Encoding.UTF8);}}catch (Exception ex)diff --git a/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs b/Emby.Server.Implementations/IO/MbLinkShortcutHandler.csindex a306f94b36..5e5e91bb39 100644--- a/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs+++ b/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs@@ -24,7 +24,7 @@ namespace Emby.Server.Implementations.IOif (string.Equals(Path.GetExtension(shortcutPath), ".mblink", StringComparison.OrdinalIgnoreCase)){- var path = _fileSystem.ReadAllText(shortcutPath);+ var path = File.ReadAllText(shortcutPath);return _fileSystem.NormalizePath(path);}@@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.IOthrow new ArgumentNullException(nameof(targetPath));}- _fileSystem.WriteAllText(shortcutPath, targetPath);+ File.WriteAllText(shortcutPath, targetPath);}}}diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.csindex bf74048243..f96a211ec5 100644--- a/Emby.Server.Implementations/Library/LibraryManager.cs+++ b/Emby.Server.Implementations/Library/LibraryManager.cs@@ -2889,7 +2889,7 @@ namespace Emby.Server.Implementations.Library{var path = Path.Combine(virtualFolderPath, collectionType + ".collection");- _fileSystem.WriteAllBytes(path, Array.Empty<byte>());+ File.WriteAllBytes(path, Array.Empty<byte>());}CollectionFolder.SaveLibraryOptions(virtualFolderPath, options);diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.csindex 0b87455a43..05fce4542f 100644--- a/Emby.Server.Implementations/Library/UserManager.cs+++ b/Emby.Server.Implementations/Library/UserManager.cs@@ -904,7 +904,7 @@ namespace Emby.Server.Implementations.Library// Tuesday, 22 August 2006 06:30 AMtext.AppendLine("The pin code will expire at " + localExpirationTime.ToString("f1", CultureInfo.CurrentCulture));- _fileSystem.WriteAllText(path, text.ToString(), Encoding.UTF8);+ File.WriteAllText(path, text.ToString(), Encoding.UTF8);var result = new PasswordPinCreationResult{diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.csindex 6b8afcb7f2..29836e0bff 100644--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs@@ -340,7 +340,8 @@ namespace Emby.Server.Implementations.Playlistsplaylist.PlaylistEntries.Add(entry);}- _fileSystem.WriteAllText(playlistPath, new WplContent().ToText(playlist));+ string text = new WplContent().ToText(playlist);+ File.WriteAllText(playlistPath, text);}if (string.Equals(".zpl", extension, StringComparison.OrdinalIgnoreCase)){@@ -373,7 +374,8 @@ namespace Emby.Server.Implementations.Playlistsplaylist.PlaylistEntries.Add(entry);}- _fileSystem.WriteAllText(playlistPath, new ZplContent().ToText(playlist));+ string text = new ZplContent().ToText(playlist);+ File.WriteAllText(playlistPath, text);}if (string.Equals(".m3u", extension, StringComparison.OrdinalIgnoreCase)){@@ -401,7 +403,8 @@ namespace Emby.Server.Implementations.Playlistsplaylist.PlaylistEntries.Add(entry);}- _fileSystem.WriteAllText(playlistPath, new M3uContent().ToText(playlist));+ string text = new M3uContent().ToText(playlist);+ File.WriteAllText(playlistPath, text);}if (string.Equals(".m3u8", extension, StringComparison.OrdinalIgnoreCase)){@@ -429,7 +432,8 @@ namespace Emby.Server.Implementations.Playlistsplaylist.PlaylistEntries.Add(entry);}- _fileSystem.WriteAllText(playlistPath, new M3u8Content().ToText(playlist));+ string text = new M3u8Content().ToText(playlist);+ File.WriteAllText(playlistPath, text);}if (string.Equals(".pls", extension, StringComparison.OrdinalIgnoreCase)){@@ -449,7 +453,8 @@ namespace Emby.Server.Implementations.Playlistsplaylist.PlaylistEntries.Add(entry);}- _fileSystem.WriteAllText(playlistPath, new PlsContent().ToText(playlist));+ string text = new PlsContent().ToText(playlist);+ File.WriteAllText(playlistPath, text);}}diff --git a/Emby.Server.Implementations/ResourceFileManager.cs b/Emby.Server.Implementations/ResourceFileManager.csindex 8c1f765e27..890d848f4b 100644--- a/Emby.Server.Implementations/ResourceFileManager.cs+++ b/Emby.Server.Implementations/ResourceFileManager.cs@@ -37,7 +37,7 @@ namespace Emby.Server.Implementationspublic string ReadAllText(string basePath, string virtualPath){- return _fileSystem.ReadAllText(GetResourcePath(basePath, virtualPath));+ return File.ReadAllText(GetResourcePath(basePath, virtualPath));}private string GetResourcePath(string basePath, string virtualPath)diff --git a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.csindex 4124063f07..c31bdd13d2 100644--- a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs+++ b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs@@ -105,7 +105,7 @@ namespace Emby.Server.Implementations.ScheduledTasks{try{- previouslyFailedImages = _fileSystem.ReadAllText(failHistoryPath)+ previouslyFailedImages = File.ReadAllText(failHistoryPath).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToList();}@@ -143,7 +143,8 @@ namespace Emby.Server.Implementations.ScheduledTasksDirectory.CreateDirectory(parentPath);- _fileSystem.WriteAllText(failHistoryPath, string.Join("|", previouslyFailedImages.ToArray()));+ string text = string.Join("|", previouslyFailedImages.ToArray());+ File.WriteAllText(failHistoryPath, text);}numComplete++;diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.csindex 6706e5700d..5521556356 100644--- a/Emby.Server.Implementations/Updates/InstallationManager.cs+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs@@ -575,7 +575,7 @@ namespace Emby.Server.Implementations.Updates//If it is an archive - write out a version file so we know what it isif (isArchive){- _fileSystem.WriteAllText(target + ".ver", package.versionStr);+ File.WriteAllText(target + ".ver", package.versionStr);}}catch (IOException ex)diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.csindex 57e3da7ff6..907c44fe1d 100644--- a/MediaBrowser.Api/EnvironmentService.cs+++ b/MediaBrowser.Api/EnvironmentService.cs@@ -169,7 +169,7 @@ namespace MediaBrowser.Api{var file = Path.Combine(path, Guid.NewGuid().ToString());- _fileSystem.WriteAllText(file, string.Empty);+ File.WriteAllText(file, string.Empty);_fileSystem.DeleteFile(file);}diff --git a/MediaBrowser.Api/Images/RemoteImageService.cs b/MediaBrowser.Api/Images/RemoteImageService.csindex 49b382e343..24d4751c59 100644--- a/MediaBrowser.Api/Images/RemoteImageService.cs+++ b/MediaBrowser.Api/Images/RemoteImageService.cs@@ -220,7 +220,7 @@ namespace MediaBrowser.Api.Imagestry{- contentPath = _fileSystem.ReadAllText(pointerCachePath);+ contentPath = File.ReadAllText(pointerCachePath);if (File.Exists(contentPath)){@@ -239,7 +239,7 @@ namespace MediaBrowser.Api.Imagesawait DownloadImage(request.ImageUrl, urlHash, pointerCachePath).ConfigureAwait(false);// Read the pointer file again- contentPath = _fileSystem.ReadAllText(pointerCachePath);+ contentPath = File.ReadAllText(pointerCachePath);return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);}@@ -274,7 +274,7 @@ namespace MediaBrowser.Api.Images}Directory.CreateDirectory(Path.GetDirectoryName(pointerCachePath));- _fileSystem.WriteAllText(pointerCachePath, fullCachePath);+ File.WriteAllText(pointerCachePath, fullCachePath);}}diff --git a/MediaBrowser.Api/ItemLookupService.cs b/MediaBrowser.Api/ItemLookupService.csindex ae3f280e80..0e7bdc0860 100644--- a/MediaBrowser.Api/ItemLookupService.cs+++ b/MediaBrowser.Api/ItemLookupService.cs@@ -265,7 +265,7 @@ namespace MediaBrowser.Apitry{- contentPath = _fileSystem.ReadAllText(pointerCachePath);+ contentPath = File.ReadAllText(pointerCachePath);if (File.Exists(contentPath)){@@ -284,7 +284,7 @@ namespace MediaBrowser.Apiawait DownloadImage(request.ProviderName, request.ImageUrl, urlHash, pointerCachePath).ConfigureAwait(false);// Read the pointer file again- contentPath = _fileSystem.ReadAllText(pointerCachePath);+ contentPath = File.ReadAllText(pointerCachePath);return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);}@@ -315,7 +315,7 @@ namespace MediaBrowser.Api}Directory.CreateDirectory(Path.GetDirectoryName(pointerCachePath));- _fileSystem.WriteAllText(pointerCachePath, fullCachePath);+ File.WriteAllText(pointerCachePath, fullCachePath);}/// <summary>diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.csindex 0a3633178a..30696ec979 100644--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs@@ -458,7 +458,7 @@ namespace MediaBrowser.Api.Playback.Hls{try{- var text = FileSystem.ReadAllText(playlistPath, Encoding.UTF8);+ var text = File.ReadAllText(playlistPath, Encoding.UTF8);// If it appears in the playlist, it's doneif (text.IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1)diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.csindex eb62b2b8f1..d978359c71 100644--- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs+++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs@@ -747,7 +747,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles}if (protocol == MediaProtocol.File){- return _fileSystem.ReadAllBytes(path);+ return File.ReadAllBytes(path);}throw new ArgumentOutOfRangeException(nameof(protocol));diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.csindex 7e2d54b903..25fc214b54 100644--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs@@ -296,7 +296,7 @@ namespace MediaBrowser.Providers.TVprivate XmlReader GetXmlReader(FileSystemMetadata xmlFile){- return GetXmlReader(_fileSystem.ReadAllText(xmlFile.FullName, Encoding.UTF8));+ return GetXmlReader(File.ReadAllText(xmlFile.FullName, Encoding.UTF8));}private XmlReader GetXmlReader(string xml)diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.csindex fc75e2c0af..6f7cb72d33 100644--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs@@ -95,7 +95,7 @@ namespace MediaBrowser.Providers.TV}// Find out the last time we queried tvdb for updates- var lastUpdateTime = timestampFileInfo.Exists ? _fileSystem.ReadAllText(timestampFile, Encoding.UTF8) : string.Empty;+ var lastUpdateTime = timestampFileInfo.Exists ? File.ReadAllText(timestampFile, Encoding.UTF8) : string.Empty;string newUpdateTime;@@ -171,7 +171,7 @@ namespace MediaBrowser.Providers.TVawait UpdateSeries(listToUpdate, path, nullableUpdateValue, progress, cancellationToken).ConfigureAwait(false);}- _fileSystem.WriteAllText(timestampFile, newUpdateTime, Encoding.UTF8);+ File.WriteAllText(timestampFile, newUpdateTime, Encoding.UTF8);progress.Report(100);}