tbf/TBF/BenchControl/Output/FileWriters/Enhanced/WriterCfg.cs

78 lines
2.8 KiB
C#

///
/// Copyright (c) 2016-2017 Sensus Metering Systems
///
using System.Collections.Generic;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Output.FileWriters.Enhanced
{
public class WriterCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(WriterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { 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 string SubtitleFormat;
public Culture Culture;
public Separator Separator;
public bool EliminateSpaces;
public bool SaveGoodOnly;
public string Header;
public string[] CommonItems;
public string[] SelectedItems;
public string Footer;
[XmlIgnore]
public Config.Entities.MetersKind MetersKind;
/// Private parameterless constructor invoked by all other (public) constructors
WriterCfg()
{
SubtitleFormat = "{4} {0}, {5} {1}";
}
public WriterCfg(string name, IComponentFactory factory, Config.Entities.MetersKind metersKind)
: this()
{
Name = name;
Factory = factory;
MetersKind = metersKind;
ParentName = string.Empty;
DestinationPath = Program.HomeDir + "Results\\";
DestinationPath2 = string.Empty;
YearFolders = YearFolders.FourDigit;
MonthFolders = MonthFolders.Digit;
DayFolders = DayFolders.Digit;
FileNameFormat = "{0:yyMMdd-HHmm}.txt";
Separator = Separator.None;
EliminateSpaces = false;
SaveGoodOnly = false;
Header = string.Empty;
Footer = string.Empty;
}
public string ToString(int i)
{
return string.Format("{0}, Path={1}, Y={2}, M={3}, D={4}, FNameFmt={5}, Separator={6}, NoSpaces={7}, GoodOnly={8}",
Name,
DestinationPath,
YearFolders,
MonthFolders,
DayFolders,
FileNameFormat,
Separator,
EliminateSpaces,
SaveGoodOnly);
}
}
}