README, moved Regex to GeneratedRegex

This commit is contained in:
martin 2023-09-14 16:36:43 +02:00
parent 8a3dfb058c
commit a17ff36719
3 changed files with 34 additions and 3 deletions

27
README.md Normal file
View File

@ -0,0 +1,27 @@
# Pac-Man The Board Game
Work in progress.
## Development
```bash
cd pac-man-board-game/ClientApp
pnpm install
cd ..
dotnet run
```
## Stack
- Frontend
- [TypeScript](https://www.typescriptlang.org/)
- [React](https://reactjs.org/)
- [Jotai](https://jotai.org/)
- [Vite](https://vitejs.dev/)
- [Tailwind CSS](https://tailwindcss.com/)
- [Jest](https://jestjs.io/)
- Backend
- [.NET 7](https://dotnet.microsoft.com/)
- [C#](https://docs.microsoft.com/en-us/dotnet/csharp/)
- [ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-7.0)
- [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API)

View File

@ -33,6 +33,7 @@ type DirectionalPosition = {
type Path = {
path?: Position[] | null,
// TODO replace with DirectionalPosition
end: Position,
direction: import("../game/direction").Direction
}

View File

@ -4,13 +4,13 @@ using System.Text.RegularExpressions;
namespace pacMan.Utils;
public static class Extensions
public static partial class Extensions
{
public static string GetString(this byte[] bytes, int length)
{
var s = Encoding.UTF8.GetString(bytes, 0, length);
// Removes invalid characters from the string
return Regex.Replace(s, @"\p{C}+", "");
return InvalidCharacters().Replace(s, "");
}
public static ArraySegment<byte> ToArraySegment(this object obj)
@ -19,4 +19,7 @@ public static class Extensions
var bytes = Encoding.UTF8.GetBytes(json);
return new ArraySegment<byte>(bytes, 0, json.Length);
}
}
[GeneratedRegex("\\p{C}+")]
private static partial Regex InvalidCharacters();
}