global using the SourceGen Regex class
This commit is contained in:
parent
9bd04d6fdd
commit
5e99d68d1e
31
Commons.cs
31
Commons.cs
@ -7,6 +7,7 @@ global using System.Text.Json.Nodes;
|
||||
global using static perubahan.Commons;
|
||||
global using static perubahan.Logging;
|
||||
global using static perubahan.Middlewares;
|
||||
global using static perubahan.Regices;
|
||||
global using System.Collections.Concurrent;
|
||||
global using System.Security.Cryptography;
|
||||
using System.Text.Json;
|
||||
@ -15,7 +16,7 @@ namespace perubahan;
|
||||
|
||||
internal static class Commons
|
||||
{
|
||||
internal readonly static string VerNum = "0.1.250509.2301";
|
||||
internal readonly static string VerNum = "0.1.250515.1559";
|
||||
|
||||
internal static ConcurrentDictionary<string,User> UserAccounts = [];
|
||||
internal static List<Deployment> Deployments = [];
|
||||
@ -340,4 +341,30 @@ internal static class DataReaderExtensions
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class Crc32
|
||||
{
|
||||
static readonly uint[] Table;
|
||||
|
||||
static Crc32()
|
||||
{
|
||||
Table = new uint[256];
|
||||
const uint poly = 0xEDB88320;
|
||||
for (uint i = 0; i < Table.Length; i++)
|
||||
{
|
||||
uint crc = i;
|
||||
for (int j = 0; j < 8; j++)
|
||||
crc = (crc & 1) != 0 ? (crc >> 1) ^ poly : crc >> 1;
|
||||
Table[i] = crc;
|
||||
}
|
||||
}
|
||||
|
||||
public static uint Compute(byte[] bytes)
|
||||
{
|
||||
uint crc = 0xFFFFFFFF;
|
||||
foreach (byte b in bytes)
|
||||
crc = (crc >> 8) ^ Table[(crc ^ b) & 0xFF];
|
||||
return ~crc;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user