/* * Iso.File.Test.cs * * Copyright © 2009 * Diversified Technical Systems, Inc. * All Rights Reserved */ using System; using System.Collections.Generic; using System.Text; using DTS.Common.Utilities; using DTS.Common.Utilities.DotNetProgrammingConstructs; namespace DTS.Serialization.Iso { // *** see Iso.File.cs *** public partial class File { /// /// /// ISO-style representation of a test. /// /// public partial class Test : Exceptional { /// /// Get the data format edition number of the file format generated by this object. /// public string DataFormatEditionNumber { get => _DataFormatEditionNumber.Value; set => _DataFormatEditionNumber.Value = value; } public const string DataFormatEditionNumberLabel = "Data format edition number"; private readonly Property _DataFormatEditionNumber = new Property( typeof(File).Namespace + ".Iso.File.DataFormatEditionNumber", "1.6", true ); /// /// Get/set the laboratory name for this test. /// public string LaboratoryName { get => _LaboratoryName.Value; set => _LaboratoryName.Value = value; } private const string LaboratoryNameLabel = "Laboratory name"; private readonly Property _LaboratoryName = new Property( typeof(File).Namespace + ".Iso.File.LaboratoryName", null, false ); /// /// Get/set the laboratory contact name for this test. /// public string LaboratoryContactName { get => _LaboratoryContactName.Value; set => _LaboratoryContactName.Value = value; } private const string LaboratoryContactNameLabel = "Laboratory contact name"; private readonly Property _LaboratoryContactName = new Property( typeof(File).Namespace + ".Iso.File.LaboratoryContactName", null, false ); /// /// Get/set the laboratory contact phone for this test. /// public string LaboratoryContactPhone { get => _LaboratoryContactPhone.Value; set => _LaboratoryContactPhone.Value = value; } private const string LaboratoryContactPhoneLabel = "Laboratory contact phone"; private readonly Property _LaboratoryContactPhone = new Property( typeof(File).Namespace + ".Iso.File.LaboratoryContactPhone", null, false ); /// /// Get/set the laboratory contact fax for this test. /// public string LaboratoryContactFax { get => _LaboratoryContactFax.Value; set => _LaboratoryContactFax.Value = value; } private const string LaboratoryContactFaxLabel = "Laboratory contact fax"; private readonly Property _LaboratoryContactFax = new Property( typeof(File).Namespace + ".Iso.File.LaboratoryContactFax", null, false ); /// /// Get/set the laboratory contact email for this test. /// public string LaboratoryContactEmail { get => _LaboratoryContactEmail.Value; set => _LaboratoryContactEmail.Value = value; } private const string LaboratoryContactEmailLabel = "Laboratory contact email"; private readonly Property _LaboratoryContactEmail = new Property( typeof(File).Namespace + ".Iso.File.LaboratoryContactEmail", null, false ); /// /// Get/set the laboratory test reference number for this test. /// public string LaboratoryTestReferenceNumber { get => _LaboratoryTestReferenceNumber.Value; set => _LaboratoryTestReferenceNumber.Value = value; } private const string LaboratoryTestReferenceNumberLabel = "Laboratory test ref. number"; private readonly Property _LaboratoryTestReferenceNumber = new Property( typeof(File).Namespace + ".Iso.File.LaboratoryTestReferenceNumber", null, false ); /// /// Get/set the laboratory project reference number for this test. /// public string LaboratoryProjectReferenceNumber { get => _LaboratoryProjectReferenceNumber.Value; set => _LaboratoryProjectReferenceNumber.Value = value; } private const string LaboratoryProjectReferenceNumberLabel = ".Laboratory project ref. num"; //The leading "." means it's additional to the standard private readonly Property _LaboratoryProjectReferenceNumber = new Property( typeof(File).Namespace + ".Iso.File.LaboratoryProjectReferenceNumber", null, false ); /// /// Get/set the customer name for this test. /// public string CustomerName { get => _CustomerName.Value; set => _CustomerName.Value = value; } private const string CustomerNameLabel = "Customer name"; private readonly Property _CustomerName = new Property( typeof(File).Namespace + ".Iso.File.CustomerName", null, false ); /// /// Get/set the customer test reference number for this test. /// public string CustomerTestReferenceNumber { get => _CustomerTestReferenceNumber.Value; set => _CustomerTestReferenceNumber.Value = value; } private const string CustomerTestReferenceNumberLabel = "Customer test ref. number"; private readonly Property _CustomerTestReferenceNumber = new Property( typeof(File).Namespace + ".Iso.File.CustomerTestReferenceNumber", null, false ); /// /// Get/set the customer project reference number for this test. /// public string CustomerProjectReferenceNumber { get => _CustomerProjectReferenceNumber.Value; set => _CustomerProjectReferenceNumber.Value = value; } private const string CustomerProjectReferenceNumberLabel = "Customer project ref. number"; private readonly Property _CustomerProjectReferenceNumber = new Property( typeof(File).Namespace + ".Iso.File.CustomerProjectReferenceNumber", null, false ); /// /// Get/set customer order number for the current test. /// public string CustomerOrderNumber { get => _CustomerOrderNumber.Value; set => _CustomerOrderNumber.Value = value; } private const string CustomerOrderNumberLabel = "Customer order number"; private readonly Property _CustomerOrderNumber = new Property( typeof(File).Namespace + ".Iso.File.CustomerOrderNumber", null, false ); /// /// Get/set customer cost unit for this test. /// public string CustomerCostUnit { get => _CustomerCostUnit.Value; set => _CustomerCostUnit.Value = value; } private const string CustomerCostUnitLabel = "Customer cost unit"; private readonly Property _CustomerCostUnit = new Property( typeof(File).Namespace + ".Iso.File.CustomerCostUnit", null, false ); /// /// Get/set the Test engineer name for this test. /// public string TestEngineerName { get => _TestEngineerName.Value; set => _TestEngineerName.Value = value; } private const string TestEngineerNameLabel = "Customer test engineer name"; private readonly Property _TestEngineerName = new Property( typeof(File).Namespace + ".Iso.File.CustomerTestEngineerName", null, false ); /// /// Get/set the Test engineer phone for this test. /// public string TestEngineerPhone { get => _TestEngineerPhone.Value; set => _TestEngineerPhone.Value = value; } private const string TestEngineerPhoneLabel = "Customer test engineer phone"; private readonly Property _TestEngineerPhone = new Property( typeof(File).Namespace + ".Iso.File.CustomerTestEngineerPhone", null, false ); /// /// Get/set the Test engineer fax for this test. /// public string TestEngineerFax { get => _TestEngineerFax.Value; set => _TestEngineerFax.Value = value; } private const string TestEngineerFaxLabel = "Customer test engineer fax"; private readonly Property _TestEngineerFax = new Property( typeof(File).Namespace + ".Iso.File.CustomerTestEngineerFax", null, false ); /// /// Get/set the Test engineer email for this test. /// public string TestEngineerEmail { get => _TestEngineerEmail.Value; set => _TestEngineerEmail.Value = value; } private const string TestEngineerEmailLabel = "Customer test engineer email"; private readonly Property _TestEngineerEmail = new Property( typeof(File).Namespace + ".Iso.File.CustomerTestEngineerEmail", null, false ); /// /// Get/set the title for this test. /// public string Title { get => _Title.Value; set => _Title.Value = value; } private const string TitleLabel = "Title"; private readonly Property _Title = new Property( typeof(File).Namespace + ".Iso.File.Title", null, false ); /// /// Get/set the number of media representation for this test. /// public string NumberOfMedia { get => _NumberOfMedia.Value; set => _NumberOfMedia.Value = value; } private const string NumberOfMediaLabel = "Medium No./number of media"; private readonly Property _NumberOfMedia = new Property( typeof(File).Namespace + ".Iso.File.NumberOfMedia", "1/1", true ); /// /// Get/set the timestamp for this test. /// public string Timestamp { get => _Timestamp.Value; set => _Timestamp.Value = value; } private const string TimestampLabel = "Timestamp"; private readonly Property _Timestamp = new Property( typeof(File).Namespace + ".Iso.File.Timestamp", // 14967 DateTime stamp not complete in ISO export DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), true ); /// /// Get/set this ISO file test's comment . /// public string TestComment { get => _Comments.Value; set => _Comments.Value = value; } protected const string CommentsLabel = "Comments"; private readonly Property _Comments = new Property( typeof(File).Namespace + ".Iso.File.Comments", null, false ); /// /// Get/set the type for this test. /// public string Type { get => _Type.Value; set => _Type.Value = value; } private const string TypeLabel = "Type of the test"; private readonly Property _Type = new Property( typeof(File).Namespace + ".Iso.File.Type", null, false ); /// /// Get/set the date for this test. /// public DateTime Date { get => _Date.Value; set => _Date.Value = value; } private const string DateLabel = "Date of the test"; private readonly Property _Date = new Property( typeof(File).Namespace + ".Iso.File.Date", DateTime.Now, false ); /// /// Get/set the subtype for this test. /// public string Subtype { get => _Subtype.Value; set => _Subtype.Value = value; } private const string SubtypeLabel = "Subtype of the test"; private readonly Property _Subtype = new Property( typeof(File).Namespace + ".Iso.File.Subtype", null, false ); /// /// Get/set the regulation for this test. /// public string Regulation { get => _Regulation.Value; set => _Regulation.Value = value; } private const string RegulationLabel = "Regulation"; private readonly Property _Regulation = new Property( typeof(File).Namespace + ".Iso.File.Regulation", null, false ); /// /// Get/set the reference temperature value for this test. /// public string ReferenceTemperature { get => _ReferenceTemperature.Value; set => _ReferenceTemperature.Value = value; } private const string ReferenceTemperatureLabel = "Reference temperature"; private readonly Property _ReferenceTemperature = new Property( typeof(File).Namespace + ".Iso.File.ReferenceTemperature", null, false ); // [DefaultValue( "90.0" )] -- all values should have /// /// Get/set the relative air humdity value for this test. /// public string RelativeAirHumidity { get => _RelativeAirHumidity.Value; set => _RelativeAirHumidity.Value = value; } private const string RelativeAirHumidityLabel = "Relative air humidity"; private readonly Property _RelativeAirHumidity = new Property( typeof(File).Namespace + ".Iso.File.RelativeAirHumidity", null, false ); /// /// Get the number of test objects in this test. /// public int NumberOfTestObjects => Objects.Count; private const string NumberOfTestObjectsLabel = "Number of test objects"; /// /// Get/set the s for this test. /// public List Objects { get => _Objects.Value; set => _Objects.Value = value; } private readonly Property> _Objects = new Property>( typeof(File).Namespace + ".Iso.File.Test.Objects", new List(), true ); /// /// Get/set the list of s for this test. /// public List Channels { get => _Channels.Value; set => _Channels.Value = value; } private readonly Property> _Channels = new Property>( typeof(File).Namespace + ".Iso.File.Channels", new List(), true ); /// /// Get/set the list of s for this test. /// public List ExtraProperties { get => _ExtraProperties.Value; set => _ExtraProperties.Value = value; } private readonly Property> _ExtraProperties = new Property>( typeof(File).Namespace + ".Iso.File.ExtraProperties", new List(), true ); /// /// Generate a representation for this instance. /// /// /// /// A representation of this instance. /// /// public override string ToString() { try { var builder = new StringBuilder(); string line = null; builder.Append(DataFormatEditionNumberLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => DataFormatEditionNumber)) + (null != line ? Eol : "")); builder.Append(LaboratoryNameLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => LaboratoryName)) + (null != line ? Eol : "")); builder.Append(LaboratoryContactNameLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => LaboratoryContactName)) + (null != line ? Eol : "")); builder.Append(LaboratoryContactPhoneLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => LaboratoryContactPhone)) + (null != line ? Eol : "")); builder.Append(LaboratoryContactFaxLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => LaboratoryContactFax)) + (null != line ? Eol : "")); builder.Append(LaboratoryContactEmailLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => LaboratoryContactEmail)) + (null != line ? Eol : "")); builder.Append(LaboratoryTestReferenceNumberLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => LaboratoryTestReferenceNumber)) + (null != line ? Eol : "")); builder.Append(LaboratoryProjectReferenceNumberLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => LaboratoryProjectReferenceNumber)) + (null != line ? Eol : "")); builder.Append(CustomerNameLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => CustomerName)) + (null != line ? Eol : "")); builder.Append(CustomerTestReferenceNumberLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => CustomerTestReferenceNumber)) + (null != line ? Eol : "")); builder.Append(CustomerProjectReferenceNumberLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => CustomerProjectReferenceNumber)) + (null != line ? Eol : "")); builder.Append(CustomerOrderNumberLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => CustomerOrderNumber)) + (null != line ? Eol : "")); builder.Append(CustomerCostUnitLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => CustomerCostUnit)) + (null != line ? Eol : "")); builder.Append(TestEngineerNameLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => TestEngineerName)) + (null != line ? Eol : "")); builder.Append(TestEngineerPhoneLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => TestEngineerPhone)) + (null != line ? Eol : "")); builder.Append(TestEngineerFaxLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => TestEngineerFax)) + (null != line ? Eol : "")); builder.Append(TestEngineerEmailLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => TestEngineerEmail)) + (null != line ? Eol : "")); builder.Append(TitleLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => Title)) + (null != line ? Eol : "")); builder.Append(NumberOfMediaLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => NumberOfMedia)) + (null != line ? Eol : "")); builder.Append(TimestampLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => Timestamp)) + (null != line ? Eol : "")); builder.Append(CommentsLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => TestComment)) + (null != line ? Eol : "")); builder.Append(TypeLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => Type)) + (null != line ? Eol : "")); builder.Append(ReferenceTemperatureLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => ReferenceTemperature.ToString())) + (null != line ? Eol : "")); builder.Append(RelativeAirHumidityLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => RelativeAirHumidity.ToString())) + (null != line ? Eol : "")); builder.Append(DateLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => Date.ToString("yyyy-MM-dd"))) + (null != line ? Eol : "")); builder.Append(RegulationLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => Regulation)) + (null != line ? Eol : "")); builder.Append(SubtypeLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => Subtype)) + (null != line ? Eol : "")); foreach (var exp in ExtraProperties) { builder.Append(exp.Key.PadRight(SeparatorOffset) + Separator + (line = exp.Value) + (null != line ? Eol : "")); } builder.Append(NumberOfTestObjectsLabel.PadRight(SeparatorOffset) + Separator + (line = GetFieldString(() => NumberOfTestObjects.ToString())) + (null != line ? Eol : "")); return builder.ToString(); } catch (System.Exception ex) { throw new Exception("encountered problem generating string representation for " + GetType().FullName, ex); } } } } }