Files
DP44/Common/DTS.Common.Serialization/SoMat/SoMatTestHeader.cs

58 lines
2.1 KiB
C#
Raw Normal View History

2026-04-17 14:55:32 -04:00
using System.Collections.Generic;
namespace DTS.Serialization.SoMat
{
public class SoMatTestHeader
{
public string TestTitle { get; set; } = "";
public string Operator { get; set; } = "";
public string RunDateTime { get; set; } = "";
private readonly List<SoMatChannel> _channels = new List<SoMatChannel>();
public int NumLogChannels => _channels.Count;
public SoMatChannel[] Channels => _channels.ToArray();
public int NumDataModes { get; set; } = 1;
public void Serialize(System.IO.StreamWriter sw)
{
sw.Write("DM_TestTitle=");
sw.WriteLine(TestTitle);
sw.Write("DM_Operator=");
sw.WriteLine(Operator);
sw.Write("RUNDATETIME=");
sw.WriteLine(RunDateTime);
sw.Write("DM_NumLogChans=");
sw.WriteLine(NumLogChannels.ToString());
sw.Write("DM_NumDataModes=");
sw.WriteLine(NumDataModes.ToString());
sw.WriteLine();
}
public SoMatTestHeader(Test test, FilteredData[] filteredData)
{
TestTitle = test.Id;
RunDateTime = string.Format("{0} {1}", test.InceptionDate.ToShortDateString(), test.InceptionDate.ToShortTimeString());
try
{
Operator = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
}
catch (System.Exception) { }
for (var i = 0; i < test.Channels.Count && i < filteredData.Length; i++)
{
var moduleArrayIndex = 0;
for (moduleArrayIndex = 0; moduleArrayIndex < test.Modules.Count; moduleArrayIndex++)
{
if (test.Channels[i].ParentModule.SerialNumber ==
test.Modules[moduleArrayIndex].SerialNumber) { break; }
}
_channels.Add(new SoMatChannel(test.Channels[i], 1 + i, filteredData[i], moduleArrayIndex, 3, test.InceptionDate));
}
}
}
}