Files
DP44/Common/DTS.Common.Serialization/Test.Module.cs
2026-04-17 14:55:32 -04:00

1432 lines
72 KiB
C#

/*
Test.Module.cs
Copyright © 2008
Diversified Technical Systems, Inc.
All Rights Reserved
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using DTS.Utilities;
using DTS.Utilities.DotNetProgrammingConstructs;
using DTS.Utilities.Xml;
namespace DTS.Serialization
{
// *** See Test.cs ***
public partial class Test : Exceptional, IXmlSerializable
{
/// <summary>
/// Representation of serializable module information.
/// </summary>
[XmlSerializationTag( "Module" )]
public partial class Module : Exceptional
{
/// <summary>
/// The <see cref="DTS.Serialization.Test"/> that contains this module.
/// </summary>
public Test ParentTest
{
get { return _ParentTest.Value; }
private set { _ParentTest.Value = value; }
}
private Property<Test> _ParentTest
= new Property<Test>(
typeof( Test.Module ).Namespace + ".Test.Module.ParentTest",
null,
false
);
/// <summary>
/// Initialize an instance of the DTS.Serialization.Test.Module class.
/// </summary>
///
/// <param name="parentTest">
/// The <see cref="DTS.Serialization.Test"/> containing this object.
/// </param>
///
public Module( Test parentTest )
{
try
{
this.ParentTest = parentTest;
}
catch ( System.Exception ex )
{
throw new Test.Module.Exception( "encountered problem constructing " + this.GetType( ).Name, ex );
}
}
/// <summary>
/// Get/set the list of channels on this module.
/// </summary>
[XmlSerializationTag( "Channels" )]
public List<Channel> Channels
{
get { return _Channels.Value; }
set { _Channels.Value = value; }
}
private Property<List<Channel>> _Channels
= new Property<List<Channel>>(
typeof( Module ).Namespace + ".Test.Module.Channels",
new List<Channel>( ),
true
);
/// <summary>
/// The list of modules in this test.
/// </summary>
[XmlSerializationTag("CalculatedChannels")]
public List<Channel> CalculatedChannels
{
get { return _CalculatedChannels.Value; }
set { _CalculatedChannels.Value = value; }
}
private Property<List<Channel>> _CalculatedChannels
= new Property<List<Channel>>(
typeof(Module).Namespace + ".Test.Module.CalculatedChannels",
new List<Channel>(),
true
);
/// <summary>
/// Get/set the module number of this module.
/// </summary>
[XmlSerializationTag( "Number" )]
public int Number
{
get { return _Number.Value; }
set { _Number.Value = value; }
}
private Property<int> _Number
= new Property<int>(
typeof( Module ).Namespace + ".Test.Module.Number",
0,
false
);
/// <summary>
/// Get/set the serial number <see cref="string"/> for this DAS.
/// </summary>
[XmlSerializationTag( "SerialNumber" )]
public string SerialNumber
{
get { return _SerialNumber.Value; }
set { _SerialNumber.Value = value; }
}
private Property<string> _SerialNumber
= new Property<string>(
typeof( Module ).Namespace + ".Test.Module.SerialNumber",
"",
true
);
/// <summary>
/// A string that describes the module, for example, to know if it was created for the
/// purposes of adding it to the .dts file during download of Slice6 Distributor attributes.
/// </summary>
[XmlSerializationTag("Description")]
public string Description
{
get { return _Description.Value; }
set { _Description.Value = value; }
}
private Property<string> _Description
= new Property<string>(
typeof(Module).Namespace + ".Test.Module.Description",
"",
true
);
/// <summary>
/// Get/set the base serial number <see cref="string"/> for this DAS.
/// </summary>
[XmlSerializationTag("BaseSerialNumber")]
public string BaseSerialNumber
{
get { return _BaseSerialNumber.Value; }
set { _BaseSerialNumber.Value = value; }
}
private Property<string> _BaseSerialNumber
= new Property<string>(
typeof(Module).Namespace + ".Test.Module.BaseSerialNumber",
"",
true
);
/// <summary>
/// Get/set the number of requested seconds pre-trigger for this module.
/// </summary>
[XmlSerializationTag("RequestedPreTriggerSeconds")]
public double RequestedPreTriggerSeconds
{
get { return _RequestedPreTriggerSeconds.Value; }
set { _RequestedPreTriggerSeconds.Value = value; }
}
private Property<double> _RequestedPreTriggerSeconds
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.RequestedPreTriggerSeconds",
0.0,
false
);
/// <summary>
/// Get/set the number of requested seconds post-trigger for this module.
/// </summary>
[XmlSerializationTag("RequestedPostTriggerSeconds")]
public double RequestedPostTriggerSeconds
{
get { return _RequestedPostTriggerSeconds.Value; }
set { _RequestedPostTriggerSeconds.Value = value; }
}
private Property<double> _RequestedPostTriggerSeconds
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.RequestedPostTriggerSeconds",
0.0,
false
);
/// <summary>
/// Get/set the number of seconds pre-trigger for this module.
/// </summary>
[XmlSerializationTag( "PreTriggerSeconds" )]
public double PreTriggerSeconds
{
get { return _PreTriggerSeconds.Value; }
set { _PreTriggerSeconds.Value = value; }
}
private Property<double> _PreTriggerSeconds
= new Property<double>(
typeof( Module ).Namespace + ".Test.Module.PreTriggerSeconds",
0.0,
false
);
/// <summary>
/// Get/set the number of seconds post-trigger for this module.
/// </summary>
[XmlSerializationTag( "PostTriggerSeconds" )]
public double PostTriggerSeconds
{
get { return _PostTriggerSeconds.Value; }
set { _PostTriggerSeconds.Value = value; }
}
private Property<double> _PostTriggerSeconds
= new Property<double>(
typeof( Module ).Namespace + ".Test.Module.PostTriggerSeconds",
0.0,
false
);
/// <summary>
/// Get/set the number of samples in this test modules.
/// </summary>
[XmlSerializationTag( "NumberOfSamples" )]
public UInt64 NumberOfSamples
{
get { return _NumberOfSamples.Value; }
set
{
if ( !_UnsubsampledNumberOfSamples.IsInitialized || value > UnsubsampledNumberOfSamples )
UnsubsampledNumberOfSamples = value;
_NumberOfSamples.Value = value;
}
}
private Property<UInt64> _NumberOfSamples
= new Property<UInt64>(
typeof( Module ).Namespace + ".Test.Module.NumberOfSamples",
0,
false
);
/// <summary>
/// Get/set the unsubsampled number of samples in this test modules.
/// </summary>
[XmlSerializationTag( "UnsubsampledNumberOfSamples" )]
public UInt64 UnsubsampledNumberOfSamples
{
get { return _UnsubsampledNumberOfSamples.Value; }
set { _UnsubsampledNumberOfSamples.Value = value; }
}
private Property<UInt64> _UnsubsampledNumberOfSamples
= new Property<UInt64>(
typeof( Module ).Namespace + ".Test.Module.UnsubsampledNumberOfSamples",
0,
false
);
/// <summary>
/// Get/set the trigger sample numbers for this module.
/// </summary>
private const int DataName = 0;
private const int DatumName = 1;
private const int DatumValueName = 2;
[XmlSerializationTag( "TriggerSampleNumbers", DataName )]
[XmlSerializationTag( "TriggerSampleNumber", DatumName )]
[XmlSerializationTag( "Value", DatumValueName )]
public List<UInt64> TriggerSampleNumbers
{
get { return _TriggerSampleNumbers.Value; }
set { _TriggerSampleNumbers.Value = value; }
}
private Property<List<UInt64>> _TriggerSampleNumbers
= new Property<List<UInt64>>(
typeof( Module ).Namespace + ".Test.Module.TriggerSampleNumbers",
null,
false
);
/// <summary>
/// Get/set the unsubsampled trigger sample numbers for this module.
/// </summary>
[XmlSerializationTag( "UnsubsampledTriggerSampleNumbers", DataName )]
[XmlSerializationTag( "UnsubsampledTriggerSampleNumber", DatumName )]
[XmlSerializationTag( "Value", DatumValueName )]
public List<UInt64> UnsubsampledTriggerSampleNumbers
{
get { return _UnsubsampledTriggerSampleNumbers.Value; }
set { _UnsubsampledTriggerSampleNumbers.Value = value; }
}
private Property<List<UInt64>> _UnsubsampledTriggerSampleNumbers
= new Property<List<UInt64>>(
typeof( Module ).Namespace + ".Test.Module.UnsubsampledTriggerSampleNumbers",
null,
false
);
/// <summary>
/// Get/set the start record sample number for this module.
/// </summary>
[XmlSerializationTag( "StartRecordSampleNumber" )]
public UInt64 StartRecordSampleNumber
{
get { return _StartRecordSampleNumber.Value; }
set { _StartRecordSampleNumber.Value = value; }
}
private Property<UInt64> _StartRecordSampleNumber
= new Property<UInt64>(
typeof( Module ).Namespace + ".Test.Module.StartRecordSampleNumber",
0,
false
);
/// <summary>
/// Get/set the sample rate for this test module.
/// </summary>
[XmlSerializationTag( "SampleRateHz" )]
public float SampleRateHz
{
get { return _SampleRateHz.Value; }
set { _SampleRateHz.Value = value; }
}
private Property<float> _SampleRateHz
= new Property<float>(
typeof( Module ).Namespace + ".Test.Module.SampleRateHz",
0,
false
);
/// <summary>
///
/// </summary>
[XmlSerializationTag("StartRecordTimestampSec")]
public double StartRecordTimestampSec
{
get { return _StartRecordTimestampSec.Value; }
set { _StartRecordTimestampSec.Value = value; }
}
private Property<double> _StartRecordTimestampSec
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.StartRecordTimestampSec",
0,
false
);
/// <summary>
///
/// </summary>
[XmlSerializationTag("TriggerTimestampSec")]
public double TriggerTimestampSec
{
get { return _TriggerTimestampSec.Value; }
set { _TriggerTimestampSec.Value = value; }
}
private Property<double> _TriggerTimestampSec
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.TriggerTimestampSec",
0,
false
);
/// <summary>
///
/// </summary>
[XmlSerializationTag("StartRecordTimestampNanoSec")]
public double StartRecordTimestampNanoSec
{
get { return _StartRecordTimestampNanoSec.Value; }
set { _StartRecordTimestampNanoSec.Value = value; }
}
private Property<double> _StartRecordTimestampNanoSec
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.StartRecordTimestampNanoSec",
0,
false
);
/// <summary>
///
/// </summary>
[XmlSerializationTag("TriggerTimestampNanoSec")]
public double TriggerTimestampNanoSec
{
get { return _TriggerTimestampNanoSec.Value; }
set { _TriggerTimestampNanoSec.Value = value; }
}
private Property<double> _TriggerTimestampNanoSec
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.TriggerTimestampNanoSec",
0,
false
);
/// <summary>
///
/// </summary>
[XmlSerializationTag("PTPMasterSync")]
public bool PTPMasterSync
{
get { return _PTPMasterSync.Value; }
set { _PTPMasterSync.Value = value; }
}
private Property<bool> _PTPMasterSync
= new Property<bool>(
typeof(Module).Namespace + ".Test.Module.PTPMasterSync",
false,
false
);
/// <summary>
/// The value for the X axis of a Slice6 tilt sensor
/// </summary>
[XmlSerializationTag("TiltSensorAxisXDegreesPre")]
public double TiltSensorAxisXDegreesPre
{
get { return _TiltSensorAxisXDegreesPre.Value; }
set { _TiltSensorAxisXDegreesPre.Value = value; }
}
private Property<double> _TiltSensorAxisXDegreesPre
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.TiltSensorAxisXDegreesPre",
0,
false
);
/// <summary>
/// The value for the Y axis of a Slice6 tilt sensor
/// </summary>
[XmlSerializationTag("TiltSensorAxisYDegreesPre")]
public double TiltSensorAxisYDegreesPre
{
get { return _TiltSensorAxisYDegreesPre.Value; }
set { _TiltSensorAxisYDegreesPre.Value = value; }
}
private Property<double> _TiltSensorAxisYDegreesPre
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.TiltSensorAxisYDegreesPre",
0,
false
);
/// <summary>
/// The value for the Z axis of a Slice6 tilt sensor
/// </summary>
[XmlSerializationTag("TiltSensorAxisZDegreesPre")]
public double TiltSensorAxisZDegreesPre
{
get { return _TiltSensorAxisZDegreesPre.Value; }
set { _TiltSensorAxisZDegreesPre.Value = value; }
}
private Property<double> _TiltSensorAxisZDegreesPre
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.TiltSensorAxisZDegreesPre",
0,
false
);
/// <summary>
/// The value for the X axis of a Slice6 tilt sensor
/// </summary>
[XmlSerializationTag("TiltSensorAxisXDegreesPost")]
public double TiltSensorAxisXDegreesPost
{
get { return _TiltSensorAxisXDegreesPost.Value; }
set { _TiltSensorAxisXDegreesPost.Value = value; }
}
private Property<double> _TiltSensorAxisXDegreesPost
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.TiltSensorAxisXDegreesPost",
0,
false
);
/// <summary>
/// The value for the Y axis of a Slice6 tilt sensor
/// </summary>
[XmlSerializationTag("TiltSensorAxisYDegreesPost")]
public double TiltSensorAxisYDegreesPost
{
get { return _TiltSensorAxisYDegreesPost.Value; }
set { _TiltSensorAxisYDegreesPost.Value = value; }
}
private Property<double> _TiltSensorAxisYDegreesPost
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.TiltSensorAxisYDegreesPost",
0,
false
);
/// <summary>
/// The value for the Z axis of a Slice6 tilt sensor
/// </summary>
[XmlSerializationTag("TiltSensorAxisZDegreesPost")]
public double TiltSensorAxisZDegreesPost
{
get { return _TiltSensorAxisZDegreesPost.Value; }
set { _TiltSensorAxisZDegreesPost.Value = value; }
}
private Property<double> _TiltSensorAxisZDegreesPost
= new Property<double>(
typeof(Module).Namespace + ".Test.Module.TiltSensorAxisZDegreesPost",
0,
false
);
/// <summary>
/// The value for the 1st location of a Slice6 temperature sensor
/// </summary>
[XmlSerializationTag("TemperatureLocation1Pre")]
public float TemperatureLocation1Pre
{
get { return _TemperatureLocation1Pre.Value; }
set { _TemperatureLocation1Pre.Value = value; }
}
private Property<float> _TemperatureLocation1Pre
= new Property<float>(
typeof(Module).Namespace + ".Test.Module.TemperatureLocation1Pre",
0,
false
);
/// <summary>
/// The value for the 2nd location of a Slice6 temperature sensor
/// </summary>
[XmlSerializationTag("TemperatureLocation2Pre")]
public float TemperatureLocation2Pre
{
get { return _TemperatureLocation2Pre.Value; }
set { _TemperatureLocation2Pre.Value = value; }
}
private Property<float> _TemperatureLocation2Pre
= new Property<float>(
typeof(Module).Namespace + ".Test.Module.TemperatureLocation2Pre",
0,
false
);
/// <summary>
/// The value for the 3rd location of a Slice6 temperature sensor
/// </summary>
[XmlSerializationTag("TemperatureLocation3Pre")]
public float TemperatureLocation3Pre
{
get { return _TemperatureLocation3Pre.Value; }
set { _TemperatureLocation3Pre.Value = value; }
}
private Property<float> _TemperatureLocation3Pre
= new Property<float>(
typeof(Module).Namespace + ".Test.Module.TemperatureLocation3Pre",
0,
false
);
/// <summary>
/// The value for the 4th location of a Slice6 temperature sensor
/// </summary>
[XmlSerializationTag("TemperatureLocation4Pre")]
public float TemperatureLocation4Pre
{
get { return _TemperatureLocation4Pre.Value; }
set { _TemperatureLocation4Pre.Value = value; }
}
private Property<float> _TemperatureLocation4Pre
= new Property<float>(
typeof(Module).Namespace + ".Test.Module.TemperatureLocation4Pre",
0,
false
);
/// <summary>
/// The value for the 1st location of a Slice6 temperature sensor post-trigger
/// </summary>
[XmlSerializationTag("TemperatureLocation1Post")]
public float TemperatureLocation1Post
{
get { return _TemperatureLocation1Post.Value; }
set { _TemperatureLocation1Post.Value = value; }
}
private Property<float> _TemperatureLocation1Post
= new Property<float>(
typeof(Module).Namespace + ".Test.Module.TemperatureLocation1Post",
0,
false
);
/// <summary>
/// The value for the 2nd location of a Slice6 temperature sensor post-trigger
/// </summary>
[XmlSerializationTag("TemperatureLocation2Post")]
public float TemperatureLocation2Post
{
get { return _TemperatureLocation2Post.Value; }
set { _TemperatureLocation2Post.Value = value; }
}
private Property<float> _TemperatureLocation2Post
= new Property<float>(
typeof(Module).Namespace + ".Test.Module.TemperatureLocation2Post",
0,
false
);
/// <summary>
/// The value for the 3rd location of a Slice6 temperature sensor post-trigger
/// </summary>
[XmlSerializationTag("TemperatureLocation3Post")]
public float TemperatureLocation3Post
{
get { return _TemperatureLocation3Post.Value; }
set { _TemperatureLocation3Post.Value = value; }
}
private Property<float> _TemperatureLocation3Post
= new Property<float>(
typeof(Module).Namespace + ".Test.Module.TemperatureLocation3Post",
0,
false
);
/// <summary>
/// The value for the 4th location of a Slice6 temperature sensor post-trigger
/// </summary>
[XmlSerializationTag("TemperatureLocation4Post")]
public float TemperatureLocation4Post
{
get { return _TemperatureLocation4Post.Value; }
set { _TemperatureLocation4Post.Value = value; }
}
private Property<float> _TemperatureLocation4Post
= new Property<float>(
typeof(Module).Namespace + ".Test.Module.TemperatureLocation4Post",
0,
false
);
/// <summary>
/// Get/set the AA filter rate for this test module.
/// </summary>
[XmlSerializationTag( "AaFilterRateHz" )]
public float AaFilterRateHz
{
get { return _AaFilterRateHz.Value; }
set { _AaFilterRateHz.Value = value; }
}
private Property<float> _AaFilterRateHz
= new Property<float>(
typeof( Module ).Namespace + ".Test.Module.AaFilterRateHz",
0,
false
);
/// <summary>
/// Get/set the recording mode of this module.
/// </summary>
[XmlSerializationTag( "RecordingMode" )]
public DAS.Concepts.Test.Module.RecordingMode RecordingMode
{
get { return _RecordingMode.Value; }
set { _RecordingMode.Value = value; }
}
private Property<DAS.Concepts.Test.Module.RecordingMode> _RecordingMode
= new Property<DAS.Concepts.Test.Module.RecordingMode>(
typeof( Module ).Namespace + ".Test.Module.RecordingMode",
DAS.Concepts.Test.Module.RecordingMode.CircularBuffer,
false
);
/// <summary>
/// Get the number of <see cref="int"/> channels in the channel list. (Intended for de/serialization only!)
/// </summary>
[XmlSerializationTag( "NumberOfChannels" )]
public int NumberOfChannels
{
get { return this.Channels.Count; }
}
/// <summary>
/// Get/set inline serialized data switch.
/// </summary>
[XmlSerializationTag( "InlineSerializedData" )]
public bool InlineSerializedData
{
get { return _InlineSerializedData.Value; }
set
{
try
{
_InlineSerializedData.Value = value;
foreach ( Test.Module.Channel channel in Channels )
channel.ExpressDataInlineOnXmlSerialization = value;
}
catch ( System.Exception ex )
{
throw new Exception( "encountered problem setting module InlineSerializedData state", ex );
}
}
}
private Property<bool> _InlineSerializedData = new Property<bool>( "InlineSerializedData", false, true );
/// <summary>
/// Write XML serialization for this object to the specified writer.
/// </summary>
///
/// <param name="writer">
/// The <see cref="XmlWriter"/> to which this object's XML serialization
/// will be written.
/// </param>
///
public void WriteXml( XmlWriter writer )
{
try
{
var cult = new System.Globalization.CultureInfo("");
AttributeExtractor<XmlSerializationTagAttribute> attributeExtractor = new AttributeExtractor<XmlSerializationTagAttribute>( );
//
// Write simple module properties.
//
// NOTE: The way this really should be done is to examine this object using reflection and just automatically
// assemble the list of properties that have been tagged with the serialization attribute. That way, when I
// add in a property after the fact, I don't have to worry about any of this crap below. It would just automatically
// get de/serialized. The equality check should also pick it's comparison properties that way. I'd do the conversion
// now, but we're under pressure for a release so it'll have to wait.
//
writer.WriteStartElement ( attributeExtractor.ExtractAttachedAttributeFromObject ( this ).Value );
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "AaFilterRateHz").Value, this.AaFilterRateHz.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "Number").Value, this.Number.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "SerialNumber").Value, (null != this.SerialNumber ? this.SerialNumber : "").ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "NumberOfSamples").Value, this.NumberOfSamples.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "UnsubsampledNumberOfSamples").Value, this.UnsubsampledNumberOfSamples.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "RequestedPostTriggerSeconds").Value, this.RequestedPostTriggerSeconds.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "RequestedPreTriggerSeconds").Value, this.RequestedPreTriggerSeconds.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "PostTriggerSeconds").Value, this.PostTriggerSeconds.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "PreTriggerSeconds").Value, this.PreTriggerSeconds.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "RecordingMode").Value, this.RecordingMode.ToString());
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "SampleRateHz").Value, this.SampleRateHz.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "StartRecordSampleNumber").Value, this.StartRecordSampleNumber.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "NumberOfChannels").Value, this.NumberOfChannels.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "InlineSerializedData").Value, this.InlineSerializedData.ToString(cult));
try
{
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "BaseSerialNumber").Value, this.BaseSerialNumber.ToString(cult));
}
catch (System.Exception)
{
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "BaseSerialNumber").Value, "NA");
}
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "StartRecordTimestampSec").Value, this.StartRecordTimestampSec.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "StartRecordTimestampNanoSec").Value, this.StartRecordTimestampNanoSec.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TriggerTimestampSec").Value, this.TriggerTimestampSec.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TriggerTimestampNanoSec").Value, this.TriggerTimestampNanoSec.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "PTPMasterSync").Value, this.PTPMasterSync.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisXDegreesPre").Value, this.TiltSensorAxisXDegreesPre.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisYDegreesPre").Value, this.TiltSensorAxisYDegreesPre.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisZDegreesPre").Value, this.TiltSensorAxisZDegreesPre.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisXDegreesPost").Value, this.TiltSensorAxisXDegreesPost.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisYDegreesPost").Value, this.TiltSensorAxisYDegreesPost.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisZDegreesPost").Value, this.TiltSensorAxisZDegreesPost.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation1Pre").Value, this.TemperatureLocation1Pre.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation2Pre").Value, this.TemperatureLocation2Pre.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation3Pre").Value, this.TemperatureLocation3Pre.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation4Pre").Value, this.TemperatureLocation4Pre.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation1Post").Value, this.TemperatureLocation1Post.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation2Post").Value, this.TemperatureLocation2Post.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation3Post").Value, this.TemperatureLocation3Post.ToString(cult));
writer.WriteAttributeString(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation4Post").Value, this.TemperatureLocation4Post.ToString(cult));
////
//// Write out trigger sample numbers list.
////
//List<XmlSerializationTagAttribute> triggerSampleNumberAttributes = attributeExtractor.ExtractAttachedAttributesFromProperty( this, "TriggerSampleNumbers" );
//triggerSampleNumberAttributes.Sort( );
//writer.WriteStartElement( triggerSampleNumberAttributes[ DataName ].Value );
//for ( int i=0; i < TriggerSampleNumbers.Count; i++ )
//{
// writer.WriteStartElement( triggerSampleNumberAttributes[ DatumName ].Value );
// writer.WriteAttributeString( triggerSampleNumberAttributes[ DatumValueName ].Value, this.TriggerSampleNumbers[ i ].ToString( ) );
// writer.WriteEndElement( );
//}
//writer.WriteEndElement( );
//
// Write out unsubsampled trigger sample numbers list.
//
List<XmlSerializationTagAttribute> unsubsampledTriggerSampleNumberAttributes = attributeExtractor.ExtractAttachedAttributesFromProperty( this, "TriggerSampleNumbers" );
unsubsampledTriggerSampleNumberAttributes.Sort( );
writer.WriteStartElement( unsubsampledTriggerSampleNumberAttributes[ DataName ].Value );
for ( int i=0; i < UnsubsampledTriggerSampleNumbers.Count; i++ )
{
writer.WriteStartElement( unsubsampledTriggerSampleNumberAttributes[ DatumName ].Value );
writer.WriteAttributeString(unsubsampledTriggerSampleNumberAttributes[DatumValueName].Value, this.UnsubsampledTriggerSampleNumbers[i].ToString(cult));
writer.WriteEndElement( );
}
writer.WriteEndElement( );
//
// Write out channel list, if it's not empty.
//
writer.WriteStartElement ( attributeExtractor.ExtractAttachedAttributeFromProperty( this, "Channels").Value );
foreach (var c in Channels)
{
c.WriteXml(writer);
}
writer.WriteEndElement();
writer.WriteStartElement(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "CalculatedChannels").Value);
foreach (var c in CalculatedChannels)
{
c.WriteXml(writer);
}
writer.WriteEndElement();
writer.WriteEndElement();
}
catch ( System.Exception ex )
{
throw new Exception( "encountered problem converting DTS.Serialization.Test.Module object to XML", ex );
}
}
/// <summary>
/// Read XML serialization for this object from the specified reader.
/// </summary>
///
/// <param name="reader">
/// The <see cref="XmlReader"/> from which this object's XML serialization
/// will be read.
/// </param>
///
public void ReadXml(XmlReader reader)
{
try
{
var cult = new System.Globalization.CultureInfo("");
AttributeExtractor<XmlSerializationTagAttribute> attributeExtractor = new AttributeExtractor<XmlSerializationTagAttribute>();
reader.MoveToContent();
//
// Read simple attributes.
//
float aafilterRateHz;
if (
float.TryParse(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this, "AaFilterRateHz").Value),
NumberStyles.Any, cult, out aafilterRateHz))
{
AaFilterRateHz = aafilterRateHz;
}
else
{
throw new Exception("error reading AaFilterRateHz");
}
int number;
if (
int.TryParse(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this, "Number").Value),
NumberStyles.Any, cult, out number))
{
Number = number;
}
else
{
throw new Exception("error reading Number");
}
try
{
SerialNumber =
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this, "SerialNumber").Value);
}
catch
{
throw new Exception("error reading SerialNumber");
}
ulong numberOfSamples;
if (
ulong.TryParse(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this, "NumberOfSamples").Value),
NumberStyles.Any, cult, out numberOfSamples))
{
NumberOfSamples = numberOfSamples;
}
else
{
throw new Exception("error reading NumberOfSamples");
}
double postTriggerSeconds;
if (
double.TryParse(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this, "PostTriggerSeconds").Value),
NumberStyles.Any, cult, out postTriggerSeconds))
{
PostTriggerSeconds = postTriggerSeconds;
}
else
{
throw new Exception("error reading PostTriggerSeconds");
}
double preTriggerSeconds;
if (
double.TryParse(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this, "PreTriggerSeconds").Value),
NumberStyles.Any, cult, out preTriggerSeconds))
{
PreTriggerSeconds = preTriggerSeconds;
}
else
{
throw new Exception("error reading PreTriggerSeconds");
}
double requestedPostTriggerSeconds;
RequestedPostTriggerSeconds = double.TryParse(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this,
"RequestedPostTriggerSeconds").Value), NumberStyles.Any, cult,
out requestedPostTriggerSeconds) ? requestedPostTriggerSeconds : PostTriggerSeconds;
double requestedPreTriggerSeconds;
RequestedPreTriggerSeconds = double.TryParse(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this,
"RequestedPreTriggerSeconds").Value), NumberStyles.Any, cult,
out requestedPreTriggerSeconds) ? requestedPreTriggerSeconds : PreTriggerSeconds;
float sampleRateHz;
if (float.TryParse(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this,
"SampleRateHz").Value), NumberStyles.Any, cult,
out sampleRateHz))
{
SampleRateHz = sampleRateHz;
}
else
{
throw new Exception("error reading SampleRateHz");
}
var startRecordTimestampSec = 0.0D;
double.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "StartRecordTimestampSec").Value), NumberStyles.Any, cult, out startRecordTimestampSec);
StartRecordTimestampSec = startRecordTimestampSec;
var triggerTimestampSec = 0.0D;
double.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TriggerTimestampSec").Value), NumberStyles.Any, cult, out triggerTimestampSec);
TriggerTimestampSec = triggerTimestampSec;
var startRecordTimestampNanoSec = 0.0D;
double.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "StartRecordTimestampNanoSec").Value), NumberStyles.Any, cult, out startRecordTimestampNanoSec);
StartRecordTimestampNanoSec = startRecordTimestampNanoSec;
var triggerTimestampNanoSec = 0.0D;
double.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TriggerTimestampNanoSec").Value), NumberStyles.Any, cult, out triggerTimestampNanoSec);
TriggerTimestampNanoSec = triggerTimestampNanoSec;
var pTpMasterSync = false;
bool.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "PTPMasterSync").Value), out pTpMasterSync);
PTPMasterSync = pTpMasterSync;
var tiltSensorAxisXDegreesPre = 0.0D;
double.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisXDegreesPre").Value), NumberStyles.Any, cult, out tiltSensorAxisXDegreesPre);
TiltSensorAxisXDegreesPre = tiltSensorAxisXDegreesPre;
var tiltSensorAxisYDegreesPre = 0.0D;
double.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisYDegreesPre").Value), NumberStyles.Any, cult, out tiltSensorAxisYDegreesPre);
TiltSensorAxisYDegreesPre = tiltSensorAxisYDegreesPre;
var tiltSensorAxisZDegreesPre = 0.0D;
double.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisZDegreesPre").Value), NumberStyles.Any, cult, out tiltSensorAxisZDegreesPre);
TiltSensorAxisZDegreesPre = tiltSensorAxisZDegreesPre;
var tiltSensorAxisXDegreesPost = 0.0D;
double.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisXDegreesPost").Value), NumberStyles.Any, cult, out tiltSensorAxisXDegreesPost);
TiltSensorAxisXDegreesPost = tiltSensorAxisXDegreesPost;
var tiltSensorAxisYDegreesPost = 0.0D;
double.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisYDegreesPost").Value), NumberStyles.Any, cult, out tiltSensorAxisYDegreesPost);
TiltSensorAxisYDegreesPost = tiltSensorAxisYDegreesPost;
var tiltSensorAxisZDegreesPost = 0.0D;
double.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TiltSensorAxisZDegreesPost").Value), NumberStyles.Any, cult, out tiltSensorAxisZDegreesPost);
TiltSensorAxisZDegreesPost = tiltSensorAxisZDegreesPost;
var temperatureLocation1Pre = 0.0F;
float.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation1Pre").Value), NumberStyles.Any, cult, out temperatureLocation1Pre);
TemperatureLocation1Pre = temperatureLocation1Pre;
var temperatureLocation2Pre = 0.0F;
float.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation2Pre").Value), NumberStyles.Any, cult, out temperatureLocation2Pre);
TemperatureLocation2Pre = temperatureLocation2Pre;
var temperatureLocation3Pre = 0.0F;
float.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation3Pre").Value), NumberStyles.Any, cult, out temperatureLocation3Pre);
TemperatureLocation3Pre = temperatureLocation3Pre;
var temperatureLocation4Pre = 0.0F;
float.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation4Pre").Value), NumberStyles.Any, cult, out temperatureLocation4Pre);
TemperatureLocation4Pre = temperatureLocation4Pre;
var temperatureLocation1Post = 0.0F;
float.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation1Post").Value), NumberStyles.Any, cult, out temperatureLocation1Post);
TemperatureLocation1Post = temperatureLocation1Post;
var temperatureLocation2Post = 0.0F;
float.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation2Post").Value), NumberStyles.Any, cult, out temperatureLocation2Post);
TemperatureLocation2Post = temperatureLocation2Post;
var temperatureLocation3Post = 0.0F;
float.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation3Post").Value), NumberStyles.Any, cult, out temperatureLocation3Post);
TemperatureLocation3Post = temperatureLocation3Post;
var temperatureLocation4Post = 0.0F;
float.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "TemperatureLocation4Post").Value), NumberStyles.Any, cult, out temperatureLocation4Post);
TemperatureLocation4Post = temperatureLocation4Post;
ulong startRecordSampleNumber;
if (
ulong.TryParse(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this, "StartRecordSampleNumber")
.Value), NumberStyles.Any, cult, out startRecordSampleNumber))
{
StartRecordSampleNumber = startRecordSampleNumber;
}
else
{
throw new Exception("error reading StartRecordSampleNumber");
}
bool inlineSerializedData;
if (bool.TryParse(reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "InlineSerializedData").Value), out inlineSerializedData))
{
InlineSerializedData = inlineSerializedData;
}
else
{
throw new Exception("error reading InlineSerializedData");
}
try
{
RecordingMode =
DAS.Concepts.Test.Module.GetRecordingModeFromString(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this, "RecordingMode").Value));
}
catch
{
throw new Exception("error reading RecordingMode");
}
try
{
BaseSerialNumber = reader.GetAttribute(attributeExtractor.ExtractAttachedAttributeFromProperty(this, "BaseSerialNumber").Value);
}
catch (Exception e)
{
throw new Exception("error reading BaseSerialNumber");
}
ulong unsubsampledNumberOfSamples;
UnsubsampledNumberOfSamples = ulong.TryParse(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this,
"UnsubsampledNumberOfSamples").Value), NumberStyles.Any, cult,
out unsubsampledNumberOfSamples) ? unsubsampledNumberOfSamples : NumberOfSamples;
// Can't set the property from whence this came; but we should use it to initialize the channel list with
// the proper number of entries so subsequent logic will know how many sequential channel files to gobble
// up for this module.
int numberOfChannelsToRead;
if (int.TryParse(
reader.GetAttribute(
attributeExtractor.ExtractAttachedAttributeFromProperty(this, "NumberOfChannels").Value),
NumberStyles.Any, cult, out numberOfChannelsToRead))
{
//
// Read unsubsampled trigger sample numbers list.
//
reader.Read();
reader.MoveToContent();
List<XmlSerializationTagAttribute> unsubsampledTriggerSampleNumberAttributes =
attributeExtractor.ExtractAttachedAttributesFromProperty(this, "TriggerSampleNumbers");
unsubsampledTriggerSampleNumberAttributes.Sort();
UnsubsampledTriggerSampleNumbers = new List<ulong>();
if (
reader.Name.Equals(unsubsampledTriggerSampleNumberAttributes[DataName].Value,
StringComparison.OrdinalIgnoreCase) && !reader.IsEmptyElement)
{
//
// UnsubsampledTriggerSampleNumbers is populated, so spin through it.
//
for (reader.Read(), reader.MoveToContent();
reader.Name.Equals(unsubsampledTriggerSampleNumberAttributes[DatumName].Value,
StringComparison.OrdinalIgnoreCase);
reader.Read(), reader.MoveToContent())
UnsubsampledTriggerSampleNumbers.Add(
UInt64.Parse(
reader.GetAttribute(
unsubsampledTriggerSampleNumberAttributes[DatumValueName].Value), cult));
reader.ReadEndElement();
reader.MoveToContent();
}
else
{
//
// UnsubsampledTriggerSampleNumbers is an empty tag, so consume it and move on.
reader.Read();
reader.MoveToContent();
}
try
{
//
// Read channel list, if it exists.
//
this.Channels = new List<Test.Module.Channel>();
if (!reader.IsEmptyElement &&
string.Equals(
attributeExtractor.ExtractAttachedAttributeFromProperty(this, "Channels").Value,
reader.Name, StringComparison.OrdinalIgnoreCase))
{
while (reader.Read() && (XmlNodeType.Element == reader.MoveToContent()))
{
string channelType
= new DTS.Utilities.Xml.PropertyAttributeDecoder<Test.Module.Channel>(
new Test.Module.AnalogInputChannel(this))
.ExtractStringProperty("ChannelType", reader);
if (null == channelType)
throw new Exception("expected channel type string but got " +
(null != channelType
? ("\"" + channelType + "\"")
: "<<NULL>>"));
else
{
Type channelClassType = Type.GetType(channelType);
Test.Module.Channel deserializedChannel =
Activator.CreateInstance(channelClassType, new object[] {this}) as
Test.Module.Channel;
// ( channelClassType, true ) as Test.Module.Channel;
if (
!(deserializedChannel.ExpressDataInlineOnXmlSerialization =
InlineSerializedData))
deserializedChannel.Data = new Channel.DataArray<short>();
deserializedChannel.ReadXml(reader);
this.Channels.Add(deserializedChannel);
}
}
reader.ReadEndElement();
}
}
catch (System.Exception ex)
{
throw new Exception("encountered problem parsing channel list", ex);
}
try
{
//
// Read calculated channel list, if it exists.
//
this.CalculatedChannels.Clear();
if (!reader.IsEmptyElement &&
string.Equals(
attributeExtractor.ExtractAttachedAttributeFromProperty(this, "CalculatedChannels")
.Value, reader.Name, StringComparison.OrdinalIgnoreCase))
{
while (reader.Read() && (XmlNodeType.Element == reader.MoveToContent()))
{
string channelType
= new DTS.Utilities.Xml.PropertyAttributeDecoder<Test.Module.Channel>(
new Test.Module.AnalogInputChannel(this))
.ExtractStringProperty("ChannelType", reader);
if (null == channelType)
throw new Exception("expected channel type string but got " +
(null != channelType
? ("\"" + channelType + "\"")
: "<<NULL>>"));
else
{
Type channelClassType = Type.GetType(channelType);
Test.Module.Channel deserializedChannel =
Activator.CreateInstance(channelClassType, new object[] {this}) as
Test.Module.Channel;
// ( channelClassType, true ) as Test.Module.Channel;
if (
!(deserializedChannel.ExpressDataInlineOnXmlSerialization =
InlineSerializedData))
deserializedChannel.Data = new Channel.DataArray<short>();
deserializedChannel.ReadXml(reader);
this.CalculatedChannels.Add(deserializedChannel);
}
}
reader.ReadEndElement();
}
}
catch (System.Exception ex)
{
throw new Exception("encountered problem parsing channel list", ex);
}
reader.Read(); // consume attribute end tag.
}
else
{
throw new Exception("error reading NumberOfChannels");
}
}
catch (System.Exception ex)
{
throw new Exception("encountered problem converting XML to DTS.Serialization.Test.Module object", ex);
}
}
/// <summary>
/// Should normally return a schema representing the form of the XML
/// generated/consumed by WriteXml/ReadXml, but it never called during
/// the serialization process so ours just returns null.
/// </summary>
///
/// <returns>
/// Null <see cref="XmlSchema"/> reference, always.
/// </returns>
///
public XmlSchema GetSchema( )
{
// This method is never invoked during XML object serialization.
return null;
}
/// <summary>
/// Test the specified object for equality with this object.
/// </summary>
///
/// <param name="obj">
/// The <see cref="object"/> to be tested for equality.
/// </param>
///
/// <returns>
/// <see cref="bool"/> true if the specified object has memeberwise equality with
/// this object; false otherwise.
/// </returns>
///
public override bool Equals( object obj )
{
try
{
Test.Module that = obj as Test.Module;
return null != that
&& this.AaFilterRateHz.Equals( that.AaFilterRateHz )
&& this.Number.Equals( that.Number )
&& this.SerialNumber.Equals( that.SerialNumber )
&& this.NumberOfSamples.Equals( that.NumberOfSamples )
&& this.UnsubsampledNumberOfSamples.Equals( that.UnsubsampledNumberOfSamples )
&& this.RequestedPostTriggerSeconds.Equals(that.RequestedPostTriggerSeconds)
&& this.RequestedPreTriggerSeconds.Equals(that.RequestedPreTriggerSeconds)
&& this.PostTriggerSeconds.Equals(that.PostTriggerSeconds)
&& this.PreTriggerSeconds.Equals(that.PreTriggerSeconds)
&& this.RecordingMode.Equals(that.RecordingMode)
&& this.SampleRateHz.Equals( that.SampleRateHz )
&& this.StartRecordTimestampSec.Equals(that.StartRecordTimestampSec)
&& this.TriggerTimestampSec.Equals(that.TriggerTimestampSec)
&& this.StartRecordTimestampSec.Equals(that.StartRecordTimestampNanoSec)
&& this.TriggerTimestampSec.Equals(that.TriggerTimestampNanoSec)
&& this.PTPMasterSync.Equals(that.PTPMasterSync)
&& this.TiltSensorAxisXDegreesPre.Equals(that.TiltSensorAxisXDegreesPre)
&& this.TiltSensorAxisYDegreesPre.Equals(that.TiltSensorAxisYDegreesPre)
&& this.TiltSensorAxisZDegreesPre.Equals(that.TiltSensorAxisZDegreesPre)
&& this.TiltSensorAxisXDegreesPost.Equals(that.TiltSensorAxisXDegreesPost)
&& this.TiltSensorAxisYDegreesPost.Equals(that.TiltSensorAxisYDegreesPost)
&& this.TiltSensorAxisZDegreesPost.Equals(that.TiltSensorAxisZDegreesPost)
&& this.TemperatureLocation1Pre.Equals(that.TemperatureLocation1Pre)
&& this.TemperatureLocation2Pre.Equals(that.TemperatureLocation2Pre)
&& this.TemperatureLocation3Pre.Equals(that.TemperatureLocation3Pre)
&& this.TemperatureLocation4Pre.Equals(that.TemperatureLocation4Pre)
&& this.TemperatureLocation1Post.Equals(that.TemperatureLocation1Post)
&& this.TemperatureLocation2Post.Equals(that.TemperatureLocation2Post)
&& this.TemperatureLocation3Post.Equals(that.TemperatureLocation3Post)
&& this.TemperatureLocation4Post.Equals(that.TemperatureLocation4Post)
&& this.StartRecordSampleNumber.Equals(that.StartRecordSampleNumber)
&& this.TriggerSampleNumbersEquals( that.TriggerSampleNumbers )
&& this.UnsubsampledTriggerSampleNumbersEquals( that.UnsubsampledTriggerSampleNumbers )
&& this.ChannelsEquals( that.Channels )
&& this.BaseSerialNumber.Equals( that.BaseSerialNumber );
}
catch ( System.Exception ex )
{
throw new Exception( "encountered problem equality-testing object " + ( null != obj ? "\"" + obj.ToString( ) + "\"" : "<<NULL>>" ), ex );
}
}
/// <summary>
/// Test the specified object's trigger sample number list for equality with this
/// object's module list.
/// </summary>
///
/// <param name="thoseTriggerSampleNumbers">
/// The <see cref="List"/> of <see cref="UInt64"/> object to be
/// compared for equality with this test's equivalent.
/// </param>
///
/// <returns>
/// <see cref="bool"/> true if the two lists contain equivalent-valued members;
/// false otherwise.
/// </returns>
///
private bool TriggerSampleNumbersEquals( List<UInt64> thoseTriggerSampleNumbers )
{
try
{
if ( null == thoseTriggerSampleNumbers || this.TriggerSampleNumbers.Count != thoseTriggerSampleNumbers.Count )
return false;
else for ( int i=0; i < thoseTriggerSampleNumbers.Count; i++ )
if ( !this.TriggerSampleNumbers[ i ].Equals( thoseTriggerSampleNumbers[ i ] ) )
return false;
return true;
}
catch ( System.Exception ex )
{
throw new Exception( "encountered problem equality-testing trigger sample numbers list ", ex );
}
}
/// <summary>
/// Test the specified object's unsubsampled trigger sample number list for equality with this
/// object's module list.
/// </summary>
///
/// <param name="thoseUnsubsampledTriggerSampleNumbers">
/// The <see cref="List"/> of <see cref="UInt64"/> object to be
/// compared for equality with this test's equivalent.
/// </param>
///
/// <returns>
/// <see cref="bool"/> true if the two lists contain equivalent-valued members;
/// false otherwise.
/// </returns>
///
private bool UnsubsampledTriggerSampleNumbersEquals( List<UInt64> thoseUnsubsampledTriggerSampleNumbers )
{
try
{
if ( null == thoseUnsubsampledTriggerSampleNumbers || this.UnsubsampledTriggerSampleNumbers.Count != thoseUnsubsampledTriggerSampleNumbers.Count )
return false;
else for ( int i=0; i < thoseUnsubsampledTriggerSampleNumbers.Count; i++ )
if ( !this.TriggerSampleNumbers[ i ].Equals( thoseUnsubsampledTriggerSampleNumbers[ i ] ) )
return false;
return true;
}
catch ( System.Exception ex )
{
throw new Exception( "encountered problem equality-testing unsubsampled trigger sample numbers list ", ex );
}
}
/// <summary>
/// Test the specified object's module list for equality with this object's
/// module list.
/// </summary>
///
/// <param name="thoseChannels">
/// The <see cref="List"/> of <see cref="Dts.Serialization.Test.Module.Channel"/> object to be
/// compared for equality with this test's equivalent.
/// </param>
///
/// <returns>
/// <see cref="bool"/> true if the two lists contain equivalent-valued members;
/// false otherwise.
/// </returns>
///
private bool ChannelsEquals( List<Test.Module.Channel> thoseChannels )
{
try
{
if ( null == thoseChannels || this.Channels.Count != thoseChannels.Count )
return false;
else for ( int i=0; i < thoseChannels.Count; i++ )
if ( !this.Channels[ i ].Equals( thoseChannels[ i ] ) )
{
bool test = this.Channels[ i ].Equals( thoseChannels[ i ] );
Debug.Assert( test );
return false;
}
//return false;
return true;
}
catch ( System.Exception ex )
{
throw new Exception( "encountered problem equality-testing channel list", ex );
}
}
/// <summary>
/// Return the hash code for this object.
/// </summary>
///
/// <returns>
/// The <see cref="int"/> hash code for this object.
/// </returns>
///
public override int GetHashCode( )
{
return base.GetHashCode( );
}
}
}
}