cs-codex-dist-tests/Tools/TestNetRewarder/EmojiMaps.cs

84 lines
2.0 KiB
C#
Raw Normal View History

2024-10-10 09:45:04 +00:00
using Utils;
namespace TestNetRewarder
{
public class EmojiMaps
{
2024-10-10 12:03:42 +00:00
private readonly string[] emojis = new[]
2024-10-10 09:45:04 +00:00
{
2024-10-10 12:03:42 +00:00
// yellow
"😀",
"🌻",
"🍋",
"🧀",
"🌔",
"⭐",
"⚡",
"🏆",
// red
"💘",
"🦞",
"🌹",
"🍒",
"🫖", // teapot
"⛩",
"🚗",
"🔥",
// green
"🐊",
"🦎",
"🐛",
"🌳",
"🍀",
"🧩",
"🔋",
"♻",
// blue
"💙",
"🐳",
2024-10-10 09:45:04 +00:00
"🐟",
2024-10-10 12:03:42 +00:00
"🍉",
"🧊",
"🌐",
"⚓",
"🌀",
2024-10-10 09:45:04 +00:00
};
2024-10-10 12:03:42 +00:00
public string NewRequest => "🐟";
public string Started => "🦈";
public string SlotFilled => "🟢";
public string SlotFreed => "⭕";
public string SlotReservationsFull => "☑️";
public string Finished => "✅";
public string Cancelled => "🚫";
public string Failed => "❌";
2024-10-10 09:45:04 +00:00
2024-10-10 12:03:42 +00:00
public string StringToEmojis(string input, int outLength)
2024-10-10 09:45:04 +00:00
{
2024-10-10 12:03:42 +00:00
if (outLength < 1) outLength = 1;
2024-10-10 09:45:04 +00:00
2024-10-10 12:03:42 +00:00
var result = "";
var segmentLength = input.Length / outLength;
if (segmentLength < 1)
{
return StringToEmojis(input + input, outLength);
}
for (var i = 0; i < outLength; i++)
{
var segment = input.Substring(i * segmentLength, segmentLength);
result += SelectOne(segment);
}
return result;
2024-10-10 09:45:04 +00:00
}
2024-10-10 12:03:42 +00:00
private string SelectOne(string segment)
2024-10-10 09:45:04 +00:00
{
2024-10-10 12:03:42 +00:00
var index = 0;
foreach (var c in segment) index += Convert.ToInt32(c);
index = index % emojis.Length;
return emojis[index];
2024-10-10 09:45:04 +00:00
}
}
}