1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-29 12:55:59 +02:00

Serialize IDE collapse state

This commit is contained in:
Brian Fiete 2022-07-12 05:53:22 -04:00
parent aa58c864f7
commit 4c2530e227
4 changed files with 224 additions and 6 deletions

View file

@ -4,7 +4,8 @@ namespace System.IO
{
class MemoryStream : Stream
{
List<uint8> mMemory ~ delete _;
bool mOwns;
List<uint8> mMemory ~ { if (mOwns) delete _; }
int mPosition = 0;
public override int64 Position
@ -46,14 +47,18 @@ namespace System.IO
public this()
{
mOwns = true;
mMemory = new List<uint8>();
}
public this(List<uint8> memory)
public this(List<uint8> memory, bool owns = true)
{
mOwns = owns;
mMemory = memory;
}
public List<uint8> Memory => mMemory;
public override Result<int> TryRead(Span<uint8> data)
{
let count = data.Length;