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