Output.FileWriters.Enhanced with formatted WM subtitles
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -125,9 +125,10 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
|
||||
/// </summary>
|
||||
/// <param name="time">Date and time</param>
|
||||
/// <returns>File name</returns>
|
||||
string GetFilename(string destinationPath, DateTime time)
|
||||
string GetFilename(string destinationPath, Results.Entities.Batch batch)
|
||||
{
|
||||
string directory = destinationPath; /// Ends with "\\";
|
||||
DateTime time = batch.EndTime;
|
||||
|
||||
switch (writerCfg.YearFolders)
|
||||
{
|
||||
@@ -185,8 +186,15 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
|
||||
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(writerCfg.FileNameFormat)) throw new Exception();
|
||||
return directory + string.Format(writerCfg.FileNameFormat, time);
|
||||
if (string.IsNullOrEmpty(writerCfg.FileNameFormat))
|
||||
{
|
||||
return string.Format("{0}{1:yyMMdd-HHmm}.txt", directory, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
TBF.Rig.GenericDevices.IBenchInfo bi = TBF.Rig.Sequences.ProcessData.BenchInfo;
|
||||
return directory + string.Format(writerCfg.FileNameFormat, batch.EndTime, batch.StartTime, batch.BatchNr, bi.TestBenchName, bi.TestBenchId);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -248,7 +256,7 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
|
||||
StreamWriter writer = StreamWriter.Null;
|
||||
try
|
||||
{
|
||||
writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
||||
writer = File.AppendText(GetFilename(destination, batch));
|
||||
WriteRsltsEx(batch, writer);
|
||||
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user