mirror of
https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies.git
synced 2026-07-26 23:01:43 +00:00
22 lines
581 B
C#
22 lines
581 B
C#
using System.IO;
|
|
using System.Linq;
|
|
|
|
namespace NebulaAuth.Utility;
|
|
|
|
public static class FileNameValidator
|
|
{
|
|
public static bool IsValidFileName(string name)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(name))
|
|
return false;
|
|
|
|
var invalidChars = Path.GetInvalidFileNameChars();
|
|
return !name.Any(c => invalidChars.Contains(c));
|
|
}
|
|
|
|
public static string GetInvalidChars(string name)
|
|
{
|
|
var invalidChars = Path.GetInvalidFileNameChars();
|
|
return new string(name.Where(c => invalidChars.Contains(c)).Distinct().ToArray());
|
|
}
|
|
} |