Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 757ad8ad authored by Harald MARTINI's avatar Harald MARTINI
Browse files

Changed CycleFile property to return a copy of the CycleFile stream to avoid...

Changed CycleFile property to return a copy of the CycleFile stream to avoid stream corruption while adding the cycle to the cache
parent fae8c5ec
No related branches found
No related tags found
No related merge requests found
......@@ -58,8 +58,28 @@ namespace TUGraz.VectoCore.Models.Declaration
public Kilogram BodyCurbWeight { get; internal set; }
private Stream _cycleFile;
private object _cycleLock = new object();
[JsonIgnore]
public Stream CycleFile { get; internal set; }
public Stream CycleFile
{
get
{
lock (_cycleLock) {
var memoryStream = new MemoryStream();
_cycleFile.CopyTo(memoryStream);
memoryStream.Position = 0;
_cycleFile.Seek(0, SeekOrigin.Begin);
return memoryStream;
}
}
internal set
{
lock (_cycleLock) {
_cycleFile = value;
}
}
}
public IList<MissionTrailer> Trailer { get; internal set; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment