Merge pull request #506 from hawken93/linting

Removing tabs and trailing whitespace
This commit is contained in:
Joshua M. Boniface 2019-01-10 19:54:18 -05:00 committed by GitHub
commit 15c89d281e
345 changed files with 3264 additions and 3508 deletions

View File

@ -3,7 +3,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BDInfo")]
@ -19,11 +19,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1")]

View File

@ -148,7 +148,7 @@ namespace BDInfo
stream.IsVBR = true;
stream.IsInitialized = true;
break;
default:
stream.IsVBR = false;
stream.IsInitialized = true;

View File

@ -22,9 +22,9 @@ namespace BDInfo
{
public abstract class TSCodecDTSHD
{
private static int[] SampleRates = new int[]
private static int[] SampleRates = new int[]
{ 0x1F40, 0x3E80, 0x7D00, 0x0FA00, 0x1F400, 0x5622, 0x0AC44, 0x15888, 0x2B110, 0x56220, 0x2EE0, 0x5DC0, 0x0BB80, 0x17700, 0x2EE00, 0x5DC00 };
public static void Scan(
TSAudioStream stream,
TSStreamBuffer buffer,
@ -131,7 +131,7 @@ namespace BDInfo
else
{
AssetSizes[i] = buffer.ReadBits(16) + 1;
}
}
}
for (int i = 0; i < nuNumAssets; i++)
{
@ -189,7 +189,7 @@ namespace BDInfo
}
stream.SampleRate = SampleRates[nuMaxSampleRate];
stream.BitDepth = nuBitResolution;
stream.LFE = 0;
if ((nuSpkrActivityMask & 0x8) == 0x8)
{
@ -240,7 +240,7 @@ namespace BDInfo
stream.IsInitialized = true;
}
stream.IsInitialized = (stream.BitRate > 0 ? true : false);
}
}
}
}
}

View File

@ -33,7 +33,7 @@ namespace BDInfo
int pictureParse = 0;
int sequenceHeaderParse = 0;
int extensionParse = 0;
int sequenceExtensionParse = 0;
int sequenceExtensionParse = 0;
for (int i = 0; i < buffer.Length; i++)
{
@ -189,7 +189,7 @@ namespace BDInfo
#if DEBUG
if (sequenceExtensionParse == 0)
{
uint sequenceExtension =
uint sequenceExtension =
((parse & 0x8) >> 3);
if (sequenceExtension == 0)
{

View File

@ -36,7 +36,7 @@ namespace BDInfo
for (int i = 0; i < buffer.Length; i++)
{
sync = (sync << 8) + buffer.ReadByte();
if (sync == 0xF8726FBA)
if (sync == 0xF8726FBA)
{
syncFound = true;
break;
@ -63,7 +63,7 @@ namespace BDInfo
int ratebits = buffer.ReadBits(4);
if (ratebits != 0xF)
{
stream.SampleRate =
stream.SampleRate =
(((ratebits & 8) > 0 ? 44100 : 48000) << (ratebits & 7));
}
int temp1 = buffer.ReadBits(8);
@ -149,9 +149,9 @@ namespace BDInfo
int peak_bitrate = buffer.ReadBits(15);
peak_bitrate = (peak_bitrate * stream.SampleRate) >> 4;
double peak_bitdepth =
(double)peak_bitrate /
(stream.ChannelCount + stream.LFE) /
double peak_bitdepth =
(double)peak_bitrate /
(stream.ChannelCount + stream.LFE) /
stream.SampleRate;
if (peak_bitdepth > 14)
{
@ -164,7 +164,7 @@ namespace BDInfo
#if DEBUG
System.Diagnostics.Debug.WriteLine(string.Format(
"{0}\t{1}\t{2:F2}",
"{0}\t{1}\t{2:F2}",
stream.PID, peak_bitrate, peak_bitdepth));
#endif
/*

View File

@ -50,18 +50,18 @@ namespace BDInfo
{
if ((parse & 0x80000000) == 0)
{
pictureType =
pictureType =
(uint)((parse & 0x78000000) >> 13);
}
else
{
pictureType =
pictureType =
(uint)((parse & 0x3c000000) >> 12);
}
}
else
{
pictureType =
pictureType =
(uint)((parse & 0xf0000000) >> 14);
}

View File

@ -42,7 +42,7 @@ namespace BDInfo
public List<double> Chapters = new List<double>();
public Dictionary<ushort, TSStream> Streams =
public Dictionary<ushort, TSStream> Streams =
new Dictionary<ushort, TSStream>();
public Dictionary<ushort, TSStream> PlaylistStreams =
new Dictionary<ushort, TSStream>();
@ -50,19 +50,19 @@ namespace BDInfo
new List<TSStreamClip>();
public List<Dictionary<ushort, TSStream>> AngleStreams =
new List<Dictionary<ushort, TSStream>>();
public List<Dictionary<double, TSStreamClip>> AngleClips =
public List<Dictionary<double, TSStreamClip>> AngleClips =
new List<Dictionary<double, TSStreamClip>>();
public int AngleCount = 0;
public List<TSStream> SortedStreams =
public List<TSStream> SortedStreams =
new List<TSStream>();
public List<TSVideoStream> VideoStreams =
public List<TSVideoStream> VideoStreams =
new List<TSVideoStream>();
public List<TSAudioStream> AudioStreams =
public List<TSAudioStream> AudioStreams =
new List<TSAudioStream>();
public List<TSTextStream> TextStreams =
public List<TSTextStream> TextStreams =
new List<TSTextStream>();
public List<TSGraphicsStream> GraphicsStreams =
public List<TSGraphicsStream> GraphicsStreams =
new List<TSGraphicsStream>();
public TSPlaylistFile(
@ -388,8 +388,8 @@ namespace BDInfo
#if DEBUG
Debug.WriteLine(string.Format(
"{0} : {1} -> V:{2} A:{3} PG:{4} IG:{5} 2A:{6} 2V:{7} PIP:{8}",
Name, streamFileName, streamCountVideo, streamCountAudio, streamCountPG, streamCountIG,
"{0} : {1} -> V:{2} A:{3} PG:{4} IG:{5} 2A:{6} 2V:{7} PIP:{8}",
Name, streamFileName, streamCountVideo, streamCountAudio, streamCountPG, streamCountIG,
streamCountSecondaryAudio, streamCountSecondaryVideo, streamCountPIP));
#endif
@ -427,7 +427,7 @@ namespace BDInfo
}
/*
* TODO
*
*
for (int i = 0; i < streamCountPIP; i++)
{
TSStream stream = CreatePlaylistStream(data, ref pos);
@ -955,7 +955,7 @@ namespace BDInfo
}
public int CompareVideoStreams(
TSVideoStream x,
TSVideoStream x,
TSVideoStream y)
{
if (x == null && y == null)
@ -996,7 +996,7 @@ namespace BDInfo
}
public int CompareAudioStreams(
TSAudioStream x,
TSAudioStream x,
TSAudioStream y)
{
if (x == y)

View File

@ -109,7 +109,7 @@ namespace BDInfo
public TSDescriptor Clone()
{
TSDescriptor descriptor =
TSDescriptor descriptor =
new TSDescriptor(Name, (byte)Value.Length);
Value.CopyTo(descriptor.Value, 0);
return descriptor;
@ -153,15 +153,15 @@ namespace BDInfo
private string _LanguageCode;
public string LanguageCode
{
get
get
{
return _LanguageCode;
return _LanguageCode;
}
set
set
{
_LanguageCode = value;
LanguageName = LanguageCodes.GetName(value);
}
}
}
public bool IsVideoStream
@ -407,7 +407,7 @@ namespace BDInfo
}
public abstract TSStream Clone();
protected void CopyTo(TSStream stream)
{
stream.PID = PID;
@ -435,7 +435,7 @@ namespace BDInfo
public int Width;
public int Height;
public bool IsInterlaced;
public bool IsInterlaced;
public int FrameRateEnumerator;
public int FrameRateDenominator;
public TSAspectRatio AspectRatio;
@ -581,7 +581,7 @@ namespace BDInfo
stream.FrameRate = _FrameRate;
stream.Width = Width;
stream.Height = Height;
stream.IsInterlaced = IsInterlaced;
stream.IsInterlaced = IsInterlaced;
stream.FrameRateEnumerator = FrameRateEnumerator;
stream.FrameRateDenominator = FrameRateDenominator;
stream.AspectRatio = AspectRatio;

View File

@ -69,7 +69,7 @@ namespace BDInfo
byte[] fileType = new byte[8];
Array.Copy(data, 0, fileType, 0, fileType.Length);
FileType = _textEncoding.GetASCIIEncoding().GetString(fileType, 0, fileType.Length);
if (FileType != "HDMV0100" &&
FileType != "HDMV0200")
@ -78,7 +78,7 @@ namespace BDInfo
"Clip info file {0} has an unknown file type {1}.",
FileInfo.Name, FileType));
}
#if DEBUG
#if DEBUG
Debug.WriteLine(string.Format(
"\tFileType: {0}", FileType));
#endif
@ -110,9 +110,9 @@ namespace BDInfo
TSStream stream = null;
ushort PID = (ushort)
((clipData[streamOffset] << 8) +
((clipData[streamOffset] << 8) +
clipData[streamOffset + 1]);
streamOffset += 2;
TSStreamType streamType = (TSStreamType)
@ -240,7 +240,7 @@ namespace BDInfo
}
streamOffset += clipData[streamOffset] + 1;
}
}
IsValid = true;
}
finally

View File

@ -391,7 +391,7 @@ namespace BDInfo
}
Dictionary<ushort, TSStream> playlistStreams = playlist.Streams;
if (clip.AngleIndex > 0 &&
if (clip.AngleIndex > 0 &&
clip.AngleIndex < playlist.AngleStreams.Count + 1)
{
playlistStreams = playlist.AngleStreams[clip.AngleIndex - 1];
@ -428,7 +428,7 @@ namespace BDInfo
TSStream stream = Streams[PID];
stream.PayloadBytes += streamState.WindowBytes;
stream.PacketCount += streamState.WindowPackets;
if (stream.IsVideoStream)
{
TSStreamDiagnostics diag = new TSStreamDiagnostics();
@ -457,7 +457,7 @@ namespace BDInfo
int dataSize = 16384;
Stream fileStream = null;
try
{
{
string fileName;
if (BDInfoSettings.EnableSSIF &&
InterleavedFile != null)
@ -482,13 +482,13 @@ namespace BDInfo
StreamStates.Clear();
StreamDiagnostics.Clear();
TSPacketParser parser =
TSPacketParser parser =
new TSPacketParser();
long fileLength = (uint)fileStream.Length;
byte[] buffer = new byte[dataSize];
int bufferLength = 0;
while ((bufferLength =
while ((bufferLength =
fileStream.Read(buffer, 0, buffer.Length)) > 0)
{
int offset = 0;
@ -598,8 +598,8 @@ namespace BDInfo
parser.StreamState.TransferCount++;
bool isFinished = ScanStream(
parser.Stream,
parser.StreamState,
parser.Stream,
parser.StreamState,
parser.StreamState.StreamBuffer);
if (!isFullScan && isFinished)
@ -680,10 +680,10 @@ namespace BDInfo
for (int k = 0; k < (parser.PATOffset - 4); k += 4)
{
uint programNumber = (uint)
((parser.PAT[k] << 8) +
((parser.PAT[k] << 8) +
parser.PAT[k + 1]);
ushort programPID = (ushort)
ushort programPID = (ushort)
(((parser.PAT[k + 2] & 0x1F) << 8) +
parser.PAT[k + 3]);
@ -985,7 +985,7 @@ namespace BDInfo
parser.PMTProgramDescriptorLength = buffer[i];
parser.PMTProgramDescriptors.Add(
new TSDescriptor(
parser.PMTProgramDescriptor,
parser.PMTProgramDescriptor,
parser.PMTProgramDescriptorLength));
break;
}
@ -998,7 +998,7 @@ namespace BDInfo
parser.PMTProgramDescriptors.Count - 1];
int valueIndex =
descriptor.Value.Length -
descriptor.Value.Length -
parser.PMTProgramDescriptorLength - 1;
descriptor.Value[valueIndex] = buffer[i];
@ -1020,8 +1020,8 @@ namespace BDInfo
parser.SyncState = false;
}
}
else if (parser.Stream != null &&
parser.StreamState != null &&
else if (parser.Stream != null &&
parser.StreamState != null &&
parser.TransportScramblingControl == 0)
{
TSStream stream = parser.Stream;
@ -1032,7 +1032,7 @@ namespace BDInfo
if (streamState.TransferState)
{
if ((bufferLength - i) >= streamState.PacketLength &&
if ((bufferLength - i) >= streamState.PacketLength &&
streamState.PacketLength > 0)
{
offset = streamState.PacketLength;
@ -1085,7 +1085,7 @@ namespace BDInfo
--parser.PacketLength;
bool headerFound = false;
if (stream.IsVideoStream &&
if (stream.IsVideoStream &&
streamState.Parse == 0x000001FD)
{
headerFound = true;
@ -1170,18 +1170,18 @@ namespace BDInfo
(byte)(streamState.Parse & 0xFF);
#endif
break;
case 1:
streamState.PESHeaderFlags =
streamState.PESHeaderFlags =
(byte)(streamState.Parse & 0xFF);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
case 0:
streamState.PESHeaderLength =
streamState.PESHeaderLength =
(byte)(streamState.Parse & 0xFF);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
@ -1211,48 +1211,48 @@ namespace BDInfo
switch (streamState.PTSParse)
{
case 4:
streamState.PTSTemp =
streamState.PTSTemp =
((streamState.Parse & 0xE) << 29);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
break;
case 3:
streamState.PTSTemp |=
streamState.PTSTemp |=
((streamState.Parse & 0xFF) << 22);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
case 2:
streamState.PTSTemp |=
streamState.PTSTemp |=
((streamState.Parse & 0xFE) << 14);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
case 1:
streamState.PTSTemp |=
streamState.PTSTemp |=
((streamState.Parse & 0xFF) << 7);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
case 0:
streamState.PTSTemp |=
streamState.PTSTemp |=
((streamState.Parse & 0xFE) >> 1);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
#endif
streamState.PTS = streamState.PTSTemp;
if (streamState.PTS > streamState.PTSLast)
@ -1260,13 +1260,13 @@ namespace BDInfo
if (streamState.PTSLast > 0)
{
streamState.PTSTransfer = (streamState.PTS - streamState.PTSLast);
}
}
streamState.PTSLast = streamState.PTS;
}
streamState.PTSDiff = streamState.PTS - streamState.DTSPrev;
if (streamState.PTSCount > 0 &&
if (streamState.PTSCount > 0 &&
stream.IsVideoStream)
{
UpdateStreamBitrates(stream.PID, streamState.PTS, streamState.PTSDiff);
@ -1280,7 +1280,7 @@ namespace BDInfo
}
Length = (double)(parser.PTSLast - parser.PTSFirst) / 90000;
}
streamState.DTSPrev = streamState.PTS;
streamState.PTSCount++;
if (streamState.PESHeaderLength == 0)
@ -1299,46 +1299,46 @@ namespace BDInfo
switch (streamState.DTSParse)
{
case 9:
streamState.PTSTemp =
streamState.PTSTemp =
((streamState.Parse & 0xE) << 29);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
case 8:
streamState.PTSTemp |=
streamState.PTSTemp |=
((streamState.Parse & 0xFF) << 22);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
case 7:
streamState.PTSTemp |=
streamState.PTSTemp |=
((streamState.Parse & 0xFE) << 14);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
break;
case 6:
streamState.PTSTemp |=
streamState.PTSTemp |=
((streamState.Parse & 0xFF) << 7);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
case 5:
streamState.PTSTemp |=
streamState.PTSTemp |=
((streamState.Parse & 0xFE) >> 1);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
streamState.PTS = streamState.PTSTemp;
@ -1347,48 +1347,48 @@ namespace BDInfo
streamState.PTSLast = streamState.PTS;
}
break;
case 4:
streamState.DTSTemp =
streamState.DTSTemp =
((streamState.Parse & 0xE) << 29);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
break;
case 3:
streamState.DTSTemp |=
streamState.DTSTemp |=
((streamState.Parse & 0xFF) << 22);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
break;
case 2:
streamState.DTSTemp |=
streamState.DTSTemp |=
((streamState.Parse & 0xFE) << 14);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
break;
case 1:
streamState.DTSTemp |=
streamState.DTSTemp |=
((streamState.Parse & 0xFF) << 7);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
case 0:
streamState.DTSTemp |=
streamState.DTSTemp |=
((streamState.Parse & 0xFE) >> 1);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
streamState.PTSDiff = streamState.DTSTemp - streamState.DTSPrev;
@ -1482,8 +1482,8 @@ namespace BDInfo
}
private TSStream CreateStream(
ushort streamPID,
byte streamType,
ushort streamPID,
byte streamType,
List<TSDescriptor> streamDescriptors)
{
TSStream stream = null;
@ -1548,6 +1548,6 @@ namespace BDInfo
}
return stream;
}
}
}
}

View File

@ -68,7 +68,7 @@ namespace DvdLib.Ifo
ProhibitedUserOperations = (UserOperation)br.ReadUInt32();
AudioStreamControl = br.ReadBytes(16);
SubpictureStreamControl = br.ReadBytes(128);
_nextProgramNumber = br.ReadUInt16();
_prevProgramNumber = br.ReadUInt16();
_goupProgramNumber = br.ReadUInt16();

View File

@ -20,7 +20,7 @@ namespace DvdLib.Ifo
public ProgramChain EntryProgramChain { get; private set; }
public readonly List<ProgramChain> ProgramChains;
public readonly List<Chapter> Chapters;
public readonly List<Chapter> Chapters;
public Title(uint titleNum)
{

View File

@ -3,7 +3,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DvdLib")]
@ -19,11 +19,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1")]

View File

@ -1,6 +1,6 @@

namespace Emby.Dlna.Common
{
{
public class Argument
{
public string Name { get; set; }

View File

@ -77,7 +77,7 @@ namespace Emby.Dlna.ConnectionManager
return action;
}
private ServiceAction GetCurrentConnectionInfo()
{
var action = new ServiceAction

View File

@ -8,7 +8,7 @@ namespace Emby.Dlna.ContentDirectory
{
public string GetXml()
{
return new ServiceXmlBuilder().GetXml(new ServiceActionListBuilder().GetActions(),
return new ServiceXmlBuilder().GetXml(new ServiceActionListBuilder().GetActions(),
GetStateVariables());
}

View File

@ -334,7 +334,7 @@ namespace Emby.Dlna.ContentDirectory
return action;
}
private ServiceAction GetXSetBookmarkAction()
{
var action = new ServiceAction

View File

@ -10,7 +10,7 @@ namespace Emby.Dlna
/// <param name="headers">The headers.</param>
/// <returns>System.String.</returns>
string GetServiceXml(IDictionary<string, string> headers);
/// <summary>
/// Processes the control request.
/// </summary>

View File

@ -75,11 +75,11 @@ namespace Emby.Dlna.Main
IUserDataManager userDataManager,
ILocalizationManager localizationManager,
IMediaSourceManager mediaSourceManager,
IDeviceDiscovery deviceDiscovery,
IMediaEncoder mediaEncoder,
ISocketFactory socketFactory,
ITimerFactory timerFactory,
IEnvironmentInfo environmentInfo,
IDeviceDiscovery deviceDiscovery,
IMediaEncoder mediaEncoder,
ISocketFactory socketFactory,
ITimerFactory timerFactory,
IEnvironmentInfo environmentInfo,
INetworkManager networkManager,
IUserViewManager userViewManager,
IXmlReaderSettingsFactory xmlReaderSettingsFactory,
@ -104,19 +104,19 @@ namespace Emby.Dlna.Main
_networkManager = networkManager;
_logger = loggerFactory.CreateLogger("Dlna");
ContentDirectory = new ContentDirectory.ContentDirectory(dlnaManager,
userDataManager,
imageProcessor,
libraryManager,
config,
userManager,
_logger,
httpClient,
localizationManager,
mediaSourceManager,
ContentDirectory = new ContentDirectory.ContentDirectory(dlnaManager,
userDataManager,
imageProcessor,
libraryManager,
config,
userManager,
_logger,
httpClient,
localizationManager,
mediaSourceManager,
userViewManager,
mediaEncoder,
xmlReaderSettingsFactory,
mediaEncoder,
xmlReaderSettingsFactory,
tvSeriesManager);
ConnectionManager = new ConnectionManager.ConnectionManager(dlnaManager, config, _logger, httpClient, xmlReaderSettingsFactory);
@ -271,12 +271,12 @@ namespace Emby.Dlna.Main
var device = new SsdpRootDevice
{
CacheLifetime = TimeSpan.FromSeconds(1800), //How long SSDP clients can cache this info.
Location = uri, // Must point to the URL that serves your devices UPnP description document.
Location = uri, // Must point to the URL that serves your devices UPnP description document.
FriendlyName = "Jellyfin",
Manufacturer = "Jellyfin",
ModelName = "Jellyfin Server",
Uuid = udn
// This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
// This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
};
SetProperies(device, fullService);
@ -297,7 +297,7 @@ namespace Emby.Dlna.Main
Manufacturer = device.Manufacturer,
ModelName = device.ModelName,
Uuid = udn
// This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
// This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
};
SetProperies(embeddedDevice, subDevice);

View File

@ -739,7 +739,7 @@ namespace Emby.Dlna.PlayTo
if (track == null)
{
//If track is null, some vendors do this, use GetMediaInfo instead
//If track is null, some vendors do this, use GetMediaInfo instead
return new Tuple<bool, uBaseObject>(true, null);
}

View File

@ -25,10 +25,10 @@ namespace Emby.Dlna.PlayTo
_config = config;
}
public async Task<XDocument> SendCommandAsync(string baseUrl,
DeviceService service,
string command,
string postData,
public async Task<XDocument> SendCommandAsync(string baseUrl,
DeviceService service,
string command,
string postData,
bool logRequest = true,
string header = null)
{
@ -62,12 +62,12 @@ namespace Emby.Dlna.PlayTo
}
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
public async Task SubscribeAsync(string url,
string ip,
int port,
string localIp,
int eventport,
public async Task SubscribeAsync(string url,
string ip,
int port,
string localIp,
int eventport,
int timeOut = 3600)
{
var options = new HttpRequestOptions
@ -121,9 +121,9 @@ namespace Emby.Dlna.PlayTo
}
}
private Task<HttpResponseInfo> PostSoapDataAsync(string url,
string soapAction,
string postData,
private Task<HttpResponseInfo> PostSoapDataAsync(string url,
string soapAction,
string postData,
string header,
bool logRequest,
CancellationToken cancellationToken)

View File

@ -171,7 +171,7 @@ namespace Emby.Dlna.PlayTo
if (state != null)
{
var sendValue = state.AllowedValues.FirstOrDefault(a => string.Equals(a, commandParameter, StringComparison.OrdinalIgnoreCase)) ??
state.AllowedValues.FirstOrDefault() ??
state.AllowedValues.FirstOrDefault() ??
value;
return string.Format("<{0} xmlns:dt=\"urn:schemas-microsoft-com:datatypes\" dt:dt=\"{1}\">{2}</{0}>", argument.Name, state.DataType ?? "string", sendValue);

View File

@ -2,7 +2,7 @@
namespace Emby.Dlna.PlayTo
{
public class uBaseObject
public class uBaseObject
{
public string Id { get; set; }

View File

@ -20,7 +20,7 @@ namespace Emby.Dlna.PlayTo
if (document == null)
return list;
var item = (from result in document.Descendants("Result") select result).FirstOrDefault();
if (item == null)

View File

@ -41,7 +41,7 @@ namespace Emby.Dlna.Profiles
EnableSingleAlbumArtLimit = true;
EnableAlbumArtInDidl = true;
TranscodingProfiles = new[]
{
new TranscodingProfile

View File

@ -3,7 +3,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.Dlna2")]
@ -19,11 +19,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

View File

@ -14,7 +14,7 @@ namespace Emby.Dlna.Service
protected BaseService(ILogger logger, IHttpClient httpClient)
{
Logger = logger;
HttpClient = httpClient;
HttpClient = httpClient;
EventManager = new EventManager(Logger, HttpClient);
}

View File

@ -10,7 +10,7 @@ namespace Emby.Dlna.Service
public class ControlErrorHandler
{
private const string NS_SOAPENV = "http://schemas.xmlsoap.org/soap/envelope/";
public ControlResponse GetResponse(Exception ex)
{
var settings = new XmlWriterSettings

View File

@ -83,8 +83,8 @@ namespace Emby.Dlna.Ssdp
{
_deviceLocator = new SsdpDeviceLocator(_commsServer, _timerFactory);
// (Optional) Set the filter so we only see notifications for devices we care about
// (can be any search target value i.e device type, uuid value etc - any value that appears in the
// (Optional) Set the filter so we only see notifications for devices we care about
// (can be any search target value i.e device type, uuid value etc - any value that appears in the
// DiscoverdSsdpDevice.NotificationType property or that is used with the searchTarget parameter of the Search method).
//_DeviceLocator.NotificationFilter = "upnp:rootdevice";

View File

@ -3,7 +3,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.Drawing.Skia")]
@ -19,7 +19,7 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//

View File

@ -103,7 +103,7 @@ namespace Emby.Drawing
"crw",
// Remove until supported
//"nef",
//"nef",
"orf",
"pef",
"arw",

View File

@ -1,7 +1,7 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.Drawing")]
@ -13,8 +13,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//

View File

@ -48,7 +48,7 @@ namespace IsoMounter
if (disposed) {
return;
}
if (disposing) {
//

View File

@ -29,7 +29,7 @@ namespace Emby.Naming.AudioBook
/// </summary>
/// <value>The alternate versions.</value>
public List<AudioBookFileInfo> AlternateVersions { get; set; }
public AudioBookInfo()
{
Files = new List<AudioBookFileInfo>();

View File

@ -46,7 +46,7 @@ namespace Emby.Naming.AudioBook
var parsingResult = new AudioBookFilePathParser(_options)
.Parse(path, IsDirectory);
return new AudioBookFileInfo
{
Path = path,

View File

@ -282,7 +282,7 @@ namespace Emby.Naming.Common
new EpisodeExpression(@".*(\\|\/)(?<seriesname>((?![Ss]([0-9]+)[][ ._-]*[Ee]([0-9]+))[^\\\/])*)?[Ss](?<seasonnumber>[0-9]+)[][ ._-]*[Ee](?<epnumber>[0-9]+)([^\\/]*)$")
{
IsNamed = true
},
},
// <!-- foo.ep01, foo.EP_01 -->
new EpisodeExpression(@"[\._ -]()[Ee][Pp]_?([0-9]+)([^\\/]*)$"),
new EpisodeExpression("([0-9]{4})[\\.-]([0-9]{2})[\\.-]([0-9]{2})", true)

View File

@ -53,7 +53,7 @@ namespace Emby.Naming.TV
var parsingResult = new EpisodePathParser(_options)
.Parse(path, IsDirectory, isNamed, isOptimistic, supportsAbsoluteNumbers, fillExtendedInfo);
return new EpisodeInfo
{
Path = path,

View File

@ -38,7 +38,7 @@ namespace Emby.Naming.Video
}
catch (ArgumentException)
{
}
var result = _options.CleanDateTimeRegexes.Select(i => Clean(name, i))

View File

@ -126,7 +126,7 @@ namespace Emby.Naming.Video
}
stack.Files.Add(file2.FullName);
}
else
else
{
// Sequel
offset = 0;

View File

@ -18,7 +18,7 @@ namespace Emby.Naming.Video
{
var result = new StubResult();
var extension = Path.GetExtension(path) ?? string.Empty;
if (_options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
{
result.IsStub = true;

View File

@ -55,7 +55,7 @@ namespace Emby.Naming.Video
/// Gets or sets the type of the stub.
/// </summary>
/// <value>The type of the stub.</value>
public string StubType { get; set; }
public string StubType { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>

View File

@ -32,7 +32,7 @@ namespace Emby.Naming.Video
/// </summary>
/// <value>The alternate versions.</value>
public List<VideoFileInfo> AlternateVersions { get; set; }
public VideoInfo()
{
Files = new List<VideoFileInfo>();

View File

@ -55,9 +55,9 @@ namespace Emby.Naming.Video
info.Year = info.Files.First().Year;
var extraBaseNames = new List<string>
var extraBaseNames = new List<string>
{
stack.Name,
stack.Name,
Path.GetFileNameWithoutExtension(stack.Files[0])
};

View File

@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.Photos")]
@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -25,10 +25,10 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

View File

@ -15,14 +15,14 @@ namespace Emby.Server.Implementations.Archiving
/// </summary>
public class ZipClient : IZipClient
{
private readonly IFileSystem _fileSystem;
private readonly IFileSystem _fileSystem;
public ZipClient(IFileSystem fileSystem)
{
_fileSystem = fileSystem;
}
public ZipClient(IFileSystem fileSystem)
{
_fileSystem = fileSystem;
}
/// <summary>
/// <summary>
/// Extracts all.
/// </summary>
/// <param name="sourceFile">The source file.</param>
@ -30,7 +30,7 @@ namespace Emby.Server.Implementations.Archiving
/// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
public void ExtractAll(string sourceFile, string targetPath, bool overwriteExistingFiles)
{
using (var fileStream = _fileSystem.OpenRead(sourceFile))
using (var fileStream = _fileSystem.OpenRead(sourceFile))
{
ExtractAll(fileStream, targetPath, overwriteExistingFiles);
}
@ -116,7 +116,7 @@ namespace Emby.Server.Implementations.Archiving
/// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
public void ExtractAllFrom7z(string sourceFile, string targetPath, bool overwriteExistingFiles)
{
using (var fileStream = _fileSystem.OpenRead(sourceFile))
using (var fileStream = _fileSystem.OpenRead(sourceFile))
{
ExtractAllFrom7z(fileStream, targetPath, overwriteExistingFiles);
}
@ -156,7 +156,7 @@ namespace Emby.Server.Implementations.Archiving
/// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
public void ExtractAllFromTar(string sourceFile, string targetPath, bool overwriteExistingFiles)
{
using (var fileStream = _fileSystem.OpenRead(sourceFile))
using (var fileStream = _fileSystem.OpenRead(sourceFile))
{
ExtractAllFromTar(fileStream, targetPath, overwriteExistingFiles);
}

View File

@ -41,7 +41,7 @@ namespace Emby.Server.Implementations.Browser
}
catch (NotSupportedException)
{
}
catch (Exception)
{

View File

@ -902,7 +902,7 @@ namespace Emby.Server.Implementations.Channels
where T : BaseItem, new()
{
var id = _libraryManager.GetNewItemId(GetIdToHash(idString, channelName), typeof(T));
T item = null;
try

View File

@ -70,8 +70,8 @@ namespace Emby.Server.Implementations.Channels
/// </summary>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
return new[] {
return new[] {
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
};

View File

@ -4038,7 +4038,7 @@ namespace Emby.Server.Implementations.Data
if (query.PersonIds.Length > 0)
{
// TODO: Should this query with CleanName ?
// TODO: Should this query with CleanName ?
var clauses = new List<string>();
var index = 0;
@ -5399,7 +5399,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
var itemIdBlob = itemId.ToGuidBlob();
// First delete
// First delete
deleteAncestorsStatement.Reset();
deleteAncestorsStatement.TryBind("@ItemId", itemIdBlob);
deleteAncestorsStatement.MoveNext();
@ -5927,7 +5927,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
var guidBlob = itemId.ToGuidBlob();
// First delete
// First delete
db.Execute("delete from ItemValues where ItemId=@Id", guidBlob);
InsertItemValues(guidBlob, values, db);

View File

@ -10,8 +10,8 @@ namespace Emby.Server.Implementations.Devices
public class DeviceId
{
private readonly IApplicationPaths _appPaths;
private readonly ILogger _logger;
private readonly IFileSystem _fileSystem;
private readonly ILogger _logger;
private readonly IFileSystem _fileSystem;
private readonly object _syncLock = new object();
@ -26,7 +26,7 @@ namespace Emby.Server.Implementations.Devices
{
lock (_syncLock)
{
var value = File.ReadAllText(CachePath, Encoding.UTF8);
var value = File.ReadAllText(CachePath, Encoding.UTF8);
Guid guid;
if (Guid.TryParse(value, out guid))
@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Devices
{
var path = CachePath;
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
lock (_syncLock)
{
@ -92,13 +92,13 @@ namespace Emby.Server.Implementations.Devices
public DeviceId(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem)
{
if (fileSystem == null) {
throw new ArgumentNullException ("fileSystem");
}
if (fileSystem == null) {
throw new ArgumentNullException ("fileSystem");
}
_appPaths = appPaths;
_logger = logger;
_fileSystem = fileSystem;
_fileSystem = fileSystem;
}
public string Value

View File

@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.Devices
HasUser = true
}).Items;
// TODO: DeviceQuery doesn't seem to be used from client. Not even Swagger.
if (query.SupportsSync.HasValue)
{

View File

@ -471,7 +471,7 @@ namespace Emby.Server.Implementations.EntryPoints
LibraryUpdateTimer.Dispose();
LibraryUpdateTimer = null;
}
_libraryManager.ItemAdded -= libraryManager_ItemAdded;
_libraryManager.ItemUpdated -= libraryManager_ItemUpdated;
_libraryManager.ItemRemoved -= libraryManager_ItemRemoved;

View File

@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.FFMpeg
{
var encoderFilename = Path.GetFileName(info.EncoderPath);
var probeFilename = Path.GetFileName(info.ProbePath);
foreach (var directory in _fileSystem.GetDirectoryPaths(rootEncoderPath)
.ToList())
{

View File

@ -148,7 +148,7 @@ namespace Emby.Server.Implementations.HttpServer
}
}
private string[] SkipLogExtensions = new string[]
private string[] SkipLogExtensions = new string[]
{
".js",
".html",

View File

@ -103,7 +103,7 @@ namespace Emby.Server.Implementations.HttpServer
}
/// <summary>
/// Applies the request filters. Returns whether or not the request has been handled
/// Applies the request filters. Returns whether or not the request has been handled
/// and no more processing should be done.
/// </summary>
/// <returns></returns>

View File

@ -265,7 +265,7 @@ namespace Emby.Server.Implementations.HttpServer
}
/// <summary>
/// Returns the optimized result for the IRequestContext.
/// Returns the optimized result for the IRequestContext.
/// Does not use or store results in any cache.
/// </summary>
/// <param name="request"></param>

View File

@ -33,7 +33,7 @@ namespace Emby.Server.Implementations.HttpServer
/// </summary>
/// <value>The web socket connecting.</value>
Action<WebSocketConnectingEventArgs> WebSocketConnecting { get; set; }
/// <summary>
/// Starts this instance.
/// </summary>

View File

@ -115,7 +115,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
{
info.Device = tokenInfo.DeviceName;
}
else if (!string.Equals(info.Device, tokenInfo.DeviceName, StringComparison.OrdinalIgnoreCase))
{
if (allowTokenInfoUpdate)

View File

@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.IO
}
catch (IOException ex)
{
// For now swallow and log.
// For now swallow and log.
// Research item: If an IOException occurs, the item may be in a disconnected state (media unavailable)
// Should we remove it from it's parent?
Logger.LogError(ex, "Error refreshing {name}", item.Name);

View File

@ -159,7 +159,7 @@ namespace Emby.Server.Implementations.IO
var firstChar = filePath[0];
if (firstChar == '/')
{
// For this we don't really know.
// For this we don't really know.
return filePath;
}
if (firstChar == '\\') //relative path

View File

@ -818,7 +818,7 @@ namespace Emby.Server.Implementations.Library
public BaseItem FindByPath(string path, bool? isFolder)
{
// If this returns multiple items it could be tricky figuring out which one is correct.
// If this returns multiple items it could be tricky figuring out which one is correct.
// In most cases, the newest one will be and the others obsolete but not yet cleaned up
if (string.IsNullOrEmpty(path))
@ -1699,7 +1699,7 @@ namespace Emby.Server.Implementations.Library
{
try
{
// Try to resolve the path into a video
// Try to resolve the path into a video
video = ResolvePath(_fileSystem.GetFileSystemInfo(info.Path)) as Video;
if (video == null)

View File

@ -231,7 +231,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
}
var firstMedia = resolvedItem.Files.First();
var libraryItem = new T
{
Path = firstMedia.Path,

View File

@ -42,7 +42,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
{
// Behind special folder resolver
return ResolverPriority.Second;
}
}
}
/// <summary>

View File

@ -41,7 +41,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
{
// Behind special folder resolver
return ResolverPriority.Second;
}
}
}
/// <summary>

View File

@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
where TVideoType : Video, new()
{
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
// If the path is a file check for a matching extensions
var parser = new Emby.Naming.Video.VideoResolver(namingOptions);
@ -120,7 +120,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
if (video != null)
{
video.Name = parseName ?
video.Name = parseName ?
videoInfo.Name :
Path.GetFileName(args.Path);
@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
};
SetVideoType(video, videoInfo);
video.Name = parseName ?
videoInfo.Name :
Path.GetFileNameWithoutExtension(args.Path);
@ -281,7 +281,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
{
return string.Equals(name, "video_ts.ifo", StringComparison.OrdinalIgnoreCase);
}
/// <summary>
/// Determines whether [is blu ray directory] [the specified directory name].
/// </summary>

View File

@ -8,14 +8,14 @@ using MediaBrowser.Model.Entities;
namespace Emby.Server.Implementations.Library.Resolvers.Books
{
/// <summary>
///
///
/// </summary>
public class BookResolver : MediaBrowser.Controller.Resolvers.ItemResolver<Book>
{
private readonly string[] _validExtensions = { ".pdf", ".epub", ".mobi", ".cbr", ".cbz", ".azw3" };
/// <summary>
///
///
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
}
/// <summary>
///
///
/// </summary>
/// <param name="args"></param>
/// <returns></returns>

View File

@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
get
{
// Give plugins a chance to catch iso's first
// Also since we have to loop through child files looking for videos,
// Also since we have to loop through child files looking for videos,
// see if we can avoid some of that by letting other resolvers claim folders first
// Also run after series resolver
return ResolverPriority.Third;

View File

@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
}
var season = parent as Season;
// Just in case the user decided to nest episodes.
// Just in case the user decided to nest episodes.
// Not officially supported but in some cases we can handle it.
if (season == null)
{
@ -36,8 +36,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
// Also handle flat tv folders
if (season != null ||
string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||
if (season != null ||
string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||
args.HasParent<Series>())
{
var episode = ResolveVideo<Episode>(args, false);

View File

@ -282,7 +282,7 @@ namespace Emby.Server.Implementations.Library
if (includeItemTypes.Length == 0)
{
// Handle situations with the grouping setting, e.g. movies showing up in tv, etc.
// Handle situations with the grouping setting, e.g. movies showing up in tv, etc.
// Thanks to mixed content libraries included in the UserView
var hasCollectionType = parents.OfType<UserView>().ToArray();
if (hasCollectionType.Length > 0)

View File

@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.Library.Validators
{
continue;
}
_logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name);
_libraryManager.DeleteItem(item, new DeleteOptions

View File

@ -1055,7 +1055,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
_logger.LogInformation("Streaming Channel " + channelId);
var result = string.IsNullOrEmpty(streamId) ?
var result = string.IsNullOrEmpty(streamId) ?
null :
currentLiveStreams.FirstOrDefault(i => string.Equals(i.OriginalStreamId, streamId, StringComparison.OrdinalIgnoreCase));

View File

@ -214,13 +214,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var outputParam = string.Empty;
var commandLineArgs = string.Format("-i \"{0}\"{5} {2} -map_metadata -1 -threads 0 {3}{4}{6} -y \"{1}\"",
inputTempFile,
targetFile,
videoArgs,
GetAudioArgs(mediaSource),
subtitleArgs,
durationParam,
var commandLineArgs = string.Format("-i \"{0}\"{5} {2} -map_metadata -1 -threads 0 {3}{4}{6} -y \"{1}\"",
inputTempFile,
targetFile,
videoArgs,
GetAudioArgs(mediaSource),
subtitleArgs,
durationParam,
outputParam);
return inputModifier + " " + commandLineArgs;

View File

@ -1993,7 +1993,7 @@ namespace Emby.Server.Implementations.LiveTv
Name = program.Name,
OfficialRating = program.OfficialRating
};
}
}
if (service == null)
{

View File

@ -48,8 +48,8 @@ namespace Emby.Server.Implementations.LiveTv
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
return new[] {
return new[] {
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
};

View File

@ -275,7 +275,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
for (int i = 0; i < model.TunerCount; ++i)
{
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);
LiveTvTunerStatus status = isAvailable ? LiveTvTunerStatus.Available : LiveTvTunerStatus.LiveTv;
tuners.Add(new LiveTvTunerInfo

View File

@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Localization
catch (ArgumentException)
{
// will throw if input contains invalid unicode chars
// https://mnaoumov.wordpress.com/2014/06/14/stripping-invalid-characters-from-utf-16-strings/
// https://mnaoumov.wordpress.com/2014/06/14/stripping-invalid-characters-from-utf-16-strings/
text = StripInvalidUnicodeCharacters(text);
return Normalize(text, form, false);
}

View File

@ -10,11 +10,11 @@ namespace Emby.Server.Implementations.Net
{
public class SocketFactory : ISocketFactory
{
// THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
// THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
// Be careful to check any changes compile and work for all platform projects it is shared in.
// Not entirely happy with this. Would have liked to have done something more generic/reusable,
// but that wasn't really the point so kept to YAGNI principal for now, even if the
// but that wasn't really the point so kept to YAGNI principal for now, even if the
// interfaces are a bit ugly, specific and make assumptions.
private readonly ILogger _logger;

View File

@ -8,7 +8,7 @@ using MediaBrowser.Model.Net;
namespace Emby.Server.Implementations.Net
{
// THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
// THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
// Be careful to check any changes compile and work for all platform projects it is shared in.
public sealed class UdpSocket : DisposableManagedObjectBase, ISocket

View File

@ -122,28 +122,28 @@ namespace System.Net
}
/// <summary>
///
///
/// Reverse a Positive BigInteger ONLY
/// Bitwise ~ operator
///
///
/// Input : FF FF FF FF
/// Width : 4
/// Result : 00 00 00 00
///
///
/// Result : 00 00 00 00
///
///
/// Input : 00 00 00 00
/// Width : 4
/// Result : FF FF FF FF
///
/// Result : FF FF FF FF
///
/// Input : FF FF FF FF
/// Width : 8
/// Result : FF FF FF FF 00 00 00 00
///
///
///
///
/// Input : 00 00 00 00
/// Width : 8
/// Result : FF FF FF FF FF FF FF FF
///
///
/// </summary>
/// <param name="input"></param>
/// <param name="width"></param>

View File

@ -7,7 +7,7 @@ using System.Text.RegularExpressions;
namespace System.Net
{
/// <summary>
/// IP Network utility class.
/// IP Network utility class.
/// Use IPNetwork.Parse to create instances.
/// </summary>
public class IPNetwork : IComparable<IPNetwork>
@ -210,7 +210,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100 - 255.255.255.0
///
///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@ -231,7 +231,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100/24
///
///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@ -253,7 +253,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100 255.255.255.0
///
///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@ -276,7 +276,7 @@ namespace System.Net
/// <summary>
/// 192.168.0.1/24
/// 192.168.0.1 255.255.255.0
///
///
/// Network : 192.168.0.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@ -303,7 +303,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100 - 255.255.255.0
///
///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@ -329,7 +329,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100/24
///
///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@ -354,7 +354,7 @@ namespace System.Net
/// <summary>
/// 192.168.0.1/24
/// 192.168.0.1 255.255.255.0
///
///
/// Network : 192.168.0.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@ -379,7 +379,7 @@ namespace System.Net
/// <summary>
/// 192.168.0.1/24
/// 192.168.0.1 255.255.255.0
///
///
/// Network : 192.168.0.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@ -409,7 +409,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100 - 255.255.255.0
///
///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@ -520,7 +520,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100 255.255.255.0
///
///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@ -578,7 +578,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100/24
///
///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@ -962,7 +962,7 @@ namespace System.Net
/// 20180217 lduchosal
/// impossible to reach code, byte cannot be negative :
///
///
/// if (cidr < 0) {
/// if (tryParse == false) {
/// throw new ArgumentOutOfRangeException("cidr");
@ -1275,7 +1275,7 @@ namespace System.Net
}
/// <summary>
/// return true if ipaddress is contained in
/// return true if ipaddress is contained in
/// IANA_ABLK_RESERVED1, IANA_BBLK_RESERVED1, IANA_CBLK_RESERVED1
/// </summary>
/// <param name="ipaddress"></param>
@ -1294,7 +1294,7 @@ namespace System.Net
}
/// <summary>
/// return true if ipnetwork is contained in
/// return true if ipnetwork is contained in
/// IANA_ABLK_RESERVED1, IANA_BBLK_RESERVED1, IANA_CBLK_RESERVED1
/// </summary>
/// <returns></returns>
@ -1395,9 +1395,9 @@ namespace System.Net
/// <summary>
/// Supernet two consecutive cidr equal subnet into a single one
/// 192.168.0.0/24 + 192.168.1.0/24 = 192.168.0.0/23
/// 192.168.0.0/24 + 192.168.1.0/24 = 192.168.0.0/23
/// 10.1.0.0/16 + 10.0.0.0/16 = 10.0.0.0/15
/// 192.168.0.0/24 + 192.168.0.0/25 = 192.168.0.0/24
/// 192.168.0.0/24 + 192.168.0.0/25 = 192.168.0.0/24
/// </summary>
/// <param name="network2"></param>
/// <returns></returns>
@ -1410,9 +1410,9 @@ namespace System.Net
/// <summary>
/// Try to supernet two consecutive cidr equal subnet into a single one
/// 192.168.0.0/24 + 192.168.1.0/24 = 192.168.0.0/23
/// 192.168.0.0/24 + 192.168.1.0/24 = 192.168.0.0/23
/// 10.1.0.0/16 + 10.0.0.0/16 = 10.0.0.0/15
/// 192.168.0.0/24 + 192.168.0.0/25 = 192.168.0.0/24
/// 192.168.0.0/24 + 192.168.0.0/25 = 192.168.0.0/24
/// </summary>
/// <param name="network2"></param>
/// <returns></returns>
@ -1841,13 +1841,13 @@ namespace System.Net
#region TryGuessCidr
/// <summary>
///
/// Class Leading bits Default netmask
/// A (CIDR /8) 00 255.0.0.0
/// A (CIDR /8) 01 255.0.0.0
/// B (CIDR /16) 10 255.255.0.0
/// C (CIDR /24) 11 255.255.255.0
///
///
/// Class Leading bits Default netmask
/// A (CIDR /8) 00 255.0.0.0
/// A (CIDR /8) 01 255.0.0.0
/// B (CIDR /16) 10 255.255.0.0
/// C (CIDR /24) 11 255.255.255.0
///
/// </summary>
/// <param name="ip"></param>
/// <param name="cidr"></param>
@ -1931,7 +1931,7 @@ namespace System.Net
/**
* Need a better way to do it
*
*
#region TrySubstractNetwork
public static bool TrySubstractNetwork(IPNetwork[] ipnetworks, IPNetwork substract, out IEnumerable<IPNetwork> result) {

View File

@ -3,7 +3,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.Server.Implementations")]
@ -19,10 +19,10 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

View File

@ -35,8 +35,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// </summary>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
return new[]
{
return new[]
{
// Every so often
new TaskTriggerInfo
{

View File

@ -36,8 +36,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
return new[] {
return new[] {
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(12).Ticks}
};

View File

@ -42,8 +42,8 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
return new[] {
return new[] {
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
};

View File

@ -38,8 +38,8 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
return new[] {
return new[] {
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
};

View File

@ -171,7 +171,7 @@ namespace Emby.Server.Implementations.Security
//build our array
var lines = new List<string>
{
RegKey,
RegKey,
// Legacy key
string.Empty

View File

@ -21,7 +21,7 @@ namespace Emby.Server.Implementations.Services
return deserializer(requestType, httpReq.InputStream);
}
}
return Task.FromResult(host.CreateInstance(requestType));
return Task.FromResult(host.CreateInstance(requestType));
}
public static RestPath FindMatchingRestPath(string httpMethod, string pathInfo, out string contentType)

View File

@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.Services
public int PathComponentsCount { get; set; }
/// <summary>
/// The total number of segments after subparts have been exploded ('.')
/// The total number of segments after subparts have been exploded ('.')
/// e.g. /path/to/here.ext == 4
/// </summary>
public int TotalComponentsCount { get; set; }

View File

@ -5,7 +5,7 @@ namespace Emby.Server.Implementations.Services
/// <summary>
/// Donated by Ivan Korneliuk from his post:
/// http://korneliuk.blogspot.com/2012/08/servicestack-reusing-dtos.html
///
///
/// Modified to only allow using routes matching the supplied HTTP Verb
/// </summary>
public static class UrlExtensions

View File

@ -28,7 +28,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <value>The user data repository.</value>
public IUserDataManager UserDataRepository { get; set; }
/// <summary>
/// Compares the specified x.
/// </summary>

View File

@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <value>The user data repository.</value>
public IUserDataManager UserDataRepository { get; set; }
/// <summary>
/// Gets or sets the user manager.
/// </summary>

View File

@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Sorting
{
return x.PremiereDate.Value;
}
if (x.ProductionYear.HasValue)
{
try

View File

@ -18,7 +18,7 @@ namespace NLangDetect.Core.Extensions
if (end < 0) throw new ArgumentOutOfRangeException("end", "Argument must not be negative.");
if (end > s.Length) throw new ArgumentOutOfRangeException("end", "Argument must not be greater than the input string's length.");
if (start > end) throw new ArgumentOutOfRangeException("start", "Argument must not be greater than the 'end' argument.");
return s.Substring(start, end - start);
}
}

View File

@ -1,15 +1,15 @@
namespace Emby.Server.Implementations.TextEncoding
{
// Copyright 2015-2016 Jonathan Bennett <jon@autoitscript.com>
//
// https://www.autoitscript.com
//
// https://www.autoitscript.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -166,7 +166,7 @@
return encoding;
}
// Now try UTF16
// Now try UTF16
encoding = CheckUtf16NewlineChars(buffer, size);
if (encoding != CharacterEncoding.None)
{

View File

@ -41,7 +41,7 @@ using System.IO;
namespace UniversalDetector
{
/// <summary>
/// Default implementation of charset detection interface.
/// Default implementation of charset detection interface.
/// The detector can be fed by a System.IO.Stream:
/// <example>
/// <code>
@ -52,9 +52,9 @@ namespace UniversalDetector
/// Console.WriteLine("{0}, {1}", cdet.Charset, cdet.Confidence);
/// </code>
/// </example>
///
///
/// or by a byte a array:
///
///
/// <example>
/// <code>
/// byte[] buff = new byte[1024];
@ -64,23 +64,23 @@ namespace UniversalDetector
/// cdet.DataEnd();
/// Console.WriteLine("{0}, {1}", cdet.Charset, cdet.Confidence);
/// </code>
/// </example>
/// </summary>
/// </example>
/// </summary>
public class CharsetDetector : Core.UniversalDetector, ICharsetDetector
{
private string charset;
private float confidence;
//public event DetectorFinished Finished;
public CharsetDetector() : base(FILTER_ALL)
{
}
public void Feed(Stream stream)
{
{
byte[] buff = new byte[1024];
int read;
while ((read = stream.Read(buff, 0, buff.Length)) > 0 && !done)
@ -88,19 +88,19 @@ namespace UniversalDetector
Feed(buff, 0, read);
}
}
public bool IsDone()
public bool IsDone()
{
return done;
}
public override void Reset()
{
this.charset = null;
this.confidence = 0.0f;
base.Reset();
}
public string Charset {
get { return charset; }
}
@ -108,7 +108,7 @@ namespace UniversalDetector
public float Confidence {
get { return confidence; }
}
protected override void Report(string charset, float confidence)
{
this.charset = charset;
@ -118,7 +118,7 @@ namespace UniversalDetector
// }
}
}
//public delegate void DetectorFinished(string charset, float confidence);
}

View File

@ -44,12 +44,12 @@ namespace UniversalDetector.Core
private CodingStateMachine codingSM;
private BIG5DistributionAnalyser distributionAnalyser;
private byte[] lastChar = new byte[2];
public Big5Prober()
{
this.codingSM = new CodingStateMachine(new BIG5SMModel());
this.distributionAnalyser = new BIG5DistributionAnalyser();
this.Reset();
this.Reset();
}
public override ProbingState HandleData(byte[] buf, int offset, int len)
@ -73,7 +73,7 @@ namespace UniversalDetector.Core
lastChar[1] = buf[offset];
distributionAnalyser.HandleOneChar(lastChar, 0, charLen);
} else {
distributionAnalyser.HandleOneChar(buf, i-1, charLen);
distributionAnalyser.HandleOneChar(buf, i-1, charLen);
}
}
}
@ -84,23 +84,23 @@ namespace UniversalDetector.Core
state = ProbingState.FoundIt;
return state;
}
public override void Reset()
{
codingSM.Reset();
codingSM.Reset();
state = ProbingState.Detecting;
distributionAnalyser.Reset();
}
public override string GetCharsetName()
{
return "Big-5";
return "Big-5";
}
public override float GetConfidence()
{
return distributionAnalyser.GetConfidence();
}
}
}

View File

@ -43,15 +43,15 @@ namespace UniversalDetector.Core
public static int INDEX_SHIFT_4BITS = 3;
public static int INDEX_SHIFT_8BITS = 2;
public static int INDEX_SHIFT_16BITS = 1;
public static int SHIFT_MASK_4BITS = 7;
public static int SHIFT_MASK_8BITS = 3;
public static int SHIFT_MASK_16BITS = 1;
public static int BIT_SHIFT_4BITS = 2;
public static int BIT_SHIFT_8BITS = 3;
public static int BIT_SHIFT_16BITS = 4;
public static int UNIT_MASK_4BITS = 0x0000000F;
public static int UNIT_MASK_8BITS = 0x000000FF;
public static int UNIT_MASK_16BITS = 0x0000FFFF;
@ -61,7 +61,7 @@ namespace UniversalDetector.Core
private int bitShift;
private int unitMask;
private int[] data;
public BitPackage(int indexShift, int shiftMask,
int bitShift, int unitMask, int[] data)
{
@ -71,27 +71,27 @@ namespace UniversalDetector.Core
this.unitMask = unitMask;
this.data = data;
}
public static int Pack16bits(int a, int b)
{
return ((b << 16) | a);
}
public static int Pack8bits(int a, int b, int c, int d)
{
return Pack16bits((b << 8) | a, (d << 8) | c);
}
public static int Pack4bits(int a, int b, int c, int d,
public static int Pack4bits(int a, int b, int c, int d,
int e, int f, int g, int h)
{
return Pack8bits((b << 4) | a, (d << 4) | c,
(f << 4) | e, (h << 4) | g);
}
public int Unpack(int i)
{
return (data[i >> indexShift] >>
return (data[i >> indexShift] >>
((i & shiftMask) << bitShift)) & unitMask;
}
}

View File

@ -38,12 +38,11 @@
namespace UniversalDetector.Core
{
/// <summary>
/// Base class for the Character Distribution Method, used for
/// Base class for the Character Distribution Method, used for
/// the CJK encodings
/// </summary>
public abstract class CharDistributionAnalyser
{
protected const float SURE_YES = 0.99f;
protected const float SURE_NO = 0.01f;
protected const int MINIMUM_DATA_THRESHOLD = 4;
@ -57,19 +56,19 @@ namespace UniversalDetector.Core
//Total character encounted.
protected int totalChars;
// Mapping table to get frequency order from char order (get from GetOrder())
protected int[] charToFreqOrder;
// Size of above table
protected int tableSize;
//This is a constant value varies from language to language, it is used
// in calculating confidence.
protected float typicalDistributionRatio;
//This is a constant value varies from language to language, it is used
// in calculating confidence.
protected float typicalDistributionRatio;
public CharDistributionAnalyser()
{
{
Reset();
}
@ -77,10 +76,10 @@ namespace UniversalDetector.Core
/// Feed a block of data and do distribution analysis
/// </summary>
/// </param>
//public abstract void HandleData(byte[] buf, int offset, int len);
//public abstract void HandleData(byte[] buf, int offset, int len);
/// <summary>
/// we do not handle character base on its original encoding string, but
/// we do not handle character base on its original encoding string, but
/// convert this encoding string to a number, here called order.
/// This allow multiple encoding of a language to share one frequency table
/// </summary>
@ -88,9 +87,9 @@ namespace UniversalDetector.Core
/// <param name="offset"></param>
/// <returns></returns>
public abstract int GetOrder(byte[] buf, int offset);
/// <summary>
/// Feed a character with known length
/// Feed a character with known length
/// </summary>
/// <param name="buf">A <see cref="System.Byte"/></param>
/// <param name="offset">buf offset</param>
@ -107,13 +106,13 @@ namespace UniversalDetector.Core
}
}
public virtual void Reset()
public virtual void Reset()
{
done = false;
totalChars = 0;
freqChars = 0;
}
/// <summary>
/// return confidence base on received data
/// </summary>
@ -133,16 +132,16 @@ namespace UniversalDetector.Core
//normalize confidence, (we don't want to be 100% sure)
return SURE_YES;
}
//It is not necessary to receive all data to draw conclusion. For charset detection,
// certain amount of data is enough
public bool GotEnoughData()
public bool GotEnoughData()
{
return totalChars > ENOUGH_DATA_THRESHOLD;
}
}
public class GB18030DistributionAnalyser : CharDistributionAnalyser
{
// GB2312 most frequently used character table
@ -155,7 +154,7 @@ namespace UniversalDetector.Core
*
* Idea Distribution Ratio = 0.79135/(1-0.79135) = 3.79
* Random Distribution Ration = 512 / (3755 - 512) = 0.157
*
*
* Typical Distribution Ratio about 25% of Ideal one, still much higher that RDR
*****************************************************************************/
@ -400,8 +399,8 @@ namespace UniversalDetector.Core
381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189,
852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, //last 512
/***************************************************************************************
*Everything below is of no interest for detection purpose *
/***************************************************************************************
*Everything below is of no interest for detection purpose *
***************************************************************************************
5508,6484,3900,3414,3974,4441,4024,3537,4037,5628,5099,3633,6485,3148,6486,3636,
@ -601,7 +600,7 @@ namespace UniversalDetector.Core
tableSize = GB2312_TABLE_SIZE;
typicalDistributionRatio = GB2312_TYPICAL_DISTRIBUTION_RATIO;
}
/// <summary>
/// for GB2312 encoding, we are interested
/// first byte range: 0xb0 -- 0xfe
@ -609,20 +608,20 @@ namespace UniversalDetector.Core
/// no validation needed here. State machine has done that
/// </summary>
/// <returns></returns>
public override int GetOrder(byte[] buf, int offset)
{
if (buf[offset] >= 0xB0 && buf[offset+1] >= 0xA1)
public override int GetOrder(byte[] buf, int offset)
{
if (buf[offset] >= 0xB0 && buf[offset+1] >= 0xA1)
return 94 * (buf[offset] - 0xb0) + buf[offset+1] - 0xA1;
else
return -1;
}
}
public class EUCTWDistributionAnalyser : CharDistributionAnalyser
{
// EUCTW frequency table
// Converted from big5 work
// by Taiwan's Mandarin Promotion Council
// Converted from big5 work
// by Taiwan's Mandarin Promotion Council
// <http://www.edu.tw:81/mandr/>
/******************************************************************************
* 128 --> 0.42261
@ -633,7 +632,7 @@ namespace UniversalDetector.Core
*
* Idea Distribution Ratio = 0.74851/(1-0.74851) =2.98
* Random Distribution Ration = 512/(5401-512)=0.105
*
*
* Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR
*****************************************************************************/
@ -979,8 +978,8 @@ namespace UniversalDetector.Core
890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114, 941, // 8086
2294, 208,3499,4057,2019, 330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118, // 8102
/***************************************************************************************
*Everything below is of no interest for detection purpose *
/***************************************************************************************
*Everything below is of no interest for detection purpose *
***************************************************************************************
2515,1613,4582,8119,3312,3866,2516,8120,4058,8121,1637,4059,2466,4583,3867,8122, // 8118
@ -1022,7 +1021,7 @@ namespace UniversalDetector.Core
8678,8679,8680,8681,8682,8683,8684,8685,8686,8687,8688,8689,8690,8691,8692,8693, // 8694
8694,8695,8696,8697,8698,8699,8700,8701,8702,8703,8704,8705,8706,8707,8708,8709, // 8710
8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,8720,8721,8722,8723,8724,8725, // 8726
8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741, // 8742 //13973
8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741, // 8742 //13973
****************************************************************************************/
};
@ -1038,15 +1037,15 @@ namespace UniversalDetector.Core
/// second byte range: 0xa1 -- 0xfe
/// no validation needed here. State machine has done that
/// </summary>
public override int GetOrder(byte[] buf, int offset)
{
if (buf[offset] >= 0xC4)
public override int GetOrder(byte[] buf, int offset)
{
if (buf[offset] >= 0xC4)
return 94 * (buf[offset] - 0xC4) + buf[offset+1] - 0xA1;
else
return -1;
}
}
public class EUCKRDistributionAnalyser : CharDistributionAnalyser
{
// Sampling from about 20M text materials include literature and computer technology
@ -1215,8 +1214,8 @@ namespace UniversalDetector.Core
2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042,
670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, //512, 256
/***************************************************************************************
* Everything below is of no interest for detection purpose
/***************************************************************************************
* Everything below is of no interest for detection purpose *
***************************************************************************************
2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658,
@ -1619,32 +1618,32 @@ namespace UniversalDetector.Core
8704,8705,8706,8707,8708,8709,8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,
8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,
8736,8737,8738,8739,8740,8741 */ };
public EUCKRDistributionAnalyser()
{
charToFreqOrder = EUCKR_CHAR2FREQ_ORDER;
tableSize = EUCKR_TABLE_SIZE;
typicalDistributionRatio = EUCKR_TYPICAL_DISTRIBUTION_RATIO;
typicalDistributionRatio = EUCKR_TYPICAL_DISTRIBUTION_RATIO;
}
/// <summary>
/// first byte range: 0xb0 -- 0xfe
/// second byte range: 0xa1 -- 0xfe
/// no validation needed here. State machine has done that
/// </summary>
public override int GetOrder(byte[] buf, int offset)
{
if (buf[offset] >= 0xB0)
public override int GetOrder(byte[] buf, int offset)
{
if (buf[offset] >= 0xB0)
return 94 * (buf[offset] - 0xB0) + buf[offset+1] - 0xA1;
else
return -1;
}
}
public class BIG5DistributionAnalyser : CharDistributionAnalyser
{
// Big5 frequency table
// by Taiwan's Mandarin Promotion Council
// by Taiwan's Mandarin Promotion Council
// <http://www.edu.tw:81/mandr/>
/******************************************************************************
* 128 --> 0.42261
@ -1655,7 +1654,7 @@ namespace UniversalDetector.Core
*
* Idea Distribution Ratio = 0.74851/(1-0.74851) =2.98
* Random Distribution Ration = 512/(5401-512)=0.105
*
*
* Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR
*****************************************************************************/
@ -2001,8 +2000,8 @@ namespace UniversalDetector.Core
890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, // 5360
2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, // 5376 //last 512
/***************************************************************************************
*Everything below is of no interest for detection purpose *
/***************************************************************************************
*Everything below is of no interest for detection purpose *
***************************************************************************************
2522,1613,4812,5799,3345,3945,2523,5800,4162,5801,1637,4163,2471,4813,3946,5802, // 5392
@ -2545,29 +2544,29 @@ namespace UniversalDetector.Core
13968,13969,13970,13971,13972, //13973
****************************************************************************************/
};
public BIG5DistributionAnalyser()
{
charToFreqOrder = BIG5_CHAR2FREQ_ORDER;
tableSize = BIG5_TABLE_SIZE;
typicalDistributionRatio = BIG5_TYPICAL_DISTRIBUTION_RATIO;
typicalDistributionRatio = BIG5_TYPICAL_DISTRIBUTION_RATIO;
}
/// <summary>
/// first byte range: 0xa4 -- 0xfe
/// second byte range: 0x40 -- 0x7e , 0xa1 -- 0xfe
/// no validation needed here. State machine has done that
/// </summary>
public override int GetOrder(byte[] buf, int offset)
{
public override int GetOrder(byte[] buf, int offset)
{
if (buf[offset] >= 0xA4) {
if (buf[offset+1] >= 0xA1)
return 157 * (buf[offset] - 0xA4) + buf[offset+1] - 0xA1 + 63;
else
return 157 * (buf[offset] - 0xA4) + buf[offset+1] - 0x40;
} else {
return -1;
}
return -1;
}
}
}
@ -2575,7 +2574,7 @@ namespace UniversalDetector.Core
{
//Sampling from about 20M text materials include literature and computer technology
// Japanese frequency table, applied to both S-JIS and EUC-JP
//They are sorted in order.
//They are sorted in order.
/******************************************************************************
* 128 --> 0.77094
@ -2586,8 +2585,8 @@ namespace UniversalDetector.Core
*
* Idea Distribution Ratio = 0.92635 / (1-0.92635) = 12.58
* Random Distribution Ration = 512 / (2965+62+83+86-512) = 0.191
*
* Typical Distribution Ratio, 25% of IDR
*
* Typical Distribution Ratio, 25% of IDR
*****************************************************************************/
protected static float SJIS_TYPICAL_DISTRIBUTION_RATIO = 3.0f;
@ -2869,8 +2868,8 @@ namespace UniversalDetector.Core
1444,1698,2385,2251,3729,1365,2281,2235,1717,6188, 864,3841,2515, 444, 527,2767, // 4352
2922,3625, 544, 461,6189, 566, 209,2437,3398,2098,1065,2068,3331,3626,3257,2137, // 4368 //last 512
/***************************************************************************************
*Everything below is of no interest for detection purpose *
/***************************************************************************************
*Everything below is of no interest for detection purpose *
***************************************************************************************
2138,2122,3730,2888,1995,1820,1044,6190,6191,6192,6193,6194,6195,6196,6197,6198, // 4384
@ -3118,31 +3117,31 @@ namespace UniversalDetector.Core
8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255, // 8256
8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271, // 8272
****************************************************************************************/
};
};
public SJISDistributionAnalyser()
{
charToFreqOrder = SJIS_CHAR2FREQ_ORDER;
tableSize = SJIS_TABLE_SIZE;
typicalDistributionRatio = SJIS_TYPICAL_DISTRIBUTION_RATIO;
typicalDistributionRatio = SJIS_TYPICAL_DISTRIBUTION_RATIO;
}
/// <summary>
/// first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe
/// second byte range: 0x40 -- 0x7e, 0x81 -- oxfe
/// no validation needed here. State machine has done that
/// </summary>
public override int GetOrder(byte[] buf, int offset)
{
public override int GetOrder(byte[] buf, int offset)
{
int order = 0;
if (buf[offset] >= 0x81 && buf[offset] <= 0x9F)
if (buf[offset] >= 0x81 && buf[offset] <= 0x9F)
order = 188 * (buf[offset] - 0x81);
else if (buf[offset] >= 0xE0 && buf[offset] <= 0xEF)
else if (buf[offset] >= 0xE0 && buf[offset] <= 0xEF)
order = 188 * (buf[offset] - 0xE0 + 31);
else
return -1;
order += buf[offset+1] - 0x40;
if (buf[offset+1] > 0x7F)
order--;
return order;
@ -3154,20 +3153,18 @@ namespace UniversalDetector.Core
public EUCJPDistributionAnalyser() : base()
{
}
/// <summary>
/// first byte range: 0xa0 -- 0xfe
/// second byte range: 0xa1 -- 0xfe
/// no validation needed here. State machine has done that
/// </summary>
public override int GetOrder(byte[] buf, int offset)
{
if (buf[offset] >= 0xA0)
public override int GetOrder(byte[] buf, int offset)
{
if (buf[offset] >= 0xA0)
return 94 * (buf[offset] - 0xA1) + buf[offset+1] - 0xA1;
else
return -1;
}
}
}

View File

@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@ -40,10 +40,10 @@ using System.IO;
namespace UniversalDetector.Core
{
public enum ProbingState {
public enum ProbingState {
Detecting = 0, // no sure answer yet, but caller can ask for confidence
FoundIt = 1, // positive answer
NotMe = 2 // negative answer
NotMe = 2 // negative answer
};
public abstract class CharsetProber
@ -51,16 +51,16 @@ namespace UniversalDetector.Core
protected const float SHORTCUT_THRESHOLD = 0.95F;
protected ProbingState state;
// ASCII codes
private const byte SPACE = 0x20;
private const byte CAPITAL_A = 0x41;
private const byte CAPITAL_Z = 0x5A;
private const byte SMALL_A = 0x61;
private const byte SMALL_Z = 0x7A;
private const byte LESS_THAN = 0x3C;
private const byte LESS_THAN = 0x3C;
private const byte GREATER_THAN = 0x3E;
/// <summary>
/// Feed data to the prober
/// </summary>
@ -71,44 +71,44 @@ namespace UniversalDetector.Core
/// A <see cref="ProbingState"/>
/// </returns>
public abstract ProbingState HandleData(byte[] buf, int offset, int len);
/// <summary>
/// Reset prober state
/// </summary>
public abstract void Reset();
public abstract string GetCharsetName();
public abstract float GetConfidence();
public virtual ProbingState GetState()
{
return state;
}
public virtual void SetOption()
{
{
}
public virtual void DumpStatus()
{
{
}
//
// Helper functions used in the Latin1 and Group probers
//
/// <summary>
///
///
/// </summary>
/// <returns>filtered buffer</returns>
protected static byte[] FilterWithoutEnglishLetters(byte[] buf, int offset, int len)
protected static byte[] FilterWithoutEnglishLetters(byte[] buf, int offset, int len)
{
byte[] result = null;
using (MemoryStream ms = new MemoryStream(buf.Length)) {
bool meetMSB = false;
int max = offset + len;
int prev = offset;
@ -140,8 +140,8 @@ namespace UniversalDetector.Core
}
/// <summary>
/// Do filtering to reduce load to probers (Remove ASCII symbols,
/// collapse spaces). This filter applies to all scripts which contain
/// Do filtering to reduce load to probers (Remove ASCII symbols,
/// collapse spaces). This filter applies to all scripts which contain
/// both English characters and upper ASCII characters.
/// </summary>
/// <returns>a filtered copy of the input buffer</returns>
@ -150,16 +150,16 @@ namespace UniversalDetector.Core
byte[] result = null;
using (MemoryStream ms = new MemoryStream(buf.Length)) {
bool inTag = false;
int max = offset + len;
int prev = offset;
int cur = offset;
while (cur < max) {
byte b = buf[cur];
if (b == GREATER_THAN)
inTag = false;
else if (b == LESS_THAN)
@ -177,7 +177,7 @@ namespace UniversalDetector.Core
cur++;
}
// If the current segment contains more than just a symbol
// If the current segment contains more than just a symbol
// and it is not inside a tag then keep it.
if (!inTag && cur > prev)
ms.Write(buf, prev, cur - prev);

View File

@ -20,7 +20,7 @@
*
* Contributor(s):
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@ -40,47 +40,47 @@ namespace UniversalDetector.Core
public static class Charsets
{
public const string ASCII = "ASCII";
public const string UTF8 = "UTF-8";
public const string UTF16_LE = "UTF-16LE";
public const string UTF16_BE = "UTF-16BE";
public const string UTF32_BE = "UTF-32BE";
public const string UTF32_LE = "UTF-32LE";
/// <summary>
/// Unusual BOM (3412 order)
/// </summary>
public const string UCS4_3412 = "X-ISO-10646-UCS-4-3412";
/// <summary>
/// Unusual BOM (2413 order)
/// </summary>
public const string UCS4_2413 = "X-ISO-10646-UCS-4-2413";
/// <summary>
/// Cyrillic (based on bulgarian and russian data)
/// </summary>
public const string WIN1251 = "windows-1251";
/// <summary>
/// Latin-1, almost identical to ISO-8859-1
/// </summary>
public const string WIN1252 = "windows-1252";
/// <summary>
/// Greek
/// </summary>
public const string WIN1253 = "windows-1253";
/// <summary>
/// Logical hebrew (includes ISO-8859-8-I and most of x-mac-hebrew)
/// </summary>
public const string WIN1255 = "windows-1255";
/// <summary>
/// Traditional chinese
/// </summary>
@ -89,7 +89,7 @@ namespace UniversalDetector.Core
public const string EUCKR = "EUC-KR";
public const string EUCJP = "EUC-JP";
public const string EUCTW = "EUC-TW";
/// <summary>
@ -98,11 +98,11 @@ namespace UniversalDetector.Core
public const string GB18030 = "gb18030";
public const string ISO2022_JP = "ISO-2022-JP";
public const string ISO2022_CN = "ISO-2022-CN";
public const string ISO2022_KR = "ISO-2022-KR";
/// <summary>
/// Simplified chinese
/// </summary>
@ -111,15 +111,15 @@ namespace UniversalDetector.Core
public const string SHIFT_JIS = "Shift-JIS";
public const string MAC_CYRILLIC = "x-mac-cyrillic";
public const string KOI8R = "KOI8-R";
public const string IBM855 = "IBM855";
public const string IBM866 = "IBM866";
/// <summary>
/// East-Europe. Disabled because too similar to windows-1252
/// East-Europe. Disabled because too similar to windows-1252
/// (latin-1). Should use tri-grams models to discriminate between
/// these two charsets.
/// </summary>
@ -141,9 +141,9 @@ namespace UniversalDetector.Core
public const string ISO8859_8 = "ISO-8859-8";
/// <summary>
/// Thai. This recognizer is not enabled yet.
/// Thai. This recognizer is not enabled yet.
/// </summary>
public const string TIS620 = "TIS620";
}
}

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