Commit graph

25 commits

Author SHA1 Message Date
Kamron Batman
f147cb119f
fix: Reverts GitVersioning (#435) 2021-01-29 01:42:37 -08:00
Kamron Batman
3d7c4583a8
fix(build): Adds MUO Constant (#412)
- [X] Adds an MUO solution constant for 3rd party drop-ins.
2021-01-16 15:03:08 -08:00
Kamron Batman
bae568d856
fix(git): Fixes git versioning (#408) 2021-01-13 20:52:09 -08:00
Kamron Batman
582e1877b8
feat(core): Makes spanwriter resizable (#376)
SpanWriter now has an argument that allows it to be resizable.
```cs
public SpanWriter(Span<byte> initialBuffer, bool resize = false)
public SpanWriter(int initialCapacity, bool resize = false)
```

If a SpanWriter is set to be resizable, or given an initial capacity instead of a buffer, it must be disposed:
```cs
public static void SomeMethod()
{
    using var writer = new SpanWriter(stackalloc byte[512], true);
    // stuff
    
    // Automatic Dispose of writer
}
```

This is because the SpanWriter uses `ArrayPool<byte>.Shared` _rented buffers_ to resize. If the writer is not disposed, those buffers will never be reused resulting in a _memory leak_.

It is possible that the SpanWriter will outright ditch the initial buffer if resize is set to true and growing is needed. To check/account for that we can do the following:

```cs
public static void SomeMethod()
{
    Span<byte> span = stackalloc byte[512];
    using var writer = new SpanWriter(span, true);
    // write some stuff that causes the span to grow
    
    span = writer.RawBuffer;
    // Do stuff with the span
}
```

Make sure you don't accidentally `Dispose()` the writer or use the `RawBuffer` outside of the `using` block. If you do, bad things will happen! (NullPointerException, or a fresh SpanWriter with no buffer, depending on the situation).

SpanWriter can also now be used with a fixed statement since it has a `PinnableReference()` function.
2020-12-31 19:57:02 -08:00
Kamron Batman
03d0a4664e
fix(core): Adds SkipLocalsInitAttribute support, optimizes broadcasted packets (#363)
- [X] Adds support for `SkipLocalsInitAttribute`. SkipLocalsInitAttribute skips initializing stack variables including `stackalloc`. I don't think it is wired/working yet but should be implemented soon.
- [X] Optimizes broadcasted packets by checking if the first byte (packet ID) is non-zero. If it is already set, it reuses the buffer.
- [X] Removes unnecessary refs to Spans. I don't think the Span struct itself is mutable, so a ref is not helpful.
2020-12-26 12:46:06 -08:00
Kamron Batman
10a6e17640
fix(core): Converts mobile moving packet (#357)
- [X] Converts mobile moving packet
2020-12-24 17:13:55 -08:00
Kamron Batman
b6cd408623
Updates Message Packets (#321)
### API Breaking Change
Combined `AsciiMessage` and `UnicodeMessage` into a single function that takes two arguments, `bool ascii` and `string lang`. Lang can be null (or anything) if ascii is true. 

- [X] Changes message packets
- [X] Cleans up some code
- [X] Uses benchmarks to determine if the spanwriter + copyfrom
2020-11-20 21:50:13 -08:00
Kamron Batman
00beaf8e6e
Fixes NBGV & Adds Big Sur to CI/CD (#317) 2020-11-17 13:02:51 -08:00
Kamron Batman
525cda5413
Cleanup & Fixes for .NET 5 (#309)
- [X] Fixes several bugs
- [X] Updates more ordinal issues
- [X] Cleans up the code a bit
- [X] Turns classes static that should have been
- [X] Changes TcpServer.Instances to a HashSet

Bumps release version
2020-11-15 10:03:50 -08:00
Kamron Batman
1c9439e4fd
Drop .NET Core 3.1 (#307)
- [X] Updates Zlib Bindings
- [X] Updates Argon2 Bindings
- [X] Drops .NET Core 3.1 support
- [X] Updates CI/CD

Bumps release version
Updates documentation
2020-11-10 20:28:05 -08:00
Kamron Batman
013f333898
Adds official .NET 5 support (#300) 2020-11-07 13:26:27 -08:00
Kamron Batman
4e799ddbd7
Adds back in old benchmarks. Cleans up tests. (#270) 2020-10-04 11:45:07 -07:00
Kamron Batman
23b8dff68c
Fixes more line ending issues (#267) 2020-09-27 13:54:56 -07:00
Kamron Batman
bbdb561de8
Fixes leaking tests (#231) 2020-09-06 14:16:57 -07:00
Kamron Batman
6df1098e06
Fixes building with VS2019 (#230)
Fixes building with VS2019. Now use F6 to build, then F5 to debug.

bumps release
2020-09-06 13:58:58 -07:00
Kamron Batman
192cf70d20
Adds gitversioning for releases (#209) 2020-09-02 17:50:57 -07:00
Kamron Batman
40f88d98e4
Release Version 0.6.1 (#205) 2020-08-30 23:15:47 -07:00
Kamron Batman
259fdb5ae8
Remove .NET 5 From Targeted Frameworks (#202) 2020-08-28 10:24:15 -07:00
Kamron Batman
1f651992d7
Updates formatting rules (#199) 2020-08-25 18:00:51 -07:00
Kamron Batman
bc2487946c
Adds .NET 5 & Ubuntu 20 LTS Targeting (#193) 2020-08-15 14:48:06 -07:00
Kamron Batman
997691fbb7
Adds specific linux operating system support (#169) 2020-07-02 17:35:46 -07:00
Kamron Batman
99b9f0a226
Fixes build runtime identifiers (#161) 2020-06-07 19:45:37 -07:00
Kamron Batman
050d6b5fa9
Replaces native argon2 with ref argon2 (#158) 2020-05-29 23:02:18 -07:00
Kamron Batman
f408662af1
Fixes publishing (#156) 2020-05-29 17:31:47 -07:00
Kamron Batman
8eab05947b
Adds lock files and fixes caching in CI (#154) 2020-05-27 17:00:48 -07:00