init
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* TSV.File.Writer.cs
|
||||
*
|
||||
* Copyright © 2009
|
||||
* Diversified Technical Systems, Inc.
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DTS.Common.Utilities.DotNetProgrammingConstructs;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
|
||||
namespace DTS.Serialization.TSV
|
||||
{
|
||||
// *** see TSV.File.Writer.cs ***
|
||||
public partial class File
|
||||
{ ///
|
||||
/// <summary>
|
||||
/// Utility object for serializing <see cref="Test"/>s to disk
|
||||
/// in the TSV format
|
||||
/// </summary>
|
||||
///
|
||||
public class Writer : Writer<File>, IWriter<Test>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialize an instance of the TSV.File.Writer class.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="fileType">
|
||||
/// The associated <see cref="DTS.SErialization.TSV.File"/> object.
|
||||
/// </param>
|
||||
///
|
||||
internal Writer(File fileType, int encoding)
|
||||
: base(fileType, encoding)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The different export modes that should theoretically be supported by this format.
|
||||
/// </summary>
|
||||
public enum ExportMode
|
||||
{
|
||||
FtssExcel,
|
||||
Ttc,
|
||||
Standard,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set the current TSV export format.
|
||||
/// </summary>
|
||||
public ExportMode CurrentExportMode
|
||||
{
|
||||
get => _CurrentExportMode.Value;
|
||||
set => _CurrentExportMode.Value = value;
|
||||
}
|
||||
private readonly Property<ExportMode> _CurrentExportMode
|
||||
= new Property<ExportMode>(
|
||||
typeof(Writer).Namespace + ".File.Writer.CurrentExportMode",
|
||||
ExportMode.FtssExcel,
|
||||
true
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Get/set the filtered channel data. If this list is supplied, the corresponding test
|
||||
/// channel data values will be supplied from this list.
|
||||
/// </summary>
|
||||
public List<FilteredData> FilteredChannelData
|
||||
{
|
||||
get => _FilteredChannelData.Value;
|
||||
set => _FilteredChannelData.Value = value;
|
||||
}
|
||||
private readonly Property<List<FilteredData>> _FilteredChannelData
|
||||
= new Property<List<FilteredData>>(
|
||||
"FilteredChannelData",
|
||||
new List<FilteredData>(),
|
||||
true
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Write the specified test to the specified pathname.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pathname">
|
||||
/// The <see cref="string"/> pathname to which the specified test should be serialized.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="test">
|
||||
/// The <see cref="Test"/> to be written out.
|
||||
/// </param>
|
||||
///
|
||||
public void Write(string pathname, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)
|
||||
{
|
||||
throw new NotSupportedException("TSV::File::Writer Write(pathname, id, test, bFiltering) not supported");
|
||||
}
|
||||
|
||||
public TSVTest MyTSVTest { get; set; }
|
||||
/// <summary>
|
||||
/// Write the representation file/files of the specified DTS.Serialization.Test
|
||||
/// at the given pathname.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="targetPathname">
|
||||
/// The <see cref="string"/> pathname of the specified object's resulting file
|
||||
/// representation.
|
||||
/// </param>
|
||||
///
|
||||
public void Write(string pathname,
|
||||
string id,
|
||||
string dataFolder,
|
||||
Test test,
|
||||
bool bFiltering,
|
||||
bool includeGroupNameInISOExport,
|
||||
FilteredData fd,
|
||||
Test.Module.Channel tmChannel,
|
||||
int channelNumber,
|
||||
BeginEventHandler beginEventHandler,
|
||||
CancelEventHandler cancelEventHandler,
|
||||
EndEventHandler endEventHandler,
|
||||
TickEventHandler tickEventHandler,
|
||||
ErrorEventHandler errorEventHandler,
|
||||
CancelRequested cancelRequested,
|
||||
double minStartTime,
|
||||
int dataCollectionLength)
|
||||
{
|
||||
System.Exception exception = null;
|
||||
try
|
||||
{
|
||||
beginEventHandler?.Invoke(this, Convert.ToUInt32(100)); foreach (var channel in MyTSVTest.Channels) { channel.Serialize(tickEventHandler); }
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
APILogger.Log("encountered problem writing TSV test files", ex);
|
||||
}
|
||||
tickEventHandler?.Invoke(this, 100D);
|
||||
if (null != errorEventHandler && null != exception)
|
||||
{
|
||||
endEventHandler(this);
|
||||
errorEventHandler(this, exception);
|
||||
}
|
||||
else if (null != exception) { throw exception; }
|
||||
else
|
||||
{
|
||||
tickEventHandler?.Invoke(this, 100.0);
|
||||
endEventHandler?.Invoke(this);
|
||||
}
|
||||
}
|
||||
public void Initialize(string pathname,
|
||||
string id,
|
||||
string dataFolder,
|
||||
Test test,
|
||||
bool bFiltering,
|
||||
bool includeGroupNameInISOExport,
|
||||
FilteredData fd,
|
||||
Test.Module.Channel tmChannel,
|
||||
int channelNumber,
|
||||
BeginEventHandler beginEventHandler,
|
||||
CancelEventHandler cancelEventHandler,
|
||||
EndEventHandler endEventHandler,
|
||||
TickEventHandler tickEventHandler,
|
||||
ErrorEventHandler errorEventHandler,
|
||||
CancelRequested cancelRequested)
|
||||
{
|
||||
}
|
||||
public double Start { get; set; } = 0D;
|
||||
public double Stop { get; set; } = 0D;
|
||||
public ushort SubSampleInterval { get; set; }
|
||||
public bool Filtered { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user