Removed mousefontchars, valid chars are 0x20-0xA9(32-169)

Added checking to player names too.
This commit is contained in:
high 2011-07-09 10:00:00 -04:00
parent 1cd0f4c74b
commit b382125cc5
8 changed files with 33 additions and 31 deletions

View file

@ -659,5 +659,20 @@ namespace TShockAPI
return bytes.Aggregate("", (s, b) => s + b.ToString("X2"));
}
}
/// <summary>
/// Checks if the string contains any unprintable characters
/// </summary>
/// <param name="str">String to check</param>
/// <returns>True if the string only contains printable characters</returns>
public static bool ValidString(string str)
{
foreach (var c in str)
{
if (c < 0x20 || c > 0xA9)
return false;
}
return true;
}
}
}