XmlSerializers created by XmlSerializer.FromType(new[] {typeof(...)})[0]; This prevents throwing an exception => better debugging.

This commit is contained in:
Milan Hanajik
2017-06-22 21:37:05 +02:00
parent 7ad8c986d7
commit 17f6f7c3be
193 changed files with 450 additions and 182 deletions
@@ -24,7 +24,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -13,6 +13,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
{
public class CombinedWithDetTestParams : TestParamsBase, IParamsProvider, ITestParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CombinedWithDetTestParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public float TargetQ; /// Target=terminal flow durning detection when increasing or decreasing the flow
public float RelativeQfrom; /// Tested flow low range related to the detected flow
public float RelativeQto; /// Tested flow high range related to the detected flow
@@ -121,14 +124,13 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
if (dbEntity == null) return;
try
{
CombinedWithDetTestParams tmp = (CombinedWithDetTestParams)(new XmlSerializer(typeof(CombinedWithDetTestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
CombinedWithDetTestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as CombinedWithDetTestParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
@@ -12,6 +12,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -12,6 +12,9 @@ namespace TBF.BenchControl.TestMethods.Endurance
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
public string Cycle;
@@ -13,7 +13,10 @@ namespace TBF.BenchControl.TestMethods.Endurance
{
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
{
public bool BooleanParam; /// Main meter readings are ignored during test (suitable for small flows)
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public bool BooleanParam; /// Main meter readings are ignored during test (suitable for small flows)
public override void InitializeAll()
{
@@ -81,14 +84,13 @@ namespace TBF.BenchControl.TestMethods.Endurance
if (dbEntity == null) return;
try
{
TestParams tmp = (TestParams)(new XmlSerializer(typeof(TestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced.Single
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.Compound
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.HeatMeters
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -12,6 +12,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.HeatMeters
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
@@ -13,6 +13,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.HeatMeters
{
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public float ErrorLimitLo; /// [%]
public float ErrorLimitHi; /// [%]
public bool EvaluateVolume; /// true = evaluate also the volume, false = evaluate only energy
@@ -159,14 +162,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.HeatMeters
if (dbEntity == null) return;
try
{
TestParams tmp = (TestParams)(new XmlSerializer(typeof(TestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.Single
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.Compound
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -12,6 +12,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.Compound
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
@@ -13,7 +13,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.Compound
{
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
{
public bool SupressTrills; /// Main meter readings are ignored during test (suitable for small flows)
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public bool SupressTrills; /// Main meter readings are ignored during test (suitable for small flows)
public override void InitializeAll()
{
@@ -81,14 +84,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.Compound
if (dbEntity == null) return;
try
{
TestParams tmp = (TestParams)(new XmlSerializer(typeof(TestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.HeatMeters
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -12,6 +12,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.HeatMeters
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
@@ -13,6 +13,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.HeatMeters
{
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public float ErrorLimitLo; /// [%]
public float ErrorLimitHi; /// [%]
public bool EvaluateVolume; /// true = evaluate also the volume, false = evaluate only energy
@@ -159,14 +162,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.HeatMeters
if (dbEntity == null) return;
try
{
TestParams tmp = (TestParams)(new XmlSerializer(typeof(TestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.Single
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -13,7 +13,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Compound
{
public class CombinedTestParams : TestParamsBase, IParamsProvider, ITestParams
{
public bool SupressTrills; /// Main meter readings are ignored during test (suitable for small flows)
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CombinedTestParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public bool SupressTrills; /// Main meter readings are ignored during test (suitable for small flows)
public override void InitializeAll()
{
@@ -81,14 +84,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Compound
if (dbEntity == null) return;
try
{
CombinedTestParams tmp = (CombinedTestParams)(new XmlSerializer(typeof(CombinedTestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
CombinedTestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as CombinedTestParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Compound
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -12,6 +12,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Compound
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.HeatMeters
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -12,6 +12,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.HeatMeters
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
@@ -13,6 +13,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.HeatMeters
{
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public float ErrorLimitLo; /// [%]
public float ErrorLimitHi; /// [%]
public bool EvaluateVolume; /// true = evaluate also the volume, false = evaluate only energy
@@ -159,14 +162,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.HeatMeters
if (dbEntity == null) return;
try
{
TestParams tmp = (TestParams)(new XmlSerializer(typeof(TestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Single
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -13,6 +13,9 @@ namespace TBF.BenchControl.TestMethods.LeakTest
{
public class LeakTestParams : TestParamsBase, IParamsProvider, ITestParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(LeakTestParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public float PressureLo; /// Presure range low limit in [bar]
public float PressureHi; /// Presure range high limit in [bar]
public int DurationPMax; /// Duration of PMax test in [s]
@@ -106,14 +109,13 @@ namespace TBF.BenchControl.TestMethods.LeakTest
if (dbEntity == null) return;
try
{
LeakTestParams tmp = (LeakTestParams)(new XmlSerializer(typeof(LeakTestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
LeakTestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as LeakTestParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
@@ -12,6 +12,9 @@ namespace TBF.BenchControl.TestMethods.LeakTest
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.LeakTest
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -12,6 +12,9 @@ namespace TBF.BenchControl.TestMethods.LiveStream
{
public class Cfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(Cfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new CfgCtrl(); }
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.LiveStream
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(Cfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(Cfg.Serializer, component, this);
}
}
}
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.TestMethods.OuterLoop.End
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.TestMethods.OuterLoop.Start
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -13,6 +13,9 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
{
public class PMaxTestParams : TestParamsBase, IParamsProvider, ITestParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PMaxTestParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public float PressureLo; /// Presure range low limit in [bar]
public float PressureHi; /// Presure range high limit in [bar]
public int DurationPMax; /// Duration of the test in [s]
@@ -99,14 +102,13 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
if (dbEntity == null) return;
try
{
PMaxTestParams tmp = (PMaxTestParams)(new XmlSerializer(typeof(PMaxTestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
PMaxTestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as PMaxTestParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
@@ -12,6 +12,9 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -11,6 +11,9 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
{
public class RoiDetectionCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RoiDetectionCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new RoiDetectionCfgCtrl(); }
/// Private parameterless constructor invoked by all other (public) constructors
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(RoiDetectionCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(RoiDetectionCfg.Serializer, component, this);
}
}
}
@@ -12,6 +12,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
///
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -13,6 +13,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
public class iPerlCommunicationParams : TestParamsBase, IParamsProvider, ITestParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(iPerlCommunicationParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public string Activity; /// Communication activity
public bool SimultWithPrevious;
public bool SimultWithNext;
@@ -96,14 +99,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (dbEntity == null) return;
try
{
iPerlCommunicationParams tmp = (iPerlCommunicationParams)(new XmlSerializer(typeof(iPerlCommunicationParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
iPerlCommunicationParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as iPerlCommunicationParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(IperlHeadCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(IperlHeadCfg.Serializer, component, this);
}
}
}
@@ -15,6 +15,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
{
public class IperlHeadCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(IperlHeadCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new IperlHeadCfgCtrl(); }
///
@@ -13,6 +13,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
{
public class ProcParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public MeterType MeterType;
public int FactorLimitLo; /// Lower limit for the calibration factor
public int FactorLimitHi; /// Upper limit for the calibration factor
@@ -135,14 +138,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
if (dbEntity == null) return;
try
{
ProcParams tmp = (ProcParams)(new XmlSerializer(typeof(ProcParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
ProcParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as ProcParams;
procedureParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
procedure = dbEntity.Procedure;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{