aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorVasily <JustAMan@users.noreply.github.com>2019-01-29 16:50:01 +0300
committerGitHub <noreply@github.com>2019-01-29 16:50:01 +0300
commit8487319374fa86601a6fcfdae64ee75dc51ed357 (patch)
tree919d0ccc8d36793bcd20dfe58c48563ea724f0e3 /MediaBrowser.Controller
parent0e2e7311036187342fd33d2eb745df4a6bece3f4 (diff)
parent91e99effc9b8dd1e34d4e53e732fe71f1423006c (diff)
Merge pull request #726 from EraYaN/remove-wrappers-for-system-io
Clean up IFileSystem wrappers around stdlib.
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs11
-rw-r--r--MediaBrowser.Controller/Entities/Game.cs2
-rw-r--r--MediaBrowser.Controller/Entities/TV/Season.cs2
-rw-r--r--MediaBrowser.Controller/Entities/User.cs11
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs2
-rw-r--r--MediaBrowser.Controller/Library/ItemResolveArgs.cs2
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs4
-rw-r--r--MediaBrowser.Controller/Playlists/Playlist.cs2
8 files changed, 19 insertions, 17 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 0d1a0ce86..482d14e11 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;
@@ -228,7 +229,7 @@ namespace MediaBrowser.Controller.Entities
return Path;
}
- return FileSystem.GetDirectoryName(Path);
+ return System.IO.Path.GetDirectoryName(Path);
}
}
@@ -2208,7 +2209,7 @@ namespace MediaBrowser.Controller.Entities
{
var allFiles = ImageInfos
.Where(i => i.IsLocalFile)
- .Select(i => FileSystem.GetDirectoryName(i.Path))
+ .Select(i => System.IO.Path.GetDirectoryName(i.Path))
.Distinct(StringComparer.OrdinalIgnoreCase)
.SelectMany(i => directoryService.GetFilePaths(i))
.ToList();
@@ -2343,7 +2344,7 @@ namespace MediaBrowser.Controller.Entities
var 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)
@@ -2396,7 +2397,7 @@ namespace MediaBrowser.Controller.Entities
var extensions = new List<string> { ".nfo", ".xml", ".srt", ".vtt", ".sub", ".idx", ".txt", ".edl", ".bif", ".smi", ".ttml" };
extensions.AddRange(SupportedImageExtensions);
- return FileSystem.GetFiles(FileSystem.GetDirectoryName(Path), extensions.ToArray(), false, false)
+ return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path), extensions.ToArray(), false, false)
.Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase))
.ToList();
}
@@ -2508,7 +2509,7 @@ namespace MediaBrowser.Controller.Entities
if (string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Path))
{
- Name = FileSystem.GetFileNameWithoutExtension(Path);
+ Name = System.IO.Path.GetFileNameWithoutExtension(Path);
hasChanges = true;
}
diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs
index 82a4531ff..eea1bf43d 100644
--- a/MediaBrowser.Controller/Entities/Game.cs
+++ b/MediaBrowser.Controller/Entities/Game.cs
@@ -87,7 +87,7 @@ namespace MediaBrowser.Controller.Entities
return new[] {
new FileSystemMetadata
{
- FullName = FileSystem.GetDirectoryName(Path),
+ FullName = System.IO.Path.GetDirectoryName(Path),
IsDirectory = true
}
};
diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs
index b40009e0c..5d7c260d1 100644
--- a/MediaBrowser.Controller/Entities/TV/Season.cs
+++ b/MediaBrowser.Controller/Entities/TV/Season.cs
@@ -97,7 +97,7 @@ namespace MediaBrowser.Controller.Entities.TV
return series.Path;
}
- return FileSystem.GetDirectoryName(Path);
+ return System.IO.Path.GetDirectoryName(Path);
}
}
diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs
index 10fe096a4..06bae9211 100644
--- a/MediaBrowser.Controller/Entities/User.cs
+++ b/MediaBrowser.Controller/Entities/User.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Library;
@@ -167,18 +168,18 @@ namespace MediaBrowser.Controller.Entities
var oldConfigurationDirectory = ConfigurationDirectoryPath;
// Exceptions will be thrown if these paths already exist
- if (FileSystem.DirectoryExists(newConfigDirectory))
+ if (Directory.Exists(newConfigDirectory))
{
- FileSystem.DeleteDirectory(newConfigDirectory, true);
+ Directory.Delete(newConfigDirectory, true);
}
- if (FileSystem.DirectoryExists(oldConfigurationDirectory))
+ if (Directory.Exists(oldConfigurationDirectory))
{
- FileSystem.MoveDirectory(oldConfigurationDirectory, newConfigDirectory);
+ Directory.Move(oldConfigurationDirectory, newConfigDirectory);
}
else
{
- FileSystem.CreateDirectory(newConfigDirectory);
+ Directory.CreateDirectory(newConfigDirectory);
}
}
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index dd4440c3b..33a967758 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -345,7 +345,7 @@ namespace MediaBrowser.Controller.Entities
{
if (IsStacked)
{
- return FileSystem.GetDirectoryName(Path);
+ return System.IO.Path.GetDirectoryName(Path);
}
if (!IsPlaceHolder)
diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs
index 7bb8325f8..0222b926e 100644
--- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs
+++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs
@@ -85,7 +85,7 @@ namespace MediaBrowser.Controller.Library
return false;
}
- var parentDir = BaseItem.FileSystem.GetDirectoryName(Path) ?? string.Empty;
+ var parentDir = System.IO.Path.GetDirectoryName(Path) ?? string.Empty;
return parentDir.Length > _appPaths.RootFolderPath.Length
&& parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase);
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 968e3dbcb..fc2b8f9c9 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -434,7 +434,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (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.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs
index 969643660..e83260725 100644
--- a/MediaBrowser.Controller/Playlists/Playlist.cs
+++ b/MediaBrowser.Controller/Playlists/Playlist.cs
@@ -50,7 +50,7 @@ namespace MediaBrowser.Controller.Playlists
if (IsPlaylistFile(path))
{
- return FileSystem.GetDirectoryName(path);
+ return System.IO.Path.GetDirectoryName(path);
}
return path;