ReSharper conform to 'var' settings
This commit is contained in:
parent
a36658f6f0
commit
65bd052f3e
|
@ -164,7 +164,7 @@ namespace BDInfo
|
||||||
if (DirectoryPLAYLIST != null)
|
if (DirectoryPLAYLIST != null)
|
||||||
{
|
{
|
||||||
FileSystemMetadata[] files = GetFiles(DirectoryPLAYLIST.FullName, ".mpls").ToArray();
|
FileSystemMetadata[] files = GetFiles(DirectoryPLAYLIST.FullName, ".mpls").ToArray();
|
||||||
foreach (FileSystemMetadata file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
PlaylistFiles.Add(
|
PlaylistFiles.Add(
|
||||||
file.Name.ToUpper(), new TSPlaylistFile(this, file, _fileSystem, textEncoding));
|
file.Name.ToUpper(), new TSPlaylistFile(this, file, _fileSystem, textEncoding));
|
||||||
|
@ -174,7 +174,7 @@ namespace BDInfo
|
||||||
if (DirectorySTREAM != null)
|
if (DirectorySTREAM != null)
|
||||||
{
|
{
|
||||||
FileSystemMetadata[] files = GetFiles(DirectorySTREAM.FullName, ".m2ts").ToArray();
|
FileSystemMetadata[] files = GetFiles(DirectorySTREAM.FullName, ".m2ts").ToArray();
|
||||||
foreach (FileSystemMetadata file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
StreamFiles.Add(
|
StreamFiles.Add(
|
||||||
file.Name.ToUpper(), new TSStreamFile(file, _fileSystem));
|
file.Name.ToUpper(), new TSStreamFile(file, _fileSystem));
|
||||||
|
@ -184,7 +184,7 @@ namespace BDInfo
|
||||||
if (DirectoryCLIPINF != null)
|
if (DirectoryCLIPINF != null)
|
||||||
{
|
{
|
||||||
FileSystemMetadata[] files = GetFiles(DirectoryCLIPINF.FullName, ".clpi").ToArray();
|
FileSystemMetadata[] files = GetFiles(DirectoryCLIPINF.FullName, ".clpi").ToArray();
|
||||||
foreach (FileSystemMetadata file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
StreamClipFiles.Add(
|
StreamClipFiles.Add(
|
||||||
file.Name.ToUpper(), new TSStreamClipFile(file, _fileSystem, textEncoding));
|
file.Name.ToUpper(), new TSStreamClipFile(file, _fileSystem, textEncoding));
|
||||||
|
@ -194,7 +194,7 @@ namespace BDInfo
|
||||||
if (DirectorySSIF != null)
|
if (DirectorySSIF != null)
|
||||||
{
|
{
|
||||||
FileSystemMetadata[] files = GetFiles(DirectorySSIF.FullName, ".ssif").ToArray();
|
FileSystemMetadata[] files = GetFiles(DirectorySSIF.FullName, ".ssif").ToArray();
|
||||||
foreach (FileSystemMetadata file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
InterleavedFiles.Add(
|
InterleavedFiles.Add(
|
||||||
file.Name.ToUpper(), new TSInterleavedFile(file));
|
file.Name.ToUpper(), new TSInterleavedFile(file));
|
||||||
|
@ -214,8 +214,8 @@ namespace BDInfo
|
||||||
|
|
||||||
public void Scan()
|
public void Scan()
|
||||||
{
|
{
|
||||||
List<TSStreamClipFile> errorStreamClipFiles = new List<TSStreamClipFile>();
|
var errorStreamClipFiles = new List<TSStreamClipFile>();
|
||||||
foreach (TSStreamClipFile streamClipFile in StreamClipFiles.Values)
|
foreach (var streamClipFile in StreamClipFiles.Values)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -239,7 +239,7 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (TSStreamFile streamFile in StreamFiles.Values)
|
foreach (var streamFile in StreamFiles.Values)
|
||||||
{
|
{
|
||||||
string ssifName = Path.GetFileNameWithoutExtension(streamFile.Name) + ".SSIF";
|
string ssifName = Path.GetFileNameWithoutExtension(streamFile.Name) + ".SSIF";
|
||||||
if (InterleavedFiles.ContainsKey(ssifName))
|
if (InterleavedFiles.ContainsKey(ssifName))
|
||||||
|
@ -252,8 +252,8 @@ namespace BDInfo
|
||||||
StreamFiles.Values.CopyTo(streamFiles, 0);
|
StreamFiles.Values.CopyTo(streamFiles, 0);
|
||||||
Array.Sort(streamFiles, CompareStreamFiles);
|
Array.Sort(streamFiles, CompareStreamFiles);
|
||||||
|
|
||||||
List<TSPlaylistFile> errorPlaylistFiles = new List<TSPlaylistFile>();
|
var errorPlaylistFiles = new List<TSPlaylistFile>();
|
||||||
foreach (TSPlaylistFile playlistFile in PlaylistFiles.Values)
|
foreach (var playlistFile in PlaylistFiles.Values)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -277,15 +277,15 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TSStreamFile> errorStreamFiles = new List<TSStreamFile>();
|
var errorStreamFiles = new List<TSStreamFile>();
|
||||||
foreach (TSStreamFile streamFile in streamFiles)
|
foreach (var streamFile in streamFiles)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<TSPlaylistFile> playlists = new List<TSPlaylistFile>();
|
var playlists = new List<TSPlaylistFile>();
|
||||||
foreach (TSPlaylistFile playlist in PlaylistFiles.Values)
|
foreach (var playlist in PlaylistFiles.Values)
|
||||||
{
|
{
|
||||||
foreach (TSStreamClip streamClip in playlist.StreamClips)
|
foreach (var streamClip in playlist.StreamClips)
|
||||||
{
|
{
|
||||||
if (streamClip.Name == streamFile.Name)
|
if (streamClip.Name == streamFile.Name)
|
||||||
{
|
{
|
||||||
|
@ -314,12 +314,12 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (TSPlaylistFile playlistFile in PlaylistFiles.Values)
|
foreach (var playlistFile in PlaylistFiles.Values)
|
||||||
{
|
{
|
||||||
playlistFile.Initialize();
|
playlistFile.Initialize();
|
||||||
if (!Is50Hz)
|
if (!Is50Hz)
|
||||||
{
|
{
|
||||||
foreach (TSVideoStream videoStream in playlistFile.VideoStreams)
|
foreach (var videoStream in playlistFile.VideoStreams)
|
||||||
{
|
{
|
||||||
if (videoStream.FrameRate == TSFrameRate.FRAMERATE_25 ||
|
if (videoStream.FrameRate == TSFrameRate.FRAMERATE_25 ||
|
||||||
videoStream.FrameRate == TSFrameRate.FRAMERATE_50)
|
videoStream.FrameRate == TSFrameRate.FRAMERATE_50)
|
||||||
|
@ -339,7 +339,7 @@ namespace BDInfo
|
||||||
throw new ArgumentNullException(nameof(path));
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path);
|
var dir = _fileSystem.GetDirectoryInfo(path);
|
||||||
|
|
||||||
while (dir != null)
|
while (dir != null)
|
||||||
{
|
{
|
||||||
|
@ -369,7 +369,7 @@ namespace BDInfo
|
||||||
if (dir != null)
|
if (dir != null)
|
||||||
{
|
{
|
||||||
FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray();
|
FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray();
|
||||||
foreach (FileSystemMetadata child in children)
|
foreach (var child in children)
|
||||||
{
|
{
|
||||||
if (string.Equals(child.Name, name, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(child.Name, name, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -378,7 +378,7 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
if (searchDepth > 0)
|
if (searchDepth > 0)
|
||||||
{
|
{
|
||||||
foreach (FileSystemMetadata child in children)
|
foreach (var child in children)
|
||||||
{
|
{
|
||||||
GetDirectory(
|
GetDirectory(
|
||||||
name, child, searchDepth - 1);
|
name, child, searchDepth - 1);
|
||||||
|
@ -395,7 +395,7 @@ namespace BDInfo
|
||||||
//if (!ExcludeDirs.Contains(directoryInfo.Name.ToUpper())) // TODO: Keep?
|
//if (!ExcludeDirs.Contains(directoryInfo.Name.ToUpper())) // TODO: Keep?
|
||||||
{
|
{
|
||||||
FileSystemMetadata[] pathFiles = _fileSystem.GetFiles(directoryInfo.FullName).ToArray();
|
FileSystemMetadata[] pathFiles = _fileSystem.GetFiles(directoryInfo.FullName).ToArray();
|
||||||
foreach (FileSystemMetadata pathFile in pathFiles)
|
foreach (var pathFile in pathFiles)
|
||||||
{
|
{
|
||||||
if (pathFile.Extension.ToUpper() == ".SSIF")
|
if (pathFile.Extension.ToUpper() == ".SSIF")
|
||||||
{
|
{
|
||||||
|
@ -405,7 +405,7 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemMetadata[] pathChildren = _fileSystem.GetDirectories(directoryInfo.FullName).ToArray();
|
FileSystemMetadata[] pathChildren = _fileSystem.GetDirectories(directoryInfo.FullName).ToArray();
|
||||||
foreach (FileSystemMetadata pathChild in pathChildren)
|
foreach (var pathChild in pathChildren)
|
||||||
{
|
{
|
||||||
size += GetDirectorySize(pathChild);
|
size += GetDirectorySize(pathChild);
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ namespace BDInfo
|
||||||
// TODO
|
// TODO
|
||||||
if (stream.CoreStream != null)
|
if (stream.CoreStream != null)
|
||||||
{
|
{
|
||||||
TSAudioStream coreStream = (TSAudioStream)stream.CoreStream;
|
var coreStream = (TSAudioStream)stream.CoreStream;
|
||||||
if (coreStream.AudioMode == TSAudioMode.Extended &&
|
if (coreStream.AudioMode == TSAudioMode.Extended &&
|
||||||
stream.ChannelCount == 5)
|
stream.ChannelCount == 5)
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,9 +85,9 @@ namespace BDInfo
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_textEncoding = textEncoding;
|
_textEncoding = textEncoding;
|
||||||
IsCustom = true;
|
IsCustom = true;
|
||||||
foreach (TSStreamClip clip in clips)
|
foreach (var clip in clips)
|
||||||
{
|
{
|
||||||
TSStreamClip newClip = new TSStreamClip(
|
var newClip = new TSStreamClip(
|
||||||
clip.StreamFile, clip.StreamClipFile);
|
clip.StreamFile, clip.StreamClipFile);
|
||||||
|
|
||||||
newClip.Name = clip.Name;
|
newClip.Name = clip.Name;
|
||||||
|
@ -123,7 +123,7 @@ namespace BDInfo
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ulong size = 0;
|
ulong size = 0;
|
||||||
foreach (TSStreamClip clip in StreamClips)
|
foreach (var clip in StreamClips)
|
||||||
{
|
{
|
||||||
size += clip.InterleavedFileSize;
|
size += clip.InterleavedFileSize;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ namespace BDInfo
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ulong size = 0;
|
ulong size = 0;
|
||||||
foreach (TSStreamClip clip in StreamClips)
|
foreach (var clip in StreamClips)
|
||||||
{
|
{
|
||||||
size += clip.FileSize;
|
size += clip.FileSize;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ namespace BDInfo
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
double length = 0;
|
double length = 0;
|
||||||
foreach (TSStreamClip clip in StreamClips)
|
foreach (var clip in StreamClips)
|
||||||
{
|
{
|
||||||
if (clip.AngleIndex == 0)
|
if (clip.AngleIndex == 0)
|
||||||
{
|
{
|
||||||
|
@ -163,7 +163,7 @@ namespace BDInfo
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
double length = 0;
|
double length = 0;
|
||||||
foreach (TSStreamClip clip in StreamClips)
|
foreach (var clip in StreamClips)
|
||||||
{
|
{
|
||||||
length += clip.Length;
|
length += clip.Length;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ namespace BDInfo
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ulong size = 0;
|
ulong size = 0;
|
||||||
foreach (TSStreamClip clip in StreamClips)
|
foreach (var clip in StreamClips)
|
||||||
{
|
{
|
||||||
if (clip.AngleIndex == 0)
|
if (clip.AngleIndex == 0)
|
||||||
{
|
{
|
||||||
|
@ -192,7 +192,7 @@ namespace BDInfo
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ulong size = 0;
|
ulong size = 0;
|
||||||
foreach (TSStreamClip clip in StreamClips)
|
foreach (var clip in StreamClips)
|
||||||
{
|
{
|
||||||
size += clip.PacketSize;
|
size += clip.PacketSize;
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ namespace BDInfo
|
||||||
int itemCount = ReadInt16(data, ref pos);
|
int itemCount = ReadInt16(data, ref pos);
|
||||||
int subitemCount = ReadInt16(data, ref pos);
|
int subitemCount = ReadInt16(data, ref pos);
|
||||||
|
|
||||||
List<TSStreamClip> chapterClips = new List<TSStreamClip>();
|
var chapterClips = new List<TSStreamClip>();
|
||||||
for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
|
for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
|
||||||
{
|
{
|
||||||
int itemStart = pos;
|
int itemStart = pos;
|
||||||
|
@ -310,7 +310,7 @@ namespace BDInfo
|
||||||
if (outTime < 0) outTime &= 0x7FFFFFFF;
|
if (outTime < 0) outTime &= 0x7FFFFFFF;
|
||||||
double timeOut = (double)outTime / 45000;
|
double timeOut = (double)outTime / 45000;
|
||||||
|
|
||||||
TSStreamClip streamClip = new TSStreamClip(
|
var streamClip = new TSStreamClip(
|
||||||
streamFile, streamClipFile);
|
streamFile, streamClipFile);
|
||||||
|
|
||||||
streamClip.Name = streamFileName; //TODO
|
streamClip.Name = streamFileName; //TODO
|
||||||
|
@ -361,7 +361,7 @@ namespace BDInfo
|
||||||
FileInfo.Name, angleClipFileName));
|
FileInfo.Name, angleClipFileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
TSStreamClip angleClip =
|
var angleClip =
|
||||||
new TSStreamClip(angleFile, angleClipFile);
|
new TSStreamClip(angleFile, angleClipFile);
|
||||||
angleClip.AngleIndex = angle + 1;
|
angleClip.AngleIndex = angle + 1;
|
||||||
angleClip.TimeIn = streamClip.TimeIn;
|
angleClip.TimeIn = streamClip.TimeIn;
|
||||||
|
@ -394,33 +394,33 @@ namespace BDInfo
|
||||||
|
|
||||||
for (int i = 0; i < streamCountVideo; i++)
|
for (int i = 0; i < streamCountVideo; i++)
|
||||||
{
|
{
|
||||||
TSStream stream = CreatePlaylistStream(data, ref pos);
|
var stream = CreatePlaylistStream(data, ref pos);
|
||||||
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < streamCountAudio; i++)
|
for (int i = 0; i < streamCountAudio; i++)
|
||||||
{
|
{
|
||||||
TSStream stream = CreatePlaylistStream(data, ref pos);
|
var stream = CreatePlaylistStream(data, ref pos);
|
||||||
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < streamCountPG; i++)
|
for (int i = 0; i < streamCountPG; i++)
|
||||||
{
|
{
|
||||||
TSStream stream = CreatePlaylistStream(data, ref pos);
|
var stream = CreatePlaylistStream(data, ref pos);
|
||||||
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < streamCountIG; i++)
|
for (int i = 0; i < streamCountIG; i++)
|
||||||
{
|
{
|
||||||
TSStream stream = CreatePlaylistStream(data, ref pos);
|
var stream = CreatePlaylistStream(data, ref pos);
|
||||||
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < streamCountSecondaryAudio; i++)
|
for (int i = 0; i < streamCountSecondaryAudio; i++)
|
||||||
{
|
{
|
||||||
TSStream stream = CreatePlaylistStream(data, ref pos);
|
var stream = CreatePlaylistStream(data, ref pos);
|
||||||
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
||||||
pos += 2;
|
pos += 2;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < streamCountSecondaryVideo; i++)
|
for (int i = 0; i < streamCountSecondaryVideo; i++)
|
||||||
{
|
{
|
||||||
TSStream stream = CreatePlaylistStream(data, ref pos);
|
var stream = CreatePlaylistStream(data, ref pos);
|
||||||
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
if (stream != null) PlaylistStreams[stream.PID] = stream;
|
||||||
pos += 6;
|
pos += 6;
|
||||||
}
|
}
|
||||||
|
@ -458,7 +458,7 @@ namespace BDInfo
|
||||||
((long)data[pos + 6] << 8) +
|
((long)data[pos + 6] << 8) +
|
||||||
((long)data[pos + 7]);
|
((long)data[pos + 7]);
|
||||||
|
|
||||||
TSStreamClip streamClip = chapterClips[streamFileIndex];
|
var streamClip = chapterClips[streamFileIndex];
|
||||||
|
|
||||||
double chapterSeconds = (double)chapterTime / 45000;
|
double chapterSeconds = (double)chapterTime / 45000;
|
||||||
|
|
||||||
|
@ -498,8 +498,8 @@ namespace BDInfo
|
||||||
{
|
{
|
||||||
LoadStreamClips();
|
LoadStreamClips();
|
||||||
|
|
||||||
Dictionary<string, List<double>> clipTimes = new Dictionary<string, List<double>>();
|
var clipTimes = new Dictionary<string, List<double>>();
|
||||||
foreach (TSStreamClip clip in StreamClips)
|
foreach (var clip in StreamClips)
|
||||||
{
|
{
|
||||||
if (clip.AngleIndex == 0)
|
if (clip.AngleIndex == 0)
|
||||||
{
|
{
|
||||||
|
@ -567,7 +567,7 @@ namespace BDInfo
|
||||||
int streamLength = data[pos++];
|
int streamLength = data[pos++];
|
||||||
int streamPos = pos;
|
int streamPos = pos;
|
||||||
|
|
||||||
TSStreamType streamType = (TSStreamType)data[pos++];
|
var streamType = (TSStreamType)data[pos++];
|
||||||
switch (streamType)
|
switch (streamType)
|
||||||
{
|
{
|
||||||
case TSStreamType.MVC_VIDEO:
|
case TSStreamType.MVC_VIDEO:
|
||||||
|
@ -579,11 +579,11 @@ namespace BDInfo
|
||||||
case TSStreamType.MPEG2_VIDEO:
|
case TSStreamType.MPEG2_VIDEO:
|
||||||
case TSStreamType.VC1_VIDEO:
|
case TSStreamType.VC1_VIDEO:
|
||||||
|
|
||||||
TSVideoFormat videoFormat = (TSVideoFormat)
|
var videoFormat = (TSVideoFormat)
|
||||||
(data[pos] >> 4);
|
(data[pos] >> 4);
|
||||||
TSFrameRate frameRate = (TSFrameRate)
|
var frameRate = (TSFrameRate)
|
||||||
(data[pos] & 0xF);
|
(data[pos] & 0xF);
|
||||||
TSAspectRatio aspectRatio = (TSAspectRatio)
|
var aspectRatio = (TSAspectRatio)
|
||||||
(data[pos + 1] >> 4);
|
(data[pos + 1] >> 4);
|
||||||
|
|
||||||
stream = new TSVideoStream();
|
stream = new TSVideoStream();
|
||||||
|
@ -617,9 +617,9 @@ namespace BDInfo
|
||||||
|
|
||||||
int audioFormat = ReadByte(data, ref pos);
|
int audioFormat = ReadByte(data, ref pos);
|
||||||
|
|
||||||
TSChannelLayout channelLayout = (TSChannelLayout)
|
var channelLayout = (TSChannelLayout)
|
||||||
(audioFormat >> 4);
|
(audioFormat >> 4);
|
||||||
TSSampleRate sampleRate = (TSSampleRate)
|
var sampleRate = (TSSampleRate)
|
||||||
(audioFormat & 0xF);
|
(audioFormat & 0xF);
|
||||||
|
|
||||||
string audioLanguage = ReadString(data, 3, ref pos);
|
string audioLanguage = ReadString(data, 3, ref pos);
|
||||||
|
@ -712,7 +712,7 @@ namespace BDInfo
|
||||||
{
|
{
|
||||||
referenceClip = StreamClips[0];
|
referenceClip = StreamClips[0];
|
||||||
}
|
}
|
||||||
foreach (TSStreamClip clip in StreamClips)
|
foreach (var clip in StreamClips)
|
||||||
{
|
{
|
||||||
if (clip.StreamClipFile.Streams.Count > referenceClip.StreamClipFile.Streams.Count)
|
if (clip.StreamClipFile.Streams.Count > referenceClip.StreamClipFile.Streams.Count)
|
||||||
{
|
{
|
||||||
|
@ -738,12 +738,12 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (TSStream clipStream
|
foreach (var clipStream
|
||||||
in referenceClip.StreamClipFile.Streams.Values)
|
in referenceClip.StreamClipFile.Streams.Values)
|
||||||
{
|
{
|
||||||
if (!Streams.ContainsKey(clipStream.PID))
|
if (!Streams.ContainsKey(clipStream.PID))
|
||||||
{
|
{
|
||||||
TSStream stream = clipStream.Clone();
|
var stream = clipStream.Clone();
|
||||||
Streams[clipStream.PID] = stream;
|
Streams[clipStream.PID] = stream;
|
||||||
|
|
||||||
if (!IsCustom && !PlaylistStreams.ContainsKey(stream.PID))
|
if (!IsCustom && !PlaylistStreams.ContainsKey(stream.PID))
|
||||||
|
@ -779,7 +779,7 @@ namespace BDInfo
|
||||||
referenceClip.StreamFile.Streams.ContainsKey(4114) &&
|
referenceClip.StreamFile.Streams.ContainsKey(4114) &&
|
||||||
!Streams.ContainsKey(4114))
|
!Streams.ContainsKey(4114))
|
||||||
{
|
{
|
||||||
TSStream stream = referenceClip.StreamFile.Streams[4114].Clone();
|
var stream = referenceClip.StreamFile.Streams[4114].Clone();
|
||||||
Streams[4114] = stream;
|
Streams[4114] = stream;
|
||||||
if (stream.IsVideoStream)
|
if (stream.IsVideoStream)
|
||||||
{
|
{
|
||||||
|
@ -787,12 +787,12 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (TSStream clipStream
|
foreach (var clipStream
|
||||||
in referenceClip.StreamFile.Streams.Values)
|
in referenceClip.StreamFile.Streams.Values)
|
||||||
{
|
{
|
||||||
if (Streams.ContainsKey(clipStream.PID))
|
if (Streams.ContainsKey(clipStream.PID))
|
||||||
{
|
{
|
||||||
TSStream stream = Streams[clipStream.PID];
|
var stream = Streams[clipStream.PID];
|
||||||
|
|
||||||
if (stream.StreamType != clipStream.StreamType) continue;
|
if (stream.StreamType != clipStream.StreamType) continue;
|
||||||
|
|
||||||
|
@ -811,8 +811,8 @@ namespace BDInfo
|
||||||
else if (stream.IsAudioStream &&
|
else if (stream.IsAudioStream &&
|
||||||
clipStream.IsAudioStream)
|
clipStream.IsAudioStream)
|
||||||
{
|
{
|
||||||
TSAudioStream audioStream = (TSAudioStream)stream;
|
var audioStream = (TSAudioStream)stream;
|
||||||
TSAudioStream clipAudioStream = (TSAudioStream)clipStream;
|
var clipAudioStream = (TSAudioStream)clipStream;
|
||||||
|
|
||||||
if (clipAudioStream.ChannelCount > audioStream.ChannelCount)
|
if (clipAudioStream.ChannelCount > audioStream.ChannelCount)
|
||||||
{
|
{
|
||||||
|
@ -863,7 +863,7 @@ namespace BDInfo
|
||||||
SortedStreams.Add(stream);
|
SortedStreams.Add(stream);
|
||||||
for (int i = 0; i < AngleCount; i++)
|
for (int i = 0; i < AngleCount; i++)
|
||||||
{
|
{
|
||||||
TSStream angleStream = stream.Clone();
|
var angleStream = stream.Clone();
|
||||||
angleStream.AngleIndex = i + 1;
|
angleStream.AngleIndex = i + 1;
|
||||||
AngleStreams[i][angleStream.PID] = angleStream;
|
AngleStreams[i][angleStream.PID] = angleStream;
|
||||||
SortedStreams.Add(angleStream);
|
SortedStreams.Add(angleStream);
|
||||||
|
@ -900,7 +900,7 @@ namespace BDInfo
|
||||||
|
|
||||||
public void ClearBitrates()
|
public void ClearBitrates()
|
||||||
{
|
{
|
||||||
foreach (TSStreamClip clip in StreamClips)
|
foreach (var clip in StreamClips)
|
||||||
{
|
{
|
||||||
clip.PayloadBytes = 0;
|
clip.PayloadBytes = 0;
|
||||||
clip.PacketCount = 0;
|
clip.PacketCount = 0;
|
||||||
|
@ -908,7 +908,7 @@ namespace BDInfo
|
||||||
|
|
||||||
if (clip.StreamFile != null)
|
if (clip.StreamFile != null)
|
||||||
{
|
{
|
||||||
foreach (TSStream stream in clip.StreamFile.Streams.Values)
|
foreach (var stream in clip.StreamFile.Streams.Values)
|
||||||
{
|
{
|
||||||
stream.PayloadBytes = 0;
|
stream.PayloadBytes = 0;
|
||||||
stream.PacketCount = 0;
|
stream.PacketCount = 0;
|
||||||
|
@ -923,7 +923,7 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (TSStream stream in SortedStreams)
|
foreach (var stream in SortedStreams)
|
||||||
{
|
{
|
||||||
stream.PayloadBytes = 0;
|
stream.PayloadBytes = 0;
|
||||||
stream.PacketCount = 0;
|
stream.PacketCount = 0;
|
||||||
|
|
|
@ -109,7 +109,7 @@ namespace BDInfo
|
||||||
|
|
||||||
public TSDescriptor Clone()
|
public TSDescriptor Clone()
|
||||||
{
|
{
|
||||||
TSDescriptor descriptor =
|
var descriptor =
|
||||||
new TSDescriptor(Name, (byte)Value.Length);
|
new TSDescriptor(Name, (byte)Value.Length);
|
||||||
Value.CopyTo(descriptor.Value, 0);
|
Value.CopyTo(descriptor.Value, 0);
|
||||||
return descriptor;
|
return descriptor;
|
||||||
|
@ -404,7 +404,7 @@ namespace BDInfo
|
||||||
if (Descriptors != null)
|
if (Descriptors != null)
|
||||||
{
|
{
|
||||||
stream.Descriptors = new List<TSDescriptor>();
|
stream.Descriptors = new List<TSDescriptor>();
|
||||||
foreach (TSDescriptor descriptor in Descriptors)
|
foreach (var descriptor in Descriptors)
|
||||||
{
|
{
|
||||||
stream.Descriptors.Add(descriptor.Clone());
|
stream.Descriptors.Add(descriptor.Clone());
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ namespace BDInfo
|
||||||
|
|
||||||
public override TSStream Clone()
|
public override TSStream Clone()
|
||||||
{
|
{
|
||||||
TSVideoStream stream = new TSVideoStream();
|
var stream = new TSVideoStream();
|
||||||
CopyTo(stream);
|
CopyTo(stream);
|
||||||
|
|
||||||
stream.VideoFormat = _VideoFormat;
|
stream.VideoFormat = _VideoFormat;
|
||||||
|
@ -727,7 +727,7 @@ namespace BDInfo
|
||||||
|
|
||||||
public override TSStream Clone()
|
public override TSStream Clone()
|
||||||
{
|
{
|
||||||
TSAudioStream stream = new TSAudioStream();
|
var stream = new TSAudioStream();
|
||||||
CopyTo(stream);
|
CopyTo(stream);
|
||||||
|
|
||||||
stream.SampleRate = SampleRate;
|
stream.SampleRate = SampleRate;
|
||||||
|
@ -756,7 +756,7 @@ namespace BDInfo
|
||||||
|
|
||||||
public override TSStream Clone()
|
public override TSStream Clone()
|
||||||
{
|
{
|
||||||
TSGraphicsStream stream = new TSGraphicsStream();
|
var stream = new TSGraphicsStream();
|
||||||
CopyTo(stream);
|
CopyTo(stream);
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
@ -772,7 +772,7 @@ namespace BDInfo
|
||||||
|
|
||||||
public override TSStream Clone()
|
public override TSStream Clone()
|
||||||
{
|
{
|
||||||
TSTextStream stream = new TSTextStream();
|
var stream = new TSTextStream();
|
||||||
CopyTo(stream);
|
CopyTo(stream);
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace BDInfo
|
||||||
data += (Stream.ReadByte() << shift);
|
data += (Stream.ReadByte() << shift);
|
||||||
shift -= 8;
|
shift -= 8;
|
||||||
}
|
}
|
||||||
BitVector32 vector = new BitVector32(data);
|
var vector = new BitVector32(data);
|
||||||
|
|
||||||
int value = 0;
|
int value = 0;
|
||||||
for (int i = SkipBits; i < SkipBits + bits; i++)
|
for (int i = SkipBits; i < SkipBits + bits; i++)
|
||||||
|
|
|
@ -90,11 +90,11 @@ namespace BDInfo
|
||||||
|
|
||||||
public bool IsCompatible(TSStreamClip clip)
|
public bool IsCompatible(TSStreamClip clip)
|
||||||
{
|
{
|
||||||
foreach (TSStream stream1 in StreamFile.Streams.Values)
|
foreach (var stream1 in StreamFile.Streams.Values)
|
||||||
{
|
{
|
||||||
if (clip.StreamFile.Streams.ContainsKey(stream1.PID))
|
if (clip.StreamFile.Streams.ContainsKey(stream1.PID))
|
||||||
{
|
{
|
||||||
TSStream stream2 = clip.StreamFile.Streams[stream1.PID];
|
var stream2 = clip.StreamFile.Streams[stream1.PID];
|
||||||
if (stream1.StreamType != stream2.StreamType)
|
if (stream1.StreamType != stream2.StreamType)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace BDInfo
|
||||||
|
|
||||||
streamOffset += 2;
|
streamOffset += 2;
|
||||||
|
|
||||||
TSStreamType streamType = (TSStreamType)
|
var streamType = (TSStreamType)
|
||||||
clipData[streamOffset + 1];
|
clipData[streamOffset + 1];
|
||||||
switch (streamType)
|
switch (streamType)
|
||||||
{
|
{
|
||||||
|
@ -127,11 +127,11 @@ namespace BDInfo
|
||||||
case TSStreamType.MPEG2_VIDEO:
|
case TSStreamType.MPEG2_VIDEO:
|
||||||
case TSStreamType.VC1_VIDEO:
|
case TSStreamType.VC1_VIDEO:
|
||||||
{
|
{
|
||||||
TSVideoFormat videoFormat = (TSVideoFormat)
|
var videoFormat = (TSVideoFormat)
|
||||||
(clipData[streamOffset + 2] >> 4);
|
(clipData[streamOffset + 2] >> 4);
|
||||||
TSFrameRate frameRate = (TSFrameRate)
|
var frameRate = (TSFrameRate)
|
||||||
(clipData[streamOffset + 2] & 0xF);
|
(clipData[streamOffset + 2] & 0xF);
|
||||||
TSAspectRatio aspectRatio = (TSAspectRatio)
|
var aspectRatio = (TSAspectRatio)
|
||||||
(clipData[streamOffset + 3] >> 4);
|
(clipData[streamOffset + 3] >> 4);
|
||||||
|
|
||||||
stream = new TSVideoStream();
|
stream = new TSVideoStream();
|
||||||
|
@ -168,9 +168,9 @@ namespace BDInfo
|
||||||
string languageCode =
|
string languageCode =
|
||||||
_textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
|
_textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
|
||||||
|
|
||||||
TSChannelLayout channelLayout = (TSChannelLayout)
|
var channelLayout = (TSChannelLayout)
|
||||||
(clipData[streamOffset + 2] >> 4);
|
(clipData[streamOffset + 2] >> 4);
|
||||||
TSSampleRate sampleRate = (TSSampleRate)
|
var sampleRate = (TSSampleRate)
|
||||||
(clipData[streamOffset + 2] & 0xF);
|
(clipData[streamOffset + 2] & 0xF);
|
||||||
|
|
||||||
stream = new TSAudioStream();
|
stream = new TSAudioStream();
|
||||||
|
|
|
@ -283,7 +283,7 @@ namespace BDInfo
|
||||||
|
|
||||||
bool isAVC = false;
|
bool isAVC = false;
|
||||||
bool isMVC = false;
|
bool isMVC = false;
|
||||||
foreach (TSStream finishedStream in Streams.Values)
|
foreach (var finishedStream in Streams.Values)
|
||||||
{
|
{
|
||||||
if (!finishedStream.IsInitialized)
|
if (!finishedStream.IsInitialized)
|
||||||
{
|
{
|
||||||
|
@ -327,10 +327,10 @@ namespace BDInfo
|
||||||
UpdateStreamBitrate(PID, PTSPID, PTS, PTSDiff);
|
UpdateStreamBitrate(PID, PTSPID, PTS, PTSDiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (TSPlaylistFile playlist in Playlists)
|
foreach (var playlist in Playlists)
|
||||||
{
|
{
|
||||||
double packetSeconds = 0;
|
double packetSeconds = 0;
|
||||||
foreach (TSStreamClip clip in playlist.StreamClips)
|
foreach (var clip in playlist.StreamClips)
|
||||||
{
|
{
|
||||||
if (clip.AngleIndex == 0)
|
if (clip.AngleIndex == 0)
|
||||||
{
|
{
|
||||||
|
@ -339,7 +339,7 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
if (packetSeconds > 0)
|
if (packetSeconds > 0)
|
||||||
{
|
{
|
||||||
foreach (TSStream playlistStream in playlist.SortedStreams)
|
foreach (var playlistStream in playlist.SortedStreams)
|
||||||
{
|
{
|
||||||
if (playlistStream.IsVBR)
|
if (playlistStream.IsVBR)
|
||||||
{
|
{
|
||||||
|
@ -366,14 +366,14 @@ namespace BDInfo
|
||||||
{
|
{
|
||||||
if (Playlists == null) return;
|
if (Playlists == null) return;
|
||||||
|
|
||||||
TSStreamState streamState = StreamStates[PID];
|
var streamState = StreamStates[PID];
|
||||||
double streamTime = (double)PTS / 90000;
|
double streamTime = (double)PTS / 90000;
|
||||||
double streamInterval = (double)PTSDiff / 90000;
|
double streamInterval = (double)PTSDiff / 90000;
|
||||||
double streamOffset = streamTime + streamInterval;
|
double streamOffset = streamTime + streamInterval;
|
||||||
|
|
||||||
foreach (TSPlaylistFile playlist in Playlists)
|
foreach (var playlist in Playlists)
|
||||||
{
|
{
|
||||||
foreach (TSStreamClip clip in playlist.StreamClips)
|
foreach (var clip in playlist.StreamClips)
|
||||||
{
|
{
|
||||||
if (clip.Name != this.Name) continue;
|
if (clip.Name != this.Name) continue;
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ namespace BDInfo
|
||||||
clip.PacketSeconds = streamOffset - clip.TimeIn;
|
clip.PacketSeconds = streamOffset - clip.TimeIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<ushort, TSStream> playlistStreams = playlist.Streams;
|
var playlistStreams = playlist.Streams;
|
||||||
if (clip.AngleIndex > 0 &&
|
if (clip.AngleIndex > 0 &&
|
||||||
clip.AngleIndex < playlist.AngleStreams.Count + 1)
|
clip.AngleIndex < playlist.AngleStreams.Count + 1)
|
||||||
{
|
{
|
||||||
|
@ -398,7 +398,7 @@ namespace BDInfo
|
||||||
}
|
}
|
||||||
if (playlistStreams.ContainsKey(PID))
|
if (playlistStreams.ContainsKey(PID))
|
||||||
{
|
{
|
||||||
TSStream stream = playlistStreams[PID];
|
var stream = playlistStreams[PID];
|
||||||
|
|
||||||
stream.PayloadBytes += streamState.WindowBytes;
|
stream.PayloadBytes += streamState.WindowBytes;
|
||||||
stream.PacketCount += streamState.WindowPackets;
|
stream.PacketCount += streamState.WindowPackets;
|
||||||
|
@ -425,13 +425,13 @@ namespace BDInfo
|
||||||
|
|
||||||
if (Streams.ContainsKey(PID))
|
if (Streams.ContainsKey(PID))
|
||||||
{
|
{
|
||||||
TSStream stream = Streams[PID];
|
var stream = Streams[PID];
|
||||||
stream.PayloadBytes += streamState.WindowBytes;
|
stream.PayloadBytes += streamState.WindowBytes;
|
||||||
stream.PacketCount += streamState.WindowPackets;
|
stream.PacketCount += streamState.WindowPackets;
|
||||||
|
|
||||||
if (stream.IsVideoStream)
|
if (stream.IsVideoStream)
|
||||||
{
|
{
|
||||||
TSStreamDiagnostics diag = new TSStreamDiagnostics();
|
var diag = new TSStreamDiagnostics();
|
||||||
diag.Marker = (double)PTS / 90000;
|
diag.Marker = (double)PTS / 90000;
|
||||||
diag.Interval = (double)PTSDiff / 90000;
|
diag.Interval = (double)PTSDiff / 90000;
|
||||||
diag.Bytes = streamState.WindowBytes;
|
diag.Bytes = streamState.WindowBytes;
|
||||||
|
@ -482,7 +482,7 @@ namespace BDInfo
|
||||||
StreamStates.Clear();
|
StreamStates.Clear();
|
||||||
StreamDiagnostics.Clear();
|
StreamDiagnostics.Clear();
|
||||||
|
|
||||||
TSPacketParser parser =
|
var parser =
|
||||||
new TSPacketParser();
|
new TSPacketParser();
|
||||||
|
|
||||||
long fileLength = (uint)fileStream.Length;
|
long fileLength = (uint)fileStream.Length;
|
||||||
|
@ -839,7 +839,7 @@ namespace BDInfo
|
||||||
|
|
||||||
if (!Streams.ContainsKey(streamPID))
|
if (!Streams.ContainsKey(streamPID))
|
||||||
{
|
{
|
||||||
List<TSDescriptor> streamDescriptors =
|
var streamDescriptors =
|
||||||
new List<TSDescriptor>();
|
new List<TSDescriptor>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -996,7 +996,7 @@ namespace BDInfo
|
||||||
{
|
{
|
||||||
--parser.PMTProgramDescriptorLength;
|
--parser.PMTProgramDescriptorLength;
|
||||||
|
|
||||||
TSDescriptor descriptor = parser.PMTProgramDescriptors[
|
var descriptor = parser.PMTProgramDescriptors[
|
||||||
parser.PMTProgramDescriptors.Count - 1];
|
parser.PMTProgramDescriptors.Count - 1];
|
||||||
|
|
||||||
int valueIndex =
|
int valueIndex =
|
||||||
|
@ -1026,8 +1026,8 @@ namespace BDInfo
|
||||||
parser.StreamState != null &&
|
parser.StreamState != null &&
|
||||||
parser.TransportScramblingControl == 0)
|
parser.TransportScramblingControl == 0)
|
||||||
{
|
{
|
||||||
TSStream stream = parser.Stream;
|
var stream = parser.Stream;
|
||||||
TSStreamState streamState = parser.StreamState;
|
var streamState = parser.StreamState;
|
||||||
|
|
||||||
streamState.Parse =
|
streamState.Parse =
|
||||||
(streamState.Parse << 8) + buffer[i];
|
(streamState.Parse << 8) + buffer[i];
|
||||||
|
@ -1461,7 +1461,7 @@ namespace BDInfo
|
||||||
|
|
||||||
ulong PTSLast = 0;
|
ulong PTSLast = 0;
|
||||||
ulong PTSDiff = 0;
|
ulong PTSDiff = 0;
|
||||||
foreach (TSStream stream in Streams.Values)
|
foreach (var stream in Streams.Values)
|
||||||
{
|
{
|
||||||
if (!stream.IsVideoStream) continue;
|
if (!stream.IsVideoStream) continue;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace DvdLib.Ifo
|
||||||
{
|
{
|
||||||
using (var vmgFs = _fileSystem.GetFileStream(vmgPath.FullName, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read))
|
using (var vmgFs = _fileSystem.GetFileStream(vmgPath.FullName, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read))
|
||||||
{
|
{
|
||||||
using (BigEndianBinaryReader vmgRead = new BigEndianBinaryReader(vmgFs))
|
using (var vmgRead = new BigEndianBinaryReader(vmgFs))
|
||||||
{
|
{
|
||||||
vmgFs.Seek(0x3E, SeekOrigin.Begin);
|
vmgFs.Seek(0x3E, SeekOrigin.Begin);
|
||||||
_titleSetCount = vmgRead.ReadUInt16();
|
_titleSetCount = vmgRead.ReadUInt16();
|
||||||
|
@ -71,7 +71,7 @@ namespace DvdLib.Ifo
|
||||||
read.BaseStream.Seek(6, SeekOrigin.Current);
|
read.BaseStream.Seek(6, SeekOrigin.Current);
|
||||||
for (uint titleNum = 1; titleNum <= _titleCount; titleNum++)
|
for (uint titleNum = 1; titleNum <= _titleCount; titleNum++)
|
||||||
{
|
{
|
||||||
Title t = new Title(titleNum);
|
var t = new Title(titleNum);
|
||||||
t.ParseTT_SRPT(read);
|
t.ParseTT_SRPT(read);
|
||||||
Titles.Add(t);
|
Titles.Add(t);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ namespace DvdLib.Ifo
|
||||||
|
|
||||||
using (var vtsFs = _fileSystem.GetFileStream(vtsPath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read))
|
using (var vtsFs = _fileSystem.GetFileStream(vtsPath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read))
|
||||||
{
|
{
|
||||||
using (BigEndianBinaryReader vtsRead = new BigEndianBinaryReader(vtsFs))
|
using (var vtsRead = new BigEndianBinaryReader(vtsFs))
|
||||||
{
|
{
|
||||||
// Read VTS_PTT_SRPT
|
// Read VTS_PTT_SRPT
|
||||||
vtsFs.Seek(0xC8, SeekOrigin.Begin);
|
vtsFs.Seek(0xC8, SeekOrigin.Begin);
|
||||||
|
@ -119,7 +119,7 @@ namespace DvdLib.Ifo
|
||||||
{
|
{
|
||||||
uint chapNum = 1;
|
uint chapNum = 1;
|
||||||
vtsFs.Seek(baseAddr + offsets[titleNum], SeekOrigin.Begin);
|
vtsFs.Seek(baseAddr + offsets[titleNum], SeekOrigin.Begin);
|
||||||
Title t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum + 1));
|
var t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum + 1));
|
||||||
if (t == null) continue;
|
if (t == null) continue;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -149,7 +149,7 @@ namespace DvdLib.Ifo
|
||||||
vtsFs.Seek(3, SeekOrigin.Current);
|
vtsFs.Seek(3, SeekOrigin.Current);
|
||||||
uint vtsPgcOffset = vtsRead.ReadUInt32();
|
uint vtsPgcOffset = vtsRead.ReadUInt32();
|
||||||
|
|
||||||
Title t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum));
|
var t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum));
|
||||||
if (t != null) t.AddPgc(vtsRead, startByte + vtsPgcOffset, entryPgc, pgcNum);
|
if (t != null) t.AddPgc(vtsRead, startByte + vtsPgcOffset, entryPgc, pgcNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace DvdLib.Ifo
|
||||||
br.BaseStream.Seek(startPos + _cellPositionOffset, SeekOrigin.Begin);
|
br.BaseStream.Seek(startPos + _cellPositionOffset, SeekOrigin.Begin);
|
||||||
for (int cellNum = 0; cellNum < _cellCount; cellNum++)
|
for (int cellNum = 0; cellNum < _cellCount; cellNum++)
|
||||||
{
|
{
|
||||||
Cell c = new Cell();
|
var c = new Cell();
|
||||||
c.ParsePosition(br);
|
c.ParsePosition(br);
|
||||||
Cells.Add(c);
|
Cells.Add(c);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ namespace DvdLib.Ifo
|
||||||
}
|
}
|
||||||
|
|
||||||
br.BaseStream.Seek(startPos + _programMapOffset, SeekOrigin.Begin);
|
br.BaseStream.Seek(startPos + _programMapOffset, SeekOrigin.Begin);
|
||||||
List<int> cellNumbers = new List<int>();
|
var cellNumbers = new List<int>();
|
||||||
for (int progNum = 0; progNum < _programCount; progNum++) cellNumbers.Add(br.ReadByte() - 1);
|
for (int progNum = 0; progNum < _programCount; progNum++) cellNumbers.Add(br.ReadByte() - 1);
|
||||||
|
|
||||||
for (int i = 0; i < cellNumbers.Count; i++)
|
for (int i = 0; i < cellNumbers.Count; i++)
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace DvdLib.Ifo
|
||||||
long curPos = br.BaseStream.Position;
|
long curPos = br.BaseStream.Position;
|
||||||
br.BaseStream.Seek(startByte, SeekOrigin.Begin);
|
br.BaseStream.Seek(startByte, SeekOrigin.Begin);
|
||||||
|
|
||||||
ProgramChain pgc = new ProgramChain(pgcNum);
|
var pgc = new ProgramChain(pgcNum);
|
||||||
pgc.ParseHeader(br);
|
pgc.ParseHeader(br);
|
||||||
ProgramChains.Add(pgc);
|
ProgramChains.Add(pgc);
|
||||||
if (entryPgc) EntryProgramChain = pgc;
|
if (entryPgc) EntryProgramChain = pgc;
|
||||||
|
|
|
@ -241,7 +241,7 @@ namespace Emby.Dlna.Api
|
||||||
var cacheLength = TimeSpan.FromDays(365);
|
var cacheLength = TimeSpan.FromDays(365);
|
||||||
var cacheKey = Request.RawUrl.GetMD5();
|
var cacheKey = Request.RawUrl.GetMD5();
|
||||||
|
|
||||||
return _resultFactory.GetStaticResult(Request, cacheKey, null, cacheLength, contentType, () => Task.FromResult<Stream>(_dlnaManager.GetIcon(request.Filename).Stream));
|
return _resultFactory.GetStaticResult(Request, cacheKey, null, cacheLength, contentType, () => Task.FromResult(_dlnaManager.GetIcon(request.Filename).Stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Subscribe(ProcessContentDirectoryEventRequest request)
|
public object Subscribe(ProcessContentDirectoryEventRequest request)
|
||||||
|
|
|
@ -242,7 +242,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
|
|
||||||
var dlnaOptions = _config.GetDlnaConfiguration();
|
var dlnaOptions = _config.GetDlnaConfiguration();
|
||||||
|
|
||||||
using (XmlWriter writer = XmlWriter.Create(builder, settings))
|
using (var writer = XmlWriter.Create(builder, settings))
|
||||||
{
|
{
|
||||||
//writer.WriteStartDocument();
|
//writer.WriteStartDocument();
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
int provided = 0;
|
int provided = 0;
|
||||||
|
|
||||||
using (XmlWriter writer = XmlWriter.Create(builder, settings))
|
using (var writer = XmlWriter.Create(builder, settings))
|
||||||
{
|
{
|
||||||
//writer.WriteStartDocument();
|
//writer.WriteStartDocument();
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace Emby.Dlna.Didl
|
||||||
|
|
||||||
using (StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8))
|
using (StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8))
|
||||||
{
|
{
|
||||||
using (XmlWriter writer = XmlWriter.Create(builder, settings))
|
using (var writer = XmlWriter.Create(builder, settings))
|
||||||
{
|
{
|
||||||
//writer.WriteStartDocument();
|
//writer.WriteStartDocument();
|
||||||
|
|
||||||
|
|
|
@ -854,7 +854,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
if (index == -1) return request;
|
if (index == -1) return request;
|
||||||
|
|
||||||
var query = url.Substring(index + 1);
|
var query = url.Substring(index + 1);
|
||||||
QueryParamCollection values = MyHttpUtility.ParseQueryString(query);
|
var values = MyHttpUtility.ParseQueryString(query);
|
||||||
|
|
||||||
request.DeviceProfileId = values.Get("DeviceProfileId");
|
request.DeviceProfileId = values.Get("DeviceProfileId");
|
||||||
request.DeviceId = values.Get("DeviceId");
|
request.DeviceId = values.Get("DeviceId");
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace Emby.Dlna.Service
|
||||||
|
|
||||||
StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8);
|
StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8);
|
||||||
|
|
||||||
using (XmlWriter writer = XmlWriter.Create(builder, settings))
|
using (var writer = XmlWriter.Create(builder, settings))
|
||||||
{
|
{
|
||||||
writer.WriteStartDocument(true);
|
writer.WriteStartDocument(true);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Emby.Dlna.Service
|
||||||
|
|
||||||
StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8);
|
StringWriter builder = new StringWriterWithEncoding(Encoding.UTF8);
|
||||||
|
|
||||||
using (XmlWriter writer = XmlWriter.Create(builder, settings))
|
using (var writer = XmlWriter.Create(builder, settings))
|
||||||
{
|
{
|
||||||
writer.WriteStartDocument(true);
|
writer.WriteStartDocument(true);
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ namespace Emby.Drawing.Skia
|
||||||
|
|
||||||
private SKBitmap GetNextValidImage(string[] paths, int currentIndex, out int newIndex)
|
private SKBitmap GetNextValidImage(string[] paths, int currentIndex, out int newIndex)
|
||||||
{
|
{
|
||||||
Dictionary<int, int> imagesTested = new Dictionary<int, int>();
|
var imagesTested = new Dictionary<int, int>();
|
||||||
SKBitmap bitmap = null;
|
SKBitmap bitmap = null;
|
||||||
|
|
||||||
while (imagesTested.Count < paths.Length)
|
while (imagesTested.Count < paths.Length)
|
||||||
|
@ -174,7 +174,7 @@ namespace Emby.Drawing.Skia
|
||||||
currentIndex = 0;
|
currentIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bitmap = SkiaEncoder.Decode(paths[currentIndex], false, _fileSystem, null, out SKEncodedOrigin origin);
|
bitmap = SkiaEncoder.Decode(paths[currentIndex], false, _fileSystem, null, out var origin);
|
||||||
|
|
||||||
imagesTested[currentIndex] = 0;
|
imagesTested[currentIndex] = 0;
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace Emby.Drawing.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="binaryReader">The binary reader.</param>
|
/// <param name="binaryReader">The binary reader.</param>
|
||||||
/// <returns>Size.</returns>
|
/// <returns>Size.</returns>
|
||||||
/// <exception cref="System.ArgumentException">binaryReader</exception>
|
/// <exception cref="ArgumentException">binaryReader</exception>
|
||||||
/// <exception cref="ArgumentException">The image was of an unrecognized format.</exception>
|
/// <exception cref="ArgumentException">The image was of an unrecognized format.</exception>
|
||||||
private static ImageSize GetDimensions(BinaryReader binaryReader)
|
private static ImageSize GetDimensions(BinaryReader binaryReader)
|
||||||
{
|
{
|
||||||
|
@ -200,7 +200,7 @@ namespace Emby.Drawing.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="binaryReader">The binary reader.</param>
|
/// <param name="binaryReader">The binary reader.</param>
|
||||||
/// <returns>Size.</returns>
|
/// <returns>Size.</returns>
|
||||||
/// <exception cref="System.ArgumentException"></exception>
|
/// <exception cref="ArgumentException"></exception>
|
||||||
private static ImageSize DecodeJfif(BinaryReader binaryReader)
|
private static ImageSize DecodeJfif(BinaryReader binaryReader)
|
||||||
{
|
{
|
||||||
// A JPEG image consists of a sequence of segments,
|
// A JPEG image consists of a sequence of segments,
|
||||||
|
|
|
@ -491,7 +491,7 @@ namespace Emby.Drawing
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <param name="image">The image.</param>
|
/// <param name="image">The image.</param>
|
||||||
/// <returns>Guid.</returns>
|
/// <returns>Guid.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="ArgumentNullException">item</exception>
|
||||||
public string GetImageCacheTag(BaseItem item, ItemImageInfo image)
|
public string GetImageCacheTag(BaseItem item, ItemImageInfo image)
|
||||||
{
|
{
|
||||||
var supportedEnhancers = GetSupportedEnhancers(item, image.Type);
|
var supportedEnhancers = GetSupportedEnhancers(item, image.Type);
|
||||||
|
@ -523,7 +523,7 @@ namespace Emby.Drawing
|
||||||
/// <param name="image">The image.</param>
|
/// <param name="image">The image.</param>
|
||||||
/// <param name="imageEnhancers">The image enhancers.</param>
|
/// <param name="imageEnhancers">The image enhancers.</param>
|
||||||
/// <returns>Guid.</returns>
|
/// <returns>Guid.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="ArgumentNullException">item</exception>
|
||||||
public string GetImageCacheTag(BaseItem item, ItemImageInfo image, IImageEnhancer[] imageEnhancers)
|
public string GetImageCacheTag(BaseItem item, ItemImageInfo image, IImageEnhancer[] imageEnhancers)
|
||||||
{
|
{
|
||||||
var originalImagePath = image.Path;
|
var originalImagePath = image.Path;
|
||||||
|
@ -744,7 +744,7 @@ namespace Emby.Drawing
|
||||||
/// <param name="uniqueName">Name of the unique.</param>
|
/// <param name="uniqueName">Name of the unique.</param>
|
||||||
/// <param name="fileExtension">The file extension.</param>
|
/// <param name="fileExtension">The file extension.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">
|
/// <exception cref="ArgumentNullException">
|
||||||
/// path
|
/// path
|
||||||
/// or
|
/// or
|
||||||
/// uniqueName
|
/// uniqueName
|
||||||
|
@ -778,7 +778,7 @@ namespace Emby.Drawing
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <param name="filename">The filename.</param>
|
/// <param name="filename">The filename.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">
|
/// <exception cref="ArgumentNullException">
|
||||||
/// path
|
/// path
|
||||||
/// or
|
/// or
|
||||||
/// filename
|
/// filename
|
||||||
|
|
|
@ -141,7 +141,7 @@ namespace IsoMounter
|
||||||
|
|
||||||
public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken)
|
public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (MountISO(isoPath, out LinuxMount mountedISO))
|
if (MountISO(isoPath, out var mountedISO))
|
||||||
{
|
{
|
||||||
return Task.FromResult<IIsoMount>(mountedISO);
|
return Task.FromResult<IIsoMount>(mountedISO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Emby.Naming.AudioBook
|
||||||
|
|
||||||
public AudioBookFilePathParserResult Parse(string path, bool IsDirectory)
|
public AudioBookFilePathParserResult Parse(string path, bool IsDirectory)
|
||||||
{
|
{
|
||||||
AudioBookFilePathParserResult result = Parse(path);
|
var result = Parse(path);
|
||||||
return !result.Success ? new AudioBookFilePathParserResult() : result;
|
return !result.Success ? new AudioBookFilePathParserResult() : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ namespace Emby.Naming.TV
|
||||||
result.EpisodeNumber = num;
|
result.EpisodeNumber = num;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group endingNumberGroup = match.Groups["endingepnumber"];
|
var endingNumberGroup = match.Groups["endingepnumber"];
|
||||||
if (endingNumberGroup.Success)
|
if (endingNumberGroup.Success)
|
||||||
{
|
{
|
||||||
// Will only set EndingEpsiodeNumber if the captured number is not followed by additional numbers
|
// Will only set EndingEpsiodeNumber if the captured number is not followed by additional numbers
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace Emby.Naming.Video
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <param name="IsDirectory">if set to <c>true</c> [is folder].</param>
|
/// <param name="IsDirectory">if set to <c>true</c> [is folder].</param>
|
||||||
/// <returns>VideoFileInfo.</returns>
|
/// <returns>VideoFileInfo.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">path</exception>
|
/// <exception cref="ArgumentNullException">path</exception>
|
||||||
public VideoFileInfo Resolve(string path, bool IsDirectory, bool parseName = true)
|
public VideoFileInfo Resolve(string path, bool IsDirectory, bool parseName = true)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
|
|
|
@ -527,7 +527,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
const int DaysInMonth = 30;
|
const int DaysInMonth = 30;
|
||||||
|
|
||||||
// Get each non-zero value from TimeSpan component
|
// Get each non-zero value from TimeSpan component
|
||||||
List<string> values = new List<string>();
|
var values = new List<string>();
|
||||||
|
|
||||||
// Number of years
|
// Number of years
|
||||||
int days = span.Days;
|
int days = span.Days;
|
||||||
|
@ -558,7 +558,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
values.Add(CreateValueString(span.Seconds, "second"));
|
values.Add(CreateValueString(span.Seconds, "second"));
|
||||||
|
|
||||||
// Combine values into string
|
// Combine values into string
|
||||||
StringBuilder builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
for (int i = 0; i < values.Count; i++)
|
for (int i = 0; i < values.Count; i++)
|
||||||
{
|
{
|
||||||
if (builder.Length > 0)
|
if (builder.Length > 0)
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
/// Replaces the configuration.
|
/// Replaces the configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="newConfiguration">The new configuration.</param>
|
/// <param name="newConfiguration">The new configuration.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">newConfiguration</exception>
|
/// <exception cref="ArgumentNullException">newConfiguration</exception>
|
||||||
public virtual void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration)
|
public virtual void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration)
|
||||||
{
|
{
|
||||||
if (newConfiguration == null)
|
if (newConfiguration == null)
|
||||||
|
@ -188,7 +188,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
/// Replaces the cache path.
|
/// Replaces the cache path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="newConfig">The new configuration.</param>
|
/// <param name="newConfig">The new configuration.</param>
|
||||||
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
/// <exception cref="DirectoryNotFoundException"></exception>
|
||||||
private void ValidateCachePath(BaseApplicationConfiguration newConfig)
|
private void ValidateCachePath(BaseApplicationConfiguration newConfig)
|
||||||
{
|
{
|
||||||
var newPath = newConfig.CachePath;
|
var newPath = newConfig.CachePath;
|
||||||
|
|
|
@ -822,7 +822,7 @@ namespace Emby.Server.Implementations
|
||||||
RegisterSingleInstance(ServerConfigurationManager);
|
RegisterSingleInstance(ServerConfigurationManager);
|
||||||
|
|
||||||
IAssemblyInfo assemblyInfo = new AssemblyInfo();
|
IAssemblyInfo assemblyInfo = new AssemblyInfo();
|
||||||
RegisterSingleInstance<IAssemblyInfo>(assemblyInfo);
|
RegisterSingleInstance(assemblyInfo);
|
||||||
|
|
||||||
LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LoggerFactory.CreateLogger("LocalizationManager"), assemblyInfo, new TextLocalizer());
|
LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LoggerFactory.CreateLogger("LocalizationManager"), assemblyInfo, new TextLocalizer());
|
||||||
StringExtensions.LocalizationManager = LocalizationManager;
|
StringExtensions.LocalizationManager = LocalizationManager;
|
||||||
|
@ -920,7 +920,7 @@ namespace Emby.Server.Implementations
|
||||||
RegisterSingleInstance(CollectionManager);
|
RegisterSingleInstance(CollectionManager);
|
||||||
|
|
||||||
PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LoggerFactory.CreateLogger("PlaylistManager"), UserManager, ProviderManager);
|
PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LoggerFactory.CreateLogger("PlaylistManager"), UserManager, ProviderManager);
|
||||||
RegisterSingleInstance<IPlaylistManager>(PlaylistManager);
|
RegisterSingleInstance(PlaylistManager);
|
||||||
|
|
||||||
LiveTvManager = new LiveTvManager(this, HttpClient, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, SecurityManager, () => ChannelManager);
|
LiveTvManager = new LiveTvManager(this, HttpClient, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, SecurityManager, () => ChannelManager);
|
||||||
RegisterSingleInstance(LiveTvManager);
|
RegisterSingleInstance(LiveTvManager);
|
||||||
|
@ -938,7 +938,7 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
RegisterMediaEncoder(assemblyInfo);
|
RegisterMediaEncoder(assemblyInfo);
|
||||||
|
|
||||||
EncodingManager = new Emby.Server.Implementations.MediaEncoder.EncodingManager(FileSystemManager, Logger, MediaEncoder, ChapterManager, LibraryManager);
|
EncodingManager = new MediaEncoder.EncodingManager(FileSystemManager, Logger, MediaEncoder, ChapterManager, LibraryManager);
|
||||||
RegisterSingleInstance(EncodingManager);
|
RegisterSingleInstance(EncodingManager);
|
||||||
|
|
||||||
var activityLogRepo = GetActivityLogRepository();
|
var activityLogRepo = GetActivityLogRepository();
|
||||||
|
@ -950,7 +950,7 @@ namespace Emby.Server.Implementations
|
||||||
RegisterSingleInstance<ISessionContext>(new SessionContext(UserManager, authContext, SessionManager));
|
RegisterSingleInstance<ISessionContext>(new SessionContext(UserManager, authContext, SessionManager));
|
||||||
|
|
||||||
AuthService = new AuthService(UserManager, authContext, ServerConfigurationManager, SessionManager, NetworkManager);
|
AuthService = new AuthService(UserManager, authContext, ServerConfigurationManager, SessionManager, NetworkManager);
|
||||||
RegisterSingleInstance<IAuthService>(AuthService);
|
RegisterSingleInstance(AuthService);
|
||||||
|
|
||||||
SubtitleEncoder = new MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder(LibraryManager, LoggerFactory.CreateLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, ProcessFactory, TextEncoding);
|
SubtitleEncoder = new MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder(LibraryManager, LoggerFactory.CreateLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, ProcessFactory, TextEncoding);
|
||||||
RegisterSingleInstance(SubtitleEncoder);
|
RegisterSingleInstance(SubtitleEncoder);
|
||||||
|
@ -1023,7 +1023,7 @@ namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
var arr = str.ToCharArray();
|
var arr = str.ToCharArray();
|
||||||
|
|
||||||
arr = Array.FindAll<char>(arr, (c => (char.IsLetterOrDigit(c)
|
arr = Array.FindAll(arr, (c => (char.IsLetterOrDigit(c)
|
||||||
|| char.IsWhiteSpace(c))));
|
|| char.IsWhiteSpace(c))));
|
||||||
|
|
||||||
var result = new string(arr);
|
var result = new string(arr);
|
||||||
|
@ -1057,7 +1057,7 @@ namespace Emby.Server.Implementations
|
||||||
// Don't use an empty string password
|
// Don't use an empty string password
|
||||||
var password = string.IsNullOrWhiteSpace(info.Password) ? null : info.Password;
|
var password = string.IsNullOrWhiteSpace(info.Password) ? null : info.Password;
|
||||||
|
|
||||||
X509Certificate2 localCert = new X509Certificate2(certificateLocation, password);
|
var localCert = new X509Certificate2(certificateLocation, password);
|
||||||
//localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
|
//localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
|
||||||
if (!localCert.HasPrivateKey)
|
if (!localCert.HasPrivateKey)
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace Emby.Server.Implementations.Configuration
|
||||||
/// Replaces the configuration.
|
/// Replaces the configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="newConfiguration">The new configuration.</param>
|
/// <param name="newConfiguration">The new configuration.</param>
|
||||||
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
/// <exception cref="DirectoryNotFoundException"></exception>
|
||||||
public override void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration)
|
public override void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration)
|
||||||
{
|
{
|
||||||
var newConfig = (ServerConfiguration)newConfiguration;
|
var newConfig = (ServerConfiguration)newConfiguration;
|
||||||
|
@ -137,7 +137,7 @@ namespace Emby.Server.Implementations.Configuration
|
||||||
/// Validates the SSL certificate.
|
/// Validates the SSL certificate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="newConfig">The new configuration.</param>
|
/// <param name="newConfig">The new configuration.</param>
|
||||||
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
/// <exception cref="DirectoryNotFoundException"></exception>
|
||||||
private void ValidateSslCertificate(BaseApplicationConfiguration newConfig)
|
private void ValidateSslCertificate(BaseApplicationConfiguration newConfig)
|
||||||
{
|
{
|
||||||
var serverConfig = (ServerConfiguration)newConfig;
|
var serverConfig = (ServerConfiguration)newConfig;
|
||||||
|
@ -159,7 +159,7 @@ namespace Emby.Server.Implementations.Configuration
|
||||||
/// Validates the metadata path.
|
/// Validates the metadata path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="newConfig">The new configuration.</param>
|
/// <param name="newConfig">The new configuration.</param>
|
||||||
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
/// <exception cref="DirectoryNotFoundException"></exception>
|
||||||
private void ValidateMetadataPath(ServerConfiguration newConfig)
|
private void ValidateMetadataPath(ServerConfiguration newConfig)
|
||||||
{
|
{
|
||||||
var newPath = newConfig.MetadataPath;
|
var newPath = newConfig.MetadataPath;
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
public T RunInTransaction<T>(Func<IDatabaseConnection, T> action, TransactionMode mode)
|
public T RunInTransaction<T>(Func<IDatabaseConnection, T> action, TransactionMode mode)
|
||||||
{
|
{
|
||||||
return db.RunInTransaction<T>(action, mode);
|
return db.RunInTransaction(action, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IReadOnlyList<IResultSetValue>> Query(string sql)
|
public IEnumerable<IReadOnlyList<IResultSetValue>> Query(string sql)
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// <param name="client">The client.</param>
|
/// <param name="client">The client.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="ArgumentNullException">item</exception>
|
||||||
public void SaveDisplayPreferences(DisplayPreferences displayPreferences, Guid userId, string client, CancellationToken cancellationToken)
|
public void SaveDisplayPreferences(DisplayPreferences displayPreferences, Guid userId, string client, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (displayPreferences == null)
|
if (displayPreferences == null)
|
||||||
|
@ -131,7 +131,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="ArgumentNullException">item</exception>
|
||||||
public void SaveAllDisplayPreferences(IEnumerable<DisplayPreferences> displayPreferences, Guid userId, CancellationToken cancellationToken)
|
public void SaveAllDisplayPreferences(IEnumerable<DisplayPreferences> displayPreferences, Guid userId, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (displayPreferences == null)
|
if (displayPreferences == null)
|
||||||
|
@ -163,7 +163,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <param name="client">The client.</param>
|
/// <param name="client">The client.</param>
|
||||||
/// <returns>Task{DisplayPreferences}.</returns>
|
/// <returns>Task{DisplayPreferences}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="ArgumentNullException">item</exception>
|
||||||
public DisplayPreferences GetDisplayPreferences(string displayPreferencesId, Guid userId, string client)
|
public DisplayPreferences GetDisplayPreferences(string displayPreferencesId, Guid userId, string client)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(displayPreferencesId))
|
if (string.IsNullOrEmpty(displayPreferencesId))
|
||||||
|
@ -202,7 +202,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <returns>Task{DisplayPreferences}.</returns>
|
/// <returns>Task{DisplayPreferences}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="ArgumentNullException">item</exception>
|
||||||
public IEnumerable<DisplayPreferences> GetAllDisplayPreferences(Guid userId)
|
public IEnumerable<DisplayPreferences> GetAllDisplayPreferences(Guid userId)
|
||||||
{
|
{
|
||||||
var list = new List<DisplayPreferences>();
|
var list = new List<DisplayPreferences>();
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// Serializes to bytes.
|
/// Serializes to bytes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>System.Byte[][].</returns>
|
/// <returns>System.Byte[][].</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">obj</exception>
|
/// <exception cref="ArgumentNullException">obj</exception>
|
||||||
public static byte[] SerializeToBytes(this IJsonSerializer json, object obj)
|
public static byte[] SerializeToBytes(this IJsonSerializer json, object obj)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
|
|
|
@ -531,7 +531,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="ArgumentNullException">item</exception>
|
||||||
public void SaveItem(BaseItem item, CancellationToken cancellationToken)
|
public void SaveItem(BaseItem item, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
|
@ -574,7 +574,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="items">The items.</param>
|
/// <param name="items">The items.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">
|
/// <exception cref="ArgumentNullException">
|
||||||
/// items
|
/// items
|
||||||
/// or
|
/// or
|
||||||
/// cancellationToken
|
/// cancellationToken
|
||||||
|
@ -1198,8 +1198,8 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The id.</param>
|
/// <param name="id">The id.</param>
|
||||||
/// <returns>BaseItem.</returns>
|
/// <returns>BaseItem.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">id</exception>
|
/// <exception cref="ArgumentNullException">id</exception>
|
||||||
/// <exception cref="System.ArgumentException"></exception>
|
/// <exception cref="ArgumentException"></exception>
|
||||||
public BaseItem RetrieveItem(Guid id)
|
public BaseItem RetrieveItem(Guid id)
|
||||||
{
|
{
|
||||||
if (id.Equals(Guid.Empty))
|
if (id.Equals(Guid.Empty))
|
||||||
|
@ -1945,7 +1945,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <returns>IEnumerable{ChapterInfo}.</returns>
|
/// <returns>IEnumerable{ChapterInfo}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">id</exception>
|
/// <exception cref="ArgumentNullException">id</exception>
|
||||||
public List<ChapterInfo> GetChapters(BaseItem item)
|
public List<ChapterInfo> GetChapters(BaseItem item)
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -1977,7 +1977,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <param name="index">The index.</param>
|
/// <param name="index">The index.</param>
|
||||||
/// <returns>ChapterInfo.</returns>
|
/// <returns>ChapterInfo.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">id</exception>
|
/// <exception cref="ArgumentNullException">id</exception>
|
||||||
public ChapterInfo GetChapter(BaseItem item, int index)
|
public ChapterInfo GetChapter(BaseItem item, int index)
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
|
|
@ -110,7 +110,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
private List<Guid> GetAllUserIdsWithUserData(IDatabaseConnection db)
|
private List<Guid> GetAllUserIdsWithUserData(IDatabaseConnection db)
|
||||||
{
|
{
|
||||||
List<Guid> list = new List<Guid>();
|
var list = new List<Guid>();
|
||||||
|
|
||||||
using (var statement = PrepareStatement(db, "select DISTINCT UserId from UserData where UserId not null"))
|
using (var statement = PrepareStatement(db, "select DISTINCT UserId from UserData where UserId not null"))
|
||||||
{
|
{
|
||||||
|
@ -271,7 +271,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// <param name="internalUserId">The user id.</param>
|
/// <param name="internalUserId">The user id.</param>
|
||||||
/// <param name="key">The key.</param>
|
/// <param name="key">The key.</param>
|
||||||
/// <returns>Task{UserItemData}.</returns>
|
/// <returns>Task{UserItemData}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">
|
/// <exception cref="ArgumentNullException">
|
||||||
/// userId
|
/// userId
|
||||||
/// or
|
/// or
|
||||||
/// key
|
/// key
|
||||||
|
|
|
@ -200,7 +200,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
/// <exception cref="ArgumentNullException">user</exception>
|
||||||
public void DeleteUser(User user)
|
public void DeleteUser(User user)
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user == null)
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="typeName">Name of the type.</param>
|
/// <param name="typeName">Name of the type.</param>
|
||||||
/// <returns>Type.</returns>
|
/// <returns>Type.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
public Type GetType(string typeName)
|
public Type GetType(string typeName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(typeName))
|
if (string.IsNullOrEmpty(typeName))
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <param name="owner">The owner.</param>
|
/// <param name="owner">The owner.</param>
|
||||||
/// <returns>Task{DtoBaseItem}.</returns>
|
/// <returns>Task{DtoBaseItem}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="ArgumentNullException">item</exception>
|
||||||
public BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null)
|
public BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null)
|
||||||
{
|
{
|
||||||
var options = new DtoOptions
|
var options = new DtoOptions
|
||||||
|
@ -463,7 +463,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="ArgumentNullException">item</exception>
|
||||||
public string GetDtoId(BaseItem item)
|
public string GetDtoId(BaseItem item)
|
||||||
{
|
{
|
||||||
return item.Id.ToString("N");
|
return item.Id.ToString("N");
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _sessionManager.SendMessageToUserSessions<TimerEventInfo>(users, name, info, CancellationToken.None);
|
await _sessionManager.SendMessageToUserSessions(users, name, info, CancellationToken.None);
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException)
|
catch (ObjectDisposedException)
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
/// <param name="host">The host.</param>
|
/// <param name="host">The host.</param>
|
||||||
/// <param name="enableHttpCompression">if set to <c>true</c> [enable HTTP compression].</param>
|
/// <param name="enableHttpCompression">if set to <c>true</c> [enable HTTP compression].</param>
|
||||||
/// <returns>HttpClient.</returns>
|
/// <returns>HttpClient.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">host</exception>
|
/// <exception cref="ArgumentNullException">host</exception>
|
||||||
private HttpClientInfo GetHttpClient(string host, bool enableHttpCompression)
|
private HttpClientInfo GetHttpClient(string host, bool enableHttpCompression)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(host))
|
if (string.IsNullOrEmpty(host))
|
||||||
|
@ -125,7 +125,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
{
|
{
|
||||||
string url = options.Url;
|
string url = options.Url;
|
||||||
|
|
||||||
Uri uriAddress = new Uri(url);
|
var uriAddress = new Uri(url);
|
||||||
string userInfo = uriAddress.UserInfo;
|
string userInfo = uriAddress.UserInfo;
|
||||||
if (!string.IsNullOrWhiteSpace(userInfo))
|
if (!string.IsNullOrWhiteSpace(userInfo))
|
||||||
{
|
{
|
||||||
|
@ -133,7 +133,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
url = url.Replace(userInfo + "@", string.Empty);
|
url = url.Replace(userInfo + "@", string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRequest request = CreateWebRequest(url);
|
var request = CreateWebRequest(url);
|
||||||
|
|
||||||
if (request is HttpWebRequest httpWebRequest)
|
if (request is HttpWebRequest httpWebRequest)
|
||||||
{
|
{
|
||||||
|
@ -188,7 +188,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
private static CredentialCache GetCredential(string url, string username, string password)
|
private static CredentialCache GetCredential(string url, string username, string password)
|
||||||
{
|
{
|
||||||
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
|
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
|
||||||
CredentialCache credentialCache = new CredentialCache();
|
var credentialCache = new CredentialCache();
|
||||||
credentialCache.Add(new Uri(url), "Basic", new NetworkCredential(username, password));
|
credentialCache.Add(new Uri(url), "Basic", new NetworkCredential(username, password));
|
||||||
return credentialCache;
|
return credentialCache;
|
||||||
}
|
}
|
||||||
|
@ -807,7 +807,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
{
|
{
|
||||||
var taskCompletion = new TaskCompletionSource<WebResponse>();
|
var taskCompletion = new TaskCompletionSource<WebResponse>();
|
||||||
|
|
||||||
Task<WebResponse> asyncTask = Task.Factory.FromAsync<WebResponse>(request.BeginGetResponse, request.EndGetResponse, null);
|
var asyncTask = Task.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, null);
|
||||||
|
|
||||||
ThreadPool.RegisterWaitForSingleObject((asyncTask as IAsyncResult).AsyncWaitHandle, TimeoutCallback, request, timeout, true);
|
ThreadPool.RegisterWaitForSingleObject((asyncTask as IAsyncResult).AsyncWaitHandle, TimeoutCallback, request, timeout, true);
|
||||||
var callback = new TaskCallback { taskCompletion = taskCompletion };
|
var callback = new TaskCallback { taskCompletion = taskCompletion };
|
||||||
|
@ -823,7 +823,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
{
|
{
|
||||||
if (timedOut && state != null)
|
if (timedOut && state != null)
|
||||||
{
|
{
|
||||||
WebRequest request = (WebRequest)state;
|
var request = (WebRequest)state;
|
||||||
request.Abort();
|
request.Abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
/// <param name="remoteEndPoint">The remote end point.</param>
|
/// <param name="remoteEndPoint">The remote end point.</param>
|
||||||
/// <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.ArgumentNullException">socket</exception>
|
/// <exception cref="ArgumentNullException">socket</exception>
|
||||||
public WebSocketConnection(IWebSocket socket, string remoteEndPoint, IJsonSerializer jsonSerializer, ILogger logger, ITextEncoding textEncoding)
|
public WebSocketConnection(IWebSocket socket, string remoteEndPoint, IJsonSerializer jsonSerializer, ILogger logger, ITextEncoding textEncoding)
|
||||||
{
|
{
|
||||||
if (socket == null)
|
if (socket == null)
|
||||||
|
@ -215,7 +215,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
/// <param name="message">The message.</param>
|
/// <param name="message">The message.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">message</exception>
|
/// <exception cref="ArgumentNullException">message</exception>
|
||||||
public Task SendAsync<T>(WebSocketMessage<T> message, CancellationToken cancellationToken)
|
public Task SendAsync<T>(WebSocketMessage<T> message, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (message == null)
|
if (message == null)
|
||||||
|
|
|
@ -23,8 +23,8 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// <param name="isoPath">The iso path.</param>
|
/// <param name="isoPath">The iso path.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>IsoMount.</returns>
|
/// <returns>IsoMount.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">isoPath</exception>
|
/// <exception cref="ArgumentNullException">isoPath</exception>
|
||||||
/// <exception cref="System.ArgumentException"></exception>
|
/// <exception cref="ArgumentException"></exception>
|
||||||
public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken)
|
public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(isoPath))
|
if (string.IsNullOrEmpty(isoPath))
|
||||||
|
|
|
@ -263,7 +263,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// <param name="lst">The LST.</param>
|
/// <param name="lst">The LST.</param>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <returns><c>true</c> if [contains parent folder] [the specified LST]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [contains parent folder] [the specified LST]; otherwise, <c>false</c>.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">path</exception>
|
/// <exception cref="ArgumentNullException">path</exception>
|
||||||
private static bool ContainsParentFolder(IEnumerable<string> lst, string path)
|
private static bool ContainsParentFolder(IEnumerable<string> lst, string path)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
|
|
|
@ -101,7 +101,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename">The filename.</param>
|
/// <param name="filename">The filename.</param>
|
||||||
/// <returns><c>true</c> if the specified filename is shortcut; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if the specified filename is shortcut; otherwise, <c>false</c>.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">filename</exception>
|
/// <exception cref="ArgumentNullException">filename</exception>
|
||||||
public virtual bool IsShortcut(string filename)
|
public virtual bool IsShortcut(string filename)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(filename))
|
if (string.IsNullOrEmpty(filename))
|
||||||
|
@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename">The filename.</param>
|
/// <param name="filename">The filename.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">filename</exception>
|
/// <exception cref="ArgumentNullException">filename</exception>
|
||||||
public virtual string ResolveShortcut(string filename)
|
public virtual string ResolveShortcut(string filename)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(filename))
|
if (string.IsNullOrEmpty(filename))
|
||||||
|
@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="shortcutPath">The shortcut path.</param>
|
/// <param name="shortcutPath">The shortcut path.</param>
|
||||||
/// <param name="target">The target.</param>
|
/// <param name="target">The target.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">
|
/// <exception cref="ArgumentNullException">
|
||||||
/// shortcutPath
|
/// shortcutPath
|
||||||
/// or
|
/// or
|
||||||
/// target
|
/// target
|
||||||
|
@ -344,7 +344,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename">The filename.</param>
|
/// <param name="filename">The filename.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">filename</exception>
|
/// <exception cref="ArgumentNullException">filename</exception>
|
||||||
public string GetValidFilename(string filename)
|
public string GetValidFilename(string filename)
|
||||||
{
|
{
|
||||||
var builder = new StringBuilder(filename);
|
var builder = new StringBuilder(filename);
|
||||||
|
@ -526,7 +526,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FileAttributes attributes = File.GetAttributes(path);
|
var attributes = File.GetAttributes(path);
|
||||||
attributes = RemoveAttribute(attributes, FileAttributes.Hidden);
|
attributes = RemoveAttribute(attributes, FileAttributes.Hidden);
|
||||||
File.SetAttributes(path, attributes);
|
File.SetAttributes(path, attributes);
|
||||||
}
|
}
|
||||||
|
@ -550,7 +550,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FileAttributes attributes = File.GetAttributes(path);
|
var attributes = File.GetAttributes(path);
|
||||||
attributes = RemoveAttribute(attributes, FileAttributes.ReadOnly);
|
attributes = RemoveAttribute(attributes, FileAttributes.ReadOnly);
|
||||||
File.SetAttributes(path, attributes);
|
File.SetAttributes(path, attributes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -711,7 +711,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// Creates the root media folder
|
/// Creates the root media folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>AggregateFolder.</returns>
|
/// <returns>AggregateFolder.</returns>
|
||||||
/// <exception cref="System.InvalidOperationException">Cannot create the root folder until plugins have loaded</exception>
|
/// <exception cref="InvalidOperationException">Cannot create the root folder until plugins have loaded</exception>
|
||||||
public AggregateFolder CreateRootFolder()
|
public AggregateFolder CreateRootFolder()
|
||||||
{
|
{
|
||||||
var rootFolderPath = ConfigurationManager.ApplicationPaths.RootFolderPath;
|
var rootFolderPath = ConfigurationManager.ApplicationPaths.RootFolderPath;
|
||||||
|
@ -905,7 +905,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
/// <returns>Task{Year}.</returns>
|
/// <returns>Task{Year}.</returns>
|
||||||
/// <exception cref="System.ArgumentOutOfRangeException"></exception>
|
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||||
public Year GetYear(int value)
|
public Year GetYear(int value)
|
||||||
{
|
{
|
||||||
if (value <= 0)
|
if (value <= 0)
|
||||||
|
@ -1233,7 +1233,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The id.</param>
|
/// <param name="id">The id.</param>
|
||||||
/// <returns>BaseItem.</returns>
|
/// <returns>BaseItem.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">id</exception>
|
/// <exception cref="ArgumentNullException">id</exception>
|
||||||
public BaseItem GetItemById(Guid id)
|
public BaseItem GetItemById(Guid id)
|
||||||
{
|
{
|
||||||
if (id.Equals(Guid.Empty))
|
if (id.Equals(Guid.Empty))
|
||||||
|
@ -2075,7 +2075,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
public string GetConfiguredContentType(BaseItem item, bool inheritConfiguredPath)
|
public string GetConfiguredContentType(BaseItem item, bool inheritConfiguredPath)
|
||||||
{
|
{
|
||||||
ICollectionFolder collectionFolder = item as ICollectionFolder;
|
var collectionFolder = item as ICollectionFolder;
|
||||||
if (collectionFolder != null)
|
if (collectionFolder != null)
|
||||||
{
|
{
|
||||||
return collectionFolder.CollectionType;
|
return collectionFolder.CollectionType;
|
||||||
|
@ -2417,11 +2417,11 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
var episodeInfo = episode.IsFileProtocol ?
|
var episodeInfo = episode.IsFileProtocol ?
|
||||||
resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming) :
|
resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming) :
|
||||||
new Emby.Naming.TV.EpisodeInfo();
|
new Naming.TV.EpisodeInfo();
|
||||||
|
|
||||||
if (episodeInfo == null)
|
if (episodeInfo == null)
|
||||||
{
|
{
|
||||||
episodeInfo = new Emby.Naming.TV.EpisodeInfo();
|
episodeInfo = new Naming.TV.EpisodeInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
var changed = false;
|
var changed = false;
|
||||||
|
|
|
@ -127,7 +127,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
if (allowMediaProbe && mediaSources[0].Type != MediaSourceType.Placeholder && !mediaSources[0].MediaStreams.Any(i => i.Type == MediaStreamType.Audio || i.Type == MediaStreamType.Video))
|
if (allowMediaProbe && mediaSources[0].Type != MediaSourceType.Placeholder && !mediaSources[0].MediaStreams.Any(i => i.Type == MediaStreamType.Audio || i.Type == MediaStreamType.Video))
|
||||||
{
|
{
|
||||||
await item.RefreshMetadata(new MediaBrowser.Controller.Providers.MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
await item.RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
||||||
{
|
{
|
||||||
EnableRemoteContentProbe = true,
|
EnableRemoteContentProbe = true,
|
||||||
MetadataRefreshMode = MediaBrowser.Controller.Providers.MetadataRefreshMode.FullRefresh
|
MetadataRefreshMode = MediaBrowser.Controller.Providers.MetadataRefreshMode.FullRefresh
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// <param name="str">The STR.</param>
|
/// <param name="str">The STR.</param>
|
||||||
/// <param name="attrib">The attrib.</param>
|
/// <param name="attrib">The attrib.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">attrib</exception>
|
/// <exception cref="ArgumentNullException">attrib</exception>
|
||||||
public static string GetAttributeValue(this string str, string attrib)
|
public static string GetAttributeValue(this string str, string attrib)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(str))
|
if (string.IsNullOrEmpty(str))
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// <param name="fileSystem">The file system.</param>
|
/// <param name="fileSystem">The file system.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
/// <param name="directoryService">The directory service.</param>
|
/// <param name="directoryService">The directory service.</param>
|
||||||
/// <exception cref="System.ArgumentException">Item must have a path</exception>
|
/// <exception cref="ArgumentException">Item must have a path</exception>
|
||||||
public static void SetInitialItemValues(BaseItem item, Folder parent, IFileSystem fileSystem, ILibraryManager libraryManager, IDirectoryService directoryService)
|
public static void SetInitialItemValues(BaseItem item, Folder parent, IFileSystem fileSystem, ILibraryManager libraryManager, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
// This version of the below method has no ItemResolveArgs, so we have to require the path already being set
|
// This version of the below method has no ItemResolveArgs, so we have to require the path already being set
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
|
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
|
||||||
|
|
||||||
// If the path is a file check for a matching extensions
|
// If the path is a file check for a matching extensions
|
||||||
var parser = new Emby.Naming.Video.VideoResolver(namingOptions);
|
var parser = new VideoResolver(namingOptions);
|
||||||
|
|
||||||
if (args.IsDirectory)
|
if (args.IsDirectory)
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
|
|
||||||
if (!season.IndexNumber.HasValue || !seasonParserResult.IsSeasonFolder)
|
if (!season.IndexNumber.HasValue || !seasonParserResult.IsSeasonFolder)
|
||||||
{
|
{
|
||||||
var resolver = new Emby.Naming.TV.EpisodeResolver(namingOptions);
|
var resolver = new Naming.TV.EpisodeResolver(namingOptions);
|
||||||
|
|
||||||
var folderName = System.IO.Path.GetFileName(path);
|
var folderName = System.IO.Path.GetFileName(path);
|
||||||
var testPath = "\\\\test\\" + folderName;
|
var testPath = "\\\\test\\" + folderName;
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
|
|
||||||
var namingOptions = ((LibraryManager)libraryManager).GetNamingOptions();
|
var namingOptions = ((LibraryManager)libraryManager).GetNamingOptions();
|
||||||
|
|
||||||
var episodeResolver = new Emby.Naming.TV.EpisodeResolver(namingOptions);
|
var episodeResolver = new Naming.TV.EpisodeResolver(namingOptions);
|
||||||
bool? isNamed = null;
|
bool? isNamed = null;
|
||||||
bool? isOptimistic = null;
|
bool? isOptimistic = null;
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <returns><c>true</c> if [is place holder] [the specified path]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is place holder] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">path</exception>
|
/// <exception cref="ArgumentNullException">path</exception>
|
||||||
private static bool IsVideoPlaceHolder(string path)
|
private static bool IsVideoPlaceHolder(string path)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// <param name="query">The query.</param>
|
/// <param name="query">The query.</param>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <returns>IEnumerable{SearchHintResult}.</returns>
|
/// <returns>IEnumerable{SearchHintResult}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">searchTerm</exception>
|
/// <exception cref="ArgumentNullException">searchTerm</exception>
|
||||||
private List<SearchHintInfo> GetSearchHints(SearchQuery query, User user)
|
private List<SearchHintInfo> GetSearchHints(SearchQuery query, User user)
|
||||||
{
|
{
|
||||||
var searchTerm = query.SearchTerm;
|
var searchTerm = query.SearchTerm;
|
||||||
|
|
|
@ -193,7 +193,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data">The data.</param>
|
/// <param name="data">The data.</param>
|
||||||
/// <returns>DtoUserItemData.</returns>
|
/// <returns>DtoUserItemData.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
private UserItemDataDto GetUserItemDataDto(UserItemData data)
|
private UserItemDataDto GetUserItemDataDto(UserItemData data)
|
||||||
{
|
{
|
||||||
if (data == null)
|
if (data == null)
|
||||||
|
|
|
@ -158,7 +158,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The id.</param>
|
/// <param name="id">The id.</param>
|
||||||
/// <returns>User.</returns>
|
/// <returns>User.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
public User GetUserById(Guid id)
|
public User GetUserById(Guid id)
|
||||||
{
|
{
|
||||||
if (id.Equals(Guid.Empty))
|
if (id.Equals(Guid.Empty))
|
||||||
|
@ -619,8 +619,8 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <param name="newName">The new name.</param>
|
/// <param name="newName">The new name.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
/// <exception cref="ArgumentNullException">user</exception>
|
||||||
/// <exception cref="System.ArgumentException"></exception>
|
/// <exception cref="ArgumentException"></exception>
|
||||||
public async Task RenameUser(User user, string newName)
|
public async Task RenameUser(User user, string newName)
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user == null)
|
||||||
|
@ -652,8 +652,8 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// Updates the user.
|
/// Updates the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
/// <exception cref="ArgumentNullException">user</exception>
|
||||||
/// <exception cref="System.ArgumentException"></exception>
|
/// <exception cref="ArgumentException"></exception>
|
||||||
public void UpdateUser(User user)
|
public void UpdateUser(User user)
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user == null)
|
||||||
|
@ -683,8 +683,8 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
/// <returns>User.</returns>
|
/// <returns>User.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">name</exception>
|
/// <exception cref="ArgumentNullException">name</exception>
|
||||||
/// <exception cref="System.ArgumentException"></exception>
|
/// <exception cref="ArgumentException"></exception>
|
||||||
public async Task<User> CreateUser(string name)
|
public async Task<User> CreateUser(string name)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(name))
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
|
@ -731,8 +731,8 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
/// <exception cref="ArgumentNullException">user</exception>
|
||||||
/// <exception cref="System.ArgumentException"></exception>
|
/// <exception cref="ArgumentException"></exception>
|
||||||
public async Task DeleteUser(User user)
|
public async Task DeleteUser(User user)
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user == null)
|
||||||
|
|
|
@ -478,7 +478,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
|
|
||||||
private static string GetMappedChannel(string channelId, NameValuePair[] mappings)
|
private static string GetMappedChannel(string channelId, NameValuePair[] mappings)
|
||||||
{
|
{
|
||||||
foreach (NameValuePair mapping in mappings)
|
foreach (var mapping in mappings)
|
||||||
{
|
{
|
||||||
if (StringHelper.EqualsIgnoreCase(mapping.Name, channelId))
|
if (StringHelper.EqualsIgnoreCase(mapping.Name, channelId))
|
||||||
{
|
{
|
||||||
|
@ -2002,7 +2002,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
CloseOutput = false
|
CloseOutput = false
|
||||||
};
|
};
|
||||||
|
|
||||||
using (XmlWriter writer = XmlWriter.Create(stream, settings))
|
using (var writer = XmlWriter.Create(stream, settings))
|
||||||
{
|
{
|
||||||
writer.WriteStartDocument(true);
|
writer.WriteStartDocument(true);
|
||||||
writer.WriteStartElement("tvshow");
|
writer.WriteStartElement("tvshow");
|
||||||
|
@ -2069,7 +2069,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
|
|
||||||
var isSeriesEpisode = timer.IsProgramSeries;
|
var isSeriesEpisode = timer.IsProgramSeries;
|
||||||
|
|
||||||
using (XmlWriter writer = XmlWriter.Create(stream, settings))
|
using (var writer = XmlWriter.Create(stream, settings))
|
||||||
{
|
{
|
||||||
writer.WriteStartDocument(true);
|
writer.WriteStartDocument(true);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
|
|
||||||
private static List<string> GetScheduleRequestDates(DateTime startDateUtc, DateTime endDateUtc)
|
private static List<string> GetScheduleRequestDates(DateTime startDateUtc, DateTime endDateUtc)
|
||||||
{
|
{
|
||||||
List<string> dates = new List<string>();
|
var dates = new List<string>();
|
||||||
|
|
||||||
var start = new List<DateTime> { startDateUtc, startDateUtc.ToLocalTime() }.Min().Date;
|
var start = new List<DateTime> { startDateUtc, startDateUtc.ToLocalTime() }.Min().Date;
|
||||||
var end = new List<DateTime> { endDateUtc, endDateUtc.ToLocalTime() }.Max().Date;
|
var end = new List<DateTime> { endDateUtc, endDateUtc.ToLocalTime() }.Max().Date;
|
||||||
|
@ -104,7 +104,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
httpOptions.RequestHeaders["token"] = token;
|
httpOptions.RequestHeaders["token"] = token;
|
||||||
|
|
||||||
using (var response = await Post(httpOptions, true, info).ConfigureAwait(false))
|
using (var response = await Post(httpOptions, true, info).ConfigureAwait(false))
|
||||||
using (StreamReader reader = new StreamReader(response.Content))
|
using (var reader = new StreamReader(response.Content))
|
||||||
{
|
{
|
||||||
var dailySchedules = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Day>>(response.Content).ConfigureAwait(false);
|
var dailySchedules = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Day>>(response.Content).ConfigureAwait(false);
|
||||||
_logger.LogDebug("Found {ScheduleCount} programs on {ChannelID} ScheduleDirect", dailySchedules.Count, channelId);
|
_logger.LogDebug("Found {ScheduleCount} programs on {ChannelID} ScheduleDirect", dailySchedules.Count, channelId);
|
||||||
|
@ -125,7 +125,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
httpOptions.RequestContent = "[\"" + string.Join("\", \"", programsID) + "\"]";
|
httpOptions.RequestContent = "[\"" + string.Join("\", \"", programsID) + "\"]";
|
||||||
|
|
||||||
using (var innerResponse = await Post(httpOptions, true, info).ConfigureAwait(false))
|
using (var innerResponse = await Post(httpOptions, true, info).ConfigureAwait(false))
|
||||||
using (StreamReader innerReader = new StreamReader(innerResponse.Content))
|
using (var innerReader = new StreamReader(innerResponse.Content))
|
||||||
{
|
{
|
||||||
var programDetails = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.ProgramDetails>>(innerResponse.Content).ConfigureAwait(false);
|
var programDetails = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.ProgramDetails>>(innerResponse.Content).ConfigureAwait(false);
|
||||||
var programDict = programDetails.ToDictionary(p => p.programID, y => y);
|
var programDict = programDetails.ToDictionary(p => p.programID, y => y);
|
||||||
|
@ -136,8 +136,8 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
|
|
||||||
var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false);
|
var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
List<ProgramInfo> programsInfo = new List<ProgramInfo>();
|
var programsInfo = new List<ProgramInfo>();
|
||||||
foreach (ScheduleDirect.Program schedule in dailySchedules.SelectMany(d => d.programs))
|
foreach (var schedule in dailySchedules.SelectMany(d => d.programs))
|
||||||
{
|
{
|
||||||
//_logger.LogDebug("Proccesing Schedule for statio ID " + stationID +
|
//_logger.LogDebug("Proccesing Schedule for statio ID " + stationID +
|
||||||
// " which corresponds to channel " + channelNumber + " and program id " +
|
// " which corresponds to channel " + channelNumber + " and program id " +
|
||||||
|
@ -222,9 +222,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
|
|
||||||
private ProgramInfo GetProgram(string channelId, ScheduleDirect.Program programInfo, ScheduleDirect.ProgramDetails details)
|
private ProgramInfo GetProgram(string channelId, ScheduleDirect.Program programInfo, ScheduleDirect.ProgramDetails details)
|
||||||
{
|
{
|
||||||
DateTime startAt = GetDate(programInfo.airDateTime);
|
var startAt = GetDate(programInfo.airDateTime);
|
||||||
DateTime endAt = startAt.AddSeconds(programInfo.duration);
|
var endAt = startAt.AddSeconds(programInfo.duration);
|
||||||
ProgramAudio audioType = ProgramAudio.Stereo;
|
var audioType = ProgramAudio.Stereo;
|
||||||
|
|
||||||
var programId = programInfo.programID ?? string.Empty;
|
var programId = programInfo.programID ?? string.Empty;
|
||||||
|
|
||||||
|
@ -526,15 +526,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var httpResponse = await Get(options, false, info).ConfigureAwait(false))
|
using (var httpResponse = await Get(options, false, info).ConfigureAwait(false))
|
||||||
using (Stream responce = httpResponse.Content)
|
using (var responce = httpResponse.Content)
|
||||||
{
|
{
|
||||||
var root = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Headends>>(responce).ConfigureAwait(false);
|
var root = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Headends>>(responce).ConfigureAwait(false);
|
||||||
|
|
||||||
if (root != null)
|
if (root != null)
|
||||||
{
|
{
|
||||||
foreach (ScheduleDirect.Headends headend in root)
|
foreach (var headend in root)
|
||||||
{
|
{
|
||||||
foreach (ScheduleDirect.Lineup lineup in headend.lineups)
|
foreach (var lineup in headend.lineups)
|
||||||
{
|
{
|
||||||
lineups.Add(new NameIdPair
|
lineups.Add(new NameIdPair
|
||||||
{
|
{
|
||||||
|
@ -887,7 +887,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
|
|
||||||
var allStations = root.stations ?? Enumerable.Empty<ScheduleDirect.Station>();
|
var allStations = root.stations ?? Enumerable.Empty<ScheduleDirect.Station>();
|
||||||
|
|
||||||
foreach (ScheduleDirect.Map map in root.map)
|
foreach (var map in root.map)
|
||||||
{
|
{
|
||||||
var channelNumber = GetChannelNumber(map);
|
var channelNumber = GetChannelNumber(map);
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
|
||||||
string path = await GetXml(info.Path, CancellationToken.None).ConfigureAwait(false);
|
string path = await GetXml(info.Path, CancellationToken.None).ConfigureAwait(false);
|
||||||
_logger.LogDebug("Opening XmlTvReader for {path}", path);
|
_logger.LogDebug("Opening XmlTvReader for {path}", path);
|
||||||
var reader = new XmlTvReader(path, GetLanguage(info));
|
var reader = new XmlTvReader(path, GetLanguage(info));
|
||||||
IEnumerable<XmlTvChannel> results = reader.GetChannels();
|
var results = reader.GetChannels();
|
||||||
|
|
||||||
// Should this method be async?
|
// Should this method be async?
|
||||||
return results.Select(c => new NameIdPair() { Id = c.Id, Name = c.DisplayName }).ToList();
|
return results.Select(c => new NameIdPair() { Id = c.Id, Name = c.DisplayName }).ToList();
|
||||||
|
@ -281,7 +281,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
|
||||||
string path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
|
string path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
|
||||||
_logger.LogDebug("Opening XmlTvReader for {path}", path);
|
_logger.LogDebug("Opening XmlTvReader for {path}", path);
|
||||||
var reader = new XmlTvReader(path, GetLanguage(info));
|
var reader = new XmlTvReader(path, GetLanguage(info));
|
||||||
IEnumerable<XmlTvChannel> results = reader.GetChannels();
|
var results = reader.GetChannels();
|
||||||
|
|
||||||
// Should this method be async?
|
// Should this method be async?
|
||||||
return results.Select(c => new ChannelInfo
|
return results.Select(c => new ChannelInfo
|
||||||
|
|
|
@ -242,7 +242,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
var channel = (LiveTvChannel)_libraryManager.GetItemById(id);
|
var channel = (LiveTvChannel)_libraryManager.GetItemById(id);
|
||||||
|
|
||||||
bool isVideo = channel.ChannelType == ChannelType.TV;
|
bool isVideo = channel.ChannelType == ChannelType.TV;
|
||||||
ILiveTvService service = GetService(channel);
|
var service = GetService(channel);
|
||||||
_logger.LogInformation("Opening channel stream from {0}, external channel Id: {1}", service.Name, channel.ExternalId);
|
_logger.LogInformation("Opening channel stream from {0}, external channel Id: {1}", service.Name, channel.ExternalId);
|
||||||
|
|
||||||
MediaSourceInfo info;
|
MediaSourceInfo info;
|
||||||
|
@ -892,7 +892,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
var programList = _libraryManager.QueryItems(internalQuery).Items;
|
var programList = _libraryManager.QueryItems(internalQuery).Items;
|
||||||
var totalCount = programList.Length;
|
var totalCount = programList.Length;
|
||||||
|
|
||||||
IOrderedEnumerable<LiveTvProgram> orderedPrograms = programList.Cast<LiveTvProgram>().OrderBy(i => i.StartDate.Date);
|
var orderedPrograms = programList.Cast<LiveTvProgram>().OrderBy(i => i.StartDate.Date);
|
||||||
|
|
||||||
if (query.IsAiring ?? false)
|
if (query.IsAiring ?? false)
|
||||||
{
|
{
|
||||||
|
@ -2302,7 +2302,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
// ServerConfiguration.SaveConfiguration crashes during xml serialization for AddListingProvider
|
// ServerConfiguration.SaveConfiguration crashes during xml serialization for AddListingProvider
|
||||||
info = _jsonSerializer.DeserializeFromString<ListingsProviderInfo>(_jsonSerializer.SerializeToString(info));
|
info = _jsonSerializer.DeserializeFromString<ListingsProviderInfo>(_jsonSerializer.SerializeToString(info));
|
||||||
|
|
||||||
IListingsProvider provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
var provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
{
|
{
|
||||||
|
@ -2313,9 +2313,9 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
|
|
||||||
await provider.Validate(info, validateLogin, validateListings).ConfigureAwait(false);
|
await provider.Validate(info, validateLogin, validateListings).ConfigureAwait(false);
|
||||||
|
|
||||||
LiveTvOptions config = GetConfiguration();
|
var config = GetConfiguration();
|
||||||
|
|
||||||
List<ListingsProviderInfo> list = config.ListingProviders.ToList();
|
var list = config.ListingProviders.ToList();
|
||||||
int index = list.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));
|
int index = list.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (index == -1 || string.IsNullOrWhiteSpace(info.Id))
|
if (index == -1 || string.IsNullOrWhiteSpace(info.Id))
|
||||||
|
|
|
@ -262,7 +262,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||||
var name = string.Format("Tuner {0}", i + 1);
|
var name = string.Format("Tuner {0}", i + 1);
|
||||||
var currentChannel = "none"; /// @todo Get current channel and map back to Station Id
|
var currentChannel = "none"; /// @todo Get current channel and map back to Station Id
|
||||||
var isAvailable = await manager.CheckTunerAvailability(ipInfo, i, cancellationToken).ConfigureAwait(false);
|
var isAvailable = await manager.CheckTunerAvailability(ipInfo, i, cancellationToken).ConfigureAwait(false);
|
||||||
LiveTvTunerStatus status = isAvailable ? LiveTvTunerStatus.Available : LiveTvTunerStatus.LiveTv;
|
var status = isAvailable ? LiveTvTunerStatus.Available : LiveTvTunerStatus.LiveTv;
|
||||||
tuners.Add(new LiveTvTunerInfo
|
tuners.Add(new LiveTvTunerInfo
|
||||||
{
|
{
|
||||||
Name = name,
|
Name = name,
|
||||||
|
|
|
@ -173,7 +173,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var commandList = commands.GetCommands();
|
var commandList = commands.GetCommands();
|
||||||
foreach (Tuple<string, string> command in commandList)
|
foreach (var command in commandList)
|
||||||
{
|
{
|
||||||
var channelMsg = CreateSetMessage(i, command.Item1, command.Item2, lockKeyValue);
|
var channelMsg = CreateSetMessage(i, command.Item1, command.Item2, lockKeyValue);
|
||||||
await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false);
|
await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false);
|
||||||
|
@ -216,7 +216,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||||
var commandList = commands.GetCommands();
|
var commandList = commands.GetCommands();
|
||||||
var receiveBuffer = new byte[8192];
|
var receiveBuffer = new byte[8192];
|
||||||
|
|
||||||
foreach (Tuple<string, string> command in commandList)
|
foreach (var command in commandList)
|
||||||
{
|
{
|
||||||
var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey);
|
var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey);
|
||||||
await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, new IpEndPointInfo(_remoteIp, HdHomeRunPort), cancellationToken).ConfigureAwait(false);
|
await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, new IpEndPointInfo(_remoteIp, HdHomeRunPort), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
|
@ -19,10 +19,10 @@ namespace Emby.Server.Implementations.Net
|
||||||
|
|
||||||
//TODO Remove and reimplement using the IsDisposed property directly.
|
//TODO Remove and reimplement using the IsDisposed property directly.
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Throws an <see cref="System.ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
|
/// Throws an <see cref="ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="IsDisposed"/>
|
/// <seealso cref="IsDisposed"/>
|
||||||
/// <exception cref="System.ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception>
|
/// <exception cref="ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception>
|
||||||
/// <seealso cref="Dispose()"/>
|
/// <seealso cref="Dispose()"/>
|
||||||
protected virtual void ThrowIfDisposed()
|
protected virtual void ThrowIfDisposed()
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,8 +133,8 @@ namespace Emby.Server.Implementations.Net
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
ThrowIfDisposed();
|
||||||
|
|
||||||
IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
|
var sender = new IPEndPoint(IPAddress.Any, 0);
|
||||||
EndPoint remoteEndPoint = (EndPoint)sender;
|
var remoteEndPoint = (EndPoint)sender;
|
||||||
|
|
||||||
var receivedBytes = _Socket.EndReceiveFrom(result, ref remoteEndPoint);
|
var receivedBytes = _Socket.EndReceiveFrom(result, ref remoteEndPoint);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace System.Net
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extension methods to convert <see cref="System.Numerics.BigInteger"/>
|
/// Extension methods to convert <see cref="BigInteger"/>
|
||||||
/// instances to hexadecimal, octal, and binary strings.
|
/// instances to hexadecimal, octal, and binary strings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class BigIntegerExtensions
|
public static class BigIntegerExtensions
|
||||||
|
@ -17,7 +17,7 @@ namespace System.Net
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bigint">A <see cref="BigInteger"/>.</param>
|
/// <param name="bigint">A <see cref="BigInteger"/>.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="System.String"/> containing a binary
|
/// A <see cref="string"/> containing a binary
|
||||||
/// representation of the supplied <see cref="BigInteger"/>.
|
/// representation of the supplied <see cref="BigInteger"/>.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static string ToBinaryString(this BigInteger bigint)
|
public static string ToBinaryString(this BigInteger bigint)
|
||||||
|
@ -54,7 +54,7 @@ namespace System.Net
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bigint">A <see cref="BigInteger"/>.</param>
|
/// <param name="bigint">A <see cref="BigInteger"/>.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="System.String"/> containing a hexadecimal
|
/// A <see cref="string"/> containing a hexadecimal
|
||||||
/// representation of the supplied <see cref="BigInteger"/>.
|
/// representation of the supplied <see cref="BigInteger"/>.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static string ToHexadecimalString(this BigInteger bigint)
|
public static string ToHexadecimalString(this BigInteger bigint)
|
||||||
|
@ -67,7 +67,7 @@ namespace System.Net
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bigint">A <see cref="BigInteger"/>.</param>
|
/// <param name="bigint">A <see cref="BigInteger"/>.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="System.String"/> containing an octal
|
/// A <see cref="string"/> containing an octal
|
||||||
/// representation of the supplied <see cref="BigInteger"/>.
|
/// representation of the supplied <see cref="BigInteger"/>.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static string ToOctalString(this BigInteger bigint)
|
public static string ToOctalString(this BigInteger bigint)
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace System.Net
|
||||||
throw new ArgumentOutOfRangeException(nameof(i));
|
throw new ArgumentOutOfRangeException(nameof(i));
|
||||||
}
|
}
|
||||||
byte width = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetwork ? (byte)32 : (byte)128;
|
byte width = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetwork ? (byte)32 : (byte)128;
|
||||||
IPNetworkCollection ipn = this._ipnetwork.Subnet(width);
|
var ipn = this._ipnetwork.Subnet(width);
|
||||||
return ipn[i].Network;
|
return ipn[i].Network;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace System.Net
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
BigInteger uintNetwork = this._ipaddress & this._netmask;
|
var uintNetwork = this._ipaddress & this._netmask;
|
||||||
return uintNetwork;
|
return uintNetwork;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ namespace System.Net
|
||||||
{
|
{
|
||||||
|
|
||||||
int width = this._family == Sockets.AddressFamily.InterNetwork ? 4 : 16;
|
int width = this._family == Sockets.AddressFamily.InterNetwork ? 4 : 16;
|
||||||
BigInteger uintBroadcast = this._network + this._netmask.PositiveReverse(width);
|
var uintBroadcast = this._network + this._netmask.PositiveReverse(width);
|
||||||
return uintBroadcast;
|
return uintBroadcast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ namespace System.Net
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
BigInteger fisrt = this._family == Sockets.AddressFamily.InterNetworkV6
|
var fisrt = this._family == Sockets.AddressFamily.InterNetworkV6
|
||||||
? this._network
|
? this._network
|
||||||
: (this.Usable <= 0) ? this._network : this._network + 1;
|
: (this.Usable <= 0) ? this._network : this._network + 1;
|
||||||
return IPNetwork.ToIPAddress(fisrt, this._family);
|
return IPNetwork.ToIPAddress(fisrt, this._family);
|
||||||
|
@ -102,7 +102,7 @@ namespace System.Net
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
BigInteger last = this._family == Sockets.AddressFamily.InterNetworkV6
|
var last = this._family == Sockets.AddressFamily.InterNetworkV6
|
||||||
? this._broadcast
|
? this._broadcast
|
||||||
: (this.Usable <= 0) ? this._network : this._broadcast - 1;
|
: (this.Usable <= 0) ? this._network : this._broadcast - 1;
|
||||||
return IPNetwork.ToIPAddress(last, this._family);
|
return IPNetwork.ToIPAddress(last, this._family);
|
||||||
|
@ -122,8 +122,8 @@ namespace System.Net
|
||||||
return this.Total;
|
return this.Total;
|
||||||
}
|
}
|
||||||
byte[] mask = new byte[] { 0xff, 0xff, 0xff, 0xff, 0x00 };
|
byte[] mask = new byte[] { 0xff, 0xff, 0xff, 0xff, 0x00 };
|
||||||
BigInteger bmask = new BigInteger(mask);
|
var bmask = new BigInteger(mask);
|
||||||
BigInteger usableIps = (_cidr > 30) ? 0 : ((bmask >> _cidr) - 1);
|
var usableIps = (_cidr > 30) ? 0 : ((bmask >> _cidr) - 1);
|
||||||
return usableIps;
|
return usableIps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ namespace System.Net
|
||||||
{
|
{
|
||||||
|
|
||||||
int max = this._family == Sockets.AddressFamily.InterNetwork ? 32 : 128;
|
int max = this._family == Sockets.AddressFamily.InterNetwork ? 32 : 128;
|
||||||
BigInteger count = BigInteger.Pow(2, (max - _cidr));
|
var count = BigInteger.Pow(2, (max - _cidr));
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -523,7 +523,7 @@ namespace System.Net
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BigInteger uintIpAddress = IPNetwork.ToBigInteger(ipaddress);
|
var uintIpAddress = IPNetwork.ToBigInteger(ipaddress);
|
||||||
byte? cidr2 = null;
|
byte? cidr2 = null;
|
||||||
bool parsed = IPNetwork.TryToCidr(netmask, out cidr2);
|
bool parsed = IPNetwork.TryToCidr(netmask, out cidr2);
|
||||||
if (parsed == false)
|
if (parsed == false)
|
||||||
|
@ -537,7 +537,7 @@ namespace System.Net
|
||||||
}
|
}
|
||||||
byte cidr = (byte)cidr2;
|
byte cidr = (byte)cidr2;
|
||||||
|
|
||||||
IPNetwork ipnet = new IPNetwork(uintIpAddress, ipaddress.AddressFamily, cidr);
|
var ipnet = new IPNetwork(uintIpAddress, ipaddress.AddressFamily, cidr);
|
||||||
ipnetwork = ipnet;
|
ipnetwork = ipnet;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -754,7 +754,7 @@ namespace System.Net
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BigInteger mask = new BigInteger(new byte[] {
|
var mask = new BigInteger(new byte[] {
|
||||||
0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff,
|
||||||
0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff,
|
||||||
0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff,
|
||||||
|
@ -762,7 +762,7 @@ namespace System.Net
|
||||||
0x00
|
0x00
|
||||||
});
|
});
|
||||||
|
|
||||||
BigInteger masked = cidr == 0 ? 0 : mask << (128 - cidr);
|
var masked = cidr == 0 ? 0 : mask << (128 - cidr);
|
||||||
byte[] m = masked.ToByteArray();
|
byte[] m = masked.ToByteArray();
|
||||||
byte[] bmask = new byte[17];
|
byte[] bmask = new byte[17];
|
||||||
int copy = m.Length > 16 ? 16 : m.Length;
|
int copy = m.Length > 16 ? 16 : m.Length;
|
||||||
|
@ -858,7 +858,7 @@ namespace System.Net
|
||||||
/// cidr = null;
|
/// cidr = null;
|
||||||
/// return;
|
/// return;
|
||||||
/// }
|
/// }
|
||||||
BigInteger uintNetmask = (BigInteger)uintNetmask2;
|
var uintNetmask = (BigInteger)uintNetmask2;
|
||||||
|
|
||||||
byte? cidr2 = null;
|
byte? cidr2 = null;
|
||||||
IPNetwork.InternalToCidr(tryParse, uintNetmask, netmask.AddressFamily, out cidr2);
|
IPNetwork.InternalToCidr(tryParse, uintNetmask, netmask.AddressFamily, out cidr2);
|
||||||
|
@ -951,8 +951,8 @@ namespace System.Net
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BigInteger mask = IPNetwork.ToUint(cidr, family);
|
var mask = IPNetwork.ToUint(cidr, family);
|
||||||
IPAddress netmask2 = IPNetwork.ToIPAddress(mask, family);
|
var netmask2 = IPNetwork.ToIPAddress(mask, family);
|
||||||
netmask = netmask2;
|
netmask = netmask2;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -990,7 +990,7 @@ namespace System.Net
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static uint BitsSet(IPAddress netmask)
|
public static uint BitsSet(IPAddress netmask)
|
||||||
{
|
{
|
||||||
BigInteger uintNetmask = IPNetwork.ToBigInteger(netmask);
|
var uintNetmask = IPNetwork.ToBigInteger(netmask);
|
||||||
uint bits = IPNetwork.BitsSet(uintNetmask, netmask.AddressFamily);
|
uint bits = IPNetwork.BitsSet(uintNetmask, netmask.AddressFamily);
|
||||||
return bits;
|
return bits;
|
||||||
}
|
}
|
||||||
|
@ -1013,7 +1013,7 @@ namespace System.Net
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(netmask));
|
throw new ArgumentNullException(nameof(netmask));
|
||||||
}
|
}
|
||||||
BigInteger uintNetmask = IPNetwork.ToBigInteger(netmask);
|
var uintNetmask = IPNetwork.ToBigInteger(netmask);
|
||||||
bool valid = IPNetwork.InternalValidNetmask(uintNetmask, netmask.AddressFamily);
|
bool valid = IPNetwork.InternalValidNetmask(uintNetmask, netmask.AddressFamily);
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
@ -1042,7 +1042,7 @@ namespace System.Net
|
||||||
0x00
|
0x00
|
||||||
});
|
});
|
||||||
|
|
||||||
BigInteger neg = ((~netmask) & (mask));
|
var neg = ((~netmask) & (mask));
|
||||||
bool isNetmask = ((neg + 1) & neg) == 0;
|
bool isNetmask = ((neg + 1) & neg) == 0;
|
||||||
return isNetmask;
|
return isNetmask;
|
||||||
|
|
||||||
|
@ -1068,7 +1068,7 @@ namespace System.Net
|
||||||
Array.Reverse(bytes2);
|
Array.Reverse(bytes2);
|
||||||
|
|
||||||
byte[] sized = Resize(bytes2, family);
|
byte[] sized = Resize(bytes2, family);
|
||||||
IPAddress ip = new IPAddress(sized);
|
var ip = new IPAddress(sized);
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1122,9 +1122,9 @@ namespace System.Net
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BigInteger uintNetwork = _network;
|
var uintNetwork = _network;
|
||||||
BigInteger uintBroadcast = _broadcast;
|
var uintBroadcast = _broadcast;
|
||||||
BigInteger uintAddress = IPNetwork.ToBigInteger(ipaddress);
|
var uintAddress = IPNetwork.ToBigInteger(ipaddress);
|
||||||
|
|
||||||
bool contains = (uintAddress >= uintNetwork
|
bool contains = (uintAddress >= uintNetwork
|
||||||
&& uintAddress <= uintBroadcast);
|
&& uintAddress <= uintBroadcast);
|
||||||
|
@ -1146,11 +1146,11 @@ namespace System.Net
|
||||||
throw new ArgumentNullException(nameof(network2));
|
throw new ArgumentNullException(nameof(network2));
|
||||||
}
|
}
|
||||||
|
|
||||||
BigInteger uintNetwork = _network;
|
var uintNetwork = _network;
|
||||||
BigInteger uintBroadcast = _broadcast;
|
var uintBroadcast = _broadcast;
|
||||||
|
|
||||||
BigInteger uintFirst = network2._network;
|
var uintFirst = network2._network;
|
||||||
BigInteger uintLast = network2._broadcast;
|
var uintLast = network2._broadcast;
|
||||||
|
|
||||||
bool contains = (uintFirst >= uintNetwork
|
bool contains = (uintFirst >= uintNetwork
|
||||||
&& uintLast <= uintBroadcast);
|
&& uintLast <= uintBroadcast);
|
||||||
|
@ -1175,11 +1175,11 @@ namespace System.Net
|
||||||
throw new ArgumentNullException(nameof(network2));
|
throw new ArgumentNullException(nameof(network2));
|
||||||
}
|
}
|
||||||
|
|
||||||
BigInteger uintNetwork = _network;
|
var uintNetwork = _network;
|
||||||
BigInteger uintBroadcast = _broadcast;
|
var uintBroadcast = _broadcast;
|
||||||
|
|
||||||
BigInteger uintFirst = network2._network;
|
var uintFirst = network2._network;
|
||||||
BigInteger uintLast = network2._broadcast;
|
var uintLast = network2._broadcast;
|
||||||
|
|
||||||
bool overlap =
|
bool overlap =
|
||||||
(uintFirst >= uintNetwork && uintFirst <= uintBroadcast)
|
(uintFirst >= uintNetwork && uintFirst <= uintBroadcast)
|
||||||
|
@ -1428,8 +1428,8 @@ namespace System.Net
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPNetwork first = (network1._network < network2._network) ? network1 : network2;
|
var first = (network1._network < network2._network) ? network1 : network2;
|
||||||
IPNetwork last = (network1._network > network2._network) ? network1 : network2;
|
var last = (network1._network > network2._network) ? network1 : network2;
|
||||||
|
|
||||||
/// Starting from here :
|
/// Starting from here :
|
||||||
/// network1 and network2 have the same cidr,
|
/// network1 and network2 have the same cidr,
|
||||||
|
@ -1449,10 +1449,10 @@ namespace System.Net
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BigInteger uintSupernet = first._network;
|
var uintSupernet = first._network;
|
||||||
byte cidrSupernet = (byte)(first._cidr - 1);
|
byte cidrSupernet = (byte)(first._cidr - 1);
|
||||||
|
|
||||||
IPNetwork networkSupernet = new IPNetwork(uintSupernet, first._family, cidrSupernet);
|
var networkSupernet = new IPNetwork(uintSupernet, first._family, cidrSupernet);
|
||||||
if (networkSupernet._network != first._network)
|
if (networkSupernet._network != first._network)
|
||||||
{
|
{
|
||||||
if (trySupernet == false)
|
if (trySupernet == false)
|
||||||
|
@ -1535,9 +1535,9 @@ namespace System.Net
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<IPNetwork> supernetted = new List<IPNetwork>();
|
var supernetted = new List<IPNetwork>();
|
||||||
List<IPNetwork> ipns = IPNetwork.Array2List(ipnetworks);
|
var ipns = IPNetwork.Array2List(ipnetworks);
|
||||||
Stack<IPNetwork> current = IPNetwork.List2Stack(ipns);
|
var current = IPNetwork.List2Stack(ipns);
|
||||||
int previousCount = 0;
|
int previousCount = 0;
|
||||||
int currentCount = current.Count;
|
int currentCount = current.Count;
|
||||||
|
|
||||||
|
@ -1547,8 +1547,8 @@ namespace System.Net
|
||||||
supernetted.Clear();
|
supernetted.Clear();
|
||||||
while (current.Count > 1)
|
while (current.Count > 1)
|
||||||
{
|
{
|
||||||
IPNetwork ipn1 = current.Pop();
|
var ipn1 = current.Pop();
|
||||||
IPNetwork ipn2 = current.Peek();
|
var ipn2 = current.Peek();
|
||||||
|
|
||||||
IPNetwork outNetwork = null;
|
IPNetwork outNetwork = null;
|
||||||
bool success = ipn1.TrySupernet(ipn2, out outNetwork);
|
bool success = ipn1.TrySupernet(ipn2, out outNetwork);
|
||||||
|
@ -1578,7 +1578,7 @@ namespace System.Net
|
||||||
|
|
||||||
private static Stack<IPNetwork> List2Stack(List<IPNetwork> list)
|
private static Stack<IPNetwork> List2Stack(List<IPNetwork> list)
|
||||||
{
|
{
|
||||||
Stack<IPNetwork> stack = new Stack<IPNetwork>();
|
var stack = new Stack<IPNetwork>();
|
||||||
list.ForEach(new Action<IPNetwork>(
|
list.ForEach(new Action<IPNetwork>(
|
||||||
delegate (IPNetwork ipn)
|
delegate (IPNetwork ipn)
|
||||||
{
|
{
|
||||||
|
@ -1590,7 +1590,7 @@ namespace System.Net
|
||||||
|
|
||||||
private static List<IPNetwork> Array2List(IPNetwork[] array)
|
private static List<IPNetwork> Array2List(IPNetwork[] array)
|
||||||
{
|
{
|
||||||
List<IPNetwork> ipns = new List<IPNetwork>();
|
var ipns = new List<IPNetwork>();
|
||||||
ipns.AddRange(array);
|
ipns.AddRange(array);
|
||||||
IPNetwork.RemoveNull(ipns);
|
IPNetwork.RemoveNull(ipns);
|
||||||
ipns.Sort(new Comparison<IPNetwork>(
|
ipns.Sort(new Comparison<IPNetwork>(
|
||||||
|
@ -1659,10 +1659,10 @@ namespace System.Net
|
||||||
throw new NotSupportedException("MixedAddressFamily");
|
throw new NotSupportedException("MixedAddressFamily");
|
||||||
}
|
}
|
||||||
|
|
||||||
IPNetwork ipnetwork = new IPNetwork(0, startIP.AddressFamily, 0);
|
var ipnetwork = new IPNetwork(0, startIP.AddressFamily, 0);
|
||||||
for (byte cidr = 32; cidr >= 0; cidr--)
|
for (byte cidr = 32; cidr >= 0; cidr--)
|
||||||
{
|
{
|
||||||
IPNetwork wideSubnet = IPNetwork.Parse(start, cidr);
|
var wideSubnet = IPNetwork.Parse(start, cidr);
|
||||||
if (wideSubnet.Contains(endIP))
|
if (wideSubnet.Contains(endIP))
|
||||||
{
|
{
|
||||||
ipnetwork = wideSubnet;
|
ipnetwork = wideSubnet;
|
||||||
|
@ -1707,7 +1707,7 @@ namespace System.Net
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IPNetwork[] nnin = Array.FindAll<IPNetwork>(ipnetworks, new Predicate<IPNetwork>(
|
IPNetwork[] nnin = Array.FindAll(ipnetworks, new Predicate<IPNetwork>(
|
||||||
delegate (IPNetwork ipnet)
|
delegate (IPNetwork ipnet)
|
||||||
{
|
{
|
||||||
return ipnet != null;
|
return ipnet != null;
|
||||||
|
@ -1726,19 +1726,19 @@ namespace System.Net
|
||||||
|
|
||||||
if (nnin.Length == 1)
|
if (nnin.Length == 1)
|
||||||
{
|
{
|
||||||
IPNetwork ipn0 = nnin[0];
|
var ipn0 = nnin[0];
|
||||||
ipnetwork = ipn0;
|
ipnetwork = ipn0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Array.Sort<IPNetwork>(nnin);
|
Array.Sort(nnin);
|
||||||
IPNetwork nnin0 = nnin[0];
|
var nnin0 = nnin[0];
|
||||||
BigInteger uintNnin0 = nnin0._ipaddress;
|
var uintNnin0 = nnin0._ipaddress;
|
||||||
|
|
||||||
IPNetwork nninX = nnin[nnin.Length - 1];
|
var nninX = nnin[nnin.Length - 1];
|
||||||
IPAddress ipaddressX = nninX.Broadcast;
|
var ipaddressX = nninX.Broadcast;
|
||||||
|
|
||||||
AddressFamily family = ipnetworks[0]._family;
|
var family = ipnetworks[0]._family;
|
||||||
foreach (var ipnx in ipnetworks)
|
foreach (var ipnx in ipnetworks)
|
||||||
{
|
{
|
||||||
if (ipnx._family != family)
|
if (ipnx._family != family)
|
||||||
|
@ -1747,10 +1747,10 @@ namespace System.Net
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IPNetwork ipn = new IPNetwork(0, family, 0);
|
var ipn = new IPNetwork(0, family, 0);
|
||||||
for (byte cidr = nnin0._cidr; cidr >= 0; cidr--)
|
for (byte cidr = nnin0._cidr; cidr >= 0; cidr--)
|
||||||
{
|
{
|
||||||
IPNetwork wideSubnet = new IPNetwork(uintNnin0, family, cidr);
|
var wideSubnet = new IPNetwork(uintNnin0, family, cidr);
|
||||||
if (wideSubnet.Contains(ipaddressX))
|
if (wideSubnet.Contains(ipaddressX))
|
||||||
{
|
{
|
||||||
ipn = wideSubnet;
|
ipn = wideSubnet;
|
||||||
|
@ -1773,7 +1773,7 @@ namespace System.Net
|
||||||
public string Print()
|
public string Print()
|
||||||
{
|
{
|
||||||
|
|
||||||
StringWriter sw = new StringWriter();
|
var sw = new StringWriter();
|
||||||
|
|
||||||
sw.WriteLine("IPNetwork : {0}", ToString());
|
sw.WriteLine("IPNetwork : {0}", ToString());
|
||||||
sw.WriteLine("Network : {0}", Network);
|
sw.WriteLine("Network : {0}", Network);
|
||||||
|
@ -1819,7 +1819,7 @@ namespace System.Net
|
||||||
cidr = 64;
|
cidr = 64;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
BigInteger uintIPAddress = IPNetwork.ToBigInteger(ipaddress);
|
var uintIPAddress = IPNetwork.ToBigInteger(ipaddress);
|
||||||
uintIPAddress = uintIPAddress >> 29;
|
uintIPAddress = uintIPAddress >> 29;
|
||||||
if (uintIPAddress <= 3)
|
if (uintIPAddress <= 3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace System.Net
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
BigInteger count = BigInteger.Pow(2, this._cidrSubnet - this._cidr);
|
var count = BigInteger.Pow(2, this._cidrSubnet - this._cidr);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,11 +61,11 @@ namespace System.Net
|
||||||
throw new ArgumentOutOfRangeException(nameof(i));
|
throw new ArgumentOutOfRangeException(nameof(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
BigInteger last = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetworkV6
|
var last = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetworkV6
|
||||||
? this._lastUsable : this._broadcast;
|
? this._lastUsable : this._broadcast;
|
||||||
BigInteger increment = (last - this._network) / this.Count;
|
var increment = (last - this._network) / this.Count;
|
||||||
BigInteger uintNetwork = this._network + ((increment + 1) * i);
|
var uintNetwork = this._network + ((increment + 1) * i);
|
||||||
IPNetwork ipn = new IPNetwork(uintNetwork, this._ipnetwork.AddressFamily, this._cidrSubnet);
|
var ipn = new IPNetwork(uintNetwork, this._ipnetwork.AddressFamily, this._cidrSubnet);
|
||||||
return ipn;
|
return ipn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,9 +214,9 @@ namespace Emby.Server.Implementations.Networking
|
||||||
|
|
||||||
subnets = new List<string>();
|
subnets = new List<string>();
|
||||||
|
|
||||||
foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces())
|
foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces())
|
||||||
{
|
{
|
||||||
foreach (UnicastIPAddressInformation unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses)
|
foreach (var unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses)
|
||||||
{
|
{
|
||||||
if (unicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork && endpointFirstPart == unicastIPAddressInformation.Address.ToString().Split('.')[0])
|
if (unicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork && endpointFirstPart == unicastIPAddressInformation.Address.ToString().Split('.')[0])
|
||||||
{
|
{
|
||||||
|
@ -461,7 +461,7 @@ namespace Emby.Server.Implementations.Networking
|
||||||
|
|
||||||
public int GetRandomUnusedUdpPort()
|
public int GetRandomUnusedUdpPort()
|
||||||
{
|
{
|
||||||
IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
var localEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
||||||
using (var udpClient = new UdpClient(localEndPoint))
|
using (var udpClient = new UdpClient(localEndPoint))
|
||||||
{
|
{
|
||||||
var port = ((IPEndPoint)(udpClient.Client.LocalEndPoint)).Port;
|
var port = ((IPEndPoint)(udpClient.Client.LocalEndPoint)).Port;
|
||||||
|
@ -522,8 +522,8 @@ namespace Emby.Server.Implementations.Networking
|
||||||
/// <param name="endpointstring">The endpointstring.</param>
|
/// <param name="endpointstring">The endpointstring.</param>
|
||||||
/// <param name="defaultport">The defaultport.</param>
|
/// <param name="defaultport">The defaultport.</param>
|
||||||
/// <returns>IPEndPoint.</returns>
|
/// <returns>IPEndPoint.</returns>
|
||||||
/// <exception cref="System.ArgumentException">Endpoint descriptor may not be empty.</exception>
|
/// <exception cref="ArgumentException">Endpoint descriptor may not be empty.</exception>
|
||||||
/// <exception cref="System.FormatException"></exception>
|
/// <exception cref="FormatException"></exception>
|
||||||
private static async Task<IPEndPoint> Parse(string endpointstring, int defaultport)
|
private static async Task<IPEndPoint> Parse(string endpointstring, int defaultport)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(endpointstring)
|
if (string.IsNullOrEmpty(endpointstring)
|
||||||
|
@ -585,7 +585,7 @@ namespace Emby.Server.Implementations.Networking
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="p">The p.</param>
|
/// <param name="p">The p.</param>
|
||||||
/// <returns>System.Int32.</returns>
|
/// <returns>System.Int32.</returns>
|
||||||
/// <exception cref="System.FormatException"></exception>
|
/// <exception cref="FormatException"></exception>
|
||||||
private static int GetPort(string p)
|
private static int GetPort(string p)
|
||||||
{
|
{
|
||||||
int port;
|
int port;
|
||||||
|
@ -605,7 +605,7 @@ namespace Emby.Server.Implementations.Networking
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <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="ArgumentException"></exception>
|
||||||
private static async Task<IPAddress> GetIPfromHost(string p)
|
private static async Task<IPAddress> GetIPfromHost(string p)
|
||||||
{
|
{
|
||||||
var hosts = await Dns.GetHostAddressesAsync(p).ConfigureAwait(false);
|
var hosts = await Dns.GetHostAddressesAsync(p).ConfigureAwait(false);
|
||||||
|
|
|
@ -469,12 +469,12 @@ namespace Emby.Server.Implementations.Playlists
|
||||||
folderPath = folderPath + Path.DirectorySeparatorChar;
|
folderPath = folderPath + Path.DirectorySeparatorChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri folderUri = new Uri(folderPath);
|
var folderUri = new Uri(folderPath);
|
||||||
Uri fileAbsoluteUri = new Uri(fileAbsolutePath);
|
var fileAbsoluteUri = new Uri(fileAbsolutePath);
|
||||||
|
|
||||||
if (folderUri.Scheme != fileAbsoluteUri.Scheme) { return fileAbsolutePath; } // path can't be made relative.
|
if (folderUri.Scheme != fileAbsoluteUri.Scheme) { return fileAbsolutePath; } // path can't be made relative.
|
||||||
|
|
||||||
Uri relativeUri = folderUri.MakeRelativeUri(fileAbsoluteUri);
|
var relativeUri = folderUri.MakeRelativeUri(fileAbsoluteUri);
|
||||||
string relativePath = Uri.UnescapeDataString(relativeUri.ToString());
|
string relativePath = Uri.UnescapeDataString(relativeUri.ToString());
|
||||||
|
|
||||||
if (fileAbsoluteUri.Scheme.Equals("file", StringComparison.CurrentCultureIgnoreCase))
|
if (fileAbsoluteUri.Scheme.Equals("file", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
/// <param name="taskManager">The task manager.</param>
|
/// <param name="taskManager">The task manager.</param>
|
||||||
/// <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.ArgumentNullException">
|
/// <exception cref="ArgumentNullException">
|
||||||
/// scheduledTask
|
/// scheduledTask
|
||||||
/// or
|
/// or
|
||||||
/// applicationPaths
|
/// applicationPaths
|
||||||
|
@ -256,7 +256,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
/// Gets the triggers that define when the task will run
|
/// Gets the triggers that define when the task will run
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The triggers.</value>
|
/// <value>The triggers.</value>
|
||||||
/// <exception cref="System.ArgumentNullException">value</exception>
|
/// <exception cref="ArgumentNullException">value</exception>
|
||||||
public TaskTriggerInfo[] Triggers
|
public TaskTriggerInfo[] Triggers
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -365,7 +365,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="options">Task options.</param>
|
/// <param name="options">Task options.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.InvalidOperationException">Cannot execute a Task that is already running</exception>
|
/// <exception cref="InvalidOperationException">Cannot execute a Task that is already running</exception>
|
||||||
public async Task Execute(TaskOptions options)
|
public async Task Execute(TaskOptions options)
|
||||||
{
|
{
|
||||||
var task = Task.Run(async () => await ExecuteInternal(options).ConfigureAwait(false));
|
var task = Task.Run(async () => await ExecuteInternal(options).ConfigureAwait(false));
|
||||||
|
@ -461,7 +461,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stops the task if it is currently executing
|
/// Stops the task if it is currently executing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="System.InvalidOperationException">Cannot cancel a Task unless it is in the Running state.</exception>
|
/// <exception cref="InvalidOperationException">Cannot cancel a Task unless it is in the Running state.</exception>
|
||||||
public void Cancel()
|
public void Cancel()
|
||||||
{
|
{
|
||||||
if (State != TaskState.Running)
|
if (State != TaskState.Running)
|
||||||
|
@ -705,8 +705,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="info">The info.</param>
|
/// <param name="info">The info.</param>
|
||||||
/// <returns>BaseTaskTrigger.</returns>
|
/// <returns>BaseTaskTrigger.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
/// <exception cref="System.ArgumentException">Invalid trigger type: + info.Type</exception>
|
/// <exception cref="ArgumentException">Invalid trigger type: + info.Type</exception>
|
||||||
private ITaskTrigger GetTrigger(TaskTriggerInfo info)
|
private ITaskTrigger GetTrigger(TaskTriggerInfo info)
|
||||||
{
|
{
|
||||||
var options = new TaskOptions
|
var options = new TaskOptions
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
/// <param name="applicationPaths">The application paths.</param>
|
/// <param name="applicationPaths">The application paths.</param>
|
||||||
/// <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="ArgumentException">kernel</exception>
|
||||||
public TaskManager(IApplicationPaths applicationPaths, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem, ISystemEvents systemEvents)
|
public TaskManager(IApplicationPaths applicationPaths, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem, ISystemEvents systemEvents)
|
||||||
{
|
{
|
||||||
ApplicationPaths = applicationPaths;
|
ApplicationPaths = applicationPaths;
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Emby.Server.Implementations.Security
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">value</exception>
|
/// <exception cref="ArgumentNullException">value</exception>
|
||||||
public string EncryptString(string value)
|
public string EncryptString(string value)
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Security
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">value</exception>
|
/// <exception cref="ArgumentNullException">value</exception>
|
||||||
public string DecryptString(string value)
|
public string DecryptString(string value)
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj">The obj.</param>
|
/// <param name="obj">The obj.</param>
|
||||||
/// <param name="stream">The stream.</param>
|
/// <param name="stream">The stream.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">obj</exception>
|
/// <exception cref="ArgumentNullException">obj</exception>
|
||||||
public void SerializeToStream(object obj, Stream stream)
|
public void SerializeToStream(object obj, Stream stream)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
|
@ -48,7 +48,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj">The obj.</param>
|
/// <param name="obj">The obj.</param>
|
||||||
/// <param name="file">The file.</param>
|
/// <param name="file">The file.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">obj</exception>
|
/// <exception cref="ArgumentNullException">obj</exception>
|
||||||
public void SerializeToFile(object obj, string file)
|
public void SerializeToFile(object obj, string file)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
|
@ -61,7 +61,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
throw new ArgumentNullException(nameof(file));
|
throw new ArgumentNullException(nameof(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
using (Stream stream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
using (var stream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
||||||
{
|
{
|
||||||
SerializeToStream(obj, stream);
|
SerializeToStream(obj, stream);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
/// <param name="type">The type.</param>
|
/// <param name="type">The type.</param>
|
||||||
/// <param name="file">The file.</param>
|
/// <param name="file">The file.</param>
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">type</exception>
|
/// <exception cref="ArgumentNullException">type</exception>
|
||||||
public object DeserializeFromFile(Type type, string file)
|
public object DeserializeFromFile(Type type, string file)
|
||||||
{
|
{
|
||||||
if (type == null)
|
if (type == null)
|
||||||
|
@ -92,7 +92,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
throw new ArgumentNullException(nameof(file));
|
throw new ArgumentNullException(nameof(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
using (Stream stream = OpenFile(file))
|
using (var stream = OpenFile(file))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream(stream, type);
|
return DeserializeFromStream(stream, type);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
/// <param name="file">The file.</param>
|
/// <param name="file">The file.</param>
|
||||||
/// <returns>``0.</returns>
|
/// <returns>``0.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">file</exception>
|
/// <exception cref="ArgumentNullException">file</exception>
|
||||||
public T DeserializeFromFile<T>(string file)
|
public T DeserializeFromFile<T>(string file)
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
throw new ArgumentNullException(nameof(file));
|
throw new ArgumentNullException(nameof(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
using (Stream stream = OpenFile(file))
|
using (var stream = OpenFile(file))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<T>(stream);
|
return DeserializeFromStream<T>(stream);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
/// <param name="stream">The stream.</param>
|
/// <param name="stream">The stream.</param>
|
||||||
/// <returns>``0.</returns>
|
/// <returns>``0.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">stream</exception>
|
/// <exception cref="ArgumentNullException">stream</exception>
|
||||||
public T DeserializeFromStream<T>(Stream stream)
|
public T DeserializeFromStream<T>(Stream stream)
|
||||||
{
|
{
|
||||||
if (stream == null)
|
if (stream == null)
|
||||||
|
@ -153,7 +153,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
/// <param name="text">The text.</param>
|
/// <param name="text">The text.</param>
|
||||||
/// <returns>``0.</returns>
|
/// <returns>``0.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">text</exception>
|
/// <exception cref="ArgumentNullException">text</exception>
|
||||||
public T DeserializeFromString<T>(string text)
|
public T DeserializeFromString<T>(string text)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(text))
|
if (string.IsNullOrEmpty(text))
|
||||||
|
@ -170,7 +170,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
/// <param name="stream">The stream.</param>
|
/// <param name="stream">The stream.</param>
|
||||||
/// <param name="type">The type.</param>
|
/// <param name="type">The type.</param>
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">stream</exception>
|
/// <exception cref="ArgumentNullException">stream</exception>
|
||||||
public object DeserializeFromStream(Stream stream, Type type)
|
public object DeserializeFromStream(Stream stream, Type type)
|
||||||
{
|
{
|
||||||
if (stream == null)
|
if (stream == null)
|
||||||
|
@ -236,7 +236,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
/// <param name="json">The json.</param>
|
/// <param name="json">The json.</param>
|
||||||
/// <param name="type">The type.</param>
|
/// <param name="type">The type.</param>
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">json</exception>
|
/// <exception cref="ArgumentNullException">json</exception>
|
||||||
public object DeserializeFromString(string json, Type type)
|
public object DeserializeFromString(string json, Type type)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(json))
|
if (string.IsNullOrEmpty(json))
|
||||||
|
@ -257,7 +257,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj">The obj.</param>
|
/// <param name="obj">The obj.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">obj</exception>
|
/// <exception cref="ArgumentNullException">obj</exception>
|
||||||
public string SerializeToString(object obj)
|
public string SerializeToString(object obj)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.Services
|
||||||
public void RegisterRestPaths(HttpListenerHost appHost, Type requestType, Type serviceType)
|
public void RegisterRestPaths(HttpListenerHost appHost, Type requestType, Type serviceType)
|
||||||
{
|
{
|
||||||
var attrs = appHost.GetRouteAttributes(requestType);
|
var attrs = appHost.GetRouteAttributes(requestType);
|
||||||
foreach (RouteAttribute attr in attrs)
|
foreach (var attr in attrs)
|
||||||
{
|
{
|
||||||
var restPath = new RestPath(appHost.CreateInstance, appHost.GetParseFn, requestType, serviceType, attr.Path, attr.Verbs, attr.IsHidden, attr.Summary, attr.Description);
|
var restPath = new RestPath(appHost.CreateInstance, appHost.GetParseFn, requestType, serviceType, attr.Path, attr.Verbs, attr.IsHidden, attr.Summary, attr.Description);
|
||||||
|
|
||||||
|
|
|
@ -201,8 +201,8 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// <param name="remoteEndPoint">The remote end point.</param>
|
/// <param name="remoteEndPoint">The remote end point.</param>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
/// <exception cref="ArgumentNullException">user</exception>
|
||||||
/// <exception cref="System.UnauthorizedAccessException"></exception>
|
/// <exception cref="UnauthorizedAccessException"></exception>
|
||||||
public SessionInfo LogSessionActivity(string appName,
|
public SessionInfo LogSessionActivity(string appName,
|
||||||
string appVersion,
|
string appVersion,
|
||||||
string deviceId,
|
string deviceId,
|
||||||
|
@ -365,7 +365,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// Removes the now playing item id.
|
/// Removes the now playing item id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="session">The session.</param>
|
/// <param name="session">The session.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="ArgumentNullException">item</exception>
|
||||||
private void RemoveNowPlayingItem(SessionInfo session)
|
private void RemoveNowPlayingItem(SessionInfo session)
|
||||||
{
|
{
|
||||||
session.NowPlayingItem = null;
|
session.NowPlayingItem = null;
|
||||||
|
@ -404,7 +404,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
|
||||||
SessionInfo sessionInfo = _activeConnections.GetOrAdd(key, k =>
|
var sessionInfo = _activeConnections.GetOrAdd(key, k =>
|
||||||
{
|
{
|
||||||
return CreateSession(k, appName, appVersion, deviceId, deviceName, remoteEndPoint, user);
|
return CreateSession(k, appName, appVersion, deviceId, deviceName, remoteEndPoint, user);
|
||||||
});
|
});
|
||||||
|
@ -571,7 +571,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="info">The info.</param>
|
/// <param name="info">The info.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">info</exception>
|
/// <exception cref="ArgumentNullException">info</exception>
|
||||||
public async Task OnPlaybackStart(PlaybackStartInfo info)
|
public async Task OnPlaybackStart(PlaybackStartInfo info)
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -784,8 +784,8 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="info">The info.</param>
|
/// <param name="info">The info.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">info</exception>
|
/// <exception cref="ArgumentNullException">info</exception>
|
||||||
/// <exception cref="System.ArgumentOutOfRangeException">positionTicks</exception>
|
/// <exception cref="ArgumentOutOfRangeException">positionTicks</exception>
|
||||||
public async Task OnPlaybackStopped(PlaybackStopInfo info)
|
public async Task OnPlaybackStopped(PlaybackStopInfo info)
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -1284,8 +1284,8 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sessionId">The session identifier.</param>
|
/// <param name="sessionId">The session identifier.</param>
|
||||||
/// <param name="userId">The user identifier.</param>
|
/// <param name="userId">The user identifier.</param>
|
||||||
/// <exception cref="System.UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
/// <exception cref="UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
||||||
/// <exception cref="System.ArgumentException">The requested user is already the primary user of the session.</exception>
|
/// <exception cref="ArgumentException">The requested user is already the primary user of the session.</exception>
|
||||||
public void AddAdditionalUser(string sessionId, Guid userId)
|
public void AddAdditionalUser(string sessionId, Guid userId)
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -1318,8 +1318,8 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sessionId">The session identifier.</param>
|
/// <param name="sessionId">The session identifier.</param>
|
||||||
/// <param name="userId">The user identifier.</param>
|
/// <param name="userId">The user identifier.</param>
|
||||||
/// <exception cref="System.UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
/// <exception cref="UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
||||||
/// <exception cref="System.ArgumentException">The requested user is already the primary user of the session.</exception>
|
/// <exception cref="ArgumentException">The requested user is already the primary user of the session.</exception>
|
||||||
public void RemoveAdditionalUser(string sessionId, Guid userId)
|
public void RemoveAdditionalUser(string sessionId, Guid userId)
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
char thisCh = s1[thisMarker];
|
char thisCh = s1[thisMarker];
|
||||||
char thatCh = s2[thatMarker];
|
char thatCh = s2[thatMarker];
|
||||||
|
|
||||||
StringBuilder thisChunk = new StringBuilder();
|
var thisChunk = new StringBuilder();
|
||||||
StringBuilder thatChunk = new StringBuilder();
|
var thatChunk = new StringBuilder();
|
||||||
|
|
||||||
while ((thisMarker < s1.Length) && (thisChunk.Length == 0 || SortHelper.InChunk(thisCh, thisChunk[0])))
|
while ((thisMarker < s1.Length) && (thisChunk.Length == 0 || SortHelper.InChunk(thisCh, thisChunk[0])))
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.TV
|
||||||
OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.DatePlayed, SortOrder.Descending) },
|
OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.DatePlayed, SortOrder.Descending) },
|
||||||
SeriesPresentationUniqueKey = presentationUniqueKey,
|
SeriesPresentationUniqueKey = presentationUniqueKey,
|
||||||
Limit = limit,
|
Limit = limit,
|
||||||
DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions
|
DtoOptions = new DtoOptions
|
||||||
{
|
{
|
||||||
Fields = new ItemFields[]
|
Fields = new ItemFields[]
|
||||||
{
|
{
|
||||||
|
@ -196,7 +196,7 @@ namespace Emby.Server.Implementations.TV
|
||||||
IsPlayed = true,
|
IsPlayed = true,
|
||||||
Limit = 1,
|
Limit = 1,
|
||||||
ParentIndexNumberNotEquals = 0,
|
ParentIndexNumberNotEquals = 0,
|
||||||
DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions
|
DtoOptions = new DtoOptions
|
||||||
{
|
{
|
||||||
Fields = new ItemFields[]
|
Fields = new ItemFields[]
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,7 +164,7 @@ namespace NLangDetect.Core
|
||||||
|
|
||||||
public string Detect()
|
public string Detect()
|
||||||
{
|
{
|
||||||
List<Language> probabilities = GetProbabilities();
|
var probabilities = GetProbabilities();
|
||||||
|
|
||||||
return
|
return
|
||||||
probabilities.Count > 0
|
probabilities.Count > 0
|
||||||
|
@ -179,7 +179,7 @@ namespace NLangDetect.Core
|
||||||
DetectBlock();
|
DetectBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Language> list = SortProbability(_langprob);
|
var list = SortProbability(_langprob);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ namespace NLangDetect.Core
|
||||||
{
|
{
|
||||||
CleanText();
|
CleanText();
|
||||||
|
|
||||||
List<string> ngrams = ExtractNGrams();
|
var ngrams = ExtractNGrams();
|
||||||
|
|
||||||
if (ngrams.Count == 0)
|
if (ngrams.Count == 0)
|
||||||
{
|
{
|
||||||
|
@ -250,7 +250,7 @@ namespace NLangDetect.Core
|
||||||
|
|
||||||
_langprob = new double[_langlist.Count];
|
_langprob = new double[_langlist.Count];
|
||||||
|
|
||||||
Random rand = (_seed.HasValue ? new Random(_seed.Value) : new Random());
|
var rand = (_seed.HasValue ? new Random(_seed.Value) : new Random());
|
||||||
|
|
||||||
for (int t = 0; t < _trialsCount; t++)
|
for (int t = 0; t < _trialsCount; t++)
|
||||||
{
|
{
|
||||||
|
@ -305,7 +305,7 @@ namespace NLangDetect.Core
|
||||||
private List<string> ExtractNGrams()
|
private List<string> ExtractNGrams()
|
||||||
{
|
{
|
||||||
var list = new List<string>();
|
var list = new List<string>();
|
||||||
NGram ngram = new NGram();
|
var ngram = new NGram();
|
||||||
|
|
||||||
for (int i = 0; i < _text.Length; i++)
|
for (int i = 0; i < _text.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -332,7 +332,7 @@ namespace NLangDetect.Core
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProbVector langProbMap = _wordLangProbMap[word];
|
var langProbMap = _wordLangProbMap[word];
|
||||||
double weight = alpha / _BaseFreq;
|
double weight = alpha / _BaseFreq;
|
||||||
|
|
||||||
for (int i = 0; i < prob.Length; i++)
|
for (int i = 0; i < prob.Length; i++)
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace NLangDetect.Core
|
||||||
|
|
||||||
public static Detector Create(double alpha)
|
public static Detector Create(double alpha)
|
||||||
{
|
{
|
||||||
Detector detector = CreateDetector();
|
var detector = CreateDetector();
|
||||||
|
|
||||||
detector.SetAlpha(alpha);
|
detector.SetAlpha(alpha);
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ namespace NLangDetect.Core
|
||||||
|
|
||||||
public static LangProfile load(string lang, string file)
|
public static LangProfile load(string lang, string file)
|
||||||
{
|
{
|
||||||
LangProfile profile = new LangProfile(lang);
|
var profile = new LangProfile(lang);
|
||||||
TagExtractor tagextractor = new TagExtractor("abstract", 100);
|
var tagextractor = new TagExtractor("abstract", 100);
|
||||||
Stream inputStream = null;
|
Stream inputStream = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -28,7 +28,7 @@ namespace NLangDetect.Core
|
||||||
inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
|
inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (XmlReader xmlReader = XmlReader.Create(inputStream))
|
using (var xmlReader = XmlReader.Create(inputStream))
|
||||||
{
|
{
|
||||||
while (xmlReader.Read())
|
while (xmlReader.Read())
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace NLangDetect.Core
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(plainText)) { throw new ArgumentException("Argument can't be null nor empty.", nameof(plainText)); }
|
if (string.IsNullOrEmpty(plainText)) { throw new ArgumentException("Argument can't be null nor empty.", nameof(plainText)); }
|
||||||
|
|
||||||
Detector detector = DetectorFactory.Create(_DefaultAlpha);
|
var detector = DetectorFactory.Create(_DefaultAlpha);
|
||||||
|
|
||||||
detector.Append(plainText);
|
detector.Append(plainText);
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,8 @@ namespace NLangDetect.Core.Utils
|
||||||
ICollection<string> keys = freq.Keys;
|
ICollection<string> keys = freq.Keys;
|
||||||
int roman = 0;
|
int roman = 0;
|
||||||
// TODO IMM HI: move up?
|
// TODO IMM HI: move up?
|
||||||
Regex regex1 = new Regex("^[A-Za-z]$", RegexOptions.Compiled);
|
var regex1 = new Regex("^[A-Za-z]$", RegexOptions.Compiled);
|
||||||
List<string> keysToRemove = new List<string>();
|
var keysToRemove = new List<string>();
|
||||||
|
|
||||||
foreach (string key in keys)
|
foreach (string key in keys)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ namespace NLangDetect.Core.Utils
|
||||||
ICollection<string> keys2 = freq.Keys;
|
ICollection<string> keys2 = freq.Keys;
|
||||||
|
|
||||||
// TODO IMM HI: move up?
|
// TODO IMM HI: move up?
|
||||||
Regex regex2 = new Regex(".*[A-Za-z].*", RegexOptions.Compiled);
|
var regex2 = new Regex(".*[A-Za-z].*", RegexOptions.Compiled);
|
||||||
|
|
||||||
foreach (string key in keys2)
|
foreach (string key in keys2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace NLangDetect.Core.Utils
|
||||||
{
|
{
|
||||||
var manifestName = typeof(Messages).Assembly.GetManifestResourceNames().FirstOrDefault(i => i.IndexOf("messages.properties", StringComparison.Ordinal) != -1);
|
var manifestName = typeof(Messages).Assembly.GetManifestResourceNames().FirstOrDefault(i => i.IndexOf("messages.properties", StringComparison.Ordinal) != -1);
|
||||||
|
|
||||||
Stream messagesStream =
|
var messagesStream =
|
||||||
typeof(Messages).Assembly
|
typeof(Messages).Assembly
|
||||||
.GetManifestResourceStream(manifestName);
|
.GetManifestResourceStream(manifestName);
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.TextEncoding
|
||||||
public CharacterEncoding DetectEncoding(byte[] buffer, int size)
|
public CharacterEncoding DetectEncoding(byte[] buffer, int size)
|
||||||
{
|
{
|
||||||
// First check if we have a BOM and return that if so
|
// First check if we have a BOM and return that if so
|
||||||
CharacterEncoding encoding = CheckBom(buffer, size);
|
var encoding = CheckBom(buffer, size);
|
||||||
if (encoding != CharacterEncoding.None)
|
if (encoding != CharacterEncoding.None)
|
||||||
{
|
{
|
||||||
return encoding;
|
return encoding;
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace UniversalDetector.Core
|
||||||
/// convert this encoding string to a number, here called order.
|
/// convert this encoding string to a number, here called order.
|
||||||
/// This allow multiple encoding of a language to share one frequency table
|
/// This allow multiple encoding of a language to share one frequency table
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="buf">A <see cref="System.Byte"/></param>
|
/// <param name="buf">A <see cref="byte"/></param>
|
||||||
/// <param name="offset"></param>
|
/// <param name="offset"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public abstract int GetOrder(byte[] buf, int offset);
|
public abstract int GetOrder(byte[] buf, int offset);
|
||||||
|
@ -91,7 +91,7 @@ namespace UniversalDetector.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Feed a character with known length
|
/// Feed a character with known length
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="buf">A <see cref="System.Byte"/></param>
|
/// <param name="buf">A <see cref="byte"/></param>
|
||||||
/// <param name="offset">buf offset</param>
|
/// <param name="offset">buf offset</param>
|
||||||
public void HandleOneChar(byte[] buf, int offset, int charLen)
|
public void HandleOneChar(byte[] buf, int offset, int charLen)
|
||||||
{
|
{
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace UniversalDetector.Core
|
||||||
{
|
{
|
||||||
byte[] result = null;
|
byte[] result = null;
|
||||||
|
|
||||||
using (MemoryStream ms = new MemoryStream(buf.Length))
|
using (var ms = new MemoryStream(buf.Length))
|
||||||
{
|
{
|
||||||
|
|
||||||
bool meetMSB = false;
|
bool meetMSB = false;
|
||||||
|
@ -156,7 +156,7 @@ namespace UniversalDetector.Core
|
||||||
{
|
{
|
||||||
byte[] result = null;
|
byte[] result = null;
|
||||||
|
|
||||||
using (MemoryStream ms = new MemoryStream(buf.Length))
|
using (var ms = new MemoryStream(buf.Length))
|
||||||
{
|
{
|
||||||
|
|
||||||
bool inTag = false;
|
bool inTag = false;
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace UniversalDetector.Core
|
||||||
}
|
}
|
||||||
else if (j != activeSM)
|
else if (j != activeSM)
|
||||||
{
|
{
|
||||||
CodingStateMachine t = codingSM[activeSM];
|
var t = codingSM[activeSM];
|
||||||
codingSM[activeSM] = codingSM[j];
|
codingSM[activeSM] = codingSM[j];
|
||||||
codingSM[j] = t;
|
codingSM[j] = t;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace UniversalDetector.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProbingState st = ProbingState.NotMe;
|
var st = ProbingState.NotMe;
|
||||||
|
|
||||||
for (int i = 0; i < probers.Length; i++)
|
for (int i = 0; i < probers.Length; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace UniversalDetector.Core
|
||||||
probers[7] = new SingleByteCharSetProber(new Win1253Model());
|
probers[7] = new SingleByteCharSetProber(new Win1253Model());
|
||||||
probers[8] = new SingleByteCharSetProber(new Latin5BulgarianModel());
|
probers[8] = new SingleByteCharSetProber(new Latin5BulgarianModel());
|
||||||
probers[9] = new SingleByteCharSetProber(new Win1251BulgarianModel());
|
probers[9] = new SingleByteCharSetProber(new Win1251BulgarianModel());
|
||||||
HebrewProber hebprober = new HebrewProber();
|
var hebprober = new HebrewProber();
|
||||||
probers[10] = hebprober;
|
probers[10] = hebprober;
|
||||||
// Logical
|
// Logical
|
||||||
probers[11] = new SingleByteCharSetProber(new Win1255Model(), false, hebprober);
|
probers[11] = new SingleByteCharSetProber(new Win1255Model(), false, hebprober);
|
||||||
|
@ -75,7 +75,7 @@ namespace UniversalDetector.Core
|
||||||
|
|
||||||
public override ProbingState HandleData(byte[] buf, int offset, int len)
|
public override ProbingState HandleData(byte[] buf, int offset, int len)
|
||||||
{
|
{
|
||||||
ProbingState st = ProbingState.NotMe;
|
var st = ProbingState.NotMe;
|
||||||
|
|
||||||
//apply filter to original buffer, and we got new buffer back
|
//apply filter to original buffer, and we got new buffer back
|
||||||
//depend on what script it is, we will feed them the new buffer
|
//depend on what script it is, we will feed them the new buffer
|
||||||
|
|
|
@ -168,7 +168,7 @@ namespace UniversalDetector.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProbingState st = ProbingState.NotMe;
|
var st = ProbingState.NotMe;
|
||||||
|
|
||||||
switch (inputState)
|
switch (inputState)
|
||||||
{
|
{
|
||||||
|
|
|
@ -415,7 +415,7 @@ namespace Emby.Server.Implementations.Updates
|
||||||
/// <param name="progress">The progress.</param>
|
/// <param name="progress">The progress.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">package</exception>
|
/// <exception cref="ArgumentNullException">package</exception>
|
||||||
public async Task InstallPackage(PackageVersionInfo package, bool isPlugin, IProgress<double> progress, CancellationToken cancellationToken)
|
public async Task InstallPackage(PackageVersionInfo package, bool isPlugin, IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (package == null)
|
if (package == null)
|
||||||
|
@ -626,7 +626,7 @@ namespace Emby.Server.Implementations.Updates
|
||||||
/// Uninstalls a plugin
|
/// Uninstalls a plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plugin">The plugin.</param>
|
/// <param name="plugin">The plugin.</param>
|
||||||
/// <exception cref="System.ArgumentException"></exception>
|
/// <exception cref="ArgumentException"></exception>
|
||||||
public void UninstallPlugin(IPlugin plugin)
|
public void UninstallPlugin(IPlugin plugin)
|
||||||
{
|
{
|
||||||
plugin.OnUninstalling();
|
plugin.OnUninstalling();
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Emby.XmlTv.Classes
|
||||||
|
|
||||||
private static XmlReader CreateXmlTextReader(string path)
|
private static XmlReader CreateXmlTextReader(string path)
|
||||||
{
|
{
|
||||||
XmlReaderSettings settings = new XmlReaderSettings();
|
var settings = new XmlReaderSettings();
|
||||||
|
|
||||||
// https://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.xmlresolver(v=vs.110).aspx
|
// https://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.xmlresolver(v=vs.110).aspx
|
||||||
// Looks like we don't need this anyway?
|
// Looks like we don't need this anyway?
|
||||||
|
|
|
@ -36,8 +36,8 @@ namespace Jellyfin.Server
|
||||||
|
|
||||||
public static async Task<int> Main(string[] args)
|
public static async Task<int> Main(string[] args)
|
||||||
{
|
{
|
||||||
StartupOptions options = new StartupOptions(args);
|
var options = new StartupOptions(args);
|
||||||
Version version = Assembly.GetEntryAssembly().GetName().Version;
|
var version = Assembly.GetEntryAssembly().GetName().Version;
|
||||||
|
|
||||||
if (options.ContainsOption("-v") || options.ContainsOption("--version"))
|
if (options.ContainsOption("-v") || options.ContainsOption("--version"))
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ namespace Jellyfin.Server
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerApplicationPaths appPaths = createApplicationPaths(options);
|
var appPaths = createApplicationPaths(options);
|
||||||
// $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager
|
// $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager
|
||||||
Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", appPaths.LogDirectoryPath);
|
Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", appPaths.LogDirectoryPath);
|
||||||
await createLogger(appPaths);
|
await createLogger(appPaths);
|
||||||
|
@ -57,7 +57,7 @@ namespace Jellyfin.Server
|
||||||
|
|
||||||
_logger.LogInformation("Jellyfin version: {Version}", version);
|
_logger.LogInformation("Jellyfin version: {Version}", version);
|
||||||
|
|
||||||
EnvironmentInfo environmentInfo = new EnvironmentInfo(getOperatingSystem());
|
var environmentInfo = new EnvironmentInfo(getOperatingSystem());
|
||||||
ApplicationHost.LogEnvironmentInfo(_logger, appPaths, environmentInfo);
|
ApplicationHost.LogEnvironmentInfo(_logger, appPaths, environmentInfo);
|
||||||
|
|
||||||
SQLitePCL.Batteries_V2.Init();
|
SQLitePCL.Batteries_V2.Init();
|
||||||
|
@ -173,7 +173,7 @@ namespace Jellyfin.Server
|
||||||
if (!File.Exists(configPath))
|
if (!File.Exists(configPath))
|
||||||
{
|
{
|
||||||
// For some reason the csproj name is used instead of the assembly name
|
// For some reason the csproj name is used instead of the assembly name
|
||||||
using (Stream rscstr = typeof(Program).Assembly
|
using (var rscstr = typeof(Program).Assembly
|
||||||
.GetManifestResourceStream("Jellyfin.Server.Resources.Configuration.logging.json"))
|
.GetManifestResourceStream("Jellyfin.Server.Resources.Configuration.logging.json"))
|
||||||
using (Stream fstr = File.Open(configPath, FileMode.CreateNew))
|
using (Stream fstr = File.Open(configPath, FileMode.CreateNew))
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace Jellyfin.SocketSharp
|
||||||
//
|
//
|
||||||
// We use a substream, as in 2.x we will support large uploads streamed to disk,
|
// We use a substream, as in 2.x we will support large uploads streamed to disk,
|
||||||
//
|
//
|
||||||
HttpPostedFile sub = new HttpPostedFile(e.Filename, e.ContentType, input, e.Start, e.Length);
|
var sub = new HttpPostedFile(e.Filename, e.ContentType, input, e.Start, e.Length);
|
||||||
files[e.Name] = sub;
|
files[e.Name] = sub;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,17 +207,17 @@ namespace Jellyfin.SocketSharp
|
||||||
|
|
||||||
async Task LoadWwwForm(WebROCollection form)
|
async Task LoadWwwForm(WebROCollection form)
|
||||||
{
|
{
|
||||||
using (Stream input = InputStream)
|
using (var input = InputStream)
|
||||||
{
|
{
|
||||||
using (var ms = new MemoryStream())
|
using (var ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
await input.CopyToAsync(ms).ConfigureAwait(false);
|
await input.CopyToAsync(ms).ConfigureAwait(false);
|
||||||
ms.Position = 0;
|
ms.Position = 0;
|
||||||
|
|
||||||
using (StreamReader s = new StreamReader(ms, ContentEncoding))
|
using (var s = new StreamReader(ms, ContentEncoding))
|
||||||
{
|
{
|
||||||
StringBuilder key = new StringBuilder();
|
var key = new StringBuilder();
|
||||||
StringBuilder value = new StringBuilder();
|
var value = new StringBuilder();
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while ((c = s.Read()) != -1)
|
while ((c = s.Read()) != -1)
|
||||||
|
@ -269,7 +269,7 @@ namespace Jellyfin.SocketSharp
|
||||||
{
|
{
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
StringBuilder result = new StringBuilder();
|
var result = new StringBuilder();
|
||||||
foreach (var pair in this)
|
foreach (var pair in this)
|
||||||
{
|
{
|
||||||
if (result.Length > 0)
|
if (result.Length > 0)
|
||||||
|
@ -715,7 +715,7 @@ namespace Jellyfin.SocketSharp
|
||||||
if (at_eof || ReadBoundary())
|
if (at_eof || ReadBoundary())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Element elem = new Element();
|
var elem = new Element();
|
||||||
string header;
|
string header;
|
||||||
while ((header = ReadHeaders()) != null)
|
while ((header = ReadHeaders()) != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -902,7 +902,7 @@ namespace MediaBrowser.Api.Library
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(_authContext, request);
|
var dtoOptions = GetDtoOptions(_authContext, request);
|
||||||
|
|
||||||
BaseItem parent = item.GetParent();
|
var parent = item.GetParent();
|
||||||
|
|
||||||
while (parent != null)
|
while (parent != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -751,7 +751,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
MediaSourceInfo mediaSource = null;
|
MediaSourceInfo mediaSource = null;
|
||||||
if (string.IsNullOrWhiteSpace(request.LiveStreamId))
|
if (string.IsNullOrWhiteSpace(request.LiveStreamId))
|
||||||
{
|
{
|
||||||
TranscodingJob currentJob = !string.IsNullOrWhiteSpace(request.PlaySessionId) ?
|
var currentJob = !string.IsNullOrWhiteSpace(request.PlaySessionId) ?
|
||||||
ApiEntryPoint.Instance.GetTranscodingJob(request.PlaySessionId)
|
ApiEntryPoint.Instance.GetTranscodingJob(request.PlaySessionId)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
/// <returns>IEnumerable{TaskInfo}.</returns>
|
/// <returns>IEnumerable{TaskInfo}.</returns>
|
||||||
/// <exception cref="MediaBrowser.Common.Extensions.ResourceNotFoundException">Task not found</exception>
|
/// <exception cref="ResourceNotFoundException">Task not found</exception>
|
||||||
public object Get(GetScheduledTask request)
|
public object Get(GetScheduledTask request)
|
||||||
{
|
{
|
||||||
var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
|
var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
|
||||||
|
@ -187,7 +187,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// Posts the specified request.
|
/// Posts the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
/// <exception cref="MediaBrowser.Common.Extensions.ResourceNotFoundException">Task not found</exception>
|
/// <exception cref="ResourceNotFoundException">Task not found</exception>
|
||||||
public void Post(StartScheduledTask request)
|
public void Post(StartScheduledTask request)
|
||||||
{
|
{
|
||||||
var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
|
var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
|
||||||
|
@ -214,7 +214,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// Posts the specified request.
|
/// Posts the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
/// <exception cref="MediaBrowser.Common.Extensions.ResourceNotFoundException">Task not found</exception>
|
/// <exception cref="ResourceNotFoundException">Task not found</exception>
|
||||||
public void Delete(StopScheduledTask request)
|
public void Delete(StopScheduledTask request)
|
||||||
{
|
{
|
||||||
var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
|
var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
|
||||||
|
@ -231,7 +231,7 @@ namespace MediaBrowser.Api.ScheduledTasks
|
||||||
/// Posts the specified request.
|
/// Posts the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
/// <exception cref="MediaBrowser.Common.Extensions.ResourceNotFoundException">Task not found</exception>
|
/// <exception cref="ResourceNotFoundException">Task not found</exception>
|
||||||
public void Post(UpdateScheduledTaskTriggers request)
|
public void Post(UpdateScheduledTaskTriggers request)
|
||||||
{
|
{
|
||||||
// We need to parse this manually because we told service stack not to with IRequiresRequestStream
|
// We need to parse this manually because we told service stack not to with IRequiresRequestStream
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace MediaBrowser.Api
|
||||||
var items = GetSimilaritems(item, libraryManager, inputItems, getSimilarityScore)
|
var items = GetSimilaritems(item, libraryManager, inputItems, getSimilarityScore)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
List<BaseItem> returnItems = items;
|
var returnItems = items;
|
||||||
|
|
||||||
if (request.Limit.HasValue)
|
if (request.Limit.HasValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -459,7 +459,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(val))
|
if (string.IsNullOrEmpty(val))
|
||||||
{
|
{
|
||||||
return Array.Empty<ValueTuple<string, Model.Entities.SortOrder>>();
|
return Array.Empty<ValueTuple<string, SortOrder>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var vals = val.Split(',');
|
var vals = val.Split(',');
|
||||||
|
@ -470,7 +470,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
var sortOrders = requestedSortOrder.Split(',');
|
var sortOrders = requestedSortOrder.Split(',');
|
||||||
|
|
||||||
var result = new ValueTuple<string, Model.Entities.SortOrder>[vals.Length];
|
var result = new ValueTuple<string, SortOrder>[vals.Length];
|
||||||
|
|
||||||
for (var i = 0; i < vals.Length; i++)
|
for (var i = 0; i < vals.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -479,7 +479,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
var sortOrderValue = sortOrders.Length > sortOrderIndex ? sortOrders[sortOrderIndex] : null;
|
var sortOrderValue = sortOrders.Length > sortOrderIndex ? sortOrders[sortOrderIndex] : null;
|
||||||
var sortOrder = string.Equals(sortOrderValue, "Descending", StringComparison.OrdinalIgnoreCase) ? MediaBrowser.Model.Entities.SortOrder.Descending : MediaBrowser.Model.Entities.SortOrder.Ascending;
|
var sortOrder = string.Equals(sortOrderValue, "Descending", StringComparison.OrdinalIgnoreCase) ? MediaBrowser.Model.Entities.SortOrder.Descending : MediaBrowser.Model.Entities.SortOrder.Ascending;
|
||||||
|
|
||||||
result[i] = new ValueTuple<string, Model.Entities.SortOrder>(vals[i], sortOrder);
|
result[i] = new ValueTuple<string, SortOrder>(vals[i], sortOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace MediaBrowser.Common.Net
|
||||||
/// <param name="options">The options.</param>
|
/// <param name="options">The options.</param>
|
||||||
/// <returns>Task{System.String}.</returns>
|
/// <returns>Task{System.String}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">progress</exception>
|
/// <exception cref="System.ArgumentNullException">progress</exception>
|
||||||
/// <exception cref="MediaBrowser.Model.Net.HttpException"></exception>
|
/// <exception cref="Model.Net.HttpException"></exception>
|
||||||
Task<string> GetTempFile(HttpRequestOptions options);
|
Task<string> GetTempFile(HttpRequestOptions options);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -212,7 +212,7 @@ namespace MediaBrowser.Common.Plugins
|
||||||
/// Returns true or false indicating success or failure
|
/// Returns true or false indicating success or failure
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="configuration">The configuration.</param>
|
/// <param name="configuration">The configuration.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">configuration</exception>
|
/// <exception cref="ArgumentNullException">configuration</exception>
|
||||||
public virtual void UpdateConfiguration(BasePluginConfiguration configuration)
|
public virtual void UpdateConfiguration(BasePluginConfiguration configuration)
|
||||||
{
|
{
|
||||||
if (configuration == null)
|
if (configuration == null)
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace MediaBrowser.Common.Plugins
|
||||||
/// Returns true or false indicating success or failure
|
/// Returns true or false indicating success or failure
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="configuration">The configuration.</param>
|
/// <param name="configuration">The configuration.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">configuration</exception>
|
/// <exception cref="ArgumentNullException">configuration</exception>
|
||||||
void UpdateConfiguration(BasePluginConfiguration configuration);
|
void UpdateConfiguration(BasePluginConfiguration configuration);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -108,14 +108,14 @@ namespace MediaBrowser.Common.Updates
|
||||||
/// <param name="progress">The progress.</param>
|
/// <param name="progress">The progress.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">package</exception>
|
/// <exception cref="ArgumentNullException">package</exception>
|
||||||
Task InstallPackage(PackageVersionInfo package, bool isPlugin, IProgress<double> progress, CancellationToken cancellationToken);
|
Task InstallPackage(PackageVersionInfo package, bool isPlugin, IProgress<double> progress, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Uninstalls a plugin
|
/// Uninstalls a plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plugin">The plugin.</param>
|
/// <param name="plugin">The plugin.</param>
|
||||||
/// <exception cref="System.ArgumentException"></exception>
|
/// <exception cref="ArgumentException"></exception>
|
||||||
void UninstallPlugin(IPlugin plugin);
|
void UninstallPlugin(IPlugin plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user