mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-06 13:57:54 +00:00
Expand system time selection logic
This commit is contained in:
parent
72cb838ad7
commit
cd9a3e0abd
5 changed files with 164 additions and 2 deletions
|
|
@ -194,6 +194,23 @@ namespace PluralKit
|
|||
// Still haven't parsed something, we just give up lmao
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string ExtractCountryFlag(string flag)
|
||||
{
|
||||
if (flag.Length != 4) return null;
|
||||
try
|
||||
{
|
||||
var cp1 = char.ConvertToUtf32(flag, 0);
|
||||
var cp2 = char.ConvertToUtf32(flag, 2);
|
||||
if (cp1 < 0x1F1E6 || cp1 > 0x1F1FF) return null;
|
||||
if (cp2 < 0x1F1E6 || cp2 > 0x1F1FF) return null;
|
||||
return $"{(char) (cp1 - 0x1F1E6 + 'A')}{(char) (cp2 - 0x1F1E6 + 'A')}";
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class Emojis {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue