continue file system rework

This commit is contained in:
Luke Pulverenti 2015-10-04 00:23:11 -04:00
parent 8ad702060e
commit 078277ebc2
286 changed files with 459 additions and 1309 deletions

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
namespace Emby.Drawing.Common namespace Emby.Drawing.Common
{ {

View File

@ -32,10 +32,17 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CommonIO, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll</HintPath>
</Reference>
<Reference Include="ImageMagickSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="ImageMagickSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ImageMagickSharp.1.0.0.16\lib\net45\ImageMagickSharp.dll</HintPath> <HintPath>..\packages\ImageMagickSharp.1.0.0.16\lib\net45\ImageMagickSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="Patterns.Logging">
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
</Reference>
<Reference Include="policy.2.0.taglib-sharp"> <Reference Include="policy.2.0.taglib-sharp">
<HintPath>..\packages\taglib.2.1.0.0\lib\policy.2.0.taglib-sharp.dll</HintPath> <HintPath>..\packages\taglib.2.1.0.0\lib\policy.2.0.taglib-sharp.dll</HintPath>
</Reference> </Reference>

View File

@ -4,6 +4,7 @@ using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using CommonIO;
namespace Emby.Drawing.GDI namespace Emby.Drawing.GDI
{ {

View File

@ -8,6 +8,7 @@ using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
using ImageFormat = MediaBrowser.Model.Drawing.ImageFormat; using ImageFormat = MediaBrowser.Model.Drawing.ImageFormat;
namespace Emby.Drawing.GDI namespace Emby.Drawing.GDI

View File

@ -8,6 +8,7 @@ using MediaBrowser.Model.Logging;
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace Emby.Drawing.ImageMagick namespace Emby.Drawing.ImageMagick

View File

@ -5,6 +5,7 @@ using MediaBrowser.Model.Drawing;
using System; using System;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace Emby.Drawing.ImageMagick namespace Emby.Drawing.ImageMagick

View File

@ -2,6 +2,7 @@
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace Emby.Drawing.ImageMagick namespace Emby.Drawing.ImageMagick

View File

@ -3,6 +3,7 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Drawing;
using System.Globalization; using System.Globalization;
using CommonIO;
namespace Emby.Drawing.ImageMagick namespace Emby.Drawing.ImageMagick
{ {

View File

@ -16,6 +16,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using Emby.Drawing.Common; using Emby.Drawing.Common;
namespace Emby.Drawing namespace Emby.Drawing

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="CommonIO" version="1.0.0.3" targetFramework="net45" />
<package id="ImageMagickSharp" version="1.0.0.16" targetFramework="net45" /> <package id="ImageMagickSharp" version="1.0.0.16" targetFramework="net45" />
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
</packages> </packages>

View File

@ -15,6 +15,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Api namespace MediaBrowser.Api
{ {

View File

@ -11,6 +11,7 @@ using ServiceStack.Web;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
namespace MediaBrowser.Api namespace MediaBrowser.Api
{ {

View File

@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
namespace MediaBrowser.Api namespace MediaBrowser.Api
{ {

View File

@ -9,6 +9,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
namespace MediaBrowser.Api.Images namespace MediaBrowser.Api.Images
{ {

View File

@ -17,6 +17,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MimeTypes = MediaBrowser.Model.Net.MimeTypes; using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
namespace MediaBrowser.Api.Images namespace MediaBrowser.Api.Images

View File

@ -16,6 +16,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Api.Images namespace MediaBrowser.Api.Images
{ {

View File

@ -16,6 +16,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Api namespace MediaBrowser.Api
{ {

View File

@ -4,6 +4,7 @@ using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
using ServiceStack; using ServiceStack;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Api namespace MediaBrowser.Api

View File

@ -3,6 +3,7 @@ using MediaBrowser.Controller;
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
namespace MediaBrowser.Api.Library namespace MediaBrowser.Api.Library
{ {

View File

@ -27,6 +27,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Api.Library namespace MediaBrowser.Api.Library

View File

@ -10,6 +10,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Api.Library namespace MediaBrowser.Api.Library
{ {

View File

@ -46,6 +46,13 @@
<RunPostBuildEvent>Always</RunPostBuildEvent> <RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CommonIO, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll</HintPath>
</Reference>
<Reference Include="Patterns.Logging">
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />

View File

@ -23,6 +23,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Api.Playback namespace MediaBrowser.Api.Playback
{ {

View File

@ -17,6 +17,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MimeTypes = MediaBrowser.Model.Net.MimeTypes; using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
namespace MediaBrowser.Api.Playback.Dash namespace MediaBrowser.Api.Playback.Dash

View File

@ -15,6 +15,7 @@ using System.IO;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Api.Playback.Hls namespace MediaBrowser.Api.Playback.Hls
{ {

View File

@ -20,6 +20,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MimeTypes = MediaBrowser.Model.Net.MimeTypes; using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
namespace MediaBrowser.Api.Playback.Hls namespace MediaBrowser.Api.Playback.Hls

View File

@ -8,6 +8,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using ServiceStack; using ServiceStack;
using System; using System;
using CommonIO;
namespace MediaBrowser.Api.Playback.Hls namespace MediaBrowser.Api.Playback.Hls
{ {

View File

@ -11,6 +11,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using ServiceStack; using ServiceStack;
using System.Collections.Generic; using System.Collections.Generic;
using CommonIO;
namespace MediaBrowser.Api.Playback.Progressive namespace MediaBrowser.Api.Playback.Progressive
{ {

View File

@ -17,6 +17,7 @@ using System.Globalization;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Api.Playback.Progressive namespace MediaBrowser.Api.Playback.Progressive
{ {

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Api.Playback.Progressive namespace MediaBrowser.Api.Playback.Progressive
{ {

View File

@ -11,6 +11,7 @@ using MediaBrowser.Model.Serialization;
using ServiceStack; using ServiceStack;
using System; using System;
using System.IO; using System.IO;
using CommonIO;
namespace MediaBrowser.Api.Playback.Progressive namespace MediaBrowser.Api.Playback.Progressive
{ {

View File

@ -15,6 +15,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MimeTypes = MediaBrowser.Model.Net.MimeTypes; using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;

View File

@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Api.System namespace MediaBrowser.Api.System
{ {

View File

@ -11,6 +11,7 @@ using System;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Api namespace MediaBrowser.Api
{ {

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="CommonIO" version="1.0.0.3" targetFramework="net45" />
<package id="morelinq" version="1.1.1" targetFramework="net45" /> <package id="morelinq" version="1.1.1" targetFramework="net45" />
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
</packages> </packages>

View File

@ -7,6 +7,7 @@ using SharpCompress.Reader;
using SharpCompress.Reader.Zip; using SharpCompress.Reader.Zip;
using System; using System;
using System.IO; using System.IO;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Common.Implementations.Archiving namespace MediaBrowser.Common.Implementations.Archiving

View File

@ -30,6 +30,7 @@ using System.Reflection;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Common.Implementations namespace MediaBrowser.Common.Implementations
{ {

View File

@ -3,6 +3,7 @@ using MediaBrowser.Model.Logging;
using System; using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Common.Implementations.Devices namespace MediaBrowser.Common.Implementations.Devices

View File

@ -17,6 +17,7 @@ using System.Net.Cache;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Common.Implementations.HttpClientManager namespace MediaBrowser.Common.Implementations.HttpClientManager
{ {

View File

@ -1,559 +0,0 @@
using MediaBrowser.Model.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Model.Logging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Common.Implementations.IO
{
/// <summary>
/// Class CommonFileSystem
/// </summary>
public class CommonFileSystem : IFileSystem
{
protected ILogger Logger;
private readonly bool _supportsAsyncFileStreams;
private char[] _invalidFileNameChars;
public CommonFileSystem(ILogger logger, bool supportsAsyncFileStreams, bool usePresetInvalidFileNameChars)
{
Logger = logger;
_supportsAsyncFileStreams = supportsAsyncFileStreams;
SetInvalidFileNameChars(usePresetInvalidFileNameChars);
}
protected void SetInvalidFileNameChars(bool usePresetInvalidFileNameChars)
{
// GetInvalidFileNameChars is less restrictive in Linux/Mac than Windows, this mimic Windows behavior for mono under Linux/Mac.
if (usePresetInvalidFileNameChars)
{
_invalidFileNameChars = new char[41] { '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
'\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12',
'\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D',
'\x1E', '\x1F', '\x22', '\x3C', '\x3E', '\x7C', ':', '*', '?', '\\', '/' };
}
else
{
_invalidFileNameChars = Path.GetInvalidFileNameChars();
}
}
/// <summary>
/// Determines whether the specified filename is shortcut.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns><c>true</c> if the specified filename is shortcut; otherwise, <c>false</c>.</returns>
/// <exception cref="System.ArgumentNullException">filename</exception>
public virtual bool IsShortcut(string filename)
{
if (string.IsNullOrEmpty(filename))
{
throw new ArgumentNullException("filename");
}
var extension = Path.GetExtension(filename);
return string.Equals(extension, ".mblink", StringComparison.OrdinalIgnoreCase);
}
/// <summary>
/// Resolves the shortcut.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns>System.String.</returns>
/// <exception cref="System.ArgumentNullException">filename</exception>
public virtual string ResolveShortcut(string filename)
{
if (string.IsNullOrEmpty(filename))
{
throw new ArgumentNullException("filename");
}
if (string.Equals(Path.GetExtension(filename), ".mblink", StringComparison.OrdinalIgnoreCase))
{
var path = ReadAllText(filename);
return NormalizePath(path);
}
return null;
}
/// <summary>
/// Creates the shortcut.
/// </summary>
/// <param name="shortcutPath">The shortcut path.</param>
/// <param name="target">The target.</param>
/// <exception cref="System.ArgumentNullException">
/// shortcutPath
/// or
/// target
/// </exception>
public void CreateShortcut(string shortcutPath, string target)
{
if (string.IsNullOrEmpty(shortcutPath))
{
throw new ArgumentNullException("shortcutPath");
}
if (string.IsNullOrEmpty(target))
{
throw new ArgumentNullException("target");
}
File.WriteAllText(shortcutPath, target);
}
/// <summary>
/// Gets the file system info.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>FileSystemInfo.</returns>
public FileSystemMetadata GetFileSystemInfo(string path)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException("path");
}
// Take a guess to try and avoid two file system hits, but we'll double-check by calling Exists
if (Path.HasExtension(path))
{
var fileInfo = new FileInfo(path);
if (fileInfo.Exists)
{
return GetFileSystemMetadata(fileInfo);
}
return GetFileSystemMetadata(new DirectoryInfo(path));
}
else
{
var fileInfo = new DirectoryInfo(path);
if (fileInfo.Exists)
{
return GetFileSystemMetadata(fileInfo);
}
return GetFileSystemMetadata(new FileInfo(path));
}
}
public FileSystemMetadata GetFileInfo(string path)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException("path");
}
var fileInfo = new FileInfo(path);
return GetFileSystemMetadata(fileInfo);
}
public FileSystemMetadata GetDirectoryInfo(string path)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException("path");
}
var fileInfo = new DirectoryInfo(path);
return GetFileSystemMetadata(fileInfo);
}
private FileSystemMetadata GetFileSystemMetadata(FileSystemInfo info)
{
var result = new FileSystemMetadata();
result.Attributes = info.Attributes;
result.Exists = info.Exists;
result.FullName = info.FullName;
result.Extension = info.Extension;
result.Name = info.Name;
if (result.Exists)
{
var fileInfo = info as FileInfo;
if (fileInfo != null)
{
result.Length = fileInfo.Length;
result.DirectoryName = fileInfo.DirectoryName;
}
result.CreationTimeUtc = GetCreationTimeUtc(info);
result.LastWriteTimeUtc = GetLastWriteTimeUtc(info);
}
return result;
}
/// <summary>
/// The space char
/// </summary>
private const char SpaceChar = ' ';
/// <summary>
/// Takes a filename and removes invalid characters
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns>System.String.</returns>
/// <exception cref="System.ArgumentNullException">filename</exception>
public string GetValidFilename(string filename)
{
if (string.IsNullOrEmpty(filename))
{
throw new ArgumentNullException("filename");
}
var builder = new StringBuilder(filename);
foreach (var c in _invalidFileNameChars)
{
builder = builder.Replace(c, SpaceChar);
}
return builder.ToString();
}
/// <summary>
/// Gets the creation time UTC.
/// </summary>
/// <param name="info">The info.</param>
/// <returns>DateTime.</returns>
public DateTime GetCreationTimeUtc(FileSystemInfo info)
{
// This could throw an error on some file systems that have dates out of range
try
{
return info.CreationTimeUtc;
}
catch (Exception ex)
{
Logger.ErrorException("Error determining CreationTimeUtc for {0}", ex, info.FullName);
return DateTime.MinValue;
}
}
/// <summary>
/// Gets the creation time UTC.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>DateTime.</returns>
public DateTime GetCreationTimeUtc(string path)
{
return GetCreationTimeUtc(GetFileSystemInfo(path));
}
public DateTime GetCreationTimeUtc(FileSystemMetadata info)
{
return info.CreationTimeUtc;
}
public DateTime GetLastWriteTimeUtc(FileSystemMetadata info)
{
return info.LastWriteTimeUtc;
}
/// <summary>
/// Gets the creation time UTC.
/// </summary>
/// <param name="info">The info.</param>
/// <returns>DateTime.</returns>
public DateTime GetLastWriteTimeUtc(FileSystemInfo info)
{
// This could throw an error on some file systems that have dates out of range
try
{
return info.LastWriteTimeUtc;
}
catch (Exception ex)
{
Logger.ErrorException("Error determining LastAccessTimeUtc for {0}", ex, info.FullName);
return DateTime.MinValue;
}
}
/// <summary>
/// Gets the last write time UTC.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>DateTime.</returns>
public DateTime GetLastWriteTimeUtc(string path)
{
return GetLastWriteTimeUtc(GetFileSystemInfo(path));
}
/// <summary>
/// Gets the file stream.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="mode">The mode.</param>
/// <param name="access">The access.</param>
/// <param name="share">The share.</param>
/// <param name="isAsync">if set to <c>true</c> [is asynchronous].</param>
/// <returns>FileStream.</returns>
public Stream GetFileStream(string path, FileMode mode, FileAccess access, FileShare share, bool isAsync = false)
{
if (_supportsAsyncFileStreams && isAsync)
{
return new FileStream(path, mode, access, share, StreamDefaults.DefaultFileStreamBufferSize, true);
}
return new FileStream(path, mode, access, share, StreamDefaults.DefaultFileStreamBufferSize);
}
/// <summary>
/// Swaps the files.
/// </summary>
/// <param name="file1">The file1.</param>
/// <param name="file2">The file2.</param>
public void SwapFiles(string file1, string file2)
{
if (string.IsNullOrEmpty(file1))
{
throw new ArgumentNullException("file1");
}
if (string.IsNullOrEmpty(file2))
{
throw new ArgumentNullException("file2");
}
var temp1 = Path.GetTempFileName();
var temp2 = Path.GetTempFileName();
// Copying over will fail against hidden files
RemoveHiddenAttribute(file1);
RemoveHiddenAttribute(file2);
CopyFile(file1, temp1, true);
CopyFile(file2, temp2, true);
CopyFile(temp1, file2, true);
CopyFile(temp2, file1, true);
DeleteFile(temp1);
DeleteFile(temp2);
}
/// <summary>
/// Removes the hidden attribute.
/// </summary>
/// <param name="path">The path.</param>
private void RemoveHiddenAttribute(string path)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException("path");
}
var currentFile = new FileInfo(path);
// This will fail if the file is hidden
if (currentFile.Exists)
{
if ((currentFile.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
{
currentFile.Attributes &= ~FileAttributes.Hidden;
}
}
}
public bool ContainsSubPath(string parentPath, string path)
{
if (string.IsNullOrEmpty(parentPath))
{
throw new ArgumentNullException("parentPath");
}
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException("path");
}
return path.IndexOf(parentPath.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) != -1;
}
public bool IsRootPath(string path)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException("path");
}
var parent = Path.GetDirectoryName(path);
if (!string.IsNullOrEmpty(parent))
{
return false;
}
return true;
}
public string NormalizePath(string path)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException("path");
}
if (path.EndsWith(":\\", StringComparison.OrdinalIgnoreCase))
{
return path;
}
return path.TrimEnd(Path.DirectorySeparatorChar);
}
public string GetFileNameWithoutExtension(FileSystemMetadata info)
{
if (info.IsDirectory)
{
return info.Name;
}
return Path.GetFileNameWithoutExtension(info.FullName);
}
public string GetFileNameWithoutExtension(string path)
{
return Path.GetFileNameWithoutExtension(path);
}
public bool IsPathFile(string path)
{
if (string.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException("path");
}
// Cannot use Path.IsPathRooted because it returns false under mono when using windows-based paths, e.g. C:\\
if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) != -1 &&
!path.StartsWith("file://", StringComparison.OrdinalIgnoreCase))
{
return false;
}
return true;
//return Path.IsPathRooted(path);
}
public void DeleteFile(string path)
{
File.Delete(path);
}
public void DeleteDirectory(string path, bool recursive)
{
Directory.Delete(path, recursive);
}
public void CreateDirectory(string path)
{
Directory.CreateDirectory(path);
}
public IEnumerable<FileSystemMetadata> GetDirectories(string path, bool recursive = false)
{
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
return new DirectoryInfo(path).EnumerateDirectories("*", searchOption).Select(GetFileSystemMetadata);
}
public IEnumerable<FileSystemMetadata> GetFiles(string path, bool recursive = false)
{
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
return new DirectoryInfo (path).EnumerateFiles("*", searchOption).Select(GetFileSystemMetadata);
}
public IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path, bool recursive = false)
{
var directoryInfo = new DirectoryInfo (path);
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
return directoryInfo.EnumerateDirectories("*", searchOption).Select(GetFileSystemMetadata)
.Concat(directoryInfo.EnumerateFiles("*", searchOption).Select(GetFileSystemMetadata));
}
public Stream OpenRead(string path)
{
return File.OpenRead(path);
}
public void CopyFile(string source, string target, bool overwrite)
{
File.Copy(source, target, overwrite);
}
public void MoveFile(string source, string target)
{
File.Move(source, target);
}
public void MoveDirectory(string source, string target)
{
Directory.Move(source, target);
}
public bool DirectoryExists(string path)
{
return Directory.Exists(path);
}
public bool FileExists(string path)
{
return File.Exists(path);
}
public string ReadAllText(string path)
{
return File.ReadAllText(path);
}
public void WriteAllText(string path, string text, Encoding encoding)
{
File.WriteAllText(path, text, encoding);
}
public void WriteAllText(string path, string text)
{
File.WriteAllText(path, text);
}
public string ReadAllText(string path, Encoding encoding)
{
return File.ReadAllText(path, encoding);
}
public IEnumerable<string> GetDirectoryPaths(string path, bool recursive = false)
{
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
return Directory.EnumerateDirectories(path, "*", searchOption);
}
public IEnumerable<string> GetFilePaths(string path, bool recursive = false)
{
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
return Directory.EnumerateFiles(path, "*", searchOption);
}
public IEnumerable<string> GetFileSystemEntryPaths(string path, bool recursive = false)
{
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
return Directory.EnumerateFileSystemEntries(path, "*", searchOption);
}
}
}

View File

@ -48,10 +48,17 @@
<RunPostBuildEvent>Always</RunPostBuildEvent> <RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CommonIO, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NLog.4.1.1\lib\net45\NLog.dll</HintPath> <HintPath>..\packages\NLog.4.1.1\lib\net45\NLog.dll</HintPath>
</Reference> </Reference>
<Reference Include="Patterns.Logging">
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
</Reference>
<Reference Include="SharpCompress, Version=0.10.2.0, Culture=neutral, PublicKeyToken=beaf6f427e128133, processorArchitecture=MSIL"> <Reference Include="SharpCompress, Version=0.10.2.0, Culture=neutral, PublicKeyToken=beaf6f427e128133, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\SharpCompress\SharpCompress.dll</HintPath> <HintPath>..\ThirdParty\SharpCompress\SharpCompress.dll</HintPath>
@ -81,7 +88,6 @@
<Compile Include="Devices\DeviceId.cs" /> <Compile Include="Devices\DeviceId.cs" />
<Compile Include="HttpClientManager\HttpClientInfo.cs" /> <Compile Include="HttpClientManager\HttpClientInfo.cs" />
<Compile Include="HttpClientManager\HttpClientManager.cs" /> <Compile Include="HttpClientManager\HttpClientManager.cs" />
<Compile Include="IO\CommonFileSystem.cs" />
<Compile Include="IO\IsoManager.cs" /> <Compile Include="IO\IsoManager.cs" />
<Compile Include="Logging\LogHelper.cs" /> <Compile Include="Logging\LogHelper.cs" />
<Compile Include="Logging\NLogger.cs" /> <Compile Include="Logging\NLogger.cs" />

View File

@ -12,6 +12,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Common.Implementations.ScheduledTasks namespace MediaBrowser.Common.Implementations.ScheduledTasks

View File

@ -10,6 +10,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Common.Implementations.ScheduledTasks namespace MediaBrowser.Common.Implementations.ScheduledTasks

View File

@ -8,6 +8,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
{ {

View File

@ -7,6 +7,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
{ {

View File

@ -2,6 +2,7 @@
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using System; using System;
using System.IO; using System.IO;
using CommonIO;
namespace MediaBrowser.Common.Implementations.Serialization namespace MediaBrowser.Common.Implementations.Serialization
{ {

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Common.Implementations.Serialization namespace MediaBrowser.Common.Implementations.Serialization

View File

@ -19,6 +19,7 @@ using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Common.Implementations.Updates namespace MediaBrowser.Common.Implementations.Updates
{ {

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="CommonIO" version="1.0.0.3" targetFramework="net45" />
<package id="NLog" version="4.1.0" targetFramework="net45" /> <package id="NLog" version="4.1.0" targetFramework="net45" />
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
<package id="SimpleInjector" version="3.0.5" targetFramework="net45" /> <package id="SimpleInjector" version="3.0.5" targetFramework="net45" />
</packages> </packages>

View File

@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MediaBrowser.Common.IO
{
public class FileSystemMetadata
{
public FileAttributes Attributes { get; set; }
public bool Exists { get; set; }
public string FullName { get; set; }
public string Name { get; set; }
public string Extension { get; set; }
public long Length { get; set; }
public string DirectoryName { get; set; }
public DateTime LastWriteTimeUtc { get; set; }
public DateTime CreationTimeUtc { get; set; }
public bool IsDirectory
{
get
{
return (Attributes & FileAttributes.Directory) == FileAttributes.Directory;
}
}
}
}

View File

@ -1,291 +0,0 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
namespace MediaBrowser.Common.IO
{
/// <summary>
/// Interface IFileSystem
/// </summary>
public interface IFileSystem
{
/// <summary>
/// Determines whether the specified filename is shortcut.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns><c>true</c> if the specified filename is shortcut; otherwise, <c>false</c>.</returns>
bool IsShortcut(string filename);
/// <summary>
/// Resolves the shortcut.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns>System.String.</returns>
string ResolveShortcut(string filename);
/// <summary>
/// Creates the shortcut.
/// </summary>
/// <param name="shortcutPath">The shortcut path.</param>
/// <param name="target">The target.</param>
void CreateShortcut(string shortcutPath, string target);
/// <summary>
/// Gets the file system info.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>FileSystemInfo.</returns>
FileSystemMetadata GetFileSystemInfo(string path);
/// <summary>
/// Gets the file information.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>FileSystemMetadata.</returns>
FileSystemMetadata GetFileInfo(string path);
/// <summary>
/// Gets the directory information.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>FileSystemMetadata.</returns>
FileSystemMetadata GetDirectoryInfo(string path);
/// <summary>
/// Gets the valid filename.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns>System.String.</returns>
string GetValidFilename(string filename);
/// <summary>
/// Gets the creation time UTC.
/// </summary>
/// <param name="info">The information.</param>
/// <returns>DateTime.</returns>
DateTime GetCreationTimeUtc(FileSystemMetadata info);
/// <summary>
/// Gets the creation time UTC.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>DateTime.</returns>
DateTime GetCreationTimeUtc(string path);
/// <summary>
/// Gets the last write time UTC.
/// </summary>
/// <param name="info">The information.</param>
/// <returns>DateTime.</returns>
DateTime GetLastWriteTimeUtc(FileSystemMetadata info);
/// <summary>
/// Gets the last write time UTC.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>DateTime.</returns>
DateTime GetLastWriteTimeUtc(string path);
/// <summary>
/// Gets the file stream.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="mode">The mode.</param>
/// <param name="access">The access.</param>
/// <param name="share">The share.</param>
/// <param name="isAsync">if set to <c>true</c> [is asynchronous].</param>
/// <returns>FileStream.</returns>
Stream GetFileStream(string path, FileMode mode, FileAccess access, FileShare share, bool isAsync = false);
/// <summary>
/// Opens the read.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>Stream.</returns>
Stream OpenRead(String path);
/// <summary>
/// Swaps the files.
/// </summary>
/// <param name="file1">The file1.</param>
/// <param name="file2">The file2.</param>
void SwapFiles(string file1, string file2);
/// <summary>
/// Determines whether [contains sub path] [the specified parent path].
/// </summary>
/// <param name="parentPath">The parent path.</param>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if [contains sub path] [the specified parent path]; otherwise, <c>false</c>.</returns>
bool ContainsSubPath(string parentPath, string path);
/// <summary>
/// Determines whether [is root path] [the specified path].
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if [is root path] [the specified path]; otherwise, <c>false</c>.</returns>
bool IsRootPath(string path);
/// <summary>
/// Normalizes the path.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>System.String.</returns>
string NormalizePath(string path);
/// <summary>
/// Gets the file name without extension.
/// </summary>
/// <param name="info">The information.</param>
/// <returns>System.String.</returns>
string GetFileNameWithoutExtension(FileSystemMetadata info);
/// <summary>
/// Gets the file name without extension.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>System.String.</returns>
string GetFileNameWithoutExtension(string path);
/// <summary>
/// Determines whether [is path file] [the specified path].
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if [is path file] [the specified path]; otherwise, <c>false</c>.</returns>
bool IsPathFile(string path);
/// <summary>
/// Deletes the file.
/// </summary>
/// <param name="path">The path.</param>
void DeleteFile(string path);
/// <summary>
/// Deletes the directory.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
void DeleteDirectory(string path, bool recursive);
/// <summary>
/// Gets the directories.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <returns>IEnumerable&lt;DirectoryInfo&gt;.</returns>
IEnumerable<FileSystemMetadata> GetDirectories(string path, bool recursive = false);
/// <summary>
/// Gets the files.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <returns>IEnumerable&lt;FileInfo&gt;.</returns>
IEnumerable<FileSystemMetadata> GetFiles(string path, bool recursive = false);
/// <summary>
/// Gets the file system entries.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <returns>IEnumerable&lt;FileSystemMetadata&gt;.</returns>
IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path, bool recursive = false);
/// <summary>
/// Creates the directory.
/// </summary>
/// <param name="path">The path.</param>
void CreateDirectory(string path);
/// <summary>
/// Copies the file.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="target">The target.</param>
/// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
void CopyFile(string source, string target, bool overwrite);
/// <summary>
/// Moves the file.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="target">The target.</param>
void MoveFile(string source, string target);
/// <summary>
/// Moves the directory.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="target">The target.</param>
void MoveDirectory(string source, string target);
/// <summary>
/// Directories the exists.
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
bool DirectoryExists(string path);
/// <summary>
/// Files the exists.
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
bool FileExists(string path);
/// <summary>
/// Reads all text.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>System.String.</returns>
string ReadAllText(string path);
/// <summary>
/// Writes all text.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="text">The text.</param>
void WriteAllText(string path, string text);
/// <summary>
/// Writes all text.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="text">The text.</param>
/// <param name="encoding">The encoding.</param>
void WriteAllText(string path, string text, Encoding encoding);
/// <summary>
/// Reads all text.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="encoding">The encoding.</param>
/// <returns>System.String.</returns>
string ReadAllText(string path, Encoding encoding);
/// <summary>
/// Gets the directory paths.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <returns>IEnumerable&lt;System.String&gt;.</returns>
IEnumerable<string> GetDirectoryPaths(string path, bool recursive = false);
/// <summary>
/// Gets the file paths.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <returns>IEnumerable&lt;System.String&gt;.</returns>
IEnumerable<string> GetFilePaths(string path, bool recursive = false);
/// <summary>
/// Gets the file system entry paths.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <returns>IEnumerable&lt;System.String&gt;.</returns>
IEnumerable<string> GetFileSystemEntryPaths(string path, bool recursive = false);
}
}

View File

@ -60,8 +60,6 @@
<Compile Include="Extensions\BaseExtensions.cs" /> <Compile Include="Extensions\BaseExtensions.cs" />
<Compile Include="Extensions\ResourceNotFoundException.cs" /> <Compile Include="Extensions\ResourceNotFoundException.cs" />
<Compile Include="IDependencyContainer.cs" /> <Compile Include="IDependencyContainer.cs" />
<Compile Include="IO\FileSystemMetadata.cs" />
<Compile Include="IO\IFileSystem.cs" />
<Compile Include="IO\ProgressStream.cs" /> <Compile Include="IO\ProgressStream.cs" />
<Compile Include="IO\StreamDefaults.cs" /> <Compile Include="IO\StreamDefaults.cs" />
<Compile Include="Configuration\IApplicationPaths.cs" /> <Compile Include="Configuration\IApplicationPaths.cs" />

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;

View File

@ -23,6 +23,7 @@ using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {

View File

@ -8,6 +8,7 @@ using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities

View File

@ -13,6 +13,7 @@ using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities

View File

@ -3,6 +3,7 @@ using MediaBrowser.Model.Entities;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities

View File

@ -8,6 +8,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Entities.Movies namespace MediaBrowser.Controller.Entities.Movies

View File

@ -11,6 +11,7 @@ using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities

View File

@ -5,6 +5,7 @@ using MediaBrowser.Model.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using CommonIO;
namespace MediaBrowser.Controller.IO namespace MediaBrowser.Controller.IO
{ {

View File

@ -11,6 +11,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Library namespace MediaBrowser.Controller.Library

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Library namespace MediaBrowser.Controller.Library

View File

@ -45,9 +45,16 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CommonIO, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll</HintPath>
</Reference>
<Reference Include="Interfaces.IO"> <Reference Include="Interfaces.IO">
<HintPath>..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll</HintPath> <HintPath>..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll</HintPath>
</Reference> </Reference>
<Reference Include="Patterns.Logging">
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.MediaEncoding namespace MediaBrowser.Controller.MediaEncoding

View File

@ -4,6 +4,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Providers namespace MediaBrowser.Controller.Providers

View File

@ -1,5 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Providers namespace MediaBrowser.Controller.Providers

View File

@ -1,4 +1,5 @@
using System.IO; using System.IO;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;

View File

@ -1,4 +1,5 @@
using System.Linq; using System.Linq;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Providers namespace MediaBrowser.Controller.Providers

View File

@ -3,6 +3,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Resolvers namespace MediaBrowser.Controller.Resolvers

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="CommonIO" version="1.0.0.3" targetFramework="net45" />
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" /> <package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
<package id="morelinq" version="1.1.1" targetFramework="net45" /> <package id="morelinq" version="1.1.1" targetFramework="net45" />
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
</packages> </packages>

View File

@ -17,6 +17,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using CommonIO;
namespace MediaBrowser.Dlna namespace MediaBrowser.Dlna
{ {

View File

@ -13,6 +13,8 @@
<ProductVersion>10.0.0</ProductVersion> <ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -39,6 +41,13 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CommonIO, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll</HintPath>
</Reference>
<Reference Include="Patterns.Logging">
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
@ -230,6 +239,9 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonIO" version="1.0.0.3" targetFramework="net45" />
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
</packages>

View File

@ -5,6 +5,7 @@ using System;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.LocalMetadata namespace MediaBrowser.LocalMetadata
{ {

View File

@ -2,6 +2,7 @@
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
using System.Collections.Generic; using System.Collections.Generic;
using CommonIO;
namespace MediaBrowser.LocalMetadata.Images namespace MediaBrowser.LocalMetadata.Images
{ {

View File

@ -7,6 +7,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
namespace MediaBrowser.LocalMetadata.Images namespace MediaBrowser.LocalMetadata.Images
{ {

View File

@ -1,5 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;

View File

@ -5,6 +5,7 @@ using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using CommonIO;
namespace MediaBrowser.LocalMetadata.Images namespace MediaBrowser.LocalMetadata.Images
{ {

View File

@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CommonIO;
namespace MediaBrowser.LocalMetadata.Images namespace MediaBrowser.LocalMetadata.Images
{ {

View File

@ -11,6 +11,8 @@
<AssemblyName>MediaBrowser.LocalMetadata</AssemblyName> <AssemblyName>MediaBrowser.LocalMetadata</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -30,6 +32,13 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CommonIO, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\CommonIO.1.0.0.3\lib\net45\CommonIO.dll</HintPath>
</Reference>
<Reference Include="Patterns.Logging">
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
@ -95,7 +104,9 @@
<Name>MediaBrowser.Model</Name> <Name>MediaBrowser.Model</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -8,6 +8,7 @@ using System.Globalization;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Xml; using System.Xml;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.LocalMetadata.Parsers namespace MediaBrowser.LocalMetadata.Parsers

View File

@ -5,6 +5,7 @@ using MediaBrowser.LocalMetadata.Parsers;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
namespace MediaBrowser.LocalMetadata.Providers namespace MediaBrowser.LocalMetadata.Providers
{ {

View File

@ -7,6 +7,7 @@ using MediaBrowser.Model.Logging;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
namespace MediaBrowser.LocalMetadata.Providers namespace MediaBrowser.LocalMetadata.Providers
{ {

View File

@ -1,5 +1,6 @@
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;

View File

@ -1,5 +1,6 @@
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;

View File

@ -5,6 +5,7 @@ using MediaBrowser.LocalMetadata.Parsers;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
namespace MediaBrowser.LocalMetadata.Providers namespace MediaBrowser.LocalMetadata.Providers
{ {

View File

@ -5,6 +5,7 @@ using MediaBrowser.LocalMetadata.Parsers;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
namespace MediaBrowser.LocalMetadata.Providers namespace MediaBrowser.LocalMetadata.Providers
{ {

View File

@ -1,5 +1,6 @@
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;

View File

@ -1,5 +1,6 @@
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;

View File

@ -5,6 +5,7 @@ using MediaBrowser.LocalMetadata.Parsers;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
namespace MediaBrowser.LocalMetadata.Providers namespace MediaBrowser.LocalMetadata.Providers
{ {

View File

@ -1,5 +1,6 @@
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;

View File

@ -1,5 +1,6 @@
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;

View File

@ -5,6 +5,7 @@ using MediaBrowser.LocalMetadata.Parsers;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using CommonIO;
namespace MediaBrowser.LocalMetadata.Providers namespace MediaBrowser.LocalMetadata.Providers
{ {

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.LocalMetadata.Savers namespace MediaBrowser.LocalMetadata.Savers

View File

@ -9,6 +9,7 @@ using System.IO;
using System.Security; using System.Security;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.LocalMetadata.Savers namespace MediaBrowser.LocalMetadata.Savers

View File

@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.LocalMetadata.Savers namespace MediaBrowser.LocalMetadata.Savers

View File

@ -6,6 +6,7 @@ using System.IO;
using System.Security; using System.Security;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.LocalMetadata.Savers namespace MediaBrowser.LocalMetadata.Savers

View File

@ -8,6 +8,7 @@ using System.IO;
using System.Security; using System.Security;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.LocalMetadata.Savers namespace MediaBrowser.LocalMetadata.Savers

View File

@ -9,6 +9,7 @@ using System.IO;
using System.Security; using System.Security;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.LocalMetadata.Savers namespace MediaBrowser.LocalMetadata.Savers

View File

@ -6,6 +6,7 @@ using System.IO;
using System.Security; using System.Security;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
namespace MediaBrowser.LocalMetadata.Savers namespace MediaBrowser.LocalMetadata.Savers

Some files were not shown because too many files have changed in this diff Show More