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

This commit is contained in:
Milan Hanajik 2017-06-21 23:39:34 +02:00
parent 7ad8c986d7
commit 17f6f7c3be
193 changed files with 450 additions and 182 deletions

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Ambient.Comet
{
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AmbientCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new AmbientCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Ambient.Comet
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(AmbientCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(AmbientCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Ambient.Greco
{
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AmbientCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new AmbientCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Ambient.Greco
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(AmbientCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(AmbientCfg.Serializer, component, this);
}
}
}

View File

@ -14,6 +14,9 @@ namespace TBF.BenchControl.BenchInfo.Munich
/// </summary>
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new ComponentCfgCtrl(); }
///

View File

@ -21,7 +21,7 @@ namespace TBF.BenchControl.BenchInfo.Munich
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(ComponentCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
}
}
}

View File

@ -14,6 +14,9 @@ namespace TBF.BenchControl.BenchInfo.Polska
/// </summary>
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new ComponentCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(ComponentCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
}
}
}

View File

@ -12,7 +12,7 @@ namespace TBF.BenchControl
{
public class ComponentCfgBase
{
[XmlIgnore]
[XmlIgnore]
public string Name
{
get { return name; }
@ -94,28 +94,32 @@ namespace TBF.BenchControl
}
protected virtual XmlSerializer GetSerializer() { return new XmlSerializer(GetType()); }
public Component CreateDbEntity()
{
using (var writer = new StringWriter())
{
(new XmlSerializer(GetType())).Serialize(writer, this);
GetSerializer().Serialize(writer, this);
return Component.CreateFromCfg(Name, factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
}
}
public static IComponentCfg CreateFromDbEntity(Type type, Component cmpntEntity, IComponentFactory factory)
public static IComponentCfg CreateFromDbEntity(XmlSerializer s, Component cmpntEntity, IComponentFactory factory)
{
using (var reader = new StringReader(cmpntEntity.Parameters))
{
IComponentCfg config = (IComponentCfg)(new XmlSerializer(type)).Deserialize(reader);
config.Name = cmpntEntity.Name;
config.ParentName = cmpntEntity.ParentName;
config.ItemNr = cmpntEntity.ItemNr;
config.DebugLevel = cmpntEntity.Mode;
config.LogLevel = cmpntEntity.Logging;
config.Corrections = cmpntEntity.Corrections;
config.Factory = factory;
IComponentCfg config = s.Deserialize(reader) as IComponentCfg;
if (config != null)
{
config.Name = cmpntEntity.Name;
config.ParentName = cmpntEntity.ParentName;
config.ItemNr = cmpntEntity.ItemNr;
config.DebugLevel = cmpntEntity.Mode;
config.LogLevel = cmpntEntity.Logging;
config.Corrections = cmpntEntity.Corrections;
config.Factory = factory;
}
return config;
}
}

View File

@ -2,11 +2,15 @@
/// Copyright (c) 2016 Sensus Metering Systems
///
using TBF.BenchControl.Generic;
using System.Xml.Serialization;
namespace TBF.BenchControl.Configs.NameOnly
{
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(); }
/// Private parameterless constructor invoked by all other (public) constructors

View File

@ -30,6 +30,9 @@ namespace TBF.BenchControl.DB.SensusOracle
public class DatabaseCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(DatabaseCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new DatabaseCfgCtrl(); }

View File

@ -21,7 +21,7 @@ namespace TBF.BenchControl.DB.SensusOracle
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(DatabaseCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(DatabaseCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Danfoss.VLT2800
{
public class PumpCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PumpCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new PumpCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Danfoss.VLT2800
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(PumpCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.DataEntry.Combined
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Combined
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///

View File

@ -23,7 +23,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
IComponentCfg cfg = ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
IComponentCfg cfg = ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
(cfg as EntryFormCfg).Units = (cfg as EntryFormCfg).DefaultUnits;
return cfg;
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///

View File

@ -23,7 +23,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
IComponentCfg cfg = ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
IComponentCfg cfg = ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
(cfg as EntryFormCfg).Units = (cfg as EntryFormCfg).DefaultUnits;
return cfg;
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.DataEntry.Munich
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Munich
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.DataEntry.Munich3
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.DataEntry.Standard12
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.DataEntry.Standard24
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.DataEntry.Standard48
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.DataEntry.Standard6
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.DataEntry.WMStates
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
/// Private parameterless constructor invoked by all other (public) constructors

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.DataEntry.iPerl
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -21,7 +21,7 @@ namespace TBF.BenchControl.Dummy.Balance
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}

View File

@ -21,7 +21,7 @@ namespace TBF.BenchControl.Dummy.Diverter
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Dummy.FlowMeter
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(FlowMeterCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(FlowMeterCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Dummy.FlowMeter
{
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibInfoCfg, IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new FlowMeterCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(RegulValveCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(RegulValveCfg.Serializer, component, this);
}
}
}

View File

@ -2,11 +2,15 @@
/// Copyright (c) 2017 Sensus Metering Systems
///
using TBF.BenchControl.Generic;
using System.Xml.Serialization;
namespace TBF.BenchControl.Dummy.RegulValve
{
public class RegulValveCfg : ComponentCfgBase, IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegulValveCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new RegulValveCfgCtrl(); }
///

View File

@ -21,7 +21,7 @@ namespace TBF.BenchControl.Dummy.Valve
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}

View File

@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde
{
public class ControlBoardCfg : ComponentCfgBase, IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ControlBoardCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new ControlBoardCfgCtrl(); }
///

View File

@ -28,7 +28,7 @@ namespace TBF.BenchControl.Elde
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(Elde.ControlBoardCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(Elde.ControlBoardCfg.Serializer, component, this);
}
public void ResetStaticProperties() { ControlBoardDev.ResetStaticProperties(); }

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Elde.CoverTest
{
public class CoverTestCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CoverTestCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new CoverTestCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.CoverTest
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(CoverTestCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(CoverTestCfg.Serializer, component, this);
}
}
}

View File

@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.Diverter
{
public class DiverterCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(DiverterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new DiverterCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.Diverter
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(DiverterCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(DiverterCfg.Serializer, component, this);
}
}
}

View File

@ -13,6 +13,9 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
{
public class RRProcedureParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RRProcedureParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public float PulsesPerLtr; /// Target low limit of the flow increase or decrease
public override void InitializeAll()
@ -83,14 +86,13 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
if (dbEntity == null) return;
try
{
RRProcedureParams tmp = (RRProcedureParams)(new XmlSerializer(typeof(RRProcedureParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
RRProcedureParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as RRProcedureParams;
procedureParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
procedure = dbEntity.Procedure;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{

View File

@ -12,6 +12,9 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
{
public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegisterReaderCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new RegisterReaderCfgCtrl(); }
/// <summary> Procedure parameters </summary>

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(RegisterReaderCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(RegisterReaderCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Elde.FlowMeter
{
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibInfoCfg, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new FlowMeterCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(FlowMeterCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(FlowMeterCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
{
public class FlowMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new FlowMeterCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(FlowMeterCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(FlowMeterCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Elde.PressureMeter
{
public class PressureMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new PressureMeterCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(PressureMeterCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(PressureMeterCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
{
public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new PressureMeterCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(PressureMeterCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(PressureMeterCfg.Serializer, component, this);
}
}
}

View File

@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.Pump
{
public class PumpCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PumpCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new PumpCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.Pump
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(PumpCfg.Serializer, component, this);
}
}
}

View File

@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.PumpTandem
{
public class PumpCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PumpCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new PumpCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.PumpTandem
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(PumpCfg.Serializer, component, this);
}
}
}

View File

@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.PumpWithFM
{
public class PumpCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PumpCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new PumpCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(PumpCfg.Serializer, component, this);
}
}
}

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(RegisterReaderCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(RegisterReaderCfg.Serializer, component, this);
}
}
}

View File

@ -13,6 +13,9 @@ namespace TBF.BenchControl.Elde.RegisterReader
{
public class RRProcedureParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RRProcedureParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public float PulsesPerLtr; /// [l^-1]
public override void InitializeAll()
@ -83,14 +86,13 @@ namespace TBF.BenchControl.Elde.RegisterReader
if (dbEntity == null) return;
try
{
RRProcedureParams tmp = (RRProcedureParams)(new XmlSerializer(typeof(RRProcedureParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
RRProcedureParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as RRProcedureParams;
procedureParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
procedure = dbEntity.Procedure;
tmp.CopyContentTo(this);
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{

View File

@ -9,6 +9,9 @@ namespace TBF.BenchControl.Elde.RegisterReader
{
public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegisterReaderCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new RegisterReaderCfgCtrl(); }
///

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Elde.RegulValve
{
public class RegulValveCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegulValveCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new RegulValveCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.RegulValve
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(RegulValveCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(RegulValveCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
{
public class RegulValveTandemCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegulValveTandemCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new RegulValveTandemCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(RegulValveTandemCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(RegulValveTandemCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Elde.TempMeter
{
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TempMeterCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.TempMeter
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TempMeterCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TempMeterCfg.Serializer, component, this);
}
}
}

View File

@ -12,6 +12,9 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
{
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TempMeterCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TempMeterCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TempMeterCfg.Serializer, component, this);
}
}
}

View File

@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.Valve
{
public class ValveCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ValveCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new ValveCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.Valve
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(ValveCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(ValveCfg.Serializer, component, this);
}
}
}

View File

@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.ValveEx
{
public class ValveCfg : ComponentCfgBase, IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ValveCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new ValveCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.ValveEx
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(ValveCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(ValveCfg.Serializer, component, this);
}
}
}

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Keithley.Multimeter_2010_RS232
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(MultimeterCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(MultimeterCfg.Serializer, component, this);
}
}
}

View File

@ -3,12 +3,16 @@
///
using System;
using System.IO.Ports;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Keithley.Multimeter_2010_RS232
{
public class MultimeterCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(MultimeterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new MultimeterCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Keithley.TempMeter
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TempMeterCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(TempMeterCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Keithley.TempMeter
{
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TempMeterCfgCtrl(); }
///

View File

@ -12,6 +12,9 @@ namespace TBF.BenchControl.MettlerToledo.Multi
{
public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ICalibInfoCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(BalanceCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); }
///

View File

@ -28,7 +28,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(BalanceCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(BalanceCfg.Serializer, component, this);
}
public void ResetStaticProperties() { BalanceDev.ResetStaticProperties(); }

View File

@ -12,6 +12,9 @@ namespace TBF.BenchControl.MettlerToledo.Standard
{
public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ICalibInfoCfg, GenericDevices.ITankDrainingCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(BalanceCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); }
///

View File

@ -28,7 +28,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(BalanceCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(BalanceCfg.Serializer, component, this);
}
public void ResetStaticProperties() { BalanceDev.ResetStaticProperties(); }

View File

@ -28,7 +28,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(BalanceCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(BalanceCfg.Serializer, component, this);
}
public void ResetStaticProperties() { BalanceNewDev.ResetStaticProperties(); }

View File

@ -28,7 +28,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(BalanceCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(BalanceCfg.Serializer, component, this);
}
public void ResetStaticProperties() { BalanceOld.ResetStaticProperties(); }

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Modbus.Common
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(ModbusCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(ModbusCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Modbus.Common
{
public class ModbusCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ModbusCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new ModbusCfgCtrl(); }
///

View File

@ -10,6 +10,9 @@ namespace TBF.BenchControl.Modbus.Easytherm
{
public class EasythermCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EasythermCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EasythermCfgCtrl(); }
///

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.Modbus.Easytherm
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EasythermCfg), component, this);
return ComponentCfgBase.CreateFromDbEntity(EasythermCfg.Serializer, component, this);
}
}
}

View File

@ -11,6 +11,9 @@ namespace TBF.BenchControl.Modbus.Easytherm
{
public class ProcParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcParams) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public float RequiredTemp; /// [°C] target temperature for a temperature controller or 0=not communicated to the controller
@ -101,14 +104,13 @@ namespace TBF.BenchControl.Modbus.Easytherm
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
{

Some files were not shown because too many files have changed in this diff Show More