CPF/CPF.ReoGrid/Common/Toolkit.cs
2024-06-24 10:15:59 +08:00

80 lines
1.1 KiB
C#

using System;
using System.Security.Cryptography;
using System.Text;
namespace CPF.ReoGrid.Common
{
public static class Toolkit
{
internal static byte[] GetMD5Hash(string str)
{
bool flag = Toolkit.md5 == null;
if (flag)
{
Toolkit.md5 = MD5.Create();
}
return Toolkit.md5.ComputeHash(Encoding.Default.GetBytes(str));
}
internal static string GetHexString(byte[] data)
{
return Convert.ToBase64String(data);
}
internal static string GetMD5HashedString(string str)
{
return Toolkit.GetHexString(Toolkit.GetMD5Hash(str));
}
internal static double Ceiling(double val, double scale)
{
double num = val % scale;
bool flag = num == 0.0;
double result;
if (flag)
{
result = val;
}
else
{
result = val - num + scale;
}
return result;
}
private static MD5 md5 = null;
public static readonly float[] FontSizeList = new float[]
{
5f,
6f,
7f,
8f,
9f,
10f,
10.5f,
11f,
11.5f,
12f,
12.5f,
14f,
16f,
18f,
20f,
22f,
24f,
26f,
28f,
30f,
32f,
34f,
38f,
46f,
58f,
64f,
78f,
92f
};
}
}