This commit is contained in:
Pilzinsel64
2025-07-31 10:39:21 +02:00
parent 3f68f0dd21
commit 41da460bfc
2 changed files with 10 additions and 3 deletions

View File

@@ -13,6 +13,8 @@ public class JsonFileContainer(string filePath) : JsonDataContainer
using var sw = new StreamReader(filePath); using var sw = new StreamReader(filePath);
GetSerializer().Populate(sw, this); GetSerializer().Populate(sw, this);
} }
else
sets.Clear();
} }
} }

View File

@@ -6,11 +6,16 @@ public class JsonStreamContainer(Stream stream) : JsonDataContainer
public override void Read() public override void Read()
{ {
lock (_lock_StreamAction) lock (_lock_StreamAction)
{
if (stream.Length != 0)
{ {
using var sw = new StreamReader(stream); using var sw = new StreamReader(stream);
stream.Position = 0; stream.Position = 0;
GetSerializer().Populate(sw, this); GetSerializer().Populate(sw, this);
} }
else
sets.Clear();
}
} }
public override void Flush() public override void Flush()