2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
2017-03-31 16:14:21 +00:00
|
|
|
|
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
2017-03-31 16:14:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
2015-12-04 16:17:20 +00:00
|
|
|
|
namespace Config.Entities
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
public class ComponentTest
|
|
|
|
|
|
{
|
|
|
|
|
|
public virtual int Id { get; protected set; }
|
|
|
|
|
|
public virtual string CmpntName { get; set; } /// Component name
|
|
|
|
|
|
public virtual string Parameters { get; set; }
|
|
|
|
|
|
public virtual Test Test { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public virtual ComponentTest Clone()
|
|
|
|
|
|
{
|
|
|
|
|
|
ComponentTest result = new ComponentTest();
|
|
|
|
|
|
result.CmpntName = CmpntName;
|
|
|
|
|
|
result.Parameters = Parameters;
|
2014-12-31 12:46:33 +00:00
|
|
|
|
result.Test = Test;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
return result;
|
|
|
|
|
|
}
|
2017-03-31 16:14:21 +00:00
|
|
|
|
|
|
|
|
|
|
public virtual void Export(StreamWriter output)
|
|
|
|
|
|
{
|
|
|
|
|
|
output.WriteLine(CmpntName);
|
|
|
|
|
|
output.WriteLine(Parameters.Replace(Environment.NewLine, "~"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static ComponentTest Import(StreamReader input, Test newTest)
|
|
|
|
|
|
{
|
|
|
|
|
|
string firstLine = input.ReadLine();
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(firstLine)) return null;
|
|
|
|
|
|
|
|
|
|
|
|
ComponentTest result = new ComponentTest();
|
|
|
|
|
|
result.CmpntName = firstLine;
|
|
|
|
|
|
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
|
|
|
|
|
result.Test = newTest;
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|