/* * DTS.Slice.Control.Event.Module.cs * * Copyright © 2009 * Diversified Technical Systems, Inc. * All Rights Reserved */ using DTS.Common.DAS.Concepts; using DTS.Serialization.StringResources; using DTS.Common.Utilities; using DTS.Common.Utilities.DotNetProgrammingConstructs; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using DTS.Common.Utilities.Logging; namespace DTS.Slice.Control { // *** see DTS.Slice.Control.Event.cs *** public partial class Event { /// /// Representation of a Slice Control event module. /// public partial class Module : Exceptional, Serialization.Test.Module.IConvertable { public Module() { try { //this.InitializeReviewableAttributes(this.ReviewableAttributes); } catch (System.Exception ex) { throw new Exception("encountered problem zero-parameter constructing " + GetType().FullName, ex); } } /// /// Initialize an instance of the DTS.Slice.Control.Event.Module class. /// /// /// /// The parent of this module. /// /// //TODO: this() is not base class public Module(Event parentEvent) : this() { try { ParentEvent = parentEvent; } catch (System.Exception ex) { throw new Exception("encounterd problem 1-parameter constructing " + GetType().FullName, ex); } } /// /// Initialize an instance of the DTS.Slice.Control.Event.Module class. /// /// /// /// A with which to initialize this object. /// /// /// /// The parent of this module. /// /// public Module(Serialization.Test.Module that, Event parent, Serialization.Test.ReportErrors reportErrors) : this(parent) { try { FromDtsSerializationTestModule(that, reportErrors); } catch (System.IO.InvalidDataException ex) { throw ex; } catch (System.Exception ex) { throw new Exception("encountered problem 2-parameter constructing " + GetType().FullName, ex); } } /// /// The that contains this module. /// public Event ParentEvent { get => _ParentEvent.Value; private set => _ParentEvent.Value = value; } private readonly Property _ParentEvent = new Property( typeof(Module).Namespace + ".Event.Module.ParentEvent", null, false ); public void SetParentEvent(Event e) { _ParentEvent.Value = e; } /// /// Get/set the list of channels on this event module. /// public List Channels { get => _Channels.Value; set => _Channels.Value = value; } private readonly Property> _Channels = new Property>("Event.Module.Channels", new List(), true); /// /// Get/set the module number of this event module. /// public int Number { get => _Number.Value; set => _Number.Value = value; } private readonly Property _Number = new Property("Event.Module.Number", 0, false); /// /// Get/set the serial number for this DAS. /// public string DasSerialNumber { get => _dasSerialNumber.Value; set => _dasSerialNumber.Value = value; } private readonly Property _dasSerialNumber = new Property(typeof(Module).Namespace + ".Event.Module.DasSerialNumber", "", true); /// /// Get/set the serial number for this DAS. /// public string Description { get => _Description.Value; set => _Description.Value = value; } private readonly Property _Description = new Property( typeof(Module).Namespace + ".Event.Module.Description", "", true ); public bool IsSlice6DBModule() { return (Description == "slice6db module"); } /// /// Get/set the base serial number for this DAS. /// public string BaseSerialNumber { get => _BaseSerialNumber.Value; set => _BaseSerialNumber.Value = value; } private readonly Property _BaseSerialNumber = new Property( typeof(Module).Namespace + ".Event.Module.BaseSerialNumber", "", true ); /// /// Get/set the number of requested seconds pre-trigger for this event module. /// public double RequestedPreTriggerSeconds { get => _RequestedPreTriggerSeconds.Value; set => _RequestedPreTriggerSeconds.Value = value; } private readonly Property _RequestedPreTriggerSeconds = new Property("Event.Module.RequestedPreTriggerSeconds", 0.0, false); /// /// Get/set the number of requested seconds post-trigger for this event module. /// public double RequestedPostTriggerSeconds { get => _RequestedPostTriggerSeconds.Value; set => _RequestedPostTriggerSeconds.Value = value; } private readonly Property _RequestedPostTriggerSeconds = new Property("Event.Module.RequestedPostTriggerSeconds", 0.0, false); /// /// Get/set the number of seconds pre-trigger for this event module. /// public double PreTriggerSeconds { get => _PreTriggerSeconds.Value; set => _PreTriggerSeconds.Value = value; } private readonly Property _PreTriggerSeconds = new Property("Event.Module.PreTriggerSeconds", 0.0, false); /// /// Get/set the number of seconds post-trigger for this event module. /// public double PostTriggerSeconds { get => _PostTriggerSeconds.Value; set => _PostTriggerSeconds.Value = value; } private readonly Property _PostTriggerSeconds = new Property("Event.Module.PostTriggerSeconds", 0.0, false); /// /// Get/set the number of samples in this event modules. /// public UInt64 NumberOfSamples { get => _NumberOfSamples.Value; set => _NumberOfSamples.Value = value; } private readonly Property _NumberOfSamples = new Property("Event.Module.NumberOfSamples", 0, false); /// /// Get/set the number of unsubsampled samples in this event modules. /// public UInt64 UnsubsampledNumberOfSamples { get => _UnsubsampledNumberOfSamples.Value; set => _UnsubsampledNumberOfSamples.Value = value; } private readonly Property _UnsubsampledNumberOfSamples = new Property("Event.Module.UnsubsampledNumberOfSamples", 0, true); /// /// Get/set the trigger sample numbers for this event module. /// public List TriggerSampleNumbers { get => _TriggerSampleNumbers.Value; set => _TriggerSampleNumbers.Value = value; } private readonly Property> _TriggerSampleNumbers = new Property>("Event.Module.TriggerSampleNumbers", null, false); /// /// Get/set the unsubsampled trigger sample numbers for this event module. /// public List UnsubsampledTriggerSampleNumbers { get => _UnsubsampledTriggerSampleNumbers.Value; set => _UnsubsampledTriggerSampleNumbers.Value = value; } private readonly Property> _UnsubsampledTriggerSampleNumbers = new Property>("Event.Module.UnsubsampledTriggerSampleNumbers", new List(), true); /// /// Get/set the start record sample number for this event module. /// public UInt64 StartRecordSampleNumber { get => _StartRecordSampleNumber.Value; set => _StartRecordSampleNumber.Value = value; } private readonly Property _StartRecordSampleNumber = new Property("Event.Module.StartRecordSampleNumber", 0, false); /// /// Get/set the sample rate for this event module. /// public float SampleRateHz { get => _SampleRateHz.Value; set => _SampleRateHz.Value = value; } private readonly Property _SampleRateHz = new Property("Event.Module.SampleRateHz", 0, false); /// /// Get/set the start record timestamp in seconds for this event module. /// public double StartRecordTimestampSec { get => _StartRecordTimestampSec.Value; set => _StartRecordTimestampSec.Value = value; } private readonly Property _StartRecordTimestampSec = new Property("Event.Module.StartRecordTimestampSec", 0, false); /// /// Get/set the start record timestamp in nanoseconds for this event module. /// public double StartRecordTimestampNanoSec { get => _StartRecordTimestampNanoSec.Value; set => _StartRecordTimestampNanoSec.Value = value; } private readonly Property _StartRecordTimestampNanoSec = new Property("Event.Module.StartRecordTimestampNanoSec", 0, false); /// /// Get/set the trigger timestamp in seconds for this event module. /// public double TriggerTimestampSec { get => _TriggerTimestampSec.Value; set => _TriggerTimestampSec.Value = value; } private readonly Property _TriggerTimestampSec = new Property("Event.Module.TriggerTimestampSec", 0, false); /// /// Get/set the trigger timestamp in nanoseconds for this event module. /// public double TriggerTimestampNanoSec { get => _TriggerTimestampNanoSec.Value; set => _TriggerTimestampNanoSec.Value = value; } private readonly Property _TriggerTimestampNanoSec = new Property("Event.Module.TriggerTimestampNanoSec", 0, false); /// /// Get/set the whether or not PTP master sync is used for this event module. /// public bool PTPMasterSync { get => _PTPMasterSync.Value; set => _PTPMasterSync.Value = value; } private readonly Property _PTPMasterSync = new Property("Event.Module.PTPMasterSync", false, false); /// /// Get/set the tilt sensor X axis value. /// public double TiltSensorAxisXDegreesPre { get => _TiltSensorAxisXDegreesPre.Value; set => _TiltSensorAxisXDegreesPre.Value = value; } private readonly Property _TiltSensorAxisXDegreesPre = new Property("Event.Module.TiltSensorAxisXDegreesPre", 0, false); /// /// Get/set the tilt sensor Y axis value. /// public double TiltSensorAxisYDegreesPre { get => _TiltSensorAxisYDegreesPre.Value; set => _TiltSensorAxisYDegreesPre.Value = value; } private readonly Property _TiltSensorAxisYDegreesPre = new Property("Event.Module.TiltSensorAxis2DegreesPre", 0, false); /// /// Get/set the tilt sensor Z axis value. /// public double TiltSensorAxisZDegreesPre { get => _TiltSensorAxisZDegreesPre.Value; set => _TiltSensorAxisZDegreesPre.Value = value; } private readonly Property _TiltSensorAxisZDegreesPre = new Property("Event.Module.TiltSensorAxisZDegreesPre", 0, false); /// /// Get/set the tilt sensor X axis value. /// public double TiltSensorAxisXDegreesPost { get => _TiltSensorAxisXDegreesPost.Value; set => _TiltSensorAxisXDegreesPost.Value = value; } private readonly Property _TiltSensorAxisXDegreesPost = new Property("Event.Module.TiltSensorAxisXDegreesPost", 0, false); /// /// Get/set the tilt sensor Y axis value. /// public double TiltSensorAxisYDegreesPost { get => _TiltSensorAxisYDegreesPost.Value; set => _TiltSensorAxisYDegreesPost.Value = value; } private readonly Property _TiltSensorAxisYDegreesPost = new Property("Event.Module.TiltSensorAxisYDegreesPost", 0, false); /// /// Get/set the tilt sensor Z axis value. /// public double TiltSensorAxisZDegreesPost { get => _TiltSensorAxisZDegreesPost.Value; set => _TiltSensorAxisZDegreesPost.Value = value; } private readonly Property _TiltSensorAxisZDegreesPost = new Property("Event.Module.TiltSensorAxisZDegreesPost", 0, false); /// /// Get/set the temperature sensor location 1 value. /// public float TemperatureLocation1Pre { get => _TemperatureLocation1Pre.Value; set => _TemperatureLocation1Pre.Value = value; } private readonly Property _TemperatureLocation1Pre = new Property("Event.Module.TemperatureLocation1Pre", 0, false); /// /// Get/set the temperature sensor location 2 value. /// public float TemperatureLocation2Pre { get => _TemperatureLocation2Pre.Value; set => _TemperatureLocation2Pre.Value = value; } private readonly Property _TemperatureLocation2Pre = new Property("Event.Module.TemperatureLocation2Pre", 0, false); /// /// Get/set the temperature sensor location 3 value. /// public float TemperatureLocation3Pre { get => _TemperatureLocation3Pre.Value; set => _TemperatureLocation3Pre.Value = value; } private readonly Property _TemperatureLocation3Pre = new Property("Event.Module.TemperatureLocation3Pre", 0, false); /// /// Get/set the temperature sensor location 4 value. /// public float TemperatureLocation4Pre { get => _TemperatureLocation4Pre.Value; set => _TemperatureLocation4Pre.Value = value; } private readonly Property _TemperatureLocation4Pre = new Property("Event.Module.TemperatureLocation4Pre", 0, false); /// /// Get/set the temperature sensor location 1 post value. /// public float TemperatureLocation1Post { get => _TemperatureLocation1Post.Value; set => _TemperatureLocation1Post.Value = value; } private readonly Property _TemperatureLocation1Post = new Property("Event.Module.TemperatureLocation1Post", 0, false); /// /// Get/set the temperature sensor location 2 value. /// public float TemperatureLocation2Post { get => _TemperatureLocation2Post.Value; set => _TemperatureLocation2Post.Value = value; } private readonly Property _TemperatureLocation2Post = new Property("Event.Module.TemperatureLocation2Post", 0, false); /// /// Get/set the temperature sensor location 3 post value. /// public float TemperatureLocation3Post { get => _TemperatureLocation3Post.Value; set => _TemperatureLocation3Post.Value = value; } private readonly Property _TemperatureLocation3Post = new Property("Event.Module.TemperatureLocation3Post", 0, false); /// /// Get/set the temperature sensor location 4 post value. /// public float TemperatureLocation4Post { get => _TemperatureLocation4Post.Value; set => _TemperatureLocation4Post.Value = value; } private readonly Property _TemperatureLocation4Post = new Property("Event.Module.TemperatureLocation4Post", 0, false); /// /// Get/set the AA filter rate for this event module. /// public float AaFilterRateHz { get => _AaFilterRateHz.Value; set => _AaFilterRateHz.Value = value; } private readonly Property _AaFilterRateHz = new Property("Event.Module.AaFilterRateHz", 0, false); /// /// Get/set the nominal /// excitation voltage of this module. /// public Test.Module.Channel.Sensor.ExcitationVoltageOption NominalExcitationVoltage { get => _NominalExcitationVoltage.Value; set => _NominalExcitationVoltage.Value = value; } private readonly Property _NominalExcitationVoltage = new Property( typeof(Module).Namespace + ".Event.Module.NominalExcitationVoltage", Test.Module.Channel.Sensor.ExcitationVoltageOption.Volt5, true ); /// /// Get/set the of this module. /// public Test.Module.RecordingMode RecordingMode { get => _RecordingMode.Value; set => _RecordingMode.Value = value; } private readonly Property _RecordingMode = new Property("Event.Module.RecordingMode", Test.Module.RecordingMode.CircularBuffer, false); /// /// Set the applicable properties of this object from the specified target object. /// /// /// /// The that is to have the information it /// shares with this object copied. /// /// public void SetPropertyValuesFrom(DASLib.Service.DASModule that) { try { TriggerSampleNumbers = new List(null != that.TriggerSampleNumbers ? that.TriggerSampleNumbers : new ulong[] { }); NumberOfSamples = that.NumberOfSamples; ParentEvent.Guid = that.OwningDAS.EventGuids[0]; ushort faultFlag = 0; try { faultFlag = ParentEvent.FaultFlags; } //TODO: handle exception!!! catch (System.Exception) { } ParentEvent.FaultFlags = Convert.ToUInt16(faultFlag | that.OwningDAS.FaultFlags[0]); // that.Description } catch (System.Exception ex) { throw new Exception("encountered problem setting property from target object " + (null != that ? "\"" + that.ToString() + "\"" : ""), ex); } } /// /// Test the specified object for equality with this object. /// /// /// /// The to be tested for equality. /// /// /// /// true if the specified object has memeberwise equality with /// this object; false otherwise. /// /// public override bool Equals(object obj) { try { var that = obj as Module; return null != that && Description.Equals(that.Description) && AaFilterRateHz.Equals(that.AaFilterRateHz) && Number.Equals(that.Number) && DasSerialNumber.Equals(that.DasSerialNumber) && NumberOfSamples.Equals(that.NumberOfSamples) && UnsubsampledNumberOfSamples.Equals(that.UnsubsampledNumberOfSamples) && RequestedPostTriggerSeconds.Equals(that.RequestedPostTriggerSeconds) && RequestedPreTriggerSeconds.Equals(that.RequestedPreTriggerSeconds) && PostTriggerSeconds.Equals(that.PostTriggerSeconds) && PreTriggerSeconds.Equals(that.PreTriggerSeconds) && RecordingMode.Equals(that.RecordingMode) && SampleRateHz.Equals(that.SampleRateHz) && StartRecordSampleNumber.Equals(that.StartRecordSampleNumber) && TriggerSampleNumbersEquals(that.TriggerSampleNumbers) && UnsubsampledTriggerSampleNumbersEquals(that.UnsubsampledTriggerSampleNumbers) && ChannelsEquals(that.Channels); } catch (System.Exception ex) { throw new Exception( string.Format( Strings.DTS_Slice_Control_Equals_ComparisonFailedString, null != obj ? "\"" + obj.ToString() + "\"" : Strings.DTS_Slice_Control_NullIndicatorString), ex); } } /// /// Test the specified object's trigger sample number list for equality with this /// object's module list. /// /// /// /// The of object to be /// compared for equality with this event's equivalent. /// /// /// /// true if the two lists contain equivalent-valued members; /// false otherwise. /// /// private bool TriggerSampleNumbersEquals(List thoseTriggerSampleNumbers) { try { if (null == thoseTriggerSampleNumbers || TriggerSampleNumbers.Count != thoseTriggerSampleNumbers.Count) return false; return !thoseTriggerSampleNumbers.Where((t, i) => !TriggerSampleNumbers[i].Equals(t)).Any(); } catch (System.Exception ex) { throw new Exception(Strings.DTS_Slice_Control_Event_Module_TriggerSampleNumbersEquals_ComparisonFailedString, ex); } } /// /// Test the specified object's unsubsampled trigger sample number list for equality with this /// object's module list. /// /// /// /// The of object to be /// compared for equality with this event's equivalent. /// /// /// /// true if the two lists contain equivalent-valued members; /// false otherwise. /// /// private bool UnsubsampledTriggerSampleNumbersEquals(List thoseUnsubsampledTriggerSampleNumbers) { try { if (null == thoseUnsubsampledTriggerSampleNumbers || UnsubsampledTriggerSampleNumbers.Count != thoseUnsubsampledTriggerSampleNumbers.Count) return false; return !thoseUnsubsampledTriggerSampleNumbers.Where((t, i) => !UnsubsampledTriggerSampleNumbers[i].Equals(t)).Any(); } catch (System.Exception ex) { throw new Exception("unsubsampled trigger sample number arrays do not match", ex); } } /// /// Test the specified object's module list for equality with this object's /// module list. /// /// /// /// The of objects to be /// compared for equality with this module's equivalent. /// /// /// /// true if the two lists contain equivalent-valued members; /// false otherwise. /// /// private bool ChannelsEquals(List thoseChannels) { try { if (null == thoseChannels || Channels.Count != thoseChannels.Count) return false; return !thoseChannels.Where((t, i) => !Channels[i].Equals(t)).Any(); } catch (System.Exception ex) { throw new Exception(Strings.DTS_Slice_Control_Event_Module_ChannelsEquals_ComparisonFailedString, ex); } } /// /// Return the hash code for this object. /// /// /// /// The hash code for this object. /// /// public override int GetHashCode() { return base.GetHashCode(); } /// /// Convert this object into a DTS.Serialization.Test.Module. /// /// /// /// A equivalent to this object. /// /// public Serialization.Test.Module ToDtsSerializationTestModule(Serialization.Test parentTest) { try { var that = new Serialization.Test.Module(parentTest) { Description = Description, AaFilterRateHz = AaFilterRateHz, Number = Number, SerialNumber = DasSerialNumber, NumberOfSamples = NumberOfSamples, UnsubsampledNumberOfSamples = UnsubsampledNumberOfSamples, RequestedPostTriggerSeconds = RequestedPostTriggerSeconds, RequestedPreTriggerSeconds = RequestedPreTriggerSeconds, PostTriggerSeconds = PostTriggerSeconds, PreTriggerSeconds = PreTriggerSeconds, RecordingMode = RecordingMode, SampleRateHz = SampleRateHz, StartRecordSampleNumber = StartRecordSampleNumber, TriggerSampleNumbers = TriggerSampleNumbers, UnsubsampledTriggerSampleNumbers = UnsubsampledTriggerSampleNumbers, BaseSerialNumber = BaseSerialNumber, StartRecordTimestampSec = StartRecordTimestampSec, StartRecordTimestampNanoSec = StartRecordTimestampNanoSec, TriggerTimestampSec = TriggerTimestampSec, TriggerTimestampNanoSec = TriggerTimestampNanoSec, PTPMasterSync = PTPMasterSync, TiltSensorAxisXDegreesPre = TiltSensorAxisXDegreesPre, TiltSensorAxisYDegreesPre = TiltSensorAxisYDegreesPre, TiltSensorAxisZDegreesPre = TiltSensorAxisZDegreesPre, TiltSensorAxisXDegreesPost = TiltSensorAxisXDegreesPost, TiltSensorAxisYDegreesPost = TiltSensorAxisYDegreesPost, TiltSensorAxisZDegreesPost = TiltSensorAxisZDegreesPost, TemperatureLocation1Pre = TemperatureLocation1Pre, TemperatureLocation2Pre = TemperatureLocation2Pre, TemperatureLocation3Pre = TemperatureLocation3Pre, TemperatureLocation4Pre = TemperatureLocation4Pre, TemperatureLocation1Post = TemperatureLocation1Post, TemperatureLocation2Post = TemperatureLocation2Post, TemperatureLocation3Post = TemperatureLocation3Post, TemperatureLocation4Post = TemperatureLocation4Post, Channels = new List() }; // Create a test module channel to embody each channel conversion, and then // copy over all relevant channel data members. foreach (var thisChannel in Channels) { //10988 Do not download/write/purge unneeded files; Only write required channels if (thisChannel.IsConfigured) { // // Create a test module channel to embody each channel conversion, and then // copy over all relevant channel data members. // that.Channels.Add(thisChannel.ToDtsSerializationTestModuleChannel(that)); } } return that; } catch (System.Exception ex) { throw new Exception("encountered problem converting " + GetType().FullName + " to " + typeof(Serialization.Test.Module).FullName, ex); } } /// /// Initialize this object from a DTS.Serialization.Test.Module. /// /// /// /// A from which to initialize this object. /// /// //TODO: use more descriptive variable names public void FromDtsSerializationTestModule(Serialization.Test.Module that, Serialization.Test.ReportErrors reportErrors) { var errors = new List(); try { if (null == that) { throw new ArgumentNullException( $"cannot set this object's properties from null serialization test module reference"); } Description = that.Description; AaFilterRateHz = that.AaFilterRateHz; Number = that.Number; DasSerialNumber = that.SerialNumber; NumberOfSamples = that.NumberOfSamples; UnsubsampledNumberOfSamples = that.UnsubsampledNumberOfSamples; RequestedPostTriggerSeconds = that.RequestedPostTriggerSeconds; RequestedPreTriggerSeconds = that.RequestedPreTriggerSeconds; PostTriggerSeconds = that.PostTriggerSeconds; PreTriggerSeconds = that.PreTriggerSeconds; RecordingMode = that.RecordingMode; SampleRateHz = that.SampleRateHz; StartRecordSampleNumber = that.StartRecordSampleNumber; TriggerSampleNumbers = that.TriggerSampleNumbers; UnsubsampledTriggerSampleNumbers = that.UnsubsampledTriggerSampleNumbers; BaseSerialNumber = that.BaseSerialNumber; try { StartRecordTimestampSec = that.StartRecordTimestampSec; } catch (System.Exception ex) { APILogger.Log("failed to get StartRecordTimestampSec", ex); } //TODO: inappropriate using try/catch!!! try { StartRecordTimestampNanoSec = that.StartRecordTimestampNanoSec; } catch (System.Exception ex) { APILogger.Log("failed to get StartRecordTimestampSec", ex); } //TODO: inappropriate using try/catch!!! try { TriggerTimestampSec = that.TriggerTimestampSec; } catch (System.Exception ex) { APILogger.Log("failed to get TriggerTimestampSec", ex); } //TODO: inappropriate using try/catch!!! try { TriggerTimestampNanoSec = that.StartRecordTimestampNanoSec; } catch (System.Exception ex) { APILogger.Log("failed to get TriggerTimestampNanoSec", ex); } //TODO: inappropriate using try/catch!!! try { PTPMasterSync = that.PTPMasterSync; } catch (System.Exception ex) { APILogger.Log("failed to get PTPMasterSync", ex); } //TODO: inappropriate using try/catch!!! try { TiltSensorAxisXDegreesPre = that.TiltSensorAxisXDegreesPre; TiltSensorAxisYDegreesPre = that.TiltSensorAxisYDegreesPre; TiltSensorAxisZDegreesPre = that.TiltSensorAxisZDegreesPre; TiltSensorAxisXDegreesPost = that.TiltSensorAxisXDegreesPost; TiltSensorAxisYDegreesPost = that.TiltSensorAxisYDegreesPost; TiltSensorAxisZDegreesPost = that.TiltSensorAxisZDegreesPost; } catch (System.Exception ex) { APILogger.Log("failed to get tilt information", ex); } //TODO: inappropriate using try/catch!!! try { TemperatureLocation1Pre = that.TemperatureLocation1Pre; TemperatureLocation2Pre = that.TemperatureLocation2Pre; TemperatureLocation3Pre = that.TemperatureLocation3Pre; TemperatureLocation4Pre = that.TemperatureLocation4Pre; TemperatureLocation1Post = that.TemperatureLocation1Post; TemperatureLocation2Post = that.TemperatureLocation2Post; TemperatureLocation3Post = that.TemperatureLocation3Post; TemperatureLocation4Post = that.TemperatureLocation4Post; } catch (System.Exception ex) { APILogger.Log("failed to get temperature information", ex); } //APILogger.DoPerformanceLog("DTS.Slice.Control.Event.Module:FromDTSSerializationTestModule:6"); var absoluteChannelNumber = ParentEvent.LastAbsoluteChannelNumberInEvent + 1; Channels.Clear(); foreach (var thatChannel in that.Channels) { // // Create a Slice Control channel corresponding to the specified serialization // channel and populate its relevant properties. // try { if (thatChannel.AbsoluteDisplayOrder != -2) { //Have to count the channels this way as the module isn't a part of the event yet. var emc = Channel.CreateChannel(thatChannel, this, absoluteChannelNumber++); Channels.Add(emc); thatChannel.emc = emc; Trace.WriteLine("Created EMC: " + absoluteChannelNumber.ToString()); } } catch (System.IO.InvalidDataException ex) { errors.Add(ex.Message); } } foreach (var thatCalculatedChannel in that.CalculatedChannels) { //Have to count the channels this way as the module isn't a part of the event yet. var emc = Channel.CreateChannel(thatCalculatedChannel, this, absoluteChannelNumber++); Trace.WriteLine("Created EMC: " + absoluteChannelNumber.ToString()); Channels.Add(emc); thatCalculatedChannel.emc = emc; } } catch (System.Exception ex) { throw new Exception("encountered problem initializing " + GetType().FullName + " using " + typeof(Serialization.Test.Module).FullName, ex); } if (errors.Count > 0 && null != reportErrors) { reportErrors(errors); } } } } }