77 lines
2.5 KiB
C#
77 lines
2.5 KiB
C#
///
|
|
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Xml.Serialization;
|
|
using TBF.BenchControl.Generic;
|
|
|
|
namespace TBF.BenchControl.Output.FileWriters.XmlBatch
|
|
{
|
|
|
|
public class WriterCfg : ComponentCfgBase, Generic.IComponentCfg
|
|
{
|
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(WriterCfg) })[0];
|
|
protected override XmlSerializer GetSerializer() { return Serializer; }
|
|
|
|
public IComponentCfgCtrl GetControl() { return new WriterCfgCtrl(); }
|
|
|
|
public string DestinationPath; /// Directory path into which the results will be saved
|
|
public string DestinationPath2; /// Directory path into which the 2nd copy of results will be saved
|
|
public YearFolders YearFolders;
|
|
public MonthFolders MonthFolders;
|
|
public DayFolders DayFolders;
|
|
public string FileNameFormat;
|
|
public Culture Culture;
|
|
public string Header;
|
|
public string RootTag;
|
|
public string MeterTag;
|
|
public string TestTag;
|
|
public string[] CommonItems;
|
|
public string[] MeterItems;
|
|
public string[] TestItems;
|
|
|
|
[XmlIgnore]
|
|
public Config.Entities.MetersKind MetersKind;
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
WriterCfg()
|
|
{
|
|
}
|
|
|
|
public WriterCfg(string name, IComponentFactory factory, Config.Entities.MetersKind metersKind)
|
|
: this()
|
|
{
|
|
Name = name;
|
|
Factory = factory;
|
|
MetersKind = metersKind;
|
|
|
|
ParentName = string.Empty;
|
|
DestinationPath = Path.Combine(Program.HomeDir, "Results", "Xml");
|
|
DestinationPath2 = string.Empty;
|
|
YearFolders = YearFolders.FourDigit;
|
|
MonthFolders = MonthFolders.Digit;
|
|
DayFolders = DayFolders.Digit;
|
|
FileNameFormat = "{0:yyMMdd-HHmm}.xml";
|
|
Culture = Culture.EN;
|
|
Header = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
|
|
RootTag = "Batch";
|
|
MeterTag = "Meter";
|
|
TestTag = "Test";
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("Name={0}, Path={1}, Y={2}, M={3}, D={4}, FNameFmt={5}, Culture={6}",
|
|
Name,
|
|
DestinationPath,
|
|
YearFolders,
|
|
MonthFolders,
|
|
DayFolders,
|
|
FileNameFormat,
|
|
Culture);
|
|
}
|
|
}
|
|
}
|