mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
refactor project structure
This commit is contained in:
parent
23d8592394
commit
c5d2b7c251
21 changed files with 54 additions and 25 deletions
32
PluralKit.Core/Utils.cs
Normal file
32
PluralKit.Core/Utils.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
|
||||
|
||||
namespace PluralKit
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static string GenerateHid()
|
||||
{
|
||||
var rnd = new Random();
|
||||
var charset = "abcdefghijklmnopqrstuvwxyz";
|
||||
string hid = "";
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
hid += charset[rnd.Next(charset.Length)];
|
||||
}
|
||||
return hid;
|
||||
}
|
||||
|
||||
public static string Truncate(this string str, int maxLength, string ellipsis = "...") {
|
||||
if (str.Length < maxLength) return str;
|
||||
return str.Substring(0, maxLength - ellipsis.Length) + ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Emojis {
|
||||
public static readonly string Warn = "\u26A0";
|
||||
public static readonly string Success = "\u2705";
|
||||
public static readonly string Error = "\u274C";
|
||||
public static readonly string Note = "\u2757";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue