mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-01 21:38:27 +01:00
Initial commit changing to on-demand child loading and validations
This commit is contained in:
31
MediaBrowser.Common/Extensions/BaseExtensions.cs
Normal file
31
MediaBrowser.Common/Extensions/BaseExtensions.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace MediaBrowser.Common.Extensions
|
||||
{
|
||||
public static class BaseExtensions
|
||||
{
|
||||
static MD5CryptoServiceProvider md5Provider = new MD5CryptoServiceProvider();
|
||||
|
||||
public static Guid GetMD5(this string str)
|
||||
{
|
||||
lock (md5Provider)
|
||||
{
|
||||
return new Guid(md5Provider.ComputeHash(Encoding.Unicode.GetBytes(str)));
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ContainsStartsWith(this List<string> lst, string value)
|
||||
{
|
||||
foreach (var str in lst)
|
||||
{
|
||||
if (str.StartsWith(value, StringComparison.OrdinalIgnoreCase)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user