Use CultureInvariant string conversion for Guids

This commit is contained in:
Bond-009 2019-02-28 23:22:57 +01:00 committed by Bond_009
parent 779f0c637f
commit 6032f31aa6
75 changed files with 240 additions and 186 deletions

View file

@ -1082,7 +1082,7 @@ namespace Emby.Dlna.Didl
public static string GetClientId(Guid idValue, StubType? stubType) public static string GetClientId(Guid idValue, StubType? stubType)
{ {
var id = idValue.ToString("N"); var id = idValue.ToString("N", CultureInfo.InvariantCulture);
if (stubType.HasValue) if (stubType.HasValue)
{ {
@ -1096,7 +1096,7 @@ namespace Emby.Dlna.Didl
{ {
var url = string.Format("{0}/Items/{1}/Images/{2}/0/{3}/{4}/{5}/{6}/0/0", var url = string.Format("{0}/Items/{1}/Images/{2}/0/{3}/{4}/{5}/{6}/0/0",
_serverAddress, _serverAddress,
info.ItemId.ToString("N"), info.ItemId.ToString("N", CultureInfo.InvariantCulture),
info.Type, info.Type,
info.ImageTag, info.ImageTag,
format, format,

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -300,7 +301,7 @@ namespace Emby.Dlna
profile = ReserializeProfile(tempProfile); profile = ReserializeProfile(tempProfile);
profile.Id = path.ToLowerInvariant().GetMD5().ToString("N"); profile.Id = path.ToLowerInvariant().GetMD5().ToString("N", CultureInfo.InvariantCulture);
_profiles[path] = new Tuple<InternalProfileInfo, DeviceProfile>(GetInternalProfileInfo(_fileSystem.GetFileInfo(path), type), profile); _profiles[path] = new Tuple<InternalProfileInfo, DeviceProfile>(GetInternalProfileInfo(_fileSystem.GetFileInfo(path), type), profile);
@ -352,7 +353,7 @@ namespace Emby.Dlna
Info = new DeviceProfileInfo Info = new DeviceProfileInfo
{ {
Id = file.FullName.ToLowerInvariant().GetMD5().ToString("N"), Id = file.FullName.ToLowerInvariant().GetMD5().ToString("N", CultureInfo.InvariantCulture),
Name = _fileSystem.GetFileNameWithoutExtension(file), Name = _fileSystem.GetFileNameWithoutExtension(file),
Type = type Type = type
} }

View file

@ -55,7 +55,7 @@ namespace Emby.Dlna.Eventing
public EventSubscriptionResponse CreateEventSubscription(string notificationType, string requestedTimeoutString, string callbackUrl) public EventSubscriptionResponse CreateEventSubscription(string notificationType, string requestedTimeoutString, string callbackUrl)
{ {
var timeout = ParseTimeout(requestedTimeoutString) ?? 300; var timeout = ParseTimeout(requestedTimeoutString) ?? 300;
var id = "uuid:" + Guid.NewGuid().ToString("N"); var id = "uuid:" + Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
// Remove logging for now because some devices are sending this very frequently // Remove logging for now because some devices are sending this very frequently
// TODO re-enable with dlna debug logging setting // TODO re-enable with dlna debug logging setting

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Net.Sockets; using System.Net.Sockets;
using System.Globalization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Emby.Dlna.PlayTo; using Emby.Dlna.PlayTo;
@ -307,7 +308,7 @@ namespace Emby.Dlna.Main
{ {
guid = text.GetMD5(); guid = text.GetMD5();
} }
return guid.ToString("N"); return guid.ToString("N", CultureInfo.InvariantCulture);
} }
private void SetProperies(SsdpDevice device, string fullDeviceType) private void SetProperies(SsdpDevice device, string fullDeviceType)

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Threading; using System.Threading;
@ -141,7 +142,7 @@ namespace Emby.Dlna.PlayTo
return usn; return usn;
} }
return usn.GetMD5().ToString("N"); return usn.GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
private async Task AddDevice(UpnpDeviceInfo info, string location, CancellationToken cancellationToken) private async Task AddDevice(UpnpDeviceInfo info, string location, CancellationToken cancellationToken)
@ -156,7 +157,7 @@ namespace Emby.Dlna.PlayTo
} }
else else
{ {
uuid = location.GetMD5().ToString("N"); uuid = location.GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationVersion, uuid, null, uri.OriginalString, null); var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationVersion, uuid, null, uri.OriginalString, null);

View file

@ -454,14 +454,14 @@ namespace Emby.Drawing
// Optimization // Optimization
if (imageEnhancers.Length == 0) if (imageEnhancers.Length == 0)
{ {
return (originalImagePath + dateModified.Ticks).GetMD5().ToString("N"); return (originalImagePath + dateModified.Ticks).GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
// Cache name is created with supported enhancers combined with the last config change so we pick up new config changes // Cache name is created with supported enhancers combined with the last config change so we pick up new config changes
var cacheKeys = imageEnhancers.Select(i => i.GetConfigurationCacheKey(item, imageType)).ToList(); var cacheKeys = imageEnhancers.Select(i => i.GetConfigurationCacheKey(item, imageType)).ToList();
cacheKeys.Add(originalImagePath + dateModified.Ticks); cacheKeys.Add(originalImagePath + dateModified.Ticks);
return string.Join("|", cacheKeys).GetMD5().ToString("N"); return string.Join("|", cacheKeys).GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
private async Task<(string path, DateTime dateModified)> GetSupportedImage(string originalImagePath, DateTime dateModified) private async Task<(string path, DateTime dateModified)> GetSupportedImage(string originalImagePath, DateTime dateModified)
@ -480,7 +480,7 @@ namespace Emby.Drawing
{ {
try try
{ {
string filename = (originalImagePath + dateModified.Ticks.ToString(UsCulture)).GetMD5().ToString("N"); string filename = (originalImagePath + dateModified.Ticks.ToString(UsCulture)).GetMD5().ToString("N", CultureInfo.InvariantCulture);
string cacheExtension = _mediaEncoder().SupportsEncoder("libwebp") ? ".webp" : ".png"; string cacheExtension = _mediaEncoder().SupportsEncoder("libwebp") ? ".webp" : ".png";
var outputPath = Path.Combine(_appPaths.ImageCachePath, "converted-images", filename + cacheExtension); var outputPath = Path.Combine(_appPaths.ImageCachePath, "converted-images", filename + cacheExtension);

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -101,7 +102,7 @@ namespace Emby.Notifications
var config = GetConfiguration(); var config = GetConfiguration();
return _userManager.Users return _userManager.Users
.Where(i => config.IsEnabledToSendToUser(request.NotificationType, i.Id.ToString("N"), i.Policy)) .Where(i => config.IsEnabledToSendToUser(request.NotificationType, i.Id.ToString("N", CultureInfo.InvariantCulture), i.Policy))
.Select(i => i.Id); .Select(i => i.Id);
} }
@ -197,7 +198,7 @@ namespace Emby.Notifications
return _services.Select(i => new NameIdPair return _services.Select(i => new NameIdPair
{ {
Name = i.Name, Name = i.Name,
Id = i.Name.GetMD5().ToString("N") Id = i.Name.GetMD5().ToString("N", CultureInfo.InvariantCulture)
}).OrderBy(i => i.Name); }).OrderBy(i => i.Name);
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -75,7 +76,6 @@ namespace Emby.Server.Implementations.Activity
_sessionManager.AuthenticationFailed += OnAuthenticationFailed; _sessionManager.AuthenticationFailed += OnAuthenticationFailed;
_sessionManager.AuthenticationSucceeded += OnAuthenticationSucceeded; _sessionManager.AuthenticationSucceeded += OnAuthenticationSucceeded;
_sessionManager.SessionEnded += OnSessionEnded; _sessionManager.SessionEnded += OnSessionEnded;
_sessionManager.PlaybackStart += OnPlaybackStart; _sessionManager.PlaybackStart += OnPlaybackStart;
_sessionManager.PlaybackStopped += OnPlaybackStopped; _sessionManager.PlaybackStopped += OnPlaybackStopped;
@ -117,7 +117,7 @@ namespace Emby.Server.Implementations.Activity
{ {
Name = string.Format(_localization.GetLocalizedString("SubtitleDownloadFailureFromForItem"), e.Provider, Notifications.Notifications.GetItemName(e.Item)), Name = string.Format(_localization.GetLocalizedString("SubtitleDownloadFailureFromForItem"), e.Provider, Notifications.Notifications.GetItemName(e.Item)),
Type = "SubtitleDownloadFailure", Type = "SubtitleDownloadFailure",
ItemId = e.Item.Id.ToString("N"), ItemId = e.Item.Id.ToString("N", CultureInfo.InvariantCulture),
ShortOverview = e.Exception.Message ShortOverview = e.Exception.Message
}); });
} }

View file

@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.Activity
} }
else else
{ {
statement.TryBind("@UserId", entry.UserId.ToString("N")); statement.TryBind("@UserId", entry.UserId.ToString("N", CultureInfo.InvariantCulture));
} }
statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue()); statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());
@ -141,7 +141,7 @@ namespace Emby.Server.Implementations.Activity
} }
else else
{ {
statement.TryBind("@UserId", entry.UserId.ToString("N")); statement.TryBind("@UserId", entry.UserId.ToString("N", CultureInfo.InvariantCulture));
} }
statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue()); statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());

View file

@ -1220,7 +1220,7 @@ namespace Emby.Server.Implementations
// Generate self-signed cert // Generate self-signed cert
var certHost = GetHostnameFromExternalDns(ServerConfigurationManager.Configuration.WanDdns); var certHost = GetHostnameFromExternalDns(ServerConfigurationManager.Configuration.WanDdns);
var certPath = Path.Combine(ServerConfigurationManager.ApplicationPaths.ProgramDataPath, "ssl", "cert_" + (certHost + "2").GetMD5().ToString("N") + ".pfx"); var certPath = Path.Combine(ServerConfigurationManager.ApplicationPaths.ProgramDataPath, "ssl", "cert_" + (certHost + "2").GetMD5().ToString("N", CultureInfo.InvariantCulture) + ".pfx");
const string Password = "embycert"; const string Password = "embycert";
return new CertificateInfo return new CertificateInfo

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -206,7 +207,7 @@ namespace Emby.Server.Implementations.Channels
try try
{ {
return GetChannelProvider(i).IsEnabledFor(user.Id.ToString("N")); return GetChannelProvider(i).IsEnabledFor(user.Id.ToString("N", CultureInfo.InvariantCulture));
} }
catch catch
{ {
@ -511,7 +512,7 @@ namespace Emby.Server.Implementations.Channels
IncludeItemTypes = new[] { typeof(Channel).Name }, IncludeItemTypes = new[] { typeof(Channel).Name },
OrderBy = new ValueTuple<string, SortOrder>[] { new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending) } OrderBy = new ValueTuple<string, SortOrder>[] { new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending) }
}).Select(i => GetChannelFeatures(i.ToString("N"))).ToArray(); }).Select(i => GetChannelFeatures(i.ToString("N", CultureInfo.InvariantCulture))).ToArray();
} }
public ChannelFeatures GetChannelFeatures(string id) public ChannelFeatures GetChannelFeatures(string id)
@ -552,7 +553,7 @@ namespace Emby.Server.Implementations.Channels
SupportsSortOrderToggle = features.SupportsSortOrderToggle, SupportsSortOrderToggle = features.SupportsSortOrderToggle,
SupportsLatestMedia = supportsLatest, SupportsLatestMedia = supportsLatest,
Name = channel.Name, Name = channel.Name,
Id = channel.Id.ToString("N"), Id = channel.Id.ToString("N", CultureInfo.InvariantCulture),
SupportsContentDownloading = features.SupportsContentDownloading, SupportsContentDownloading = features.SupportsContentDownloading,
AutoRefreshLevels = features.AutoRefreshLevels AutoRefreshLevels = features.AutoRefreshLevels
}; };
@ -740,7 +741,7 @@ namespace Emby.Server.Implementations.Channels
bool sortDescending, bool sortDescending,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var userId = user == null ? null : user.Id.ToString("N"); var userId = user == null ? null : user.Id.ToString("N", CultureInfo.InvariantCulture);
var cacheLength = CacheLength; var cacheLength = CacheLength;
var cachePath = GetChannelDataCachePath(channel, userId, externalFolderId, sortField, sortDescending); var cachePath = GetChannelDataCachePath(channel, userId, externalFolderId, sortField, sortDescending);
@ -836,7 +837,7 @@ namespace Emby.Server.Implementations.Channels
ChannelItemSortField? sortField, ChannelItemSortField? sortField,
bool sortDescending) bool sortDescending)
{ {
var channelId = GetInternalChannelId(channel.Name).ToString("N"); var channelId = GetInternalChannelId(channel.Name).ToString("N", CultureInfo.InvariantCulture);
var userCacheKey = string.Empty; var userCacheKey = string.Empty;
@ -846,10 +847,10 @@ namespace Emby.Server.Implementations.Channels
userCacheKey = hasCacheKey.GetCacheKey(userId) ?? string.Empty; userCacheKey = hasCacheKey.GetCacheKey(userId) ?? string.Empty;
} }
var filename = string.IsNullOrEmpty(externalFolderId) ? "root" : externalFolderId.GetMD5().ToString("N"); var filename = string.IsNullOrEmpty(externalFolderId) ? "root" : externalFolderId.GetMD5().ToString("N", CultureInfo.InvariantCulture);
filename += userCacheKey; filename += userCacheKey;
var version = ((channel.DataVersion ?? string.Empty) + "2").GetMD5().ToString("N"); var version = ((channel.DataVersion ?? string.Empty) + "2").GetMD5().ToString("N", CultureInfo.InvariantCulture);
if (sortField.HasValue) if (sortField.HasValue)
{ {
@ -860,7 +861,7 @@ namespace Emby.Server.Implementations.Channels
filename += "-sortDescending"; filename += "-sortDescending";
} }
filename = filename.GetMD5().ToString("N"); filename = filename.GetMD5().ToString("N", CultureInfo.InvariantCulture);
return Path.Combine(_config.ApplicationPaths.CachePath, return Path.Combine(_config.ApplicationPaths.CachePath,
"channels", "channels",

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -182,7 +183,7 @@ namespace Emby.Server.Implementations.Collections
public void AddToCollection(Guid collectionId, IEnumerable<Guid> ids) public void AddToCollection(Guid collectionId, IEnumerable<Guid> ids)
{ {
AddToCollection(collectionId, ids.Select(i => i.ToString("N")), true, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))); AddToCollection(collectionId, ids.Select(i => i.ToString("N", CultureInfo.InvariantCulture)), true, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)));
} }
private void AddToCollection(Guid collectionId, IEnumerable<string> ids, bool fireEvent, MetadataRefreshOptions refreshOptions) private void AddToCollection(Guid collectionId, IEnumerable<string> ids, bool fireEvent, MetadataRefreshOptions refreshOptions)

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
@ -182,7 +183,7 @@ namespace Emby.Server.Implementations.Data
return new DisplayPreferences return new DisplayPreferences
{ {
Id = guidId.ToString("N") Id = guidId.ToString("N", CultureInfo.InvariantCulture)
}; };
} }
} }

View file

@ -696,7 +696,7 @@ namespace Emby.Server.Implementations.Data
saveItemStatement.TryBindNull("@EndDate"); saveItemStatement.TryBindNull("@EndDate");
} }
saveItemStatement.TryBind("@ChannelId", item.ChannelId.Equals(Guid.Empty) ? null : item.ChannelId.ToString("N")); saveItemStatement.TryBind("@ChannelId", item.ChannelId.Equals(Guid.Empty) ? null : item.ChannelId.ToString("N", CultureInfo.InvariantCulture));
if (item is IHasProgramAttributes hasProgramAttributes) if (item is IHasProgramAttributes hasProgramAttributes)
{ {
@ -851,7 +851,7 @@ namespace Emby.Server.Implementations.Data
} }
else else
{ {
saveItemStatement.TryBind("@TopParentId", topParent.Id.ToString("N")); saveItemStatement.TryBind("@TopParentId", topParent.Id.ToString("N", CultureInfo.InvariantCulture));
} }
if (item is Trailer trailer && trailer.TrailerTypes.Length > 0) if (item is Trailer trailer && trailer.TrailerTypes.Length > 0)
@ -3548,12 +3548,12 @@ namespace Emby.Server.Implementations.Data
whereClauses.Add("ChannelId=@ChannelId"); whereClauses.Add("ChannelId=@ChannelId");
if (statement != null) if (statement != null)
{ {
statement.TryBind("@ChannelId", query.ChannelIds[0].ToString("N")); statement.TryBind("@ChannelId", query.ChannelIds[0].ToString("N", CultureInfo.InvariantCulture));
} }
} }
else if (query.ChannelIds.Length > 1) else if (query.ChannelIds.Length > 1)
{ {
var inClause = string.Join(",", query.ChannelIds.Select(i => "'" + i.ToString("N") + "'")); var inClause = string.Join(",", query.ChannelIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'"));
whereClauses.Add($"ChannelId in ({inClause})"); whereClauses.Add($"ChannelId in ({inClause})");
} }
@ -4537,12 +4537,12 @@ namespace Emby.Server.Implementations.Data
} }
if (statement != null) if (statement != null)
{ {
statement.TryBind("@TopParentId", queryTopParentIds[0].ToString("N")); statement.TryBind("@TopParentId", queryTopParentIds[0].ToString("N", CultureInfo.InvariantCulture));
} }
} }
else if (queryTopParentIds.Length > 1) else if (queryTopParentIds.Length > 1)
{ {
var val = string.Join(",", queryTopParentIds.Select(i => "'" + i.ToString("N") + "'")); var val = string.Join(",", queryTopParentIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'"));
if (enableItemsByName && includedItemByNameTypes.Count == 1) if (enableItemsByName && includedItemByNameTypes.Count == 1)
{ {
@ -4574,7 +4574,7 @@ namespace Emby.Server.Implementations.Data
} }
if (query.AncestorIds.Length > 1) if (query.AncestorIds.Length > 1)
{ {
var inClause = string.Join(",", query.AncestorIds.Select(i => "'" + i.ToString("N") + "'")); var inClause = string.Join(",", query.AncestorIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'"));
whereClauses.Add(string.Format("Guid in (select itemId from AncestorIds where AncestorIdText in ({0}))", inClause)); whereClauses.Add(string.Format("Guid in (select itemId from AncestorIds where AncestorIdText in ({0}))", inClause));
} }
if (!string.IsNullOrWhiteSpace(query.AncestorWithPresentationUniqueKey)) if (!string.IsNullOrWhiteSpace(query.AncestorWithPresentationUniqueKey))
@ -4637,7 +4637,7 @@ namespace Emby.Server.Implementations.Data
foreach (var folderId in query.BoxSetLibraryFolders) foreach (var folderId in query.BoxSetLibraryFolders)
{ {
folderIdQueries.Add("data like '%" + folderId.ToString("N") + "%'"); folderIdQueries.Add("data like '%" + folderId.ToString("N", CultureInfo.InvariantCulture) + "%'");
} }
whereClauses.Add("(" + string.Join(" OR ", folderIdQueries) + ")"); whereClauses.Add("(" + string.Join(" OR ", folderIdQueries) + ")");
@ -5161,7 +5161,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
var ancestorId = ancestorIds[i]; var ancestorId = ancestorIds[i];
statement.TryBind("@AncestorId" + index, ancestorId.ToGuidBlob()); statement.TryBind("@AncestorId" + index, ancestorId.ToGuidBlob());
statement.TryBind("@AncestorIdText" + index, ancestorId.ToString("N")); statement.TryBind("@AncestorIdText" + index, ancestorId.ToString("N", CultureInfo.InvariantCulture));
} }
statement.Reset(); statement.Reset();
@ -5579,6 +5579,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
{ {
counts.TrailerCount = value; counts.TrailerCount = value;
} }
counts.ItemCount += value; counts.ItemCount += value;
} }

View file

@ -1,8 +1,8 @@
using System; using System;
using System.Globalization;
using System.IO; using System.IO;
using System.Text; using System.Text;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Devices namespace Emby.Server.Implementations.Devices
@ -67,7 +67,7 @@ namespace Emby.Server.Implementations.Devices
private static string GetNewId() private static string GetNewId()
{ {
return Guid.NewGuid().ToString("N"); return Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
} }
private string GetDeviceId() private string GetDeviceId()

View file

@ -1,11 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
@ -195,7 +195,7 @@ namespace Emby.Server.Implementations.Devices
private string GetDevicePath(string id) private string GetDevicePath(string id)
{ {
return Path.Combine(GetDevicesPath(), id.GetMD5().ToString("N")); return Path.Combine(GetDevicesPath(), id.GetMD5().ToString("N", CultureInfo.InvariantCulture));
} }
public ContentUploadHistory GetCameraUploadHistory(string deviceId) public ContentUploadHistory GetCameraUploadHistory(string deviceId)

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -213,7 +214,7 @@ namespace Emby.Server.Implementations.Dto
if (options.ContainsField(ItemFields.DisplayPreferencesId)) if (options.ContainsField(ItemFields.DisplayPreferencesId))
{ {
dto.DisplayPreferencesId = item.DisplayPreferencesId.ToString("N"); dto.DisplayPreferencesId = item.DisplayPreferencesId.ToString("N", CultureInfo.InvariantCulture);
} }
if (user != null) if (user != null)
@ -444,7 +445,7 @@ namespace Emby.Server.Implementations.Dto
/// <exception cref="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", CultureInfo.InvariantCulture);
} }
private static void SetBookProperties(BaseItemDto dto, Book item) private static void SetBookProperties(BaseItemDto dto, Book item)
@ -608,7 +609,7 @@ namespace Emby.Server.Implementations.Dto
if (dictionary.TryGetValue(person.Name, out Person entity)) if (dictionary.TryGetValue(person.Name, out Person entity))
{ {
baseItemPerson.PrimaryImageTag = GetImageCacheTag(entity, ImageType.Primary); baseItemPerson.PrimaryImageTag = GetImageCacheTag(entity, ImageType.Primary);
baseItemPerson.Id = entity.Id.ToString("N"); baseItemPerson.Id = entity.Id.ToString("N", CultureInfo.InvariantCulture);
list.Add(baseItemPerson); list.Add(baseItemPerson);
} }
} }
@ -893,7 +894,7 @@ namespace Emby.Server.Implementations.Dto
//var artistItems = _libraryManager.GetArtists(new InternalItemsQuery //var artistItems = _libraryManager.GetArtists(new InternalItemsQuery
//{ //{
// EnableTotalRecordCount = false, // EnableTotalRecordCount = false,
// ItemIds = new[] { item.Id.ToString("N") } // ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) }
//}); //});
//dto.ArtistItems = artistItems.Items //dto.ArtistItems = artistItems.Items
@ -903,7 +904,7 @@ namespace Emby.Server.Implementations.Dto
// return new NameIdPair // return new NameIdPair
// { // {
// Name = artist.Name, // Name = artist.Name,
// Id = artist.Id.ToString("N") // Id = artist.Id.ToString("N", CultureInfo.InvariantCulture)
// }; // };
// }) // })
// .ToList(); // .ToList();
@ -946,7 +947,7 @@ namespace Emby.Server.Implementations.Dto
//var artistItems = _libraryManager.GetAlbumArtists(new InternalItemsQuery //var artistItems = _libraryManager.GetAlbumArtists(new InternalItemsQuery
//{ //{
// EnableTotalRecordCount = false, // EnableTotalRecordCount = false,
// ItemIds = new[] { item.Id.ToString("N") } // ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) }
//}); //});
//dto.AlbumArtists = artistItems.Items //dto.AlbumArtists = artistItems.Items
@ -956,7 +957,7 @@ namespace Emby.Server.Implementations.Dto
// return new NameIdPair // return new NameIdPair
// { // {
// Name = artist.Name, // Name = artist.Name,
// Id = artist.Id.ToString("N") // Id = artist.Id.ToString("N", CultureInfo.InvariantCulture)
// }; // };
// }) // })
// .ToList(); // .ToList();
@ -1044,7 +1045,7 @@ namespace Emby.Server.Implementations.Dto
} }
else else
{ {
string id = item.Id.ToString("N"); string id = item.Id.ToString("N", CultureInfo.InvariantCulture);
mediaStreams = dto.MediaSources.Where(i => string.Equals(i.Id, id, StringComparison.OrdinalIgnoreCase)) mediaStreams = dto.MediaSources.Where(i => string.Equals(i.Id, id, StringComparison.OrdinalIgnoreCase))
.SelectMany(i => i.MediaStreams) .SelectMany(i => i.MediaStreams)
.ToArray(); .ToArray();

View file

@ -100,7 +100,7 @@ namespace Emby.Server.Implementations.EntryPoints
_lastProgressMessageTimes[item.Id] = DateTime.UtcNow; _lastProgressMessageTimes[item.Id] = DateTime.UtcNow;
var dict = new Dictionary<string, string>(); var dict = new Dictionary<string, string>();
dict["ItemId"] = item.Id.ToString("N"); dict["ItemId"] = item.Id.ToString("N", CultureInfo.InvariantCulture);
dict["Progress"] = progress.ToString(CultureInfo.InvariantCulture); dict["Progress"] = progress.ToString(CultureInfo.InvariantCulture);
try try
@ -116,7 +116,7 @@ namespace Emby.Server.Implementations.EntryPoints
foreach (var collectionFolder in collectionFolders) foreach (var collectionFolder in collectionFolders)
{ {
var collectionFolderDict = new Dictionary<string, string>(); var collectionFolderDict = new Dictionary<string, string>();
collectionFolderDict["ItemId"] = collectionFolder.Id.ToString("N"); collectionFolderDict["ItemId"] = collectionFolder.Id.ToString("N", CultureInfo.InvariantCulture);
collectionFolderDict["Progress"] = (collectionFolder.GetRefreshProgress() ?? 0).ToString(CultureInfo.InvariantCulture); collectionFolderDict["Progress"] = (collectionFolder.GetRefreshProgress() ?? 0).ToString(CultureInfo.InvariantCulture);
try try
@ -378,15 +378,15 @@ namespace Emby.Server.Implementations.EntryPoints
return new LibraryUpdateInfo return new LibraryUpdateInfo
{ {
ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(), ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(),
ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(), ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(),
ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true)).Select(i => i.Id.ToString("N")).Distinct().ToArray(), ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(),
FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(), FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(),
FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(), FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(),
CollectionFolders = GetTopParentIds(newAndRemoved, allUserRootChildren).ToArray() CollectionFolders = GetTopParentIds(newAndRemoved, allUserRootChildren).ToArray()
}; };
@ -422,7 +422,7 @@ namespace Emby.Server.Implementations.EntryPoints
var collectionFolders = _libraryManager.GetCollectionFolders(item, allUserRootChildren); var collectionFolders = _libraryManager.GetCollectionFolders(item, allUserRootChildren);
foreach (var folder in allUserRootChildren) foreach (var folder in allUserRootChildren)
{ {
list.Add(folder.Id.ToString("N")); list.Add(folder.Id.ToString("N", CultureInfo.InvariantCulture));
} }
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Plugins;
@ -134,7 +135,7 @@ namespace Emby.Server.Implementations.EntryPoints
/// <param name="e">The e.</param> /// <param name="e">The e.</param>
void userManager_UserDeleted(object sender, GenericEventArgs<User> e) void userManager_UserDeleted(object sender, GenericEventArgs<User> e)
{ {
SendMessageToUserSession(e.Argument, "UserDeleted", e.Argument.Id.ToString("N")); SendMessageToUserSession(e.Argument, "UserDeleted", e.Argument.Id.ToString("N", CultureInfo.InvariantCulture));
} }
void _userManager_UserPolicyUpdated(object sender, GenericEventArgs<User> e) void _userManager_UserPolicyUpdated(object sender, GenericEventArgs<User> e)

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,7 +9,6 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session; using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Session; using MediaBrowser.Model.Session;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -125,12 +125,12 @@ namespace Emby.Server.Implementations.EntryPoints
.Select(i => .Select(i =>
{ {
var dto = _userDataManager.GetUserDataDto(i, user); var dto = _userDataManager.GetUserDataDto(i, user);
dto.ItemId = i.Id.ToString("N"); dto.ItemId = i.Id.ToString("N", CultureInfo.InvariantCulture);
return dto; return dto;
}) })
.ToArray(); .ToArray();
var userIdString = userId.ToString("N"); var userIdString = userId.ToString("N", CultureInfo.InvariantCulture);
return new UserDataChangeInfo return new UserDataChangeInfo
{ {

View file

@ -195,7 +195,7 @@ namespace Emby.Server.Implementations.HttpClientManager
} }
var url = options.Url; var url = options.Url;
var urlHash = url.ToLowerInvariant().GetMD5().ToString("N"); var urlHash = url.ToLowerInvariant().GetMD5().ToString("N", CultureInfo.InvariantCulture);
var responseCachePath = Path.Combine(_appPaths.CachePath, "httpclient", urlHash); var responseCachePath = Path.Combine(_appPaths.CachePath, "httpclient", urlHash);

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -555,7 +556,7 @@ namespace Emby.Server.Implementations.IO
throw new ArgumentNullException(nameof(file2)); throw new ArgumentNullException(nameof(file2));
} }
var temp1 = Path.Combine(_tempPath, Guid.NewGuid().ToString("N")); var temp1 = Path.Combine(_tempPath, Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture));
// Copying over will fail against hidden files // Copying over will fail against hidden files
SetHidden(file1, false); SetHidden(file1, false);

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -89,7 +90,7 @@ namespace Emby.Server.Implementations.Images
ImageType imageType, ImageType imageType,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var outputPathWithoutExtension = Path.Combine(ApplicationPaths.TempDirectory, Guid.NewGuid().ToString("N")); var outputPathWithoutExtension = Path.Combine(ApplicationPaths.TempDirectory, Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture));
Directory.CreateDirectory(Path.GetDirectoryName(outputPathWithoutExtension)); Directory.CreateDirectory(Path.GetDirectoryName(outputPathWithoutExtension));
string outputPath = CreateImage(item, itemsWithImages, outputPathWithoutExtension, imageType, 0); string outputPath = CreateImage(item, itemsWithImages, outputPathWithoutExtension, imageType, 0);

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
@ -26,7 +27,7 @@ namespace Emby.Server.Implementations.Library
EnableStreamSharing = false; EnableStreamSharing = false;
_closeFn = closeFn; _closeFn = closeFn;
ConsumerCount = 1; ConsumerCount = 1;
UniqueId = Guid.NewGuid().ToString("N"); UniqueId = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
} }
public Task Close() public Task Close()

View file

@ -1187,12 +1187,12 @@ namespace Emby.Server.Implementations.Library
if (libraryFolder != null && libraryFolder.HasImage(ImageType.Primary)) if (libraryFolder != null && libraryFolder.HasImage(ImageType.Primary))
{ {
info.PrimaryImageItemId = libraryFolder.Id.ToString("N"); info.PrimaryImageItemId = libraryFolder.Id.ToString("N", CultureInfo.InvariantCulture);
} }
if (libraryFolder != null) if (libraryFolder != null)
{ {
info.ItemId = libraryFolder.Id.ToString("N"); info.ItemId = libraryFolder.Id.ToString("N", CultureInfo.InvariantCulture);
info.LibraryOptions = GetLibraryOptions(libraryFolder); info.LibraryOptions = GetLibraryOptions(libraryFolder);
if (refreshQueue != null) if (refreshQueue != null)
@ -2135,12 +2135,12 @@ namespace Emby.Server.Implementations.Library
string viewType, string viewType,
string sortName) string sortName)
{ {
var parentIdString = parentId.Equals(Guid.Empty) ? null : parentId.ToString("N"); var parentIdString = parentId.Equals(Guid.Empty) ? null : parentId.ToString("N", CultureInfo.InvariantCulture);
var idValues = "38_namedview_" + name + user.Id.ToString("N") + (parentIdString ?? string.Empty) + (viewType ?? string.Empty); var idValues = "38_namedview_" + name + user.Id.ToString("N", CultureInfo.InvariantCulture) + (parentIdString ?? string.Empty) + (viewType ?? string.Empty);
var id = GetNewItemId(idValues, typeof(UserView)); var id = GetNewItemId(idValues, typeof(UserView));
var path = Path.Combine(ConfigurationManager.ApplicationPaths.InternalMetadataPath, "views", id.ToString("N")); var path = Path.Combine(ConfigurationManager.ApplicationPaths.InternalMetadataPath, "views", id.ToString("N", CultureInfo.InvariantCulture));
var item = GetItemById(id) as UserView; var item = GetItemById(id) as UserView;
@ -2271,7 +2271,7 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentNullException(nameof(name)); throw new ArgumentNullException(nameof(name));
} }
var parentIdString = parentId.Equals(Guid.Empty) ? null : parentId.ToString("N"); var parentIdString = parentId.Equals(Guid.Empty) ? null : parentId.ToString("N", CultureInfo.InvariantCulture);
var idValues = "37_namedview_" + name + (parentIdString ?? string.Empty) + (viewType ?? string.Empty); var idValues = "37_namedview_" + name + (parentIdString ?? string.Empty) + (viewType ?? string.Empty);
if (!string.IsNullOrEmpty(uniqueId)) if (!string.IsNullOrEmpty(uniqueId))
{ {
@ -2280,7 +2280,7 @@ namespace Emby.Server.Implementations.Library
var id = GetNewItemId(idValues, typeof(UserView)); var id = GetNewItemId(idValues, typeof(UserView));
var path = Path.Combine(ConfigurationManager.ApplicationPaths.InternalMetadataPath, "views", id.ToString("N")); var path = Path.Combine(ConfigurationManager.ApplicationPaths.InternalMetadataPath, "views", id.ToString("N", CultureInfo.InvariantCulture));
var item = GetItemById(id) as UserView; var item = GetItemById(id) as UserView;

View file

@ -40,7 +40,7 @@ namespace Emby.Server.Implementations.Library
var now = DateTime.UtcNow; var now = DateTime.UtcNow;
MediaInfo mediaInfo = null; MediaInfo mediaInfo = null;
var cacheFilePath = string.IsNullOrEmpty(cacheKey) ? null : Path.Combine(_appPaths.CachePath, "mediainfo", cacheKey.GetMD5().ToString("N") + ".json"); var cacheFilePath = string.IsNullOrEmpty(cacheKey) ? null : Path.Combine(_appPaths.CachePath, "mediainfo", cacheKey.GetMD5().ToString("N", CultureInfo.InvariantCulture) + ".json");
if (!string.IsNullOrEmpty(cacheKey)) if (!string.IsNullOrEmpty(cacheKey))
{ {

View file

@ -269,7 +269,7 @@ namespace Emby.Server.Implementations.Library
private static void SetKeyProperties(IMediaSourceProvider provider, MediaSourceInfo mediaSource) private static void SetKeyProperties(IMediaSourceProvider provider, MediaSourceInfo mediaSource)
{ {
var prefix = provider.GetType().FullName.GetMD5().ToString("N") + LiveStreamIdDelimeter; var prefix = provider.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture) + LiveStreamIdDelimeter;
if (!string.IsNullOrEmpty(mediaSource.OpenToken) && !mediaSource.OpenToken.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) if (!string.IsNullOrEmpty(mediaSource.OpenToken) && !mediaSource.OpenToken.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
{ {
@ -626,7 +626,7 @@ namespace Emby.Server.Implementations.Library
var now = DateTime.UtcNow; var now = DateTime.UtcNow;
MediaInfo mediaInfo = null; MediaInfo mediaInfo = null;
var cacheFilePath = string.IsNullOrEmpty(cacheKey) ? null : Path.Combine(_appPaths.CachePath, "mediainfo", cacheKey.GetMD5().ToString("N") + ".json"); var cacheFilePath = string.IsNullOrEmpty(cacheKey) ? null : Path.Combine(_appPaths.CachePath, "mediainfo", cacheKey.GetMD5().ToString("N", CultureInfo.InvariantCulture) + ".json");
if (!string.IsNullOrEmpty(cacheKey)) if (!string.IsNullOrEmpty(cacheKey))
{ {
@ -854,7 +854,7 @@ namespace Emby.Server.Implementations.Library
var keys = key.Split(new[] { LiveStreamIdDelimeter }, 2); var keys = key.Split(new[] { LiveStreamIdDelimeter }, 2);
var provider = _providers.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N"), keys[0], StringComparison.OrdinalIgnoreCase)); var provider = _providers.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), keys[0], StringComparison.OrdinalIgnoreCase));
var splitIndex = key.IndexOf(LiveStreamIdDelimeter); var splitIndex = key.IndexOf(LiveStreamIdDelimeter);
var keyId = key.Substring(splitIndex + 1); var keyId = key.Substring(splitIndex + 1);

View file

@ -152,7 +152,7 @@ namespace Emby.Server.Implementations.Library
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
private static string GetCacheKey(long internalUserId, Guid itemId) private static string GetCacheKey(long internalUserId, Guid itemId)
{ {
return internalUserId.ToString(CultureInfo.InvariantCulture) + "-" + itemId.ToString("N"); return internalUserId.ToString(CultureInfo.InvariantCulture) + "-" + itemId.ToString("N", CultureInfo.InvariantCulture);
} }
public UserItemData GetUserData(User user, BaseItem item) public UserItemData GetUserData(User user, BaseItem item)

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Channels;
@ -117,7 +118,7 @@ namespace Emby.Server.Implementations.Library
if (!query.IncludeHidden) if (!query.IncludeHidden)
{ {
list = list.Where(i => !user.Configuration.MyMediaExcludes.Contains(i.Id.ToString("N"))).ToList(); list = list.Where(i => !user.Configuration.MyMediaExcludes.Contains(i.Id.ToString("N", CultureInfo.InvariantCulture))).ToList();
} }
var sorted = _libraryManager.Sort(list, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).ToList(); var sorted = _libraryManager.Sort(list, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).ToList();
@ -127,7 +128,7 @@ namespace Emby.Server.Implementations.Library
return list return list
.OrderBy(i => .OrderBy(i =>
{ {
var index = orders.IndexOf(i.Id.ToString("N")); var index = orders.IndexOf(i.Id.ToString("N", CultureInfo.InvariantCulture));
if (index == -1) if (index == -1)
{ {
@ -136,7 +137,7 @@ namespace Emby.Server.Implementations.Library
{ {
if (!view.DisplayParentId.Equals(Guid.Empty)) if (!view.DisplayParentId.Equals(Guid.Empty))
{ {
index = orders.IndexOf(view.DisplayParentId.ToString("N")); index = orders.IndexOf(view.DisplayParentId.ToString("N", CultureInfo.InvariantCulture));
} }
} }
} }
@ -269,7 +270,7 @@ namespace Emby.Server.Implementations.Library
{ {
parents = _libraryManager.GetUserRootFolder().GetChildren(user, true) parents = _libraryManager.GetUserRootFolder().GetChildren(user, true)
.Where(i => i is Folder) .Where(i => i is Folder)
.Where(i => !user.Configuration.LatestItemsExcludes.Contains(i.Id.ToString("N"))) .Where(i => !user.Configuration.LatestItemsExcludes.Contains(i.Id.ToString("N", CultureInfo.InvariantCulture)))
.ToList(); .ToList();
} }

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -91,7 +92,7 @@ namespace Emby.Server.Implementations.Library.Validators
continue; continue;
} }
_logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name); _logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N", CultureInfo.InvariantCulture), item.Name, item.GetType().Name);
_libraryManager.DeleteItem(item, new DeleteOptions _libraryManager.DeleteItem(item, new DeleteOptions
{ {

View file

@ -1,7 +1,7 @@
using System; using System;
using System.Globalization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
@ -96,7 +96,7 @@ namespace Emby.Server.Implementations.Library.Validators
foreach (var item in deadEntities) foreach (var item in deadEntities)
{ {
_logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name); _logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N", CultureInfo.InvariantCulture), item.Name, item.GetType().Name);
_libraryManager.DeleteItem(item, new DeleteOptions _libraryManager.DeleteItem(item, new DeleteOptions
{ {

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
@ -76,7 +77,7 @@ namespace Emby.Server.Implementations.Library.Validators
foreach (var item in deadEntities) foreach (var item in deadEntities)
{ {
_logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name); _logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N", CultureInfo.InvariantCulture), item.Name, item.GetType().Name);
_libraryManager.DeleteItem(item, new DeleteOptions _libraryManager.DeleteItem(item, new DeleteOptions
{ {

View file

@ -681,7 +681,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
} }
} }
timer.Id = Guid.NewGuid().ToString("N"); timer.Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
LiveTvProgram programInfo = null; LiveTvProgram programInfo = null;
@ -713,7 +713,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public async Task<string> CreateSeriesTimer(SeriesTimerInfo info, CancellationToken cancellationToken) public async Task<string> CreateSeriesTimer(SeriesTimerInfo info, CancellationToken cancellationToken)
{ {
info.Id = Guid.NewGuid().ToString("N"); info.Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
// populate info.seriesID // populate info.seriesID
var program = GetProgramInfoFromCache(info.ProgramId); var program = GetProgramInfoFromCache(info.ProgramId);
@ -1059,7 +1059,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var json = _jsonSerializer.SerializeToString(mediaSource); var json = _jsonSerializer.SerializeToString(mediaSource);
mediaSource = _jsonSerializer.DeserializeFromString<MediaSourceInfo>(json); mediaSource = _jsonSerializer.DeserializeFromString<MediaSourceInfo>(json);
mediaSource.Id = Guid.NewGuid().ToString("N") + "_" + mediaSource.Id; mediaSource.Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture) + "_" + mediaSource.Id;
//if (mediaSource.DateLiveStreamOpened.HasValue && enableStreamSharing) //if (mediaSource.DateLiveStreamOpened.HasValue && enableStreamSharing)
//{ //{
@ -2529,7 +2529,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var timer = new TimerInfo var timer = new TimerInfo
{ {
ChannelId = channelId, ChannelId = channelId,
Id = (seriesTimer.Id + parent.ExternalId).GetMD5().ToString("N"), Id = (seriesTimer.Id + parent.ExternalId).GetMD5().ToString("N", CultureInfo.InvariantCulture),
StartDate = parent.StartDate, StartDate = parent.StartDate,
EndDate = parent.EndDate.Value, EndDate = parent.EndDate.Value,
ProgramId = parent.ExternalId, ProgramId = parent.ExternalId,

View file

@ -211,7 +211,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
HasImage = program.Icon != null && !string.IsNullOrEmpty(program.Icon.Source), HasImage = program.Icon != null && !string.IsNullOrEmpty(program.Icon.Source),
OfficialRating = program.Rating != null && !string.IsNullOrEmpty(program.Rating.Value) ? program.Rating.Value : null, OfficialRating = program.Rating != null && !string.IsNullOrEmpty(program.Rating.Value) ? program.Rating.Value : null,
CommunityRating = program.StarRating, CommunityRating = program.StarRating,
SeriesId = program.Episode == null ? null : program.Title.GetMD5().ToString("N") SeriesId = program.Episode == null ? null : program.Title.GetMD5().ToString("N", CultureInfo.InvariantCulture)
}; };
if (string.IsNullOrWhiteSpace(program.ProgramId)) if (string.IsNullOrWhiteSpace(program.ProgramId))
@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
uniqueString = "-" + programInfo.EpisodeNumber.Value.ToString(CultureInfo.InvariantCulture); uniqueString = "-" + programInfo.EpisodeNumber.Value.ToString(CultureInfo.InvariantCulture);
} }
programInfo.ShowId = uniqueString.GetMD5().ToString("N"); programInfo.ShowId = uniqueString.GetMD5().ToString("N", CultureInfo.InvariantCulture);
// If we don't have valid episode info, assume it's a unique program, otherwise recordings might be skipped // If we don't have valid episode info, assume it's a unique program, otherwise recordings might be skipped
if (programInfo.IsSeries if (programInfo.IsSeries

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -52,7 +53,7 @@ namespace Emby.Server.Implementations.LiveTv
ExternalId = info.Id, ExternalId = info.Id,
ChannelId = GetInternalChannelId(service.Name, info.ChannelId), ChannelId = GetInternalChannelId(service.Name, info.ChannelId),
Status = info.Status, Status = info.Status,
SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) ? null : GetInternalSeriesTimerId(info.SeriesTimerId).ToString("N"), SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) ? null : GetInternalSeriesTimerId(info.SeriesTimerId).ToString("N", CultureInfo.InvariantCulture),
PrePaddingSeconds = info.PrePaddingSeconds, PrePaddingSeconds = info.PrePaddingSeconds,
PostPaddingSeconds = info.PostPaddingSeconds, PostPaddingSeconds = info.PostPaddingSeconds,
IsPostPaddingRequired = info.IsPostPaddingRequired, IsPostPaddingRequired = info.IsPostPaddingRequired,
@ -69,7 +70,7 @@ namespace Emby.Server.Implementations.LiveTv
if (!string.IsNullOrEmpty(info.ProgramId)) if (!string.IsNullOrEmpty(info.ProgramId))
{ {
dto.ProgramId = GetInternalProgramId(info.ProgramId).ToString("N"); dto.ProgramId = GetInternalProgramId(info.ProgramId).ToString("N", CultureInfo.InvariantCulture);
} }
if (program != null) if (program != null)
@ -107,7 +108,7 @@ namespace Emby.Server.Implementations.LiveTv
{ {
var dto = new SeriesTimerInfoDto var dto = new SeriesTimerInfoDto
{ {
Id = GetInternalSeriesTimerId(info.Id).ToString("N"), Id = GetInternalSeriesTimerId(info.Id).ToString("N", CultureInfo.InvariantCulture),
Overview = info.Overview, Overview = info.Overview,
EndDate = info.EndDate, EndDate = info.EndDate,
Name = info.Name, Name = info.Name,
@ -139,7 +140,7 @@ namespace Emby.Server.Implementations.LiveTv
if (!string.IsNullOrEmpty(info.ProgramId)) if (!string.IsNullOrEmpty(info.ProgramId))
{ {
dto.ProgramId = GetInternalProgramId(info.ProgramId).ToString("N"); dto.ProgramId = GetInternalProgramId(info.ProgramId).ToString("N", CultureInfo.InvariantCulture);
} }
dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days.ToArray()); dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days.ToArray());
@ -169,7 +170,7 @@ namespace Emby.Server.Implementations.LiveTv
try try
{ {
dto.ParentThumbImageTag = _imageProcessor.GetImageCacheTag(librarySeries, image); dto.ParentThumbImageTag = _imageProcessor.GetImageCacheTag(librarySeries, image);
dto.ParentThumbItemId = librarySeries.Id.ToString("N"); dto.ParentThumbItemId = librarySeries.Id.ToString("N", CultureInfo.InvariantCulture);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -185,7 +186,7 @@ namespace Emby.Server.Implementations.LiveTv
{ {
_imageProcessor.GetImageCacheTag(librarySeries, image) _imageProcessor.GetImageCacheTag(librarySeries, image)
}; };
dto.ParentBackdropItemId = librarySeries.Id.ToString("N"); dto.ParentBackdropItemId = librarySeries.Id.ToString("N", CultureInfo.InvariantCulture);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -213,7 +214,7 @@ namespace Emby.Server.Implementations.LiveTv
try try
{ {
dto.ParentPrimaryImageTag = _imageProcessor.GetImageCacheTag(program, image); dto.ParentPrimaryImageTag = _imageProcessor.GetImageCacheTag(program, image);
dto.ParentPrimaryImageItemId = program.Id.ToString("N"); dto.ParentPrimaryImageItemId = program.Id.ToString("N", CultureInfo.InvariantCulture);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -232,7 +233,7 @@ namespace Emby.Server.Implementations.LiveTv
{ {
_imageProcessor.GetImageCacheTag(program, image) _imageProcessor.GetImageCacheTag(program, image)
}; };
dto.ParentBackdropItemId = program.Id.ToString("N"); dto.ParentBackdropItemId = program.Id.ToString("N", CultureInfo.InvariantCulture);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -263,7 +264,7 @@ namespace Emby.Server.Implementations.LiveTv
try try
{ {
dto.ParentThumbImageTag = _imageProcessor.GetImageCacheTag(librarySeries, image); dto.ParentThumbImageTag = _imageProcessor.GetImageCacheTag(librarySeries, image);
dto.ParentThumbItemId = librarySeries.Id.ToString("N"); dto.ParentThumbItemId = librarySeries.Id.ToString("N", CultureInfo.InvariantCulture);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -279,7 +280,7 @@ namespace Emby.Server.Implementations.LiveTv
{ {
_imageProcessor.GetImageCacheTag(librarySeries, image) _imageProcessor.GetImageCacheTag(librarySeries, image)
}; };
dto.ParentBackdropItemId = librarySeries.Id.ToString("N"); dto.ParentBackdropItemId = librarySeries.Id.ToString("N", CultureInfo.InvariantCulture);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -320,7 +321,7 @@ namespace Emby.Server.Implementations.LiveTv
try try
{ {
dto.ParentPrimaryImageTag = _imageProcessor.GetImageCacheTag(program, image); dto.ParentPrimaryImageTag = _imageProcessor.GetImageCacheTag(program, image);
dto.ParentPrimaryImageItemId = program.Id.ToString("N"); dto.ParentPrimaryImageItemId = program.Id.ToString("N", CultureInfo.InvariantCulture);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -339,7 +340,7 @@ namespace Emby.Server.Implementations.LiveTv
{ {
_imageProcessor.GetImageCacheTag(program, image) _imageProcessor.GetImageCacheTag(program, image)
}; };
dto.ParentBackdropItemId = program.Id.ToString("N"); dto.ParentBackdropItemId = program.Id.ToString("N", CultureInfo.InvariantCulture);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -407,7 +408,7 @@ namespace Emby.Server.Implementations.LiveTv
{ {
var name = ServiceName + externalId + InternalVersionNumber; var name = ServiceName + externalId + InternalVersionNumber;
return name.ToLowerInvariant().GetMD5().ToString("N"); return name.ToLowerInvariant().GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
public Guid GetInternalSeriesTimerId(string externalId) public Guid GetInternalSeriesTimerId(string externalId)

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -258,7 +259,7 @@ namespace Emby.Server.Implementations.LiveTv
} }
info.RequiresClosing = true; info.RequiresClosing = true;
var idPrefix = service.GetType().FullName.GetMD5().ToString("N") + "_"; var idPrefix = service.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture) + "_";
info.LiveStreamId = idPrefix + info.Id; info.LiveStreamId = idPrefix + info.Id;
@ -820,7 +821,7 @@ namespace Emby.Server.Implementations.LiveTv
if (!string.IsNullOrWhiteSpace(query.SeriesTimerId)) if (!string.IsNullOrWhiteSpace(query.SeriesTimerId))
{ {
var seriesTimers = await GetSeriesTimersInternal(new SeriesTimerQuery { }, cancellationToken).ConfigureAwait(false); var seriesTimers = await GetSeriesTimersInternal(new SeriesTimerQuery { }, cancellationToken).ConfigureAwait(false);
var seriesTimer = seriesTimers.Items.FirstOrDefault(i => string.Equals(_tvDtoService.GetInternalSeriesTimerId(i.Id).ToString("N"), query.SeriesTimerId, StringComparison.OrdinalIgnoreCase)); var seriesTimer = seriesTimers.Items.FirstOrDefault(i => string.Equals(_tvDtoService.GetInternalSeriesTimerId(i.Id).ToString("N", CultureInfo.InvariantCulture), query.SeriesTimerId, StringComparison.OrdinalIgnoreCase));
if (seriesTimer != null) if (seriesTimer != null)
{ {
internalQuery.ExternalSeriesId = seriesTimer.SeriesId; internalQuery.ExternalSeriesId = seriesTimer.SeriesId;
@ -997,7 +998,7 @@ namespace Emby.Server.Implementations.LiveTv
if (!string.IsNullOrEmpty(timer.SeriesTimerId)) if (!string.IsNullOrEmpty(timer.SeriesTimerId))
{ {
program.SeriesTimerId = _tvDtoService.GetInternalSeriesTimerId(timer.SeriesTimerId) program.SeriesTimerId = _tvDtoService.GetInternalSeriesTimerId(timer.SeriesTimerId)
.ToString("N"); .ToString("N", CultureInfo.InvariantCulture);
foundSeriesTimer = true; foundSeriesTimer = true;
} }
@ -1018,7 +1019,7 @@ namespace Emby.Server.Implementations.LiveTv
if (seriesTimer != null) if (seriesTimer != null)
{ {
program.SeriesTimerId = _tvDtoService.GetInternalSeriesTimerId(seriesTimer.Id) program.SeriesTimerId = _tvDtoService.GetInternalSeriesTimerId(seriesTimer.Id)
.ToString("N"); .ToString("N", CultureInfo.InvariantCulture);
} }
} }
} }
@ -1472,7 +1473,7 @@ namespace Emby.Server.Implementations.LiveTv
dto.SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) dto.SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId)
? null ? null
: _tvDtoService.GetInternalSeriesTimerId(info.SeriesTimerId).ToString("N"); : _tvDtoService.GetInternalSeriesTimerId(info.SeriesTimerId).ToString("N", CultureInfo.InvariantCulture);
dto.TimerId = string.IsNullOrEmpty(info.Id) dto.TimerId = string.IsNullOrEmpty(info.Id)
? null ? null
@ -2027,7 +2028,7 @@ namespace Emby.Server.Implementations.LiveTv
info.StartDate = program.StartDate; info.StartDate = program.StartDate;
info.Name = program.Name; info.Name = program.Name;
info.Overview = program.Overview; info.Overview = program.Overview;
info.ProgramId = programDto.Id.ToString("N"); info.ProgramId = programDto.Id.ToString("N", CultureInfo.InvariantCulture);
info.ExternalProgramId = program.ExternalId; info.ExternalProgramId = program.ExternalId;
if (program.EndDate.HasValue) if (program.EndDate.HasValue)
@ -2088,7 +2089,7 @@ namespace Emby.Server.Implementations.LiveTv
if (service is ISupportsNewTimerIds supportsNewTimerIds) if (service is ISupportsNewTimerIds supportsNewTimerIds)
{ {
newTimerId = await supportsNewTimerIds.CreateSeriesTimer(info, cancellationToken).ConfigureAwait(false); newTimerId = await supportsNewTimerIds.CreateSeriesTimer(info, cancellationToken).ConfigureAwait(false);
newTimerId = _tvDtoService.GetInternalSeriesTimerId(newTimerId).ToString("N"); newTimerId = _tvDtoService.GetInternalSeriesTimerId(newTimerId).ToString("N", CultureInfo.InvariantCulture);
} }
else else
{ {
@ -2192,7 +2193,7 @@ namespace Emby.Server.Implementations.LiveTv
info.EnabledUsers = _userManager.Users info.EnabledUsers = _userManager.Users
.Where(IsLiveTvEnabled) .Where(IsLiveTvEnabled)
.Select(i => i.Id.ToString("N")) .Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture))
.ToArray(); .ToArray();
return info; return info;
@ -2219,7 +2220,7 @@ namespace Emby.Server.Implementations.LiveTv
{ {
var parts = id.Split(new[] { '_' }, 2); var parts = id.Split(new[] { '_' }, 2);
var service = _services.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N"), parts[0], StringComparison.OrdinalIgnoreCase)); var service = _services.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), parts[0], StringComparison.OrdinalIgnoreCase));
if (service == null) if (service == null)
{ {
@ -2269,7 +2270,7 @@ namespace Emby.Server.Implementations.LiveTv
if (index == -1 || string.IsNullOrWhiteSpace(info.Id)) if (index == -1 || string.IsNullOrWhiteSpace(info.Id))
{ {
info.Id = Guid.NewGuid().ToString("N"); info.Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
list.Add(info); list.Add(info);
config.TunerHosts = list.ToArray(); config.TunerHosts = list.ToArray();
} }
@ -2312,7 +2313,7 @@ namespace Emby.Server.Implementations.LiveTv
if (index == -1 || string.IsNullOrWhiteSpace(info.Id)) if (index == -1 || string.IsNullOrWhiteSpace(info.Id))
{ {
info.Id = Guid.NewGuid().ToString("N"); info.Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
list.Add(info); list.Add(info);
config.ListingProviders = list.ToArray(); config.ListingProviders = list.ToArray();
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -101,7 +102,7 @@ namespace Emby.Server.Implementations.LiveTv
{ {
var openKeys = new List<string>(); var openKeys = new List<string>();
openKeys.Add(item.GetType().Name); openKeys.Add(item.GetType().Name);
openKeys.Add(item.Id.ToString("N")); openKeys.Add(item.Id.ToString("N", CultureInfo.InvariantCulture));
openKeys.Add(source.Id ?? string.Empty); openKeys.Add(source.Id ?? string.Empty);
source.OpenToken = string.Join(StreamIdDelimeterString, openKeys.ToArray()); source.OpenToken = string.Join(StreamIdDelimeterString, openKeys.ToArray());
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
@ -460,7 +461,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{ {
id = "native"; id = "native";
} }
id += "_" + channelId.GetMD5().ToString("N") + "_" + url.GetMD5().ToString("N"); id += "_" + channelId.GetMD5().ToString("N", CultureInfo.InvariantCulture) + "_" + url.GetMD5().ToString("N", CultureInfo.InvariantCulture);
var mediaSource = new MediaSourceInfo var mediaSource = new MediaSourceInfo
{ {

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -42,7 +43,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
MediaSource = mediaSource; MediaSource = mediaSource;
Logger = logger; Logger = logger;
EnableStreamSharing = true; EnableStreamSharing = true;
UniqueId = Guid.NewGuid().ToString("N"); UniqueId = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
if (tuner != null) if (tuner != null)
{ {

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -43,7 +44,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
private string GetFullChannelIdPrefix(TunerHostInfo info) private string GetFullChannelIdPrefix(TunerHostInfo info)
{ {
return ChannelIdPrefix + info.Url.GetMD5().ToString("N"); return ChannelIdPrefix + info.Url.GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
protected override async Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken) protected override async Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken)
@ -61,7 +62,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
Name = Name, Name = Name,
SourceType = Type, SourceType = Type,
Status = LiveTvTunerStatus.Available, Status = LiveTvTunerStatus.Available,
Id = i.Url.GetMD5().ToString("N"), Id = i.Url.GetMD5().ToString("N", CultureInfo.InvariantCulture),
Url = i.Url Url = i.Url
}) })
.ToList(); .ToList();
@ -173,7 +174,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
ReadAtNativeFramerate = false, ReadAtNativeFramerate = false,
Id = channel.Path.GetMD5().ToString("N"), Id = channel.Path.GetMD5().ToString("N", CultureInfo.InvariantCulture),
IsInfiniteStream = true, IsInfiniteStream = true,
IsRemote = isRemote, IsRemote = isRemote,

View file

@ -92,11 +92,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
var channel = GetChannelnfo(extInf, tunerHostId, line); var channel = GetChannelnfo(extInf, tunerHostId, line);
if (string.IsNullOrWhiteSpace(channel.Id)) if (string.IsNullOrWhiteSpace(channel.Id))
{ {
channel.Id = channelIdPrefix + line.GetMD5().ToString("N"); channel.Id = channelIdPrefix + line.GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
else else
{ {
channel.Id = channelIdPrefix + channel.Id.GetMD5().ToString("N"); channel.Id = channelIdPrefix + channel.Id.GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
channel.Path = line; channel.Path = line;

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -129,7 +130,7 @@ namespace Emby.Server.Implementations.Playlists
{ {
new Share new Share
{ {
UserId = options.UserId.Equals(Guid.Empty) ? null : options.UserId.ToString("N"), UserId = options.UserId.Equals(Guid.Empty) ? null : options.UserId.ToString("N", CultureInfo.InvariantCulture),
CanEdit = true CanEdit = true
} }
} }
@ -144,7 +145,7 @@ namespace Emby.Server.Implementations.Playlists
if (options.ItemIdList.Length > 0) if (options.ItemIdList.Length > 0)
{ {
AddToPlaylistInternal(playlist.Id.ToString("N"), options.ItemIdList, user, new DtoOptions(false) AddToPlaylistInternal(playlist.Id.ToString("N", CultureInfo.InvariantCulture), options.ItemIdList, user, new DtoOptions(false)
{ {
EnableImages = true EnableImages = true
}); });
@ -152,7 +153,7 @@ namespace Emby.Server.Implementations.Playlists
return new PlaylistCreationResult return new PlaylistCreationResult
{ {
Id = playlist.Id.ToString("N") Id = playlist.Id.ToString("N", CultureInfo.InvariantCulture)
}; };
} }
finally finally

View file

@ -1,5 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -287,7 +287,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{ {
if (_id == null) if (_id == null)
{ {
_id = ScheduledTask.GetType().FullName.GetMD5().ToString("N"); _id = ScheduledTask.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
return _id; return _id;

View file

@ -174,7 +174,7 @@ namespace Emby.Server.Implementations.Security
if (!query.UserId.Equals(Guid.Empty)) if (!query.UserId.Equals(Guid.Empty))
{ {
statement.TryBind("@UserId", query.UserId.ToString("N")); statement.TryBind("@UserId", query.UserId.ToString("N", CultureInfo.InvariantCulture));
} }
if (!string.IsNullOrEmpty(query.DeviceId)) if (!string.IsNullOrEmpty(query.DeviceId))

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
@ -245,7 +246,7 @@ namespace Emby.Server.Implementations.Serialization
return null; return null;
} }
return guid.ToString("N"); return guid.ToString("N", CultureInfo.InvariantCulture);
} }
/// <summary> /// <summary>

View file

@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.Session
{ {
var dict = new Dictionary<string, string>(); var dict = new Dictionary<string, string>();
dict["ItemIds"] = string.Join(",", command.ItemIds.Select(i => i.ToString("N")).ToArray()); dict["ItemIds"] = string.Join(",", command.ItemIds.Select(i => i.ToString("N", CultureInfo.InvariantCulture)).ToArray());
if (command.StartPositionTicks.HasValue) if (command.StartPositionTicks.HasValue)
{ {

View file

@ -327,7 +327,7 @@ namespace Emby.Server.Implementations.Session
{ {
if (string.IsNullOrEmpty(info.MediaSourceId)) if (string.IsNullOrEmpty(info.MediaSourceId))
{ {
info.MediaSourceId = info.ItemId.ToString("N"); info.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);
} }
if (!info.ItemId.Equals(Guid.Empty) && info.Item == null && libraryItem != null) if (!info.ItemId.Equals(Guid.Empty) && info.Item == null && libraryItem != null)
@ -463,7 +463,7 @@ namespace Emby.Server.Implementations.Session
Client = appName, Client = appName,
DeviceId = deviceId, DeviceId = deviceId,
ApplicationVersion = appVersion, ApplicationVersion = appVersion,
Id = key.GetMD5().ToString("N"), Id = key.GetMD5().ToString("N", CultureInfo.InvariantCulture),
ServerId = _appHost.SystemId ServerId = _appHost.SystemId
}; };
@ -845,7 +845,7 @@ namespace Emby.Server.Implementations.Session
// Normalize // Normalize
if (string.IsNullOrEmpty(info.MediaSourceId)) if (string.IsNullOrEmpty(info.MediaSourceId))
{ {
info.MediaSourceId = info.ItemId.ToString("N"); info.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);
} }
if (!info.ItemId.Equals(Guid.Empty) && info.Item == null && libraryItem != null) if (!info.ItemId.Equals(Guid.Empty) && info.Item == null && libraryItem != null)
@ -1029,7 +1029,7 @@ namespace Emby.Server.Implementations.Session
private static async Task SendMessageToSession<T>(SessionInfo session, string name, T data, CancellationToken cancellationToken) private static async Task SendMessageToSession<T>(SessionInfo session, string name, T data, CancellationToken cancellationToken)
{ {
var controllers = session.SessionControllers.ToArray(); var controllers = session.SessionControllers.ToArray();
var messageId = Guid.NewGuid().ToString("N"); var messageId = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
foreach (var controller in controllers) foreach (var controller in controllers)
{ {
@ -1234,7 +1234,7 @@ namespace Emby.Server.Implementations.Session
AssertCanControl(session, controllingSession); AssertCanControl(session, controllingSession);
if (!controllingSession.UserId.Equals(Guid.Empty)) if (!controllingSession.UserId.Equals(Guid.Empty))
{ {
command.ControllingUserId = controllingSession.UserId.ToString("N"); command.ControllingUserId = controllingSession.UserId.ToString("N", CultureInfo.InvariantCulture);
} }
} }
@ -1484,7 +1484,7 @@ namespace Emby.Server.Implementations.Session
DeviceId = deviceId, DeviceId = deviceId,
DeviceName = deviceName, DeviceName = deviceName,
UserId = user.Id, UserId = user.Id,
AccessToken = Guid.NewGuid().ToString("N"), AccessToken = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture),
UserName = user.Name UserName = user.Name
}; };
@ -1822,6 +1822,7 @@ namespace Emby.Server.Implementations.Session
CheckDisposed(); CheckDisposed();
var sessions = Sessions.Where(i => string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase)); var sessions = Sessions.Where(i => string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase));
return SendMessageToSessions(sessions, name, data, cancellationToken); return SendMessageToSessions(sessions, name, data, cancellationToken);
} }
@ -1831,6 +1832,7 @@ namespace Emby.Server.Implementations.Session
var sessions = Sessions var sessions = Sessions
.Where(i => string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase) || IsAdminSession(i)); .Where(i => string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase) || IsAdminSession(i));
return SendMessageToSessions(sessions, name, data, cancellationToken); return SendMessageToSessions(sessions, name, data, cancellationToken);
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Dto;
@ -73,7 +74,7 @@ namespace Emby.Server.Implementations.TV
{ {
parents = _libraryManager.GetUserRootFolder().GetChildren(user, true) parents = _libraryManager.GetUserRootFolder().GetChildren(user, true)
.Where(i => i is Folder) .Where(i => i is Folder)
.Where(i => !user.Configuration.LatestItemsExcludes.Contains(i.Id.ToString("N"))) .Where(i => !user.Configuration.LatestItemsExcludes.Contains(i.Id.ToString("N", CultureInfo.InvariantCulture)))
.ToArray(); .ToArray();
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -537,7 +538,7 @@ namespace MediaBrowser.Api.Images
if (item == null) if (item == null)
{ {
throw new ResourceNotFoundException(string.Format("Item {0} not found.", itemId.ToString("N"))); throw new ResourceNotFoundException(string.Format("Item {0} not found.", itemId.ToString("N", CultureInfo.InvariantCulture)));
} }
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -272,7 +273,7 @@ namespace MediaBrowser.Api.Library
// Changing capitalization. Handle windows case insensitivity // Changing capitalization. Handle windows case insensitivity
if (string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase)) if (string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase))
{ {
var tempPath = Path.Combine(rootFolderPath, Guid.NewGuid().ToString("N")); var tempPath = Path.Combine(rootFolderPath, Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture));
Directory.Move(currentPath, tempPath); Directory.Move(currentPath, tempPath);
currentPath = tempPath; currentPath = tempPath;
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
@ -11,7 +12,6 @@ using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services; using MediaBrowser.Model.Services;
@ -268,7 +268,7 @@ namespace MediaBrowser.Api.Movies
EnableGroupByMetadataKey = true, EnableGroupByMetadataKey = true,
DtoOptions = dtoOptions DtoOptions = dtoOptions
}).GroupBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N")) }).GroupBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture))
.Select(x => x.First()) .Select(x => x.First())
.Take(itemLimit) .Take(itemLimit)
.ToList(); .ToList();
@ -309,7 +309,7 @@ namespace MediaBrowser.Api.Movies
EnableGroupByMetadataKey = true, EnableGroupByMetadataKey = true,
DtoOptions = dtoOptions DtoOptions = dtoOptions
}).GroupBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N")) }).GroupBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture))
.Select(x => x.First()) .Select(x => x.First())
.Take(itemLimit) .Take(itemLimit)
.ToList(); .ToList();

View file

@ -142,7 +142,7 @@ namespace MediaBrowser.Api.Playback
data += "-" + (state.Request.DeviceId ?? string.Empty) data += "-" + (state.Request.DeviceId ?? string.Empty)
+ "-" + (state.Request.PlaySessionId ?? string.Empty); + "-" + (state.Request.PlaySessionId ?? string.Empty);
var filename = data.GetMD5().ToString("N"); var filename = data.GetMD5().ToString("N", CultureInfo.InvariantCulture);
var ext = outputFileExtension.ToLowerInvariant(); var ext = outputFileExtension.ToLowerInvariant();
var folder = ServerConfigurationManager.ApplicationPaths.TranscodingTempPath; var folder = ServerConfigurationManager.ApplicationPaths.TranscodingTempPath;
@ -215,6 +215,12 @@ namespace MediaBrowser.Api.Playback
var encodingOptions = ApiEntryPoint.Instance.GetEncodingOptions(); var encodingOptions = ApiEntryPoint.Instance.GetEncodingOptions();
<<<<<<< HEAD
=======
var transcodingId = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
var commandLineArgs = GetCommandLineArguments(outputPath, encodingOptions, state, true);
>>>>>>> Use CultureInvariant string conversion for Guids
var process = new Process() var process = new Process()
{ {
StartInfo = new ProcessStartInfo() StartInfo = new ProcessStartInfo()

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -306,7 +307,7 @@ namespace MediaBrowser.Api.Playback
{ {
result.MediaSources = Clone(result.MediaSources); result.MediaSources = Clone(result.MediaSources);
result.PlaySessionId = Guid.NewGuid().ToString("N"); result.PlaySessionId = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
} }
return result; return result;

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.Linq; using System.Linq;
using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Dto;
@ -305,7 +306,7 @@ namespace MediaBrowser.Api
if (tag != null) if (tag != null)
{ {
hint.ThumbImageTag = tag; hint.ThumbImageTag = tag;
hint.ThumbImageItemId = itemWithImage.Id.ToString("N"); hint.ThumbImageItemId = itemWithImage.Id.ToString("N", CultureInfo.InvariantCulture);
} }
} }
} }
@ -326,7 +327,7 @@ namespace MediaBrowser.Api
if (tag != null) if (tag != null)
{ {
hint.BackdropImageTag = tag; hint.BackdropImageTag = tag;
hint.BackdropImageItemId = itemWithImage.Id.ToString("N"); hint.BackdropImageItemId = itemWithImage.Id.ToString("N", CultureInfo.InvariantCulture);
} }
} }
} }

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -316,7 +317,7 @@ namespace MediaBrowser.Api.Session
_authRepo.Create(new AuthenticationInfo _authRepo.Create(new AuthenticationInfo
{ {
AppName = request.App, AppName = request.App,
AccessToken = Guid.NewGuid().ToString("N"), AccessToken = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture),
DateCreated = DateTime.UtcNow, DateCreated = DateTime.UtcNow,
DeviceId = _appHost.SystemId, DeviceId = _appHost.SystemId,
DeviceName = _appHost.FriendlyName, DeviceName = _appHost.FriendlyName,

View file

@ -168,7 +168,7 @@ namespace MediaBrowser.Api.Subtitles
builder.AppendLine("#EXT-X-MEDIA-SEQUENCE:0"); builder.AppendLine("#EXT-X-MEDIA-SEQUENCE:0");
builder.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD"); builder.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD");
long positionTicks = 0; long positionTicks = 0;
var accessToken = _authContext.GetAuthorizationInfo(Request).Token; var accessToken = _authContext.GetAuthorizationInfo(Request).Token;
@ -206,7 +206,7 @@ namespace MediaBrowser.Api.Subtitles
{ {
var item = (Video)_libraryManager.GetItemById(request.Id); var item = (Video)_libraryManager.GetItemById(request.Id);
var idString = request.Id.ToString("N"); var idString = request.Id.ToString("N", CultureInfo.InvariantCulture);
var mediaSource = _mediaSourceManager.GetStaticMediaSources(item, false, null) var mediaSource = _mediaSourceManager.GetStaticMediaSources(item, false, null)
.First(i => string.Equals(i.Id, request.MediaSourceId ?? idString)); .First(i => string.Equals(i.Id, request.MediaSourceId ?? idString));

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Dto;
@ -470,7 +471,7 @@ namespace MediaBrowser.Api
if (!string.IsNullOrWhiteSpace(request.StartItemId)) if (!string.IsNullOrWhiteSpace(request.StartItemId))
{ {
episodes = episodes.SkipWhile(i => !string.Equals(i.Id.ToString("N"), request.StartItemId, StringComparison.OrdinalIgnoreCase)).ToList(); episodes = episodes.SkipWhile(i => !string.Equals(i.Id.ToString("N", CultureInfo.InvariantCulture), request.StartItemId, StringComparison.OrdinalIgnoreCase)).ToList();
} }
// This must be the last filter // This must be the last filter

View file

@ -99,7 +99,7 @@ namespace MediaBrowser.Api.UserLibrary
{ {
ancestorIds = _libraryManager.GetUserRootFolder().GetChildren(user, true) ancestorIds = _libraryManager.GetUserRootFolder().GetChildren(user, true)
.Where(i => i is Folder) .Where(i => i is Folder)
.Where(i => !excludeFolderIds.Contains(i.Id.ToString("N"))) .Where(i => !excludeFolderIds.Contains(i.Id.ToString("N", CultureInfo.InvariantCulture)))
.Select(i => i.Id) .Select(i => i.Id)
.ToArray(); .ToArray();
} }

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.Linq; using System.Linq;
using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
@ -116,7 +117,7 @@ namespace MediaBrowser.Api.UserLibrary
.Select(i => new SpecialViewOption .Select(i => new SpecialViewOption
{ {
Name = i.Name, Name = i.Name,
Id = i.Id.ToString("N") Id = i.Id.ToString("N", CultureInfo.InvariantCulture)
}) })
.OrderBy(i => i.Name) .OrderBy(i => i.Name)

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
@ -168,7 +169,7 @@ namespace MediaBrowser.Api
foreach (var item in items.Where(i => i.Id != primaryVersion.Id)) foreach (var item in items.Where(i => i.Id != primaryVersion.Id))
{ {
item.SetPrimaryVersionId(primaryVersion.Id.ToString("N")); item.SetPrimaryVersionId(primaryVersion.Id.ToString("N", CultureInfo.InvariantCulture));
item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None); item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using MediaBrowser.Common.Progress; using MediaBrowser.Common.Progress;
@ -14,14 +15,14 @@ namespace MediaBrowser.Controller.Channels
{ {
if (user.Policy.BlockedChannels != null) if (user.Policy.BlockedChannels != null)
{ {
if (user.Policy.BlockedChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase)) if (user.Policy.BlockedChannels.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
{ {
return false; return false;
} }
} }
else else
{ {
if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase)) if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
{ {
return false; return false;
} }
@ -60,7 +61,7 @@ namespace MediaBrowser.Controller.Channels
public static string GetInternalMetadataPath(string basePath, Guid id) public static string GetInternalMetadataPath(string basePath, Guid id)
{ {
return System.IO.Path.Combine(basePath, "channels", id.ToString("N"), "metadata"); return System.IO.Path.Combine(basePath, "channels", id.ToString("N", CultureInfo.InvariantCulture), "metadata");
} }
public override bool CanDelete() public override bool CanDelete()

View file

@ -503,7 +503,7 @@ namespace MediaBrowser.Controller.Entities
foreach (var folder in collectionFolders) foreach (var folder in collectionFolders)
{ {
if (allowed.Contains(folder.Id.ToString("N"), StringComparer.OrdinalIgnoreCase)) if (allowed.Contains(folder.Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
{ {
return true; return true;
} }
@ -664,10 +664,10 @@ namespace MediaBrowser.Controller.Entities
{ {
if (SourceType == SourceType.Channel) if (SourceType == SourceType.Channel)
{ {
return System.IO.Path.Combine(basePath, "channels", ChannelId.ToString("N"), Id.ToString("N")); return System.IO.Path.Combine(basePath, "channels", ChannelId.ToString("N", CultureInfo.InvariantCulture), Id.ToString("N", CultureInfo.InvariantCulture));
} }
var idString = Id.ToString("N"); var idString = Id.ToString("N", CultureInfo.InvariantCulture);
basePath = System.IO.Path.Combine(basePath, "library"); basePath = System.IO.Path.Combine(basePath, "library");
@ -1095,7 +1095,7 @@ namespace MediaBrowser.Controller.Entities
var info = new MediaSourceInfo var info = new MediaSourceInfo
{ {
Id = item.Id.ToString("N"), Id = item.Id.ToString("N", CultureInfo.InvariantCulture),
Protocol = protocol ?? MediaProtocol.File, Protocol = protocol ?? MediaProtocol.File,
MediaStreams = MediaSourceManager.GetMediaStreams(item.Id), MediaStreams = MediaSourceManager.GetMediaStreams(item.Id),
Name = GetMediaSourceName(item), Name = GetMediaSourceName(item),
@ -1113,7 +1113,7 @@ namespace MediaBrowser.Controller.Entities
if (info.Protocol == MediaProtocol.File) if (info.Protocol == MediaProtocol.File)
{ {
info.ETag = item.DateModified.Ticks.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N"); info.ETag = item.DateModified.Ticks.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
var video = item as Video; var video = item as Video;
@ -1626,7 +1626,7 @@ namespace MediaBrowser.Controller.Entities
public virtual string CreatePresentationUniqueKey() public virtual string CreatePresentationUniqueKey()
{ {
return Id.ToString("N"); return Id.ToString("N", CultureInfo.InvariantCulture);
} }
[IgnoreDataMember] [IgnoreDataMember]
@ -2736,7 +2736,7 @@ namespace MediaBrowser.Controller.Entities
{ {
var list = GetEtagValues(user); var list = GetEtagValues(user);
return string.Join("|", list.ToArray()).GetMD5().ToString("N"); return string.Join("|", list.ToArray()).GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
protected virtual List<string> GetEtagValues(User user) protected virtual List<string> GetEtagValues(User user)

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -177,7 +178,7 @@ namespace MediaBrowser.Controller.Entities
{ {
if (user.Policy.BlockedMediaFolders != null) if (user.Policy.BlockedMediaFolders != null)
{ {
if (user.Policy.BlockedMediaFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase) || if (user.Policy.BlockedMediaFolders.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase) ||
// Backwards compatibility // Backwards compatibility
user.Policy.BlockedMediaFolders.Contains(Name, StringComparer.OrdinalIgnoreCase)) user.Policy.BlockedMediaFolders.Contains(Name, StringComparer.OrdinalIgnoreCase))
@ -187,7 +188,7 @@ namespace MediaBrowser.Controller.Entities
} }
else else
{ {
if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase)) if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
{ {
return false; return false;
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
@ -29,7 +30,7 @@ namespace MediaBrowser.Controller.Entities
if (string.IsNullOrEmpty(child.Path)) if (string.IsNullOrEmpty(child.Path))
{ {
child.LibraryItemId = item.Id.ToString("N"); child.LibraryItemId = item.Id.ToString("N", CultureInfo.InvariantCulture);
} }
return child; return child;
@ -37,7 +38,7 @@ namespace MediaBrowser.Controller.Entities
public LinkedChild() public LinkedChild()
{ {
Id = Guid.NewGuid().ToString("N"); Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
} }
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -91,7 +92,7 @@ namespace MediaBrowser.Controller.Entities.TV
} }
var folders = LibraryManager.GetCollectionFolders(this) var folders = LibraryManager.GetCollectionFolders(this)
.Select(i => i.Id.ToString("N")) .Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture))
.ToArray(); .ToArray();
if (folders.Length == 0) if (folders.Length == 0)

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -230,7 +231,7 @@ namespace MediaBrowser.Controller.Entities
// TODO: Remove idPath and just use usernamePath for future releases // TODO: Remove idPath and just use usernamePath for future releases
var usernamePath = System.IO.Path.Combine(parentPath, username); var usernamePath = System.IO.Path.Combine(parentPath, username);
var idPath = System.IO.Path.Combine(parentPath, Id.ToString("N")); var idPath = System.IO.Path.Combine(parentPath, Id.ToString("N", CultureInfo.InvariantCulture));
if (!Directory.Exists(usernamePath) && Directory.Exists(idPath)) if (!Directory.Exists(usernamePath) && Directory.Exists(idPath))
{ {
Directory.Move(idPath, usernamePath); Directory.Move(idPath, usernamePath);

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.Movies;
@ -987,7 +988,7 @@ namespace MediaBrowser.Controller.Entities
private UserView GetUserViewWithName(string name, string type, string sortName, BaseItem parent) private UserView GetUserViewWithName(string name, string type, string sortName, BaseItem parent)
{ {
return _userViewManager.GetUserSubView(parent.Id, parent.Id.ToString("N"), type, sortName); return _userViewManager.GetUserSubView(parent.Id, parent.Id.ToString("N", CultureInfo.InvariantCulture), type, sortName);
} }
private UserView GetUserView(string type, string localizationKey, string sortName, BaseItem parent) private UserView GetUserView(string type, string localizationKey, string sortName, BaseItem parent)

View file

@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.LiveTv
var info = new MediaSourceInfo var info = new MediaSourceInfo
{ {
Id = Id.ToString("N"), Id = Id.ToString("N", CultureInfo.InvariantCulture),
Protocol = PathProtocol ?? MediaProtocol.File, Protocol = PathProtocol ?? MediaProtocol.File,
MediaStreams = new List<MediaStream>(), MediaStreams = new List<MediaStream>(),
Name = Name, Name = Name,
@ -111,7 +111,7 @@ namespace MediaBrowser.Controller.LiveTv
protected override string GetInternalMetadataPath(string basePath) protected override string GetInternalMetadataPath(string basePath)
{ {
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"), "metadata"); return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N", CultureInfo.InvariantCulture), "metadata");
} }
public override bool CanDelete() public override bool CanDelete()

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
@ -188,7 +189,7 @@ namespace MediaBrowser.Controller.LiveTv
protected override string GetInternalMetadataPath(string basePath) protected override string GetInternalMetadataPath(string basePath)
{ {
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N")); return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N", CultureInfo.InvariantCulture));
} }
public override bool CanDelete() public override bool CanDelete()

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -239,7 +240,7 @@ namespace MediaBrowser.Controller.Playlists
return base.IsVisible(user); return base.IsVisible(user);
} }
var userId = user.Id.ToString("N"); var userId = user.Id.ToString("N", CultureInfo.InvariantCulture);
foreach (var share in shares) foreach (var share in shares)
{ {
if (string.Equals(share.UserId, userId, StringComparison.OrdinalIgnoreCase)) if (string.Equals(share.UserId, userId, StringComparison.OrdinalIgnoreCase))

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
namespace MediaBrowser.Controller.Providers namespace MediaBrowser.Controller.Providers
@ -55,7 +56,7 @@ namespace MediaBrowser.Controller.Providers
foreach (var i in UserDataList) foreach (var i in UserDataList)
{ {
if (string.Equals(userId, i.UserId.ToString("N"), StringComparison.OrdinalIgnoreCase)) if (string.Equals(userId, i.UserId.ToString("N", CultureInfo.InvariantCulture), StringComparison.OrdinalIgnoreCase))
{ {
userData = i; userData = i;
} }

View file

@ -934,7 +934,7 @@ namespace MediaBrowser.Providers.Manager
public void OnRefreshStart(BaseItem item) public void OnRefreshStart(BaseItem item)
{ {
//_logger.LogInformation("OnRefreshStart {0}", item.Id.ToString("N")); //_logger.LogInformation("OnRefreshStart {0}", item.Id.ToString("N", CultureInfo.InvariantCulture));
var id = item.Id; var id = item.Id;
lock (_activeRefreshes) lock (_activeRefreshes)
@ -947,7 +947,7 @@ namespace MediaBrowser.Providers.Manager
public void OnRefreshComplete(BaseItem item) public void OnRefreshComplete(BaseItem item)
{ {
//_logger.LogInformation("OnRefreshComplete {0}", item.Id.ToString("N")); //_logger.LogInformation("OnRefreshComplete {0}", item.Id.ToString("N", CultureInfo.InvariantCulture));
lock (_activeRefreshes) lock (_activeRefreshes)
{ {
_activeRefreshes.Remove(item.Id); _activeRefreshes.Remove(item.Id);
@ -971,7 +971,7 @@ namespace MediaBrowser.Providers.Manager
public void OnRefreshProgress(BaseItem item, double progress) public void OnRefreshProgress(BaseItem item, double progress)
{ {
//_logger.LogInformation("OnRefreshProgress {0} {1}", item.Id.ToString("N"), progress); //_logger.LogInformation("OnRefreshProgress {0} {1}", item.Id.ToString("N", CultureInfo.InvariantCulture), progress);
var id = item.Id; var id = item.Id;
lock (_activeRefreshes) lock (_activeRefreshes)
@ -985,7 +985,7 @@ namespace MediaBrowser.Providers.Manager
else else
{ {
// TODO: Need to hunt down the conditions for this happening // TODO: Need to hunt down the conditions for this happening
//throw new Exception(string.Format("Refresh for item {0} {1} is not in progress", item.GetType().Name, item.Id.ToString("N"))); //throw new Exception(string.Format("Refresh for item {0} {1} is not in progress", item.GetType().Name, item.Id.ToString("N", CultureInfo.InvariantCulture)));
} }
} }
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -99,11 +100,11 @@ namespace MediaBrowser.Providers.MediaInfo
if (!string.IsNullOrWhiteSpace(item.Album) && !string.IsNullOrWhiteSpace(albumArtist)) if (!string.IsNullOrWhiteSpace(item.Album) && !string.IsNullOrWhiteSpace(albumArtist))
{ {
filename = (item.Album + "-" + albumArtist).GetMD5().ToString("N"); filename = (item.Album + "-" + albumArtist).GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
else else
{ {
filename = item.Id.ToString("N"); filename = item.Id.ToString("N", CultureInfo.InvariantCulture);
} }
filename += ".jpg"; filename += ".jpg";
@ -111,7 +112,7 @@ namespace MediaBrowser.Providers.MediaInfo
else else
{ {
// If it's an audio book or audio podcast, allow unique image per item // If it's an audio book or audio podcast, allow unique image per item
filename = item.Id.ToString("N") + ".jpg"; filename = item.Id.ToString("N", CultureInfo.InvariantCulture) + ".jpg";
} }
var prefix = filename.Substring(0, 1); var prefix = filename.Substring(0, 1);

View file

@ -1,12 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
@ -296,7 +295,7 @@ namespace MediaBrowser.Providers.Subtitles
private string GetProviderId(string name) private string GetProviderId(string name)
{ {
return name.ToLowerInvariant().GetMD5().ToString("N"); return name.ToLowerInvariant().GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
private ISubtitleProvider GetProvider(string id) private ISubtitleProvider GetProvider(string id)

View file

@ -27,6 +27,10 @@
<Rule Id="CA1031" Action="Info" /> <Rule Id="CA1031" Action="Info" />
<!-- disable warning CA1062: Validate arguments of public methods --> <!-- disable warning CA1062: Validate arguments of public methods -->
<Rule Id="CA1062" Action="Info" /> <Rule Id="CA1062" Action="Info" />
<!-- disable warning CA1812: internal class that is apparently never instantiated.
If so, remove the code from the assembly.
If this class is intended to contain only static members, make it static -->
<Rule Id="CA1812" Action="Info" />
<!-- disable warning CA1822: Member does not access instance data and can be marked as static --> <!-- disable warning CA1822: Member does not access instance data and can be marked as static -->
<Rule Id="CA1822" Action="Info" /> <Rule Id="CA1822" Action="Info" />