ProcessData (aka BatchResults) serialization part 2
This commit is contained in:
@@ -222,8 +222,10 @@ namespace Results.Entities
|
||||
public virtual Config.Entities.Publish Publish() { return (Config.Entities.Publish)TestData.Publish; }
|
||||
|
||||
|
||||
protected TestRslt()
|
||||
public TestRslt()
|
||||
{
|
||||
MethodClass = string.Empty;
|
||||
Remark = string.Empty;
|
||||
}
|
||||
|
||||
public TestRslt(Batch batch, TestData testData, int part, int repetitionNr)
|
||||
@@ -397,11 +399,35 @@ namespace Results.Entities
|
||||
DiverterStart, DiverterEnd);
|
||||
}
|
||||
|
||||
public virtual void WriteBinary(BinaryWriter writer)
|
||||
|
||||
public virtual void WriteBinary(BinaryWriter writer, IList<TestData> savedTestDatas)
|
||||
{
|
||||
writer.Write(Id);
|
||||
TestData.WriteBinary(writer); /// Writes TestData, does not write batch
|
||||
Components.WriteBinary(writer); /// Writes Components
|
||||
|
||||
/// Save TestData or TestData.Name
|
||||
if (savedTestDatas != null && !savedTestDatas.Contains(TestData))
|
||||
{
|
||||
writer.Write(true);
|
||||
TestData.WriteBinary(writer);
|
||||
savedTestDatas.Add(TestData);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(false);
|
||||
writer.Write(TestData.Name);
|
||||
}
|
||||
|
||||
/// Save Components if not null
|
||||
if (Components != null)
|
||||
{
|
||||
writer.Write(true);
|
||||
Components.WriteBinary(writer); /// Write Components
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(false);
|
||||
}
|
||||
|
||||
writer.Write(Part);
|
||||
writer.Write(RepetitionNr);
|
||||
writer.Write(MethodClass);
|
||||
@@ -514,11 +540,35 @@ namespace Results.Entities
|
||||
writer.Write(Counter5);
|
||||
}
|
||||
|
||||
public virtual void ReadBinary(BinaryReader reader)
|
||||
public virtual void ReadBinary(BinaryReader reader, IList<TestData> testDatas)
|
||||
{
|
||||
Id = reader.ReadInt32();
|
||||
TestData.ReadBinary(reader); /// Reads TestData, does not read batch
|
||||
Components.ReadBinary(reader); /// Reads Components
|
||||
|
||||
/// Retrieve TestData
|
||||
if (reader.ReadBoolean())
|
||||
{
|
||||
(TestData = new TestData()).ReadBinary(reader);
|
||||
if (testDatas != null) testDatas.Add(TestData);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestData = null;
|
||||
string testDataName = reader.ReadString();
|
||||
foreach (var td in testDatas)
|
||||
{
|
||||
if (td.Name == testDataName)
|
||||
{
|
||||
TestData = td;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (reader.ReadBoolean())
|
||||
{
|
||||
(Components = new Components()).ReadBinary(reader); /// Read Components
|
||||
}
|
||||
|
||||
Part = reader.ReadInt32();
|
||||
RepetitionNr = reader.ReadInt32();
|
||||
MethodClass = reader.ReadString();
|
||||
|
||||
Reference in New Issue
Block a user