Storage queries run in the background with cancellation and covering indexes so switching views no longer freezes the UI. Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
716 B
C#
35 lines
716 B
C#
using System.Globalization;
|
|
using System.Text;
|
|
|
|
namespace Explorer.Domain;
|
|
|
|
public static class NameNormalizer
|
|
{
|
|
public static string Normalize(string name)
|
|
{
|
|
if (string.IsNullOrEmpty(name))
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
var form = name.Normalize(NormalizationForm.FormC);
|
|
return form.ToLower(CultureInfo.InvariantCulture);
|
|
}
|
|
|
|
public static string? Extension(string name)
|
|
{
|
|
if (string.IsNullOrEmpty(name))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
var idx = name.LastIndexOf('.');
|
|
if (idx <= 0 || idx == name.Length - 1)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return Normalize(name[(idx + 1)..]);
|
|
}
|
|
}
|