@ -2,7 +2,7 @@
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{88AE38DF-19D7-406F-A6A9-09527719A21E}</ProjectGuid>
|
||||
@ -13,9 +13,8 @@
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -61,6 +60,12 @@
|
||||
<Compile Include="TSStreamClipFile.cs" />
|
||||
<Compile Include="TSStreamFile.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
|
||||
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
|
||||
<Name>MediaBrowser.Model</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<!-- 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.
|
||||
|
6
BDInfo/BDInfo.nuget.targets
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Target Name="EmitMSBuildWarning" BeforeTargets="Build">
|
||||
<Warning Text="Packages containing MSBuild targets and props files cannot be fully installed in projects targeting multiple frameworks. The MSBuild targets and props files have been ignored." />
|
||||
</Target>
|
||||
</Project>
|
111
BDInfo/BDROM.cs
@ -20,19 +20,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.TextEncoding;
|
||||
|
||||
namespace BDInfo
|
||||
{
|
||||
public class BDROM
|
||||
{
|
||||
public DirectoryInfo DirectoryRoot = null;
|
||||
public DirectoryInfo DirectoryBDMV = null;
|
||||
public DirectoryInfo DirectoryBDJO = null;
|
||||
public DirectoryInfo DirectoryCLIPINF = null;
|
||||
public DirectoryInfo DirectoryPLAYLIST = null;
|
||||
public DirectoryInfo DirectorySNP = null;
|
||||
public DirectoryInfo DirectorySSIF = null;
|
||||
public DirectoryInfo DirectorySTREAM = null;
|
||||
public FileSystemMetadata DirectoryRoot = null;
|
||||
public FileSystemMetadata DirectoryBDMV = null;
|
||||
public FileSystemMetadata DirectoryBDJO = null;
|
||||
public FileSystemMetadata DirectoryCLIPINF = null;
|
||||
public FileSystemMetadata DirectoryPLAYLIST = null;
|
||||
public FileSystemMetadata DirectorySNP = null;
|
||||
public FileSystemMetadata DirectorySSIF = null;
|
||||
public FileSystemMetadata DirectorySTREAM = null;
|
||||
|
||||
public string VolumeLabel = null;
|
||||
public ulong Size = 0;
|
||||
@ -43,6 +46,8 @@ namespace BDInfo
|
||||
public bool Is3D = false;
|
||||
public bool Is50Hz = false;
|
||||
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public Dictionary<string, TSPlaylistFile> PlaylistFiles =
|
||||
new Dictionary<string, TSPlaylistFile>();
|
||||
public Dictionary<string, TSStreamClipFile> StreamClipFiles =
|
||||
@ -70,8 +75,9 @@ namespace BDInfo
|
||||
public event OnPlaylistFileScanError PlaylistFileScanError;
|
||||
|
||||
public BDROM(
|
||||
string path)
|
||||
string path, IFileSystem fileSystem, IEncoding textEncoding)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
//
|
||||
// Locate BDMV directories.
|
||||
//
|
||||
@ -85,7 +91,7 @@ namespace BDInfo
|
||||
}
|
||||
|
||||
DirectoryRoot =
|
||||
DirectoryBDMV.Parent;
|
||||
_fileSystem.GetDirectoryInfo(Path.GetDirectoryName(DirectoryBDMV.FullName));
|
||||
DirectoryBDJO =
|
||||
GetDirectory("BDJO", DirectoryBDMV, 0);
|
||||
DirectoryCLIPINF =
|
||||
@ -124,26 +130,26 @@ namespace BDInfo
|
||||
{
|
||||
IsBDPlus = true;
|
||||
}
|
||||
|
||||
|
||||
if (DirectoryBDJO != null &&
|
||||
DirectoryBDJO.GetFiles().Length > 0)
|
||||
_fileSystem.GetFiles(DirectoryBDJO.FullName).Any())
|
||||
{
|
||||
IsBDJava = true;
|
||||
}
|
||||
|
||||
|
||||
if (DirectorySNP != null &&
|
||||
(DirectorySNP.GetFiles("*.mnv").Length > 0 || DirectorySNP.GetFiles("*.MNV").Length > 0))
|
||||
GetFiles(DirectorySNP.FullName, ".mnv").Any())
|
||||
{
|
||||
IsPSP = true;
|
||||
}
|
||||
|
||||
if (DirectorySSIF != null &&
|
||||
DirectorySSIF.GetFiles().Length > 0)
|
||||
_fileSystem.GetFiles(DirectorySSIF.FullName).Any())
|
||||
{
|
||||
Is3D = true;
|
||||
}
|
||||
|
||||
if (File.Exists(Path.Combine(DirectoryRoot.FullName, "FilmIndex.xml")))
|
||||
if (_fileSystem.FileExists(Path.Combine(DirectoryRoot.FullName, "FilmIndex.xml")))
|
||||
{
|
||||
IsDBOX = true;
|
||||
}
|
||||
@ -154,54 +160,38 @@ namespace BDInfo
|
||||
|
||||
if (DirectoryPLAYLIST != null)
|
||||
{
|
||||
FileInfo[] files = DirectoryPLAYLIST.GetFiles("*.mpls");
|
||||
if (files.Length == 0)
|
||||
{
|
||||
files = DirectoryPLAYLIST.GetFiles("*.MPLS");
|
||||
}
|
||||
foreach (FileInfo file in files)
|
||||
FileSystemMetadata[] files = GetFiles(DirectoryPLAYLIST.FullName, ".mpls").ToArray();
|
||||
foreach (FileSystemMetadata file in files)
|
||||
{
|
||||
PlaylistFiles.Add(
|
||||
file.Name.ToUpper(), new TSPlaylistFile(this, file));
|
||||
file.Name.ToUpper(), new TSPlaylistFile(this, file, _fileSystem, textEncoding));
|
||||
}
|
||||
}
|
||||
|
||||
if (DirectorySTREAM != null)
|
||||
{
|
||||
FileInfo[] files = DirectorySTREAM.GetFiles("*.m2ts");
|
||||
if (files.Length == 0)
|
||||
{
|
||||
files = DirectoryPLAYLIST.GetFiles("*.M2TS");
|
||||
}
|
||||
foreach (FileInfo file in files)
|
||||
FileSystemMetadata[] files = GetFiles(DirectorySTREAM.FullName, ".m2ts").ToArray();
|
||||
foreach (FileSystemMetadata file in files)
|
||||
{
|
||||
StreamFiles.Add(
|
||||
file.Name.ToUpper(), new TSStreamFile(file));
|
||||
file.Name.ToUpper(), new TSStreamFile(file, _fileSystem));
|
||||
}
|
||||
}
|
||||
|
||||
if (DirectoryCLIPINF != null)
|
||||
{
|
||||
FileInfo[] files = DirectoryCLIPINF.GetFiles("*.clpi");
|
||||
if (files.Length == 0)
|
||||
{
|
||||
files = DirectoryPLAYLIST.GetFiles("*.CLPI");
|
||||
}
|
||||
foreach (FileInfo file in files)
|
||||
FileSystemMetadata[] files = GetFiles(DirectoryCLIPINF.FullName, ".clpi").ToArray();
|
||||
foreach (FileSystemMetadata file in files)
|
||||
{
|
||||
StreamClipFiles.Add(
|
||||
file.Name.ToUpper(), new TSStreamClipFile(file));
|
||||
file.Name.ToUpper(), new TSStreamClipFile(file, _fileSystem, textEncoding));
|
||||
}
|
||||
}
|
||||
|
||||
if (DirectorySSIF != null)
|
||||
{
|
||||
FileInfo[] files = DirectorySSIF.GetFiles("*.ssif");
|
||||
if (files.Length == 0)
|
||||
{
|
||||
files = DirectorySSIF.GetFiles("*.SSIF");
|
||||
}
|
||||
foreach (FileInfo file in files)
|
||||
FileSystemMetadata[] files = GetFiles(DirectorySSIF.FullName, ".ssif").ToArray();
|
||||
foreach (FileSystemMetadata file in files)
|
||||
{
|
||||
InterleavedFiles.Add(
|
||||
file.Name.ToUpper(), new TSInterleavedFile(file));
|
||||
@ -209,6 +199,11 @@ namespace BDInfo
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<FileSystemMetadata> GetFiles(string path, string extension)
|
||||
{
|
||||
return _fileSystem.GetFiles(path).Where(i => string.Equals(i.Extension, extension, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
public void Scan()
|
||||
{
|
||||
List<TSStreamClipFile> errorStreamClipFiles = new List<TSStreamClipFile>();
|
||||
@ -328,10 +323,10 @@ namespace BDInfo
|
||||
}
|
||||
}
|
||||
|
||||
private DirectoryInfo GetDirectoryBDMV(
|
||||
private FileSystemMetadata GetDirectoryBDMV(
|
||||
string path)
|
||||
{
|
||||
DirectoryInfo dir = new DirectoryInfo(path);
|
||||
FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path);
|
||||
|
||||
while (dir != null)
|
||||
{
|
||||
@ -339,21 +334,21 @@ namespace BDInfo
|
||||
{
|
||||
return dir;
|
||||
}
|
||||
dir = dir.Parent;
|
||||
dir = _fileSystem.GetDirectoryInfo(Path.GetDirectoryName(dir.FullName));
|
||||
}
|
||||
|
||||
return GetDirectory("BDMV", new DirectoryInfo(path), 0);
|
||||
return GetDirectory("BDMV", _fileSystem.GetDirectoryInfo(path), 0);
|
||||
}
|
||||
|
||||
private DirectoryInfo GetDirectory(
|
||||
private FileSystemMetadata GetDirectory(
|
||||
string name,
|
||||
DirectoryInfo dir,
|
||||
FileSystemMetadata dir,
|
||||
int searchDepth)
|
||||
{
|
||||
if (dir != null)
|
||||
{
|
||||
DirectoryInfo[] children = dir.GetDirectories();
|
||||
foreach (DirectoryInfo child in children)
|
||||
FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray();
|
||||
foreach (FileSystemMetadata child in children)
|
||||
{
|
||||
if (child.Name == name)
|
||||
{
|
||||
@ -362,7 +357,7 @@ namespace BDInfo
|
||||
}
|
||||
if (searchDepth > 0)
|
||||
{
|
||||
foreach (DirectoryInfo child in children)
|
||||
foreach (FileSystemMetadata child in children)
|
||||
{
|
||||
GetDirectory(
|
||||
name, child, searchDepth - 1);
|
||||
@ -372,14 +367,14 @@ namespace BDInfo
|
||||
return null;
|
||||
}
|
||||
|
||||
private long GetDirectorySize(DirectoryInfo directoryInfo)
|
||||
private long GetDirectorySize(FileSystemMetadata directoryInfo)
|
||||
{
|
||||
long size = 0;
|
||||
|
||||
//if (!ExcludeDirs.Contains(directoryInfo.Name.ToUpper())) // TODO: Keep?
|
||||
{
|
||||
FileInfo[] pathFiles = directoryInfo.GetFiles();
|
||||
foreach (FileInfo pathFile in pathFiles)
|
||||
FileSystemMetadata[] pathFiles = _fileSystem.GetFiles(directoryInfo.FullName).ToArray();
|
||||
foreach (FileSystemMetadata pathFile in pathFiles)
|
||||
{
|
||||
if (pathFile.Extension.ToUpper() == ".SSIF")
|
||||
{
|
||||
@ -388,8 +383,8 @@ namespace BDInfo
|
||||
size += pathFile.Length;
|
||||
}
|
||||
|
||||
DirectoryInfo[] pathChildren = directoryInfo.GetDirectories();
|
||||
foreach (DirectoryInfo pathChild in pathChildren)
|
||||
FileSystemMetadata[] pathChildren = _fileSystem.GetDirectories(directoryInfo.FullName).ToArray();
|
||||
foreach (FileSystemMetadata pathChild in pathChildren)
|
||||
{
|
||||
size += GetDirectorySize(pathChild);
|
||||
}
|
||||
@ -398,7 +393,7 @@ namespace BDInfo
|
||||
return size;
|
||||
}
|
||||
|
||||
private string GetVolumeLabel(DirectoryInfo dir)
|
||||
private string GetVolumeLabel(FileSystemMetadata dir)
|
||||
{
|
||||
return dir.Name;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ namespace BDInfo
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System;
|
||||
using Microsoft.Win32;
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>Provides a simple light bit vector with easy integer or Boolean access to
|
||||
@ -69,11 +68,6 @@ namespace BDInfo
|
||||
}
|
||||
set
|
||||
{
|
||||
#if DEBUG
|
||||
if ((value & section.Mask) != value) {
|
||||
Debug.Fail("Value out of bounds on BitVector32 Section Set!");
|
||||
}
|
||||
#endif
|
||||
value <<= section.Offset;
|
||||
int offsetMask = (0xFFFF & (int)section.Mask) << section.Offset;
|
||||
data = (data & ~(uint)offsetMask) | ((uint)value & (uint)offsetMask);
|
||||
|
@ -18,6 +18,7 @@
|
||||
//=============================================================================
|
||||
|
||||
using System.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
// TODO: Do more interesting things here...
|
||||
|
||||
@ -25,10 +26,10 @@ namespace BDInfo
|
||||
{
|
||||
public class TSInterleavedFile
|
||||
{
|
||||
public FileInfo FileInfo = null;
|
||||
public FileSystemMetadata FileInfo = null;
|
||||
public string Name = null;
|
||||
|
||||
public TSInterleavedFile(FileInfo fileInfo)
|
||||
public TSInterleavedFile(FileSystemMetadata fileInfo)
|
||||
{
|
||||
FileInfo = fileInfo;
|
||||
Name = fileInfo.Name.ToUpper();
|
||||
|
@ -22,12 +22,16 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.TextEncoding;
|
||||
|
||||
namespace BDInfo
|
||||
{
|
||||
public class TSPlaylistFile
|
||||
{
|
||||
private FileInfo FileInfo = null;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IEncoding _textEncoding;
|
||||
private FileSystemMetadata FileInfo = null;
|
||||
public string FileType = null;
|
||||
public bool IsInitialized = false;
|
||||
public string Name = null;
|
||||
@ -63,20 +67,24 @@ namespace BDInfo
|
||||
|
||||
public TSPlaylistFile(
|
||||
BDROM bdrom,
|
||||
FileInfo fileInfo)
|
||||
FileSystemMetadata fileInfo, IFileSystem fileSystem, IEncoding textEncoding)
|
||||
{
|
||||
BDROM = bdrom;
|
||||
FileInfo = fileInfo;
|
||||
_fileSystem = fileSystem;
|
||||
_textEncoding = textEncoding;
|
||||
Name = fileInfo.Name.ToUpper();
|
||||
}
|
||||
|
||||
public TSPlaylistFile(
|
||||
BDROM bdrom,
|
||||
string name,
|
||||
List<TSStreamClip> clips)
|
||||
List<TSStreamClip> clips, IFileSystem fileSystem, IEncoding textEncoding)
|
||||
{
|
||||
BDROM = bdrom;
|
||||
Name = name;
|
||||
_fileSystem = fileSystem;
|
||||
_textEncoding = textEncoding;
|
||||
IsCustom = true;
|
||||
foreach (TSStreamClip clip in clips)
|
||||
{
|
||||
@ -221,7 +229,7 @@ namespace BDInfo
|
||||
Dictionary<string, TSStreamFile> streamFiles,
|
||||
Dictionary<string, TSStreamClipFile> streamClipFiles)
|
||||
{
|
||||
FileStream fileStream = null;
|
||||
Stream fileStream = null;
|
||||
BinaryReader fileReader = null;
|
||||
|
||||
try
|
||||
@ -229,7 +237,7 @@ namespace BDInfo
|
||||
Streams.Clear();
|
||||
StreamClips.Clear();
|
||||
|
||||
fileStream = File.OpenRead(FileInfo.FullName);
|
||||
fileStream = _fileSystem.OpenRead(FileInfo.FullName);
|
||||
fileReader = new BinaryReader(fileStream);
|
||||
|
||||
byte[] data = new byte[fileStream.Length];
|
||||
@ -1239,7 +1247,7 @@ namespace BDInfo
|
||||
ref int pos)
|
||||
{
|
||||
string val =
|
||||
ASCIIEncoding.ASCII.GetString(data, pos, count);
|
||||
_textEncoding.GetASCIIString(data, pos, count);
|
||||
|
||||
pos += count;
|
||||
|
||||
|
@ -22,12 +22,16 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.TextEncoding;
|
||||
|
||||
namespace BDInfo
|
||||
{
|
||||
public class TSStreamClipFile
|
||||
{
|
||||
public FileInfo FileInfo = null;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IEncoding _textEncoding;
|
||||
public FileSystemMetadata FileInfo = null;
|
||||
public string FileType = null;
|
||||
public bool IsValid = false;
|
||||
public string Name = null;
|
||||
@ -36,15 +40,17 @@ namespace BDInfo
|
||||
new Dictionary<ushort,TSStream>();
|
||||
|
||||
public TSStreamClipFile(
|
||||
FileInfo fileInfo)
|
||||
FileSystemMetadata fileInfo, IFileSystem fileSystem, IEncoding textEncoding)
|
||||
{
|
||||
FileInfo = fileInfo;
|
||||
_fileSystem = fileSystem;
|
||||
_textEncoding = textEncoding;
|
||||
Name = fileInfo.Name.ToUpper();
|
||||
}
|
||||
|
||||
public void Scan()
|
||||
{
|
||||
FileStream fileStream = null;
|
||||
Stream fileStream = null;
|
||||
BinaryReader fileReader = null;
|
||||
|
||||
try
|
||||
@ -55,7 +61,7 @@ namespace BDInfo
|
||||
#endif
|
||||
Streams.Clear();
|
||||
|
||||
fileStream = File.OpenRead(FileInfo.FullName);
|
||||
fileStream = _fileSystem.OpenRead(FileInfo.FullName);
|
||||
fileReader = new BinaryReader(fileStream);
|
||||
|
||||
byte[] data = new byte[fileStream.Length];
|
||||
@ -64,7 +70,7 @@ namespace BDInfo
|
||||
byte[] fileType = new byte[8];
|
||||
Array.Copy(data, 0, fileType, 0, fileType.Length);
|
||||
|
||||
FileType = ASCIIEncoding.ASCII.GetString(fileType);
|
||||
FileType = _textEncoding.GetASCIIString(fileType, 0, fileType.Length);
|
||||
if (FileType != "HDMV0100" &&
|
||||
FileType != "HDMV0200")
|
||||
{
|
||||
@ -161,7 +167,7 @@ namespace BDInfo
|
||||
Array.Copy(clipData, streamOffset + 3,
|
||||
languageBytes, 0, languageBytes.Length);
|
||||
string languageCode =
|
||||
ASCIIEncoding.ASCII.GetString(languageBytes);
|
||||
_textEncoding.GetASCIIString(languageBytes, 0, languageBytes.Length);
|
||||
|
||||
TSChannelLayout channelLayout = (TSChannelLayout)
|
||||
(clipData[streamOffset + 2] >> 4);
|
||||
@ -192,9 +198,9 @@ namespace BDInfo
|
||||
Array.Copy(clipData, streamOffset + 2,
|
||||
languageBytes, 0, languageBytes.Length);
|
||||
string languageCode =
|
||||
ASCIIEncoding.ASCII.GetString(languageBytes);
|
||||
_textEncoding.GetASCIIString(languageBytes, 0, languageBytes.Length);
|
||||
|
||||
stream = new TSGraphicsStream();
|
||||
stream = new TSGraphicsStream();
|
||||
stream.LanguageCode = languageCode;
|
||||
#if DEBUG
|
||||
Debug.WriteLine(string.Format(
|
||||
@ -212,7 +218,7 @@ namespace BDInfo
|
||||
Array.Copy(clipData, streamOffset + 3,
|
||||
languageBytes, 0, languageBytes.Length);
|
||||
string languageCode =
|
||||
ASCIIEncoding.ASCII.GetString(languageBytes);
|
||||
_textEncoding.GetASCIIString(languageBytes, 0, languageBytes.Length);
|
||||
#if DEBUG
|
||||
Debug.WriteLine(string.Format(
|
||||
"\t{0} {1} {2}",
|
||||
@ -220,7 +226,7 @@ namespace BDInfo
|
||||
streamType,
|
||||
languageCode));
|
||||
#endif
|
||||
stream = new TSTextStream();
|
||||
stream = new TSTextStream();
|
||||
stream.LanguageCode = languageCode;
|
||||
}
|
||||
break;
|
||||
|
@ -21,6 +21,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace BDInfo
|
||||
{
|
||||
@ -152,7 +153,7 @@ namespace BDInfo
|
||||
|
||||
public class TSStreamFile
|
||||
{
|
||||
public FileInfo FileInfo = null;
|
||||
public FileSystemMetadata FileInfo = null;
|
||||
public string Name = null;
|
||||
public long Size = 0;
|
||||
public double Length = 0;
|
||||
@ -170,9 +171,12 @@ namespace BDInfo
|
||||
|
||||
private List<TSPlaylistFile> Playlists = null;
|
||||
|
||||
public TSStreamFile(FileInfo fileInfo)
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public TSStreamFile(FileSystemMetadata fileInfo, IFileSystem fileSystem)
|
||||
{
|
||||
FileInfo = fileInfo;
|
||||
_fileSystem = fileSystem;
|
||||
Name = fileInfo.Name.ToUpper();
|
||||
}
|
||||
|
||||
@ -451,7 +455,7 @@ namespace BDInfo
|
||||
|
||||
Playlists = playlists;
|
||||
int dataSize = 16384;
|
||||
FileStream fileStream = null;
|
||||
Stream fileStream = null;
|
||||
try
|
||||
{
|
||||
string fileName;
|
||||
@ -464,12 +468,12 @@ namespace BDInfo
|
||||
{
|
||||
fileName = FileInfo.FullName;
|
||||
}
|
||||
fileStream = new FileStream(
|
||||
fileStream = _fileSystem.GetFileStream(
|
||||
fileName,
|
||||
FileMode.Open,
|
||||
FileAccess.Read,
|
||||
FileShare.Read,
|
||||
dataSize, false);
|
||||
FileOpenMode.Open,
|
||||
FileAccessMode.Read,
|
||||
FileShareMode.Read,
|
||||
false);
|
||||
|
||||
Size = 0;
|
||||
Length = 0;
|
||||
|
@ -1,16 +1,17 @@
|
||||
{
|
||||
"supports": {
|
||||
"net46.app": {},
|
||||
"uwp.10.0.app": {},
|
||||
"dnxcore50.app": {}
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore": "5.0.0",
|
||||
"Microsoft.NETCore.Portable.Compatibility": "1.0.0"
|
||||
},
|
||||
"frameworks": {
|
||||
"dotnet": {
|
||||
"imports": "portable-net452+win81"
|
||||
{
|
||||
"frameworks":{
|
||||
"netstandard1.6":{
|
||||
"dependencies":{
|
||||
"NETStandard.Library":"1.6.0",
|
||||
}
|
||||
},
|
||||
".NETPortable,Version=v4.5,Profile=Profile7":{
|
||||
"buildOptions": {
|
||||
"define": [ ]
|
||||
},
|
||||
"frameworkAssemblies":{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21125
BDInfo/project.lock.json
@ -1,16 +1,17 @@
|
||||
{
|
||||
"frameworks": {
|
||||
"netstandard1.6": {
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.6.0"
|
||||
}
|
||||
},
|
||||
".NETPortable,Version=v4.5,Profile=Profile7": {
|
||||
"buildOptions": {
|
||||
"define": []
|
||||
},
|
||||
"frameworkAssemblies": {}
|
||||
{
|
||||
"frameworks":{
|
||||
"netstandard1.6":{
|
||||
"dependencies":{
|
||||
"NETStandard.Library":"1.6.0",
|
||||
}
|
||||
},
|
||||
".NETPortable,Version=v4.5,Profile=Profile7":{
|
||||
"buildOptions": {
|
||||
"define": [ ]
|
||||
},
|
||||
"frameworkAssemblies":{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
@ -1,15 +1,13 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Implementations.Devices;
|
||||
using MediaBrowser.Common.Implementations.IO;
|
||||
using MediaBrowser.Common.Implementations.ScheduledTasks;
|
||||
using MediaBrowser.Common.Implementations.Security;
|
||||
using MediaBrowser.Common.Implementations.Serialization;
|
||||
using MediaBrowser.Common.Implementations.Updates;
|
||||
using Emby.Common.Implementations.Devices;
|
||||
using Emby.Common.Implementations.IO;
|
||||
using Emby.Common.Implementations.ScheduledTasks;
|
||||
using Emby.Common.Implementations.Serialization;
|
||||
using Emby.Common.Implementations.Updates;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Common.Security;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Model.Events;
|
||||
@ -17,8 +15,6 @@ using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Updates;
|
||||
using ServiceStack;
|
||||
using SimpleInjector;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@ -30,18 +26,23 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Implementations.Cryptography;
|
||||
using Emby.Common.Implementations.Cryptography;
|
||||
using MediaBrowser.Common;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Model.Cryptography;
|
||||
using MediaBrowser.Model.System;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
#if NETSTANDARD1_6
|
||||
using System.Runtime.Loader;
|
||||
#endif
|
||||
|
||||
namespace MediaBrowser.Common.Implementations
|
||||
namespace Emby.Common.Implementations
|
||||
{
|
||||
/// <summary>
|
||||
/// Class BaseApplicationHost
|
||||
/// </summary>
|
||||
/// <typeparam name="TApplicationPathsType">The type of the T application paths type.</typeparam>
|
||||
public abstract class BaseApplicationHost<TApplicationPathsType> : IApplicationHost, IDependencyContainer
|
||||
public abstract class BaseApplicationHost<TApplicationPathsType> : IApplicationHost
|
||||
where TApplicationPathsType : class, IApplicationPaths
|
||||
{
|
||||
/// <summary>
|
||||
@ -84,11 +85,6 @@ namespace MediaBrowser.Common.Implementations
|
||||
/// <value>The application paths.</value>
|
||||
protected TApplicationPathsType ApplicationPaths { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The container
|
||||
/// </summary>
|
||||
protected readonly Container Container = new Container();
|
||||
|
||||
/// <summary>
|
||||
/// The json serializer
|
||||
/// </summary>
|
||||
@ -128,11 +124,6 @@ namespace MediaBrowser.Common.Implementations
|
||||
/// <value>The kernel.</value>
|
||||
protected ITaskManager TaskManager { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets the security manager.
|
||||
/// </summary>
|
||||
/// <value>The security manager.</value>
|
||||
protected ISecurityManager SecurityManager { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets the HTTP client.
|
||||
/// </summary>
|
||||
/// <value>The HTTP client.</value>
|
||||
@ -149,16 +140,12 @@ namespace MediaBrowser.Common.Implementations
|
||||
/// <value>The configuration manager.</value>
|
||||
protected IConfigurationManager ConfigurationManager { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the installation manager.
|
||||
/// </summary>
|
||||
/// <value>The installation manager.</value>
|
||||
protected IInstallationManager InstallationManager { get; private set; }
|
||||
|
||||
protected IFileSystem FileSystemManager { get; private set; }
|
||||
|
||||
protected IIsoManager IsoManager { get; private set; }
|
||||
|
||||
protected ISystemEvents SystemEvents { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
@ -189,11 +176,25 @@ namespace MediaBrowser.Common.Implementations
|
||||
|
||||
public virtual string OperatingSystemDisplayName
|
||||
{
|
||||
get { return Environment.OSVersion.VersionString; }
|
||||
get
|
||||
{
|
||||
#if NET46
|
||||
return Environment.OSVersion.VersionString;
|
||||
#endif
|
||||
#if NETSTANDARD1_6
|
||||
return System.Runtime.InteropServices.RuntimeInformation.OSDescription;
|
||||
#endif
|
||||
return "Operating System";
|
||||
}
|
||||
}
|
||||
|
||||
public IMemoryStreamProvider MemoryStreamProvider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The container
|
||||
/// </summary>
|
||||
protected readonly SimpleInjector.Container Container = new SimpleInjector.Container();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BaseApplicationHost{TApplicationPathsType}"/> class.
|
||||
/// </summary>
|
||||
@ -223,20 +224,12 @@ namespace MediaBrowser.Common.Implementations
|
||||
/// <returns>Task.</returns>
|
||||
public virtual async Task Init(IProgress<double> progress)
|
||||
{
|
||||
try
|
||||
{
|
||||
// https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.IntegrationTests/Web.config#L4
|
||||
Licensing.RegisterLicense("1001-e1JlZjoxMDAxLE5hbWU6VGVzdCBCdXNpbmVzcyxUeXBlOkJ1c2luZXNzLEhhc2g6UHVNTVRPclhvT2ZIbjQ5MG5LZE1mUTd5RUMzQnBucTFEbTE3TDczVEF4QUNMT1FhNXJMOWkzVjFGL2ZkVTE3Q2pDNENqTkQyUktRWmhvUVBhYTBiekJGUUZ3ZE5aZHFDYm9hL3lydGlwUHI5K1JsaTBYbzNsUC85cjVJNHE5QVhldDN6QkE4aTlvdldrdTgyTk1relY2eis2dFFqTThYN2lmc0JveHgycFdjPSxFeHBpcnk6MjAxMy0wMS0wMX0=");
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Failing under mono
|
||||
}
|
||||
progress.Report(1);
|
||||
|
||||
JsonSerializer = CreateJsonSerializer();
|
||||
|
||||
MemoryStreamProvider = CreateMemoryStreamProvider();
|
||||
SystemEvents = CreateSystemEvents();
|
||||
|
||||
OnLoggerLoaded(true);
|
||||
LogManager.LoggerLoaded += (s, e) => OnLoggerLoaded(false);
|
||||
@ -270,6 +263,7 @@ namespace MediaBrowser.Common.Implementations
|
||||
}
|
||||
|
||||
protected abstract IMemoryStreamProvider CreateMemoryStreamProvider();
|
||||
protected abstract ISystemEvents CreateSystemEvents();
|
||||
|
||||
protected virtual void OnLoggerLoaded(bool isFirstLoad)
|
||||
{
|
||||
@ -307,11 +301,10 @@ namespace MediaBrowser.Common.Implementations
|
||||
|
||||
builder.AppendLine(string.Format("Command line: {0}", string.Join(" ", Environment.GetCommandLineArgs())));
|
||||
|
||||
#if NET46
|
||||
builder.AppendLine(string.Format("Operating system: {0}", Environment.OSVersion));
|
||||
builder.AppendLine(string.Format("Processor count: {0}", Environment.ProcessorCount));
|
||||
builder.AppendLine(string.Format("64-Bit OS: {0}", Environment.Is64BitOperatingSystem));
|
||||
builder.AppendLine(string.Format("64-Bit Process: {0}", Environment.Is64BitProcess));
|
||||
builder.AppendLine(string.Format("Program data path: {0}", appPaths.ProgramDataPath));
|
||||
|
||||
Type type = Type.GetType("Mono.Runtime");
|
||||
if (type != null)
|
||||
@ -322,23 +315,25 @@ namespace MediaBrowser.Common.Implementations
|
||||
builder.AppendLine("Mono: " + displayName.Invoke(null, null));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
builder.AppendLine(string.Format("Processor count: {0}", Environment.ProcessorCount));
|
||||
builder.AppendLine(string.Format("Program data path: {0}", appPaths.ProgramDataPath));
|
||||
builder.AppendLine(string.Format("Application Path: {0}", appPaths.ApplicationPath));
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
protected virtual IJsonSerializer CreateJsonSerializer()
|
||||
{
|
||||
return new JsonSerializer(FileSystemManager, LogManager.GetLogger("JsonSerializer"));
|
||||
}
|
||||
protected abstract IJsonSerializer CreateJsonSerializer();
|
||||
|
||||
private void SetHttpLimit()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Increase the max http request limit
|
||||
#if NET46
|
||||
ServicePointManager.DefaultConnectionLimit = Math.Max(96, ServicePointManager.DefaultConnectionLimit);
|
||||
#endif
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -424,8 +419,6 @@ namespace MediaBrowser.Common.Implementations
|
||||
/// </summary>
|
||||
protected virtual void FindParts()
|
||||
{
|
||||
RegisterModules();
|
||||
|
||||
ConfigurationManager.AddParts(GetExports<IConfigurationFactory>());
|
||||
Plugins = GetExports<IPlugin>().Select(LoadPlugin).Where(i => i != null).ToArray();
|
||||
}
|
||||
@ -438,6 +431,7 @@ namespace MediaBrowser.Common.Implementations
|
||||
|
||||
if (assemblyPlugin != null)
|
||||
{
|
||||
#if NET46
|
||||
var assembly = plugin.GetType().Assembly;
|
||||
var assemblyName = assembly.GetName();
|
||||
|
||||
@ -448,10 +442,24 @@ namespace MediaBrowser.Common.Implementations
|
||||
var assemblyFilePath = Path.Combine(ApplicationPaths.PluginsPath, assemblyFileName);
|
||||
|
||||
assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version, assemblyId);
|
||||
#elif NETSTANDARD1_6
|
||||
var typeInfo = plugin.GetType().GetTypeInfo();
|
||||
var assembly = typeInfo.Assembly;
|
||||
var assemblyName = assembly.GetName();
|
||||
|
||||
var attribute = (GuidAttribute)assembly.GetCustomAttribute(typeof(GuidAttribute));
|
||||
var assemblyId = new Guid(attribute.Value);
|
||||
|
||||
var assemblyFileName = assemblyName.Name + ".dll";
|
||||
var assemblyFilePath = Path.Combine(ApplicationPaths.PluginsPath, assemblyFileName);
|
||||
|
||||
assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version, assemblyId);
|
||||
#else
|
||||
return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
var isFirstRun = !File.Exists(plugin.ConfigurationFilePath);
|
||||
|
||||
plugin.SetStartupInfo(isFirstRun, File.GetLastWriteTimeUtc, s => Directory.CreateDirectory(s));
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -479,7 +487,17 @@ namespace MediaBrowser.Common.Implementations
|
||||
|
||||
AllConcreteTypes = assemblies
|
||||
.SelectMany(GetTypes)
|
||||
.Where(t => t.IsClass && !t.IsAbstract && !t.IsInterface && !t.IsGenericType)
|
||||
.Where(t =>
|
||||
{
|
||||
#if NET46
|
||||
return t.IsClass && !t.IsAbstract && !t.IsInterface && !t.IsGenericType;
|
||||
#endif
|
||||
#if NETSTANDARD1_6
|
||||
var typeInfo = t.GetTypeInfo();
|
||||
return typeInfo.IsClass && !typeInfo.IsAbstract && !typeInfo.IsInterface && !typeInfo.IsGenericType;
|
||||
#endif
|
||||
return false;
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
@ -494,11 +512,12 @@ namespace MediaBrowser.Common.Implementations
|
||||
|
||||
RegisterSingleInstance<IApplicationPaths>(ApplicationPaths);
|
||||
|
||||
TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LogManager.GetLogger("TaskManager"), FileSystemManager);
|
||||
TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LogManager.GetLogger("TaskManager"), FileSystemManager, SystemEvents);
|
||||
|
||||
RegisterSingleInstance(JsonSerializer);
|
||||
RegisterSingleInstance(XmlSerializer);
|
||||
RegisterSingleInstance(MemoryStreamProvider);
|
||||
RegisterSingleInstance(SystemEvents);
|
||||
|
||||
RegisterSingleInstance(LogManager);
|
||||
RegisterSingleInstance(Logger);
|
||||
@ -513,37 +532,12 @@ namespace MediaBrowser.Common.Implementations
|
||||
NetworkManager = CreateNetworkManager(LogManager.GetLogger("NetworkManager"));
|
||||
RegisterSingleInstance(NetworkManager);
|
||||
|
||||
SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LogManager);
|
||||
RegisterSingleInstance(SecurityManager);
|
||||
|
||||
InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager, FileSystemManager);
|
||||
RegisterSingleInstance(InstallationManager);
|
||||
|
||||
IsoManager = new IsoManager();
|
||||
RegisterSingleInstance(IsoManager);
|
||||
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
private void RegisterModules()
|
||||
{
|
||||
var moduleTypes = GetExportTypes<IDependencyModule>();
|
||||
|
||||
foreach (var type in moduleTypes)
|
||||
{
|
||||
try
|
||||
{
|
||||
var instance = Activator.CreateInstance(type) as IDependencyModule;
|
||||
if (instance != null)
|
||||
instance.BindDependencies(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error setting up dependency bindings for " + type.Name, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of types within an assembly
|
||||
/// This will handle situations that would normally throw an exception - such as a type within the assembly that depends on some other non-existant reference
|
||||
@ -617,11 +611,6 @@ namespace MediaBrowser.Common.Implementations
|
||||
}
|
||||
}
|
||||
|
||||
void IDependencyContainer.RegisterSingleInstance<T>(T obj, bool manageLifetime)
|
||||
{
|
||||
RegisterSingleInstance(obj, manageLifetime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the specified obj.
|
||||
/// </summary>
|
||||
@ -644,11 +633,6 @@ namespace MediaBrowser.Common.Implementations
|
||||
}
|
||||
}
|
||||
|
||||
void IDependencyContainer.RegisterSingleInstance<T>(Func<T> func)
|
||||
{
|
||||
RegisterSingleInstance(func);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the single instance.
|
||||
/// </summary>
|
||||
@ -660,11 +644,6 @@ namespace MediaBrowser.Common.Implementations
|
||||
Container.RegisterSingleton(func);
|
||||
}
|
||||
|
||||
void IDependencyContainer.Register(Type typeInterface, Type typeImplementation)
|
||||
{
|
||||
Container.Register(typeInterface, typeImplementation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves this instance.
|
||||
/// </summary>
|
||||
@ -700,7 +679,13 @@ namespace MediaBrowser.Common.Implementations
|
||||
{
|
||||
try
|
||||
{
|
||||
#if NET46
|
||||
return Assembly.Load(File.ReadAllBytes(file));
|
||||
#elif NETSTANDARD1_6
|
||||
|
||||
return AssemblyLoadContext.Default.LoadFromStream(new MemoryStream(File.ReadAllBytes(file)));
|
||||
#endif
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -719,7 +704,14 @@ namespace MediaBrowser.Common.Implementations
|
||||
{
|
||||
var currentType = typeof(T);
|
||||
|
||||
return AllConcreteTypes.AsParallel().Where(currentType.IsAssignableFrom);
|
||||
#if NET46
|
||||
return AllConcreteTypes.Where(currentType.IsAssignableFrom);
|
||||
#elif NETSTANDARD1_6
|
||||
var currentTypeInfo = currentType.GetTypeInfo();
|
||||
|
||||
return AllConcreteTypes.Where(currentTypeInfo.IsAssignableFrom);
|
||||
#endif
|
||||
return new List<Type>();
|
||||
}
|
||||
|
||||
/// <summary>
|
@ -1,7 +1,7 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations
|
||||
namespace Emby.Common.Implementations
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a base class to hold common application paths used by both the Ui and Server.
|
@ -1,19 +1,19 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using Emby.Common.Implementations;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.Configuration
|
||||
namespace Emby.Common.Implementations.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Class BaseConfigurationManager
|
||||
@ -80,7 +80,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
get
|
||||
{
|
||||
// Lazy load
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationLoaded, ref _configurationSyncLock, () => (BaseApplicationConfiguration)ConfigurationHelper.GetXmlConfiguration(ConfigurationType, CommonApplicationPaths.SystemConfigurationFilePath, XmlSerializer));
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationLoaded, ref _configurationSyncLock, () => (BaseApplicationConfiguration)ConfigurationHelper.GetXmlConfiguration(ConfigurationType, CommonApplicationPaths.SystemConfigurationFilePath, XmlSerializer, FileSystem));
|
||||
return _configuration;
|
||||
}
|
||||
protected set
|
||||
@ -127,7 +127,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
Logger.Info("Saving system configuration");
|
||||
var path = CommonApplicationPaths.SystemConfigurationFilePath;
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
FileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
lock (_configurationSyncLock)
|
||||
{
|
||||
@ -197,9 +197,9 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
&& !string.Equals(CommonConfiguration.CachePath ?? string.Empty, newPath))
|
||||
{
|
||||
// Validate
|
||||
if (!Directory.Exists(newPath))
|
||||
if (!FileSystem.DirectoryExists(newPath))
|
||||
{
|
||||
throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath));
|
||||
throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));
|
||||
}
|
||||
|
||||
EnsureWriteAccess(newPath);
|
||||
@ -254,7 +254,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
{
|
||||
return Activator.CreateInstance(configurationType);
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
return Activator.CreateInstance(configurationType);
|
||||
}
|
||||
@ -294,7 +294,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
_configurations.AddOrUpdate(key, configuration, (k, v) => configuration);
|
||||
|
||||
var path = GetConfigurationFile(key);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
FileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
lock (_configurationSyncLock)
|
||||
{
|
@ -1,9 +1,10 @@
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.Configuration
|
||||
namespace Emby.Common.Implementations.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ConfigurationHelper
|
||||
@ -18,7 +19,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="xmlSerializer">The XML serializer.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public static object GetXmlConfiguration(Type type, string path, IXmlSerializer xmlSerializer)
|
||||
public static object GetXmlConfiguration(Type type, string path, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
|
||||
{
|
||||
object configuration;
|
||||
|
||||
@ -27,7 +28,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
// Use try/catch to avoid the extra file system lookup using File.Exists
|
||||
try
|
||||
{
|
||||
buffer = File.ReadAllBytes(path);
|
||||
buffer = fileSystem.ReadAllBytes(path);
|
||||
|
||||
configuration = xmlSerializer.DeserializeFromBytes(type, buffer);
|
||||
}
|
||||
@ -46,10 +47,10 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
// If the file didn't exist before, or if something has changed, re-save
|
||||
if (buffer == null || !buffer.SequenceEqual(newBytes))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
fileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
// Save it after load in case we got new items
|
||||
File.WriteAllBytes(path, newBytes);
|
||||
fileSystem.WriteAllBytes(path, newBytes);
|
||||
}
|
||||
|
||||
return configuration;
|
@ -4,7 +4,7 @@ using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using MediaBrowser.Model.Cryptography;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.Cryptography
|
||||
namespace Emby.Common.Implementations.Cryptography
|
||||
{
|
||||
public class CryptographyProvider : ICryptographyProvider
|
||||
{
|
@ -1,12 +1,11 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.Devices
|
||||
namespace Emby.Common.Implementations.Devices
|
||||
{
|
||||
public class DeviceId
|
||||
{
|
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>5a27010a-09c6-4e86-93ea-437484c10917</ProjectGuid>
|
||||
<RootNamespace>Emby.Common.Implementations</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
namespace Emby.Common.Implementations.HttpClientManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Class HttpClientInfo
|
@ -13,14 +13,13 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Cache;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.IO;
|
||||
using Emby.Common.Implementations.HttpClientManager;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
namespace Emby.Common.Implementations.HttpClientManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Class HttpClientManager
|
||||
@ -70,11 +69,13 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
_memoryStreamProvider = memoryStreamProvider;
|
||||
_appPaths = appPaths;
|
||||
|
||||
#if NET46
|
||||
// http://stackoverflow.com/questions/566437/http-post-returns-the-error-417-expectation-failed-c
|
||||
ServicePointManager.Expect100Continue = false;
|
||||
|
||||
// Trakt requests sometimes fail without this
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -131,6 +132,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
|
||||
private void AddIpv4Option(HttpWebRequest request, HttpRequestOptions options)
|
||||
{
|
||||
#if NET46
|
||||
request.ServicePoint.BindIPEndPointDelegate = (servicePount, remoteEndPoint, retryCount) =>
|
||||
{
|
||||
if (remoteEndPoint.AddressFamily == AddressFamily.InterNetwork)
|
||||
@ -139,6 +141,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
}
|
||||
throw new InvalidOperationException("no IPv4 address");
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
private WebRequest GetRequest(HttpRequestOptions options, string method)
|
||||
@ -165,34 +168,52 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
|
||||
AddRequestHeaders(httpWebRequest, options);
|
||||
|
||||
httpWebRequest.AutomaticDecompression = options.EnableHttpCompression ?
|
||||
(options.DecompressionMethod ?? DecompressionMethods.Deflate) :
|
||||
#if NET46
|
||||
httpWebRequest.AutomaticDecompression = options.EnableHttpCompression ?
|
||||
(options.DecompressionMethod ?? DecompressionMethods.Deflate) :
|
||||
DecompressionMethods.None;
|
||||
#endif
|
||||
}
|
||||
|
||||
request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache);
|
||||
|
||||
|
||||
#if NET46
|
||||
request.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.BypassCache);
|
||||
#endif
|
||||
|
||||
if (httpWebRequest != null)
|
||||
{
|
||||
if (options.EnableKeepAlive)
|
||||
{
|
||||
#if NET46
|
||||
httpWebRequest.KeepAlive = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
request.Method = method;
|
||||
#if NET46
|
||||
request.Timeout = options.TimeoutMs;
|
||||
|
||||
#endif
|
||||
|
||||
if (httpWebRequest != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(options.Host))
|
||||
{
|
||||
#if NET46
|
||||
httpWebRequest.Host = options.Host;
|
||||
#elif NETSTANDARD1_6
|
||||
httpWebRequest.Headers["Host"] = options.Host;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(options.Referer))
|
||||
{
|
||||
#if NET46
|
||||
httpWebRequest.Referer = options.Referer;
|
||||
#elif NETSTANDARD1_6
|
||||
httpWebRequest.Headers["Referer"] = options.Referer;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,7 +223,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
request.Credentials = GetCredential(url, parts[0], parts[1]);
|
||||
// TODO: .net core ??
|
||||
#if NET46
|
||||
request.PreAuthenticate = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,11 +251,19 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
}
|
||||
else if (string.Equals(header.Key, "User-Agent", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
#if NET46
|
||||
request.UserAgent = header.Value;
|
||||
#elif NETSTANDARD1_6
|
||||
request.Headers["User-Agent"] = header.Value;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if NET46
|
||||
request.Headers.Set(header.Key, header.Value);
|
||||
#elif NETSTANDARD1_6
|
||||
request.Headers[header.Key] = header.Value;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -407,8 +439,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
|
||||
httpWebRequest.ContentType = options.RequestContentType ?? "application/x-www-form-urlencoded";
|
||||
|
||||
#if NET46
|
||||
httpWebRequest.ContentLength = bytes.Length;
|
||||
httpWebRequest.GetRequestStream().Write(bytes, 0, bytes.Length);
|
||||
#endif
|
||||
(await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false)).Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
if (options.ResourcePool != null)
|
||||
@ -885,6 +919,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
|
||||
private Task<WebResponse> GetResponseAsync(WebRequest request, TimeSpan timeout)
|
||||
{
|
||||
#if NET46
|
||||
var taskCompletion = new TaskCompletionSource<WebResponse>();
|
||||
|
||||
Task<WebResponse> asyncTask = Task.Factory.FromAsync<WebResponse>(request.BeginGetResponse, request.EndGetResponse, null);
|
||||
@ -897,6 +932,9 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
asyncTask.ContinueWith(callback.OnError, TaskContinuationOptions.OnlyOnFaulted);
|
||||
|
||||
return taskCompletion.Task;
|
||||
#endif
|
||||
|
||||
return request.GetResponseAsync();
|
||||
}
|
||||
|
||||
private static void TimeoutCallback(object state, bool timedOut)
|
@ -1,11 +1,11 @@
|
||||
using MediaBrowser.Model.IO;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.IO
|
||||
namespace Emby.Common.Implementations.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Class IsoManager
|
@ -3,11 +3,10 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using Patterns.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.IO
|
||||
namespace Emby.Common.Implementations.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ManagedFileSystem
|
||||
@ -660,6 +659,11 @@ namespace MediaBrowser.Common.Implementations.IO
|
||||
return File.ReadAllText(path);
|
||||
}
|
||||
|
||||
public byte[] ReadAllBytes(string path)
|
||||
{
|
||||
return File.ReadAllBytes(path);
|
||||
}
|
||||
|
||||
public void WriteAllText(string path, string text, Encoding encoding)
|
||||
{
|
||||
File.WriteAllText(path, text, encoding);
|
||||
@ -670,6 +674,11 @@ namespace MediaBrowser.Common.Implementations.IO
|
||||
File.WriteAllText(path, text);
|
||||
}
|
||||
|
||||
public void WriteAllBytes(string path, byte[] bytes)
|
||||
{
|
||||
File.WriteAllBytes(path, bytes);
|
||||
}
|
||||
|
||||
public string ReadAllText(string path, Encoding encoding)
|
||||
{
|
||||
return File.ReadAllText(path, encoding);
|
@ -1,13 +1,12 @@
|
||||
using Patterns.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.IO
|
||||
namespace Emby.Common.Implementations.IO
|
||||
{
|
||||
public class WindowsFileSystem : ManagedFileSystem
|
||||
{
|
||||
public WindowsFileSystem(ILogger logger)
|
||||
: base(logger, true, true)
|
||||
{
|
||||
AddShortcutHandler(new LnkShortcutHandler());
|
||||
EnableFileSystemRequestConcat = false;
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.Logging
|
||||
namespace Emby.Common.Implementations.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Class NLogger
|
@ -1,13 +1,13 @@
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
using NLog.Targets.Wrappers;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.Logging
|
||||
namespace Emby.Common.Implementations.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Class NlogManager
|
||||
@ -170,7 +170,7 @@ namespace MediaBrowser.Common.Implementations.Logging
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <returns>ILogger.</returns>
|
||||
public Model.Logging.ILogger GetLogger(string name)
|
||||
public MediaBrowser.Model.Logging.ILogger GetLogger(string name)
|
||||
{
|
||||
return new NLogger(name, this);
|
||||
}
|
||||
@ -206,7 +206,7 @@ namespace MediaBrowser.Common.Implementations.Logging
|
||||
/// <param name="level">The level.</param>
|
||||
public void ReloadLogger(LogSeverity level)
|
||||
{
|
||||
LogFilePath = Path.Combine(LogDirectory, LogFilePrefix + "-" + decimal.Round(DateTime.Now.Ticks / 10000000) + ".txt");
|
||||
LogFilePath = Path.Combine(LogDirectory, LogFilePrefix + "-" + decimal.Floor(DateTime.Now.Ticks / 10000000) + ".txt");
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(LogFilePath));
|
||||
|
@ -6,9 +6,10 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.Networking
|
||||
namespace Emby.Common.Implementations.Networking
|
||||
{
|
||||
public abstract class BaseNetworkManager
|
||||
{
|
||||
@ -56,7 +57,7 @@ namespace MediaBrowser.Common.Implementations.Networking
|
||||
|
||||
if (list.Count == 0)
|
||||
{
|
||||
list.AddRange(GetLocalIpAddressesFallback());
|
||||
list.AddRange(GetLocalIpAddressesFallback().Result);
|
||||
}
|
||||
|
||||
return list.Where(FilterIpAddress).DistinctBy(i => i.ToString());
|
||||
@ -170,7 +171,7 @@ namespace MediaBrowser.Common.Implementations.Networking
|
||||
var host = uri.DnsSafeHost;
|
||||
Logger.Debug("Resolving host {0}", host);
|
||||
|
||||
address = GetIpAddresses(host).FirstOrDefault();
|
||||
address = GetIpAddresses(host).Result.FirstOrDefault();
|
||||
|
||||
if (address != null)
|
||||
{
|
||||
@ -193,9 +194,9 @@ namespace MediaBrowser.Common.Implementations.Networking
|
||||
return false;
|
||||
}
|
||||
|
||||
public IEnumerable<IPAddress> GetIpAddresses(string hostName)
|
||||
private Task<IPAddress[]> GetIpAddresses(string hostName)
|
||||
{
|
||||
return Dns.GetHostAddresses(hostName);
|
||||
return Dns.GetHostAddressesAsync(hostName);
|
||||
}
|
||||
|
||||
private List<IPAddress> GetIPsDefault()
|
||||
@ -236,9 +237,9 @@ namespace MediaBrowser.Common.Implementations.Networking
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private IEnumerable<IPAddress> GetLocalIpAddressesFallback()
|
||||
private async Task<IEnumerable<IPAddress>> GetLocalIpAddressesFallback()
|
||||
{
|
||||
var host = Dns.GetHostEntry(Dns.GetHostName());
|
||||
var host = await Dns.GetHostEntryAsync(Dns.GetHostName()).ConfigureAwait(false);
|
||||
|
||||
// Reverse them because the last one is usually the correct one
|
||||
// It's not fool-proof so ultimately the consumer will have to examine them and decide
|
||||
@ -279,7 +280,7 @@ namespace MediaBrowser.Common.Implementations.Networking
|
||||
/// <returns>IPEndPoint.</returns>
|
||||
public IPEndPoint Parse(string endpointstring)
|
||||
{
|
||||
return Parse(endpointstring, -1);
|
||||
return Parse(endpointstring, -1).Result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -290,7 +291,7 @@ namespace MediaBrowser.Common.Implementations.Networking
|
||||
/// <returns>IPEndPoint.</returns>
|
||||
/// <exception cref="System.ArgumentException">Endpoint descriptor may not be empty.</exception>
|
||||
/// <exception cref="System.FormatException"></exception>
|
||||
private static IPEndPoint Parse(string endpointstring, int defaultport)
|
||||
private static async Task<IPEndPoint> Parse(string endpointstring, int defaultport)
|
||||
{
|
||||
if (String.IsNullOrEmpty(endpointstring)
|
||||
|| endpointstring.Trim().Length == 0)
|
||||
@ -316,7 +317,7 @@ namespace MediaBrowser.Common.Implementations.Networking
|
||||
|
||||
//try to use the address as IPv4, otherwise get hostname
|
||||
if (!IPAddress.TryParse(values[0], out ipaddy))
|
||||
ipaddy = GetIPfromHost(values[0]);
|
||||
ipaddy = await GetIPfromHost(values[0]).ConfigureAwait(false);
|
||||
}
|
||||
else if (values.Length > 2) //ipv6
|
||||
{
|
||||
@ -372,9 +373,9 @@ namespace MediaBrowser.Common.Implementations.Networking
|
||||
/// <param name="p">The p.</param>
|
||||
/// <returns>IPAddress.</returns>
|
||||
/// <exception cref="System.ArgumentException"></exception>
|
||||
private static IPAddress GetIPfromHost(string p)
|
||||
private static async Task<IPAddress> GetIPfromHost(string p)
|
||||
{
|
||||
var hosts = Dns.GetHostAddresses(p);
|
||||
var hosts = await Dns.GetHostAddressesAsync(p).ConfigureAwait(false);
|
||||
|
||||
if (hosts == null || hosts.Length == 0)
|
||||
throw new ArgumentException(String.Format("Host not found: {0}", p));
|
@ -1,30 +1,19 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("MediaBrowser.Dlna")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MediaBrowser.Dlna")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyProduct("Emby.Common.Implementations")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("c319ebfa-fd9d-42e4-ae74-a40039a6a688")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: Guid("5a27010a-09c6-4e86-93ea-437484c10917")]
|
@ -1,11 +1,11 @@
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.ScheduledTasks
|
||||
namespace Emby.Common.Implementations.ScheduledTasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a task trigger that fires everyday
|
@ -1,11 +1,11 @@
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.ScheduledTasks
|
||||
namespace Emby.Common.Implementations.ScheduledTasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a task trigger that runs repeatedly on an interval
|
@ -1,21 +1,20 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.System;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.ScheduledTasks
|
||||
namespace Emby.Common.Implementations.ScheduledTasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ScheduledTaskWorker
|
||||
@ -54,6 +53,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
|
||||
/// <value>The task manager.</value>
|
||||
private ITaskManager TaskManager { get; set; }
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ISystemEvents _systemEvents;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScheduledTaskWorker" /> class.
|
||||
@ -74,7 +74,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
|
||||
/// or
|
||||
/// logger
|
||||
/// </exception>
|
||||
public ScheduledTaskWorker(IScheduledTask scheduledTask, IApplicationPaths applicationPaths, ITaskManager taskManager, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem)
|
||||
public ScheduledTaskWorker(IScheduledTask scheduledTask, IApplicationPaths applicationPaths, ITaskManager taskManager, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem, ISystemEvents systemEvents)
|
||||
{
|
||||
if (scheduledTask == null)
|
||||
{
|
||||
@ -103,6 +103,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
|
||||
JsonSerializer = jsonSerializer;
|
||||
Logger = logger;
|
||||
_fileSystem = fileSystem;
|
||||
_systemEvents = systemEvents;
|
||||
|
||||
InitTriggerEvents();
|
||||
}
|
||||
@ -688,7 +689,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
|
||||
/// <returns>BaseTaskTrigger.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
/// <exception cref="System.ArgumentException">Invalid trigger type: + info.Type</exception>
|
||||
public static ITaskTrigger GetTrigger(TaskTriggerInfo info)
|
||||
private ITaskTrigger GetTrigger(TaskTriggerInfo info)
|
||||
{
|
||||
var options = new TaskExecutionOptions
|
||||
{
|
||||
@ -750,7 +751,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
return new SystemEventTrigger
|
||||
return new SystemEventTrigger(_systemEvents)
|
||||
{
|
||||
SystemEvent = info.SystemEvent.Value,
|
||||
TaskOptions = options
|
@ -1,10 +1,10 @@
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.ScheduledTasks
|
||||
namespace Emby.Common.Implementations.ScheduledTasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Class StartupTaskTrigger
|
@ -1,11 +1,11 @@
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.System;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.ScheduledTasks
|
||||
namespace Emby.Common.Implementations.ScheduledTasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Class SystemEventTrigger
|
||||
@ -26,6 +26,13 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||
/// </value>
|
||||
public TaskExecutionOptions TaskOptions { get; set; }
|
||||
|
||||
private readonly ISystemEvents _systemEvents;
|
||||
|
||||
public SystemEventTrigger(ISystemEvents systemEvents)
|
||||
{
|
||||
_systemEvents = systemEvents;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stars waiting for the trigger action
|
||||
/// </summary>
|
||||
@ -36,33 +43,28 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||
switch (SystemEvent)
|
||||
{
|
||||
case SystemEvent.WakeFromSleep:
|
||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||
_systemEvents.Resume += _systemEvents_Resume;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async void _systemEvents_Resume(object sender, EventArgs e)
|
||||
{
|
||||
if (SystemEvent == SystemEvent.WakeFromSleep)
|
||||
{
|
||||
// This value is a bit arbitrary, but add a delay to help ensure network connections have been restored before running the task
|
||||
await Task.Delay(10000).ConfigureAwait(false);
|
||||
|
||||
OnTriggered();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops waiting for the trigger action
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the PowerModeChanged event of the SystemEvents control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="PowerModeChangedEventArgs" /> instance containing the event data.</param>
|
||||
async void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||
{
|
||||
if (e.Mode == PowerModes.Resume && SystemEvent == SystemEvent.WakeFromSleep)
|
||||
{
|
||||
// This value is a bit arbitrary, but add a delay to help ensure network connections have been restored before running the task
|
||||
await Task.Delay(10000).ConfigureAwait(false);
|
||||
|
||||
OnTriggered();
|
||||
}
|
||||
_systemEvents.Resume -= _systemEvents_Resume;
|
||||
}
|
||||
|
||||
/// <summary>
|
@ -1,6 +1,5 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
@ -10,11 +9,10 @@ using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using Microsoft.Win32;
|
||||
using MediaBrowser.Model.System;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.ScheduledTasks
|
||||
namespace Emby.Common.Implementations.ScheduledTasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Class TaskManager
|
||||
@ -48,6 +46,8 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
|
||||
/// <value>The application paths.</value>
|
||||
private IApplicationPaths ApplicationPaths { get; set; }
|
||||
|
||||
private readonly ISystemEvents _systemEvents;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the logger.
|
||||
/// </summary>
|
||||
@ -81,29 +81,23 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
|
||||
/// <param name="jsonSerializer">The json serializer.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <exception cref="System.ArgumentException">kernel</exception>
|
||||
public TaskManager(IApplicationPaths applicationPaths, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem)
|
||||
public TaskManager(IApplicationPaths applicationPaths, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem, ISystemEvents systemEvents)
|
||||
{
|
||||
ApplicationPaths = applicationPaths;
|
||||
JsonSerializer = jsonSerializer;
|
||||
Logger = logger;
|
||||
_fileSystem = fileSystem;
|
||||
_systemEvents = systemEvents;
|
||||
|
||||
ScheduledTasks = new IScheduledTaskWorker[] { };
|
||||
}
|
||||
|
||||
private void BindToSystemEvent()
|
||||
{
|
||||
try
|
||||
{
|
||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
_systemEvents.Resume += _systemEvents_Resume;
|
||||
}
|
||||
|
||||
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||
private void _systemEvents_Resume(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var task in ScheduledTasks)
|
||||
{
|
||||
@ -255,7 +249,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
|
||||
var myTasks = ScheduledTasks.ToList();
|
||||
|
||||
var list = tasks.ToList();
|
||||
myTasks.AddRange(list.Select(t => new ScheduledTaskWorker(t, ApplicationPaths, this, JsonSerializer, Logger, _fileSystem)));
|
||||
myTasks.AddRange(list.Select(t => new ScheduledTaskWorker(t, ApplicationPaths, this, JsonSerializer, Logger, _fileSystem, _systemEvents)));
|
||||
|
||||
ScheduledTasks = myTasks.ToArray();
|
||||
|
@ -1,17 +1,15 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
|
||||
namespace Emby.Common.Implementations.ScheduledTasks.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Deletes old cache files
|
@ -1,15 +1,13 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
|
||||
namespace Emby.Common.Implementations.ScheduledTasks.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Deletes old log files
|
@ -1,13 +1,12 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
|
||||
namespace Emby.Common.Implementations.ScheduledTasks.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ReloadLoggerFileTask
|
@ -4,7 +4,7 @@ using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.ScheduledTasks
|
||||
namespace Emby.Common.Implementations.ScheduledTasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a task trigger that fires on a weekly basis
|
@ -8,14 +8,14 @@ using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.Serialization
|
||||
namespace Emby.Common.Implementations.Serialization
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a wrapper around third party xml serialization.
|
||||
/// </summary>
|
||||
public class XmlSerializer : IXmlSerializer
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public XmlSerializer(IFileSystem fileSystem, ILogger logger)
|
||||
@ -49,9 +49,9 @@ namespace MediaBrowser.Common.Implementations.Serialization
|
||||
/// </summary>
|
||||
/// <param name="obj">The obj.</param>
|
||||
/// <param name="writer">The writer.</param>
|
||||
private void SerializeToWriter(object obj, XmlTextWriter writer)
|
||||
private void SerializeToWriter(object obj, XmlWriter writer)
|
||||
{
|
||||
writer.Formatting = Formatting.Indented;
|
||||
//writer.Formatting = Formatting.Indented;
|
||||
var netSerializer = GetSerializer(obj.GetType());
|
||||
netSerializer.Serialize(writer, obj);
|
||||
}
|
||||
@ -64,7 +64,7 @@ namespace MediaBrowser.Common.Implementations.Serialization
|
||||
/// <returns>System.Object.</returns>
|
||||
public object DeserializeFromStream(Type type, Stream stream)
|
||||
{
|
||||
using (var reader = new XmlTextReader(stream))
|
||||
using (var reader = XmlReader.Create(stream))
|
||||
{
|
||||
var netSerializer = GetSerializer(type);
|
||||
return netSerializer.Deserialize(reader);
|
||||
@ -78,7 +78,7 @@ namespace MediaBrowser.Common.Implementations.Serialization
|
||||
/// <param name="stream">The stream.</param>
|
||||
public void SerializeToStream(object obj, Stream stream)
|
||||
{
|
||||
using (var writer = new XmlTextWriter(stream, null))
|
||||
using (var writer = XmlWriter.Create(stream))
|
||||
{
|
||||
SerializeToWriter(obj, writer);
|
||||
}
|
@ -8,7 +8,7 @@ using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Updates;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.Updates
|
||||
namespace Emby.Common.Implementations.Updates
|
||||
{
|
||||
public class GithubUpdater
|
||||
{
|
39
Emby.Common.Implementations/project.fragment.lock.json
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"version": 2,
|
||||
"exports": {
|
||||
"MediaBrowser.Common/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETPortable,Version=v4.5,Profile=Profile7",
|
||||
"compile": {
|
||||
"bin/Debug/MediaBrowser.Common.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/MediaBrowser.Common.dll": {}
|
||||
},
|
||||
"contentFiles": {
|
||||
"bin/Debug/MediaBrowser.Common.pdb": {
|
||||
"buildAction": "None",
|
||||
"codeLanguage": "any",
|
||||
"copyToOutput": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"MediaBrowser.Model/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETPortable,Version=v4.5,Profile=Profile7",
|
||||
"compile": {
|
||||
"bin/Debug/MediaBrowser.Model.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/MediaBrowser.Model.dll": {}
|
||||
},
|
||||
"contentFiles": {
|
||||
"bin/Debug/MediaBrowser.Model.pdb": {
|
||||
"buildAction": "None",
|
||||
"codeLanguage": "any",
|
||||
"copyToOutput": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
62
Emby.Common.Implementations/project.json
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"net46": {
|
||||
"frameworkAssemblies": {
|
||||
"System.Collections": "4.0.0.0",
|
||||
"System.IO": "4.0.0.0",
|
||||
"System.Net": "4.0.0.0",
|
||||
"System.Net.Http": "4.0.0.0",
|
||||
"System.Net.Http.WebRequest": "4.0.0.0",
|
||||
"System.Net.Primitives": "4.0.0.0",
|
||||
"System.Runtime": "4.0.0.0",
|
||||
"System.Runtime.Extensions": "4.0.0.0",
|
||||
"System.Text.Encoding": "4.0.0.0",
|
||||
"System.Threading": "4.0.0.0",
|
||||
"System.Threading.Tasks": "4.0.0.0",
|
||||
"System.Xml": "4.0.0.0",
|
||||
"System.Xml.Serialization": "4.0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"MediaBrowser.Common": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.Model": {
|
||||
"target": "project"
|
||||
},
|
||||
"SimpleInjector": "3.2.4",
|
||||
"NLog": "4.4.0-betaV15"
|
||||
}
|
||||
},
|
||||
"netstandard1.6": {
|
||||
"imports": "dnxcore50",
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.6.0",
|
||||
"MediaBrowser.Common": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.Model": {
|
||||
"target": "project"
|
||||
},
|
||||
"System.Net.Requests": "4.0.11",
|
||||
"System.Xml.XmlSerializer": "4.0.11",
|
||||
"System.Net.Http": "4.1.0",
|
||||
"System.Net.Primitives": "4.0.11",
|
||||
"System.Net.Sockets": "4.1.0",
|
||||
"System.Net.NetworkInformation": "4.1.0",
|
||||
"System.Net.NameResolution": "4.0.0",
|
||||
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0",
|
||||
"System.Reflection": "4.1.0",
|
||||
"System.Reflection.Primitives": "4.0.1",
|
||||
"System.Runtime.Loader": "4.0.0",
|
||||
"SimpleInjector": "3.2.4",
|
||||
"NLog": "4.4.0-betaV15"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
5937
Emby.Common.Implementations/project.lock.json
Normal file
@ -1,5 +1,5 @@
|
||||
|
||||
namespace MediaBrowser.Dlna.Common
|
||||
namespace Emby.Dlna.Common
|
||||
{
|
||||
public class Argument
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
|
||||
namespace MediaBrowser.Dlna.Common
|
||||
namespace Emby.Dlna.Common
|
||||
{
|
||||
public class DeviceIcon
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
|
||||
namespace MediaBrowser.Dlna.Common
|
||||
namespace Emby.Dlna.Common
|
||||
{
|
||||
public class DeviceService
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.Common
|
||||
namespace Emby.Dlna.Common
|
||||
{
|
||||
public class ServiceAction
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.Common
|
||||
namespace Emby.Dlna.Common
|
||||
{
|
||||
public class StateVariable
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna
|
||||
namespace Emby.Dlna
|
||||
{
|
||||
public static class ConfigurationExtension
|
||||
{
|
@ -1,11 +1,11 @@
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Dlna.Service;
|
||||
using Emby.Dlna.Service;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.ConnectionManager
|
||||
namespace Emby.Dlna.ConnectionManager
|
||||
{
|
||||
public class ConnectionManager : BaseService, IConnectionManager
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using MediaBrowser.Dlna.Common;
|
||||
using MediaBrowser.Dlna.Service;
|
||||
using Emby.Dlna.Common;
|
||||
using Emby.Dlna.Service;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.ConnectionManager
|
||||
namespace Emby.Dlna.ConnectionManager
|
||||
{
|
||||
public class ConnectionManagerXmlBuilder
|
||||
{
|
@ -1,13 +1,13 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Dlna.Server;
|
||||
using MediaBrowser.Dlna.Service;
|
||||
using Emby.Dlna.Server;
|
||||
using Emby.Dlna.Service;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.ConnectionManager
|
||||
namespace Emby.Dlna.ConnectionManager
|
||||
{
|
||||
public class ControlHandler : BaseControlHandler
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using MediaBrowser.Dlna.Common;
|
||||
using Emby.Dlna.Common;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.ConnectionManager
|
||||
namespace Emby.Dlna.ConnectionManager
|
||||
{
|
||||
public class ServiceActionListBuilder
|
||||
{
|
@ -5,7 +5,7 @@ using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Dlna.Service;
|
||||
using Emby.Dlna.Service;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
@ -14,7 +14,7 @@ using System.Linq;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
|
||||
namespace MediaBrowser.Dlna.ContentDirectory
|
||||
namespace Emby.Dlna.ContentDirectory
|
||||
{
|
||||
public class ContentDirectory : BaseService, IContentDirectory, IDisposable
|
||||
{
|
@ -10,8 +10,9 @@ using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Emby.Dlna.Server;
|
||||
|
||||
namespace MediaBrowser.Dlna.ContentDirectory
|
||||
namespace Emby.Dlna.ContentDirectory
|
||||
{
|
||||
public class ContentDirectoryBrowser
|
||||
{
|
||||
@ -90,7 +91,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||
request.ParentId = "1";
|
||||
}
|
||||
|
||||
builder.AppendFormat("<ObjectID>{0}</ObjectID>", SecurityElement.Escape(request.ParentId));
|
||||
builder.AppendFormat("<ObjectID>{0}</ObjectID>", DescriptionXmlBuilder.Escape(request.ParentId));
|
||||
builder.Append("<BrowseFlag>BrowseDirectChildren</BrowseFlag>");
|
||||
|
||||
//builder.Append("<BrowseFlag>BrowseMetadata</BrowseFlag>");
|
||||
@ -98,12 +99,12 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||
builder.Append("<Filter>*</Filter>");
|
||||
|
||||
request.StartIndex = request.StartIndex ?? 0;
|
||||
builder.AppendFormat("<StartingIndex>{0}</StartingIndex>", SecurityElement.Escape(request.StartIndex.Value.ToString(CultureInfo.InvariantCulture)));
|
||||
builder.AppendFormat("<StartingIndex>{0}</StartingIndex>", DescriptionXmlBuilder.Escape(request.StartIndex.Value.ToString(CultureInfo.InvariantCulture)));
|
||||
|
||||
request.Limit = request.Limit ?? 20;
|
||||
if (request.Limit.HasValue)
|
||||
{
|
||||
builder.AppendFormat("<RequestedCount>{0}</RequestedCount>", SecurityElement.Escape(request.Limit.Value.ToString(CultureInfo.InvariantCulture)));
|
||||
builder.AppendFormat("<RequestedCount>{0}</RequestedCount>", DescriptionXmlBuilder.Escape(request.Limit.Value.ToString(CultureInfo.InvariantCulture)));
|
||||
}
|
||||
|
||||
builder.Append("<SortCriteria></SortCriteria>");
|
@ -1,8 +1,8 @@
|
||||
using MediaBrowser.Dlna.Common;
|
||||
using MediaBrowser.Dlna.Service;
|
||||
using Emby.Dlna.Common;
|
||||
using Emby.Dlna.Service;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.ContentDirectory
|
||||
namespace Emby.Dlna.ContentDirectory
|
||||
{
|
||||
public class ContentDirectoryXmlBuilder
|
||||
{
|
@ -6,9 +6,9 @@ using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Dlna.Didl;
|
||||
using MediaBrowser.Dlna.Server;
|
||||
using MediaBrowser.Dlna.Service;
|
||||
using Emby.Dlna.Didl;
|
||||
using Emby.Dlna.Server;
|
||||
using Emby.Dlna.Service;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@ -25,7 +25,7 @@ using System.Xml;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
|
||||
namespace MediaBrowser.Dlna.ContentDirectory
|
||||
namespace Emby.Dlna.ContentDirectory
|
||||
{
|
||||
public class ControlHandler : BaseControlHandler
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using MediaBrowser.Dlna.Common;
|
||||
using Emby.Dlna.Common;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.ContentDirectory
|
||||
namespace Emby.Dlna.ContentDirectory
|
||||
{
|
||||
public class ServiceActionListBuilder
|
||||
{
|
@ -7,7 +7,7 @@ using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Playlists;
|
||||
using MediaBrowser.Dlna.ContentDirectory;
|
||||
using Emby.Dlna.ContentDirectory;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@ -22,7 +22,7 @@ using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
|
||||
namespace MediaBrowser.Dlna.Didl
|
||||
namespace Emby.Dlna.Didl
|
||||
{
|
||||
public class DidlBuilder
|
||||
{
|
||||
@ -368,11 +368,11 @@ namespace MediaBrowser.Dlna.Didl
|
||||
|
||||
if (item.IndexNumber.HasValue)
|
||||
{
|
||||
var number = item.IndexNumber.Value.ToString("00").ToString(CultureInfo.InvariantCulture);
|
||||
var number = item.IndexNumber.Value.ToString("00", CultureInfo.InvariantCulture);
|
||||
|
||||
if (episode.IndexNumberEnd.HasValue)
|
||||
{
|
||||
number += "-" + episode.IndexNumberEnd.Value.ToString("00").ToString(CultureInfo.InvariantCulture);
|
||||
number += "-" + episode.IndexNumberEnd.Value.ToString("00", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
return number + " - " + item.Name;
|
@ -3,7 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Dlna.Didl
|
||||
namespace Emby.Dlna.Didl
|
||||
{
|
||||
public class Filter
|
||||
{
|
@ -4,8 +4,8 @@ using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Dlna.Profiles;
|
||||
using MediaBrowser.Dlna.Server;
|
||||
using Emby.Dlna.Profiles;
|
||||
using Emby.Dlna.Server;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Logging;
|
||||
@ -19,8 +19,11 @@ using System.Text.RegularExpressions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
#if NETSTANDARD1_6
|
||||
using System.Reflection;
|
||||
#endif
|
||||
|
||||
namespace MediaBrowser.Dlna
|
||||
namespace Emby.Dlna
|
||||
{
|
||||
public class DlnaManager : IDlnaManager
|
||||
{
|
||||
@ -325,7 +328,7 @@ namespace MediaBrowser.Dlna
|
||||
|
||||
if (string.Equals(Path.GetExtension(path), ".xml", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var tempProfile = (MediaBrowser.Dlna.ProfileSerialization.DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(MediaBrowser.Dlna.ProfileSerialization.DeviceProfile), path);
|
||||
var tempProfile = (Emby.Dlna.ProfileSerialization.DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(Emby.Dlna.ProfileSerialization.DeviceProfile), path);
|
||||
|
||||
var json = _jsonSerializer.SerializeToString(tempProfile);
|
||||
profile = (DeviceProfile)_jsonSerializer.DeserializeFromString<DeviceProfile>(json);
|
||||
@ -397,8 +400,13 @@ namespace MediaBrowser.Dlna
|
||||
|
||||
private void ExtractSystemProfiles()
|
||||
{
|
||||
#if NET46
|
||||
var assembly = GetType().Assembly;
|
||||
var namespaceName = GetType().Namespace + ".Profiles.Json.";
|
||||
#elif NETSTANDARD1_6
|
||||
var assembly = GetType().GetTypeInfo().Assembly;
|
||||
var namespaceName = GetType().GetTypeInfo().Namespace + ".Profiles.Json.";
|
||||
#endif
|
||||
|
||||
var systemProfilesPath = SystemProfilesPath;
|
||||
|
||||
@ -552,11 +560,20 @@ namespace MediaBrowser.Dlna
|
||||
? ImageFormat.Png
|
||||
: ImageFormat.Jpg;
|
||||
|
||||
#if NET46
|
||||
return new ImageStream
|
||||
{
|
||||
Format = format,
|
||||
Stream = GetType().Assembly.GetManifestResourceStream("MediaBrowser.Dlna.Images." + filename.ToLower())
|
||||
};
|
||||
#elif NETSTANDARD1_6
|
||||
return new ImageStream
|
||||
{
|
||||
Format = format,
|
||||
Stream = GetType().GetTypeInfo().Assembly.GetManifestResourceStream("MediaBrowser.Dlna.Images." + filename.ToLower())
|
||||
};
|
||||
#endif
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
24
Emby.Dlna/Emby.Dlna.xproj
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>f40e364d-01d9-4bbf-b82c-5d6c55e0a1f5</ProjectGuid>
|
||||
<RootNamespace>Emby.Dlna</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
@ -10,7 +10,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Dlna.Eventing
|
||||
namespace Emby.Dlna.Eventing
|
||||
{
|
||||
public class EventManager : IEventManager
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Dlna.Eventing
|
||||
namespace Emby.Dlna.Eventing
|
||||
{
|
||||
public class EventSubscription
|
||||
{
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 840 B After Width: | Height: | Size: 840 B |
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 699 B After Width: | Height: | Size: 699 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 688 B After Width: | Height: | Size: 688 B |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
@ -8,8 +8,8 @@ using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Dlna.PlayTo;
|
||||
using MediaBrowser.Dlna.Ssdp;
|
||||
using Emby.Dlna.PlayTo;
|
||||
using Emby.Dlna.Ssdp;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -17,11 +17,12 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
using Rssdp;
|
||||
using Rssdp.Infrastructure;
|
||||
|
||||
namespace MediaBrowser.Dlna.Main
|
||||
namespace Emby.Dlna.Main
|
||||
{
|
||||
public class DlnaEntryPoint : IServerEntryPoint
|
||||
{
|
@ -1,12 +1,12 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Dlna.Server;
|
||||
using MediaBrowser.Dlna.Service;
|
||||
using Emby.Dlna.Server;
|
||||
using Emby.Dlna.Service;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.MediaReceiverRegistrar
|
||||
namespace Emby.Dlna.MediaReceiverRegistrar
|
||||
{
|
||||
public class ControlHandler : BaseControlHandler
|
||||
{
|
@ -1,12 +1,12 @@
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Dlna.Service;
|
||||
using Emby.Dlna.Service;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.MediaReceiverRegistrar
|
||||
namespace Emby.Dlna.MediaReceiverRegistrar
|
||||
{
|
||||
public class MediaReceiverRegistrar : BaseService, IMediaReceiverRegistrar, IDisposable
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using MediaBrowser.Dlna.Common;
|
||||
using MediaBrowser.Dlna.Service;
|
||||
using Emby.Dlna.Common;
|
||||
using Emby.Dlna.Service;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.MediaReceiverRegistrar
|
||||
namespace Emby.Dlna.MediaReceiverRegistrar
|
||||
{
|
||||
public class MediaReceiverRegistrarXmlBuilder
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using MediaBrowser.Dlna.Common;
|
||||
using Emby.Dlna.Common;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.MediaReceiverRegistrar
|
||||
namespace Emby.Dlna.MediaReceiverRegistrar
|
||||
{
|
||||
public class ServiceActionListBuilder
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class CurrentIdEventArgs : EventArgs
|
||||
{
|
@ -1,8 +1,9 @@
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Dlna.Common;
|
||||
using MediaBrowser.Dlna.Ssdp;
|
||||
using Emby.Dlna.Common;
|
||||
using Emby.Dlna.Ssdp;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
@ -12,8 +13,9 @@ using System.Security;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using Emby.Dlna.Server;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class Device : IDisposable
|
||||
{
|
||||
@ -358,7 +360,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||
if (string.IsNullOrEmpty(value))
|
||||
return String.Empty;
|
||||
|
||||
return SecurityElement.Escape(value);
|
||||
return DescriptionXmlBuilder.Escape(value);
|
||||
}
|
||||
|
||||
public async Task SetPlay()
|
||||
@ -469,7 +471,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
catch (HttpException ex)
|
||||
{
|
||||
if (_disposed)
|
||||
return;
|
@ -1,8 +1,8 @@
|
||||
using MediaBrowser.Dlna.Common;
|
||||
using Emby.Dlna.Common;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class DeviceInfo
|
||||
{
|
@ -3,7 +3,7 @@ using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Dlna.Didl;
|
||||
using Emby.Dlna.Didl;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@ -21,7 +21,7 @@ using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class PlayToController : ISessionController, IDisposable
|
||||
{
|
@ -14,10 +14,11 @@ using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
class PlayToManager : IDisposable
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class PlaybackProgressEventArgs : EventArgs
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class PlaybackStartEventArgs : EventArgs
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class PlaybackStoppedEventArgs : EventArgs
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class PlaylistItem
|
||||
{
|
@ -6,7 +6,7 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class PlaylistItemFactory
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Dlna.Common;
|
||||
using Emby.Dlna.Common;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
@ -8,7 +8,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class SsdpHttpClient
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public enum TRANSPORTSTATE
|
||||
{
|
@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using MediaBrowser.Dlna.Common;
|
||||
using Emby.Dlna.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using MediaBrowser.Dlna.Ssdp;
|
||||
using Emby.Dlna.Ssdp;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class TransportCommands
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class TransportStateEventArgs : EventArgs
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Xml.Linq;
|
||||
using MediaBrowser.Dlna.Ssdp;
|
||||
using Emby.Dlna.Ssdp;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class UpnpContainer : uBaseObject
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class uBaseObject
|
||||
{
|
||||
@ -38,17 +38,17 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||
{
|
||||
var classType = UpnpClass ?? string.Empty;
|
||||
|
||||
if (classType.IndexOf(Model.Entities.MediaType.Audio, StringComparison.Ordinal) != -1)
|
||||
if (classType.IndexOf(MediaBrowser.Model.Entities.MediaType.Audio, StringComparison.Ordinal) != -1)
|
||||
{
|
||||
return Model.Entities.MediaType.Audio;
|
||||
return MediaBrowser.Model.Entities.MediaType.Audio;
|
||||
}
|
||||
if (classType.IndexOf(Model.Entities.MediaType.Video, StringComparison.Ordinal) != -1)
|
||||
if (classType.IndexOf(MediaBrowser.Model.Entities.MediaType.Video, StringComparison.Ordinal) != -1)
|
||||
{
|
||||
return Model.Entities.MediaType.Video;
|
||||
return MediaBrowser.Model.Entities.MediaType.Video;
|
||||
}
|
||||
if (classType.IndexOf("image", StringComparison.Ordinal) != -1)
|
||||
{
|
||||
return Model.Entities.MediaType.Photo;
|
||||
return MediaBrowser.Model.Entities.MediaType.Photo;
|
||||
}
|
||||
|
||||
return null;
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class uParser
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class uParserObject
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace MediaBrowser.Dlna.PlayTo
|
||||
namespace Emby.Dlna.PlayTo
|
||||
{
|
||||
public class uPnpNamespaces
|
||||
{
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace MediaBrowser.Dlna.ProfileSerialization
|
||||
namespace Emby.Dlna.ProfileSerialization
|
||||
{
|
||||
public class CodecProfile
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace MediaBrowser.Dlna.ProfileSerialization
|
||||
namespace Emby.Dlna.ProfileSerialization
|
||||
{
|
||||
public class ContainerProfile
|
||||
{
|
@ -3,7 +3,7 @@ using MediaBrowser.Model.MediaInfo;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace MediaBrowser.Dlna.ProfileSerialization
|
||||
namespace Emby.Dlna.ProfileSerialization
|
||||
{
|
||||
[XmlRoot("Profile")]
|
||||
public class DeviceProfile
|
||||
@ -232,7 +232,7 @@ namespace MediaBrowser.Dlna.ProfileSerialization
|
||||
|
||||
private MediaBrowser.Model.Dlna.ProfileCondition GetModelProfileCondition(ProfileCondition c)
|
||||
{
|
||||
return new Model.Dlna.ProfileCondition
|
||||
return new MediaBrowser.Model.Dlna.ProfileCondition
|
||||
{
|
||||
Condition = c.Condition,
|
||||
IsRequired = c.IsRequired,
|