Skip to content
This repository was archived by the owner on Aug 16, 2025. It is now read-only.

Commit aba7970

Browse files
committed
feat: readme documentation
1 parent 5164366 commit aba7970

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

readme.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,57 @@
1-
# MemwLib
1+
# MemwLib
2+
3+
Utils library to mostly cover needs or *better implementations* of needs.
4+
5+
> This library is meant to be expanded with ideas over time.
6+
7+
8+
## Features
9+
10+
- Http server
11+
- Colors
12+
13+
### Http server
14+
15+
It's an implementation for the overly complicated c# webserver, it's made to resemble the npm package [express.js](https://expressjs.com/)
16+
17+
Basic usage demonstration:
18+
```csharp
19+
HttpServer server = new(IpAdress.Any, 3000);
20+
// (IpAdress ip, ushort port)
21+
// (IpAdress ip, ushort port, CancellationToken cancellationToken)
22+
23+
// Method type supports flags and path supports Regex c# api.
24+
server.AddEndpoint(RequestMethodType.Get | RequestMethodType.Put, "/test", request => {
25+
return new ResponseEntity(200, "Hello World!");
26+
// (int code, string httpVersion, string body)
27+
// (int code, string body)
28+
});
29+
30+
// thread blocking due to implementation.
31+
```
32+
33+
### Colors
34+
35+
Rgb color implementation in 2 classes `<Rgb24>` and `<Rgb32>`, for future usage in other library parts.
36+
37+
Basic usage demonstration:
38+
```csharp
39+
// 3 bytes for red, green, blue
40+
Rgb24 red = (Rgb24)0xFF0000;
41+
Rgb24 green = new Rgb24(0x00FF00);
42+
Rgb24 blue = new Rgb24(0, 0, 255);
43+
```
44+
45+
```csharp
46+
// last byte represents opacity.
47+
Rgb32 red = (Rgb32)0xFF0000FF;
48+
Rgb32 green = new Rgb32(0x00FF00FF);
49+
Rgb32 blue = new Rgb32(0, 0, 255, 255);
50+
```
51+
52+
Both classes can be casted into each-other, and both classes can be casted into a `<uint>`.
53+
54+
```csharp
55+
uint red = (uint)new Rgb24(255, 0, 0);
56+
uint green = (uint)new Rgb32(0, 255, 0, 255);
57+
```

0 commit comments

Comments
 (0)