Refactorization : BenchControl -> Rig
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Output.FileWriters.Elde
|
||||
{
|
||||
public class FactorySingle : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(8) + ".Single"; } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public void ResetStaticProperties() { Writer.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new Writer(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Writer(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new WriterCfg("FileWriter.Elde", this, Config.Entities.MetersKind.Single); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
IComponentCfg cfg = ComponentCfgBase.CreateFromDbEntity(WriterCfg.Serializer, component, this);
|
||||
(cfg as WriterCfg).MetersKind = Config.Entities.MetersKind.Single;
|
||||
return cfg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,470 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.Output.FileWriters.Elde
|
||||
{
|
||||
public class Writer : ComponentBase, IOperation, GenericDevices.IResultsWriter
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Writer));
|
||||
public override string ToString() { return string.Format("Output.FileWriters.Enhanced({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly WriterCfg writerCfg;
|
||||
|
||||
string separatorStr;
|
||||
|
||||
/// Items to print
|
||||
string header;
|
||||
IList<Results.WMeterRsltItemSpec> commonItems;
|
||||
IList<Results.WMeterRsltItemSpec> testItems;
|
||||
string footer;
|
||||
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
bool abort;
|
||||
|
||||
|
||||
public Writer() {}
|
||||
|
||||
public Writer(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
writerCfg = cfg as WriterCfg;
|
||||
ApplyConfig();
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
void ApplyConfig()
|
||||
{
|
||||
switch (writerCfg.Separator)
|
||||
{
|
||||
default:
|
||||
case Separator.None: separatorStr = string.Empty; break;
|
||||
case Separator.Space: separatorStr = " "; break;
|
||||
case Separator.Tabulator: separatorStr = "\t"; break;
|
||||
case Separator.Comma: separatorStr = ","; break;
|
||||
case Separator.Semicolon: separatorStr = ";"; break;
|
||||
}
|
||||
|
||||
header = string.IsNullOrEmpty(writerCfg.Header) ? string.Empty : writerCfg.Header.Replace("~", Environment.NewLine);
|
||||
commonItems = Results.WMeterRsltItemSpec.FromStrArray(new string[] {
|
||||
"72~Date / Time~~None~: {0:yyyy/MM/dd} / {0:HH:mm} Page : 1/1~~0~Left",
|
||||
"50~Watermeter Type~~None~: {0}~~0~Left",
|
||||
"64~Device No~~None~: {0}~~0~Left",
|
||||
"66~Personal~~None~: {0}~~0~Left",
|
||||
} );
|
||||
testItems = Results.WMeterRsltItemSpec.FromStrArray(new string[] {
|
||||
"1~Test~~None~~~0~Left",
|
||||
"258~Met. t.~~None~~~0~Left",
|
||||
"257~Fl.~~None~~~0~Left",
|
||||
"25~Dev. [%]~~Pct~~~0~Left",
|
||||
"202~Flow [m3/h]~~m3ph~~F6~0~Left",
|
||||
"14~Test time [s]~~s~~F1~0~Left",
|
||||
"16~T1 [°C]~~C~~F1~0~Left",
|
||||
"17~T2 [°C]~~C~~F1~0~Left",
|
||||
"5~Density [kg/m3]~~kgpm3~~F3~0~Left",
|
||||
"131~Mass [kg]~~kg~~F3~0~Left",
|
||||
"19~Pressure [MPa]~~MPa~~F2~0~Left",
|
||||
"229~Volume [L]~~l~~F4~0~Left",
|
||||
} );
|
||||
|
||||
footer = string.IsNullOrEmpty(writerCfg.Footer) ? string.Empty : writerCfg.Footer.Replace("~", Environment.NewLine);
|
||||
}
|
||||
|
||||
|
||||
#region Configuration Change Handling
|
||||
|
||||
public static void OnCfgChange(object sender, CfgChangeArgs args)
|
||||
{
|
||||
if (CfgChangeHandler == null) return;
|
||||
try { CfgChangeHandler(sender, args); }
|
||||
catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
|
||||
}
|
||||
|
||||
public static event EventHandler<CfgChangeArgs> CfgChangeHandler;
|
||||
|
||||
public override void StartChangeHandler()
|
||||
{
|
||||
CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
|
||||
{
|
||||
WriterCfg newCfg = args.Cfg as WriterCfg;
|
||||
if (newCfg != null && newCfg.Name.Equals(Name))
|
||||
{
|
||||
if (args.Command == CfgChangeCmd.CfgChange)
|
||||
{
|
||||
writerCfg.DestinationPath = newCfg.DestinationPath;
|
||||
writerCfg.DestinationPath2 = newCfg.DestinationPath2;
|
||||
writerCfg.YearFolders = newCfg.YearFolders;
|
||||
writerCfg.MonthFolders = newCfg.MonthFolders;
|
||||
writerCfg.DayFolders = newCfg.DayFolders;
|
||||
writerCfg.FileNameFormat = newCfg.FileNameFormat;
|
||||
writerCfg.Culture = newCfg.Culture;
|
||||
writerCfg.Separator = newCfg.Separator;
|
||||
writerCfg.EliminateSpaces = newCfg.EliminateSpaces;
|
||||
writerCfg.Header = newCfg.Header;
|
||||
writerCfg.CommonItems = newCfg.CommonItems;
|
||||
writerCfg.SelectedItems = newCfg.SelectedItems;
|
||||
writerCfg.Footer = newCfg.Footer;
|
||||
|
||||
ApplyConfig();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endregion Configuration Change Handling
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eliminate spaces conditionally, depesing on bool WriterCfg.EliminateSpaces
|
||||
/// </summary>
|
||||
/// <param name="item">Input string</param>
|
||||
/// <returns>Output string</returns>
|
||||
string ElSpaces(string item)
|
||||
{
|
||||
if (writerCfg.EliminateSpaces)
|
||||
return item.Replace(" ", string.Empty);
|
||||
else
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a file name derived from a DateTime structure.
|
||||
/// Creates directories on this path as a side effect.
|
||||
/// </summary>
|
||||
/// <param name="time">Date and time</param>
|
||||
/// <returns>File name</returns>
|
||||
string GetFilename(string destinationPath, DateTime time)
|
||||
{
|
||||
string directory = destinationPath; /// Ends with "\\";
|
||||
|
||||
switch (writerCfg.YearFolders)
|
||||
{
|
||||
case YearFolders.FourDigit:
|
||||
directory = string.Format("{0}{1:yyyy}\\", directory, time);
|
||||
break;
|
||||
case YearFolders.TwoDigit:
|
||||
directory = string.Format("{0}{1:yy}\\", directory, time);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (writerCfg.MonthFolders)
|
||||
{
|
||||
case MonthFolders.Name:
|
||||
{
|
||||
string monthStr;
|
||||
switch (time.Month)
|
||||
{
|
||||
default:
|
||||
case 1: monthStr = "January"; break;
|
||||
case 2: monthStr = "February"; break;
|
||||
case 3: monthStr = "March"; break;
|
||||
case 4: monthStr = "April"; break;
|
||||
case 5: monthStr = "May"; break;
|
||||
case 6: monthStr = "June"; break;
|
||||
case 7: monthStr = "July"; break;
|
||||
case 8: monthStr = "August"; break;
|
||||
case 9: monthStr = "September"; break;
|
||||
case 10: monthStr = "October"; break;
|
||||
case 11: monthStr = "November"; break;
|
||||
case 12: monthStr = "December"; break;
|
||||
}
|
||||
directory = string.Format("{0}{1}\\", directory, monthStr);
|
||||
break;
|
||||
}
|
||||
case MonthFolders.Digit:
|
||||
directory = string.Format("{0}{1}\\", directory, time.Month.ToString());
|
||||
break;
|
||||
case MonthFolders.TwoDigit:
|
||||
directory = string.Format("{0}{1:MM}\\", directory, time);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (writerCfg.DayFolders)
|
||||
{
|
||||
case DayFolders.Digit:
|
||||
directory = string.Format("{0}{1}\\", directory, time.Day.ToString());
|
||||
break;
|
||||
case DayFolders.TwoDigit:
|
||||
directory = string.Format("{0}{1:dd}\\", directory, time);
|
||||
break;
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(directory);
|
||||
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(writerCfg.FileNameFormat)) throw new Exception();
|
||||
return directory + string.Format(writerCfg.FileNameFormat, time);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Format("{0}{1:yyMMdd-HHmm}.txt", directory, time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Writes the test cycle results into a file
|
||||
/// Events:
|
||||
/// Event.ResultsWritten
|
||||
/// Event.Busy
|
||||
/// </summary>
|
||||
/// <param name="batch">Results to write into a file</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ProcessResultsOp(Results.Entities.Batch batch)
|
||||
{
|
||||
this.batch = batch;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
|
||||
|
||||
if (writerCfg.Culture != Culture.system)
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo(writerCfg.Culture.ToString());
|
||||
}
|
||||
|
||||
abort = false;
|
||||
WriteRslts(batch, writerCfg.DestinationPath);
|
||||
WriteRslts(batch, writerCfg.DestinationPath2);
|
||||
|
||||
Thread.CurrentThread.CurrentCulture = oriCulture;
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsWritten</returns>
|
||||
public Event Run()
|
||||
{
|
||||
return Event.ResultsWritten;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void WriteRslts(Results.Entities.Batch batch, string destination)
|
||||
{
|
||||
if (batch == null || batch.WaterMeters == null || batch.WaterMeters.Count <= 0) return;
|
||||
|
||||
if (!string.IsNullOrEmpty(destination))
|
||||
{
|
||||
StreamWriter writer = StreamWriter.Null;
|
||||
try
|
||||
{
|
||||
writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
||||
WriteRsltsEx(batch, writer);
|
||||
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||
}
|
||||
catch
|
||||
{
|
||||
log.ErrorFormat("Error writing batch {0} by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||
}
|
||||
finally
|
||||
{
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WriteRsltsEx(Results.Entities.Batch batch, StreamWriter wrtr)
|
||||
{
|
||||
string toPrint;
|
||||
|
||||
///
|
||||
/// Get a sample water meter (to save common and test items)
|
||||
///
|
||||
Results.Entities.WaterMeter sampleWM = null;
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
if (wm != null)
|
||||
{
|
||||
sampleWM = wm;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sampleWM == null) return; /// No water meters
|
||||
|
||||
///----------
|
||||
/// Header
|
||||
///----------
|
||||
if (!string.IsNullOrEmpty(writerCfg.Header)) wrtr.Write(header);
|
||||
wrtr.WriteLine();
|
||||
|
||||
///----------------
|
||||
/// Common items
|
||||
///----------------
|
||||
string[] leftColumn = new string[commonItems.Count];
|
||||
string[] rightColumn = new string[commonItems.Count];
|
||||
|
||||
int cnt = 0;
|
||||
foreach (var item in commonItems)
|
||||
{
|
||||
leftColumn[cnt] = item.Caption;
|
||||
rightColumn[cnt] = item.Print(sampleWM);
|
||||
cnt++;
|
||||
}
|
||||
|
||||
/// Determine max. left column width in characters
|
||||
int maxLen = 0;
|
||||
foreach (var s in leftColumn) if (s.Length > maxLen) maxLen = s.Length;
|
||||
|
||||
/// Write aligned columns
|
||||
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
|
||||
{
|
||||
if (abort) return;
|
||||
|
||||
wrtr.Write(leftColumn[i]);
|
||||
|
||||
if (!writerCfg.EliminateSpaces)
|
||||
{
|
||||
wrtr.Write(new string(' ', maxLen - leftColumn[i].Length + 3));
|
||||
}
|
||||
wrtr.Write(separatorStr);
|
||||
|
||||
wrtr.WriteLine(rightColumn[i]);
|
||||
}
|
||||
|
||||
///---------
|
||||
/// Tests
|
||||
///---------
|
||||
wrtr.WriteLine();
|
||||
wrtr.WriteLine("Test Met. Fl. Dev. Flow Test time T1 T2 Density Mass Pressure Volume");
|
||||
wrtr.WriteLine(" t. [%] [m3/h] [s] [°C] [°C] [kg/m3] [kg] [MPa] [L]");
|
||||
wrtr.WriteLine("------------------------------------------------------------------------------------------------------------------");
|
||||
|
||||
int emptyTestsLeft = 5;
|
||||
|
||||
int[] widths = new int[] { 11, 5, 6, 9, 12, 12, 8, 11, 10, 15, 8, 1 }; /// Widths of columns
|
||||
foreach (var testRslt in batch.RegularTestRslts())
|
||||
{
|
||||
if (testRslt.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(testItems.Count, widths.Length); i++)
|
||||
{
|
||||
wrtr.Write(toPrint = testItems[i].Print(sampleWM, testRslt.Name()));
|
||||
for (int j = 0; j < Math.Max(1, widths[i] - toPrint.Length); j++) wrtr.Write(' ');
|
||||
}
|
||||
wrtr.WriteLine();
|
||||
wrtr.WriteLine();
|
||||
if (emptyTestsLeft > 0) emptyTestsLeft--;
|
||||
}
|
||||
}
|
||||
|
||||
///----------------
|
||||
/// Water meters
|
||||
///----------------
|
||||
wrtr.WriteLine();
|
||||
wrtr.WriteLine();
|
||||
wrtr.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||
wrtr.WriteLine("No | Prod. No | Initial Volume [L] | End Volume [L] | Deviation [%] |Sen| Result.");
|
||||
wrtr.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||
wrtr.Write(" ");
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
foreach (var testRslt in batch.RegularTestRslts())
|
||||
{
|
||||
if (testRslt.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
wrtr.Write(toPrint = testRslt.Name());
|
||||
for (int j = 0; j < Math.Max(1, (i<2 ? 8 : 7) - toPrint.Length); j++) wrtr.Write(' ');
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < emptyTestsLeft; k++) wrtr.Write("- ");
|
||||
}
|
||||
wrtr.WriteLine();
|
||||
wrtr.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
if (wm != null)
|
||||
{
|
||||
wrtr.Write(' ');
|
||||
|
||||
wrtr.Write(toPrint = wm.WMPosition.ToString());
|
||||
for (int j = 0; j < Math.Max(1, 3 - toPrint.Length); j++) wrtr.Write(' ');
|
||||
|
||||
wrtr.Write(toPrint = wm.SerialNr);
|
||||
for (int j = 0; j < Math.Max(1, 14 - toPrint.Length); j++) wrtr.Write(' ');
|
||||
|
||||
/// Volume start
|
||||
foreach (var mtr in wm.RegularMeterTestRslts())
|
||||
{
|
||||
if (mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
wrtr.Write(toPrint = mtr.VolumeStart.ToString("F2"));
|
||||
for (int j = 0; j < Math.Max(1, 8 - toPrint.Length); j++) wrtr.Write(' ');
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < emptyTestsLeft; k++) wrtr.Write(" ");
|
||||
|
||||
/// Volume end
|
||||
foreach (var mtr in wm.RegularMeterTestRslts())
|
||||
{
|
||||
if (mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
wrtr.Write(toPrint = mtr.VolumeEnd.ToString("F2"));
|
||||
for (int j = 0; j < Math.Max(1, 8 - toPrint.Length); j++) wrtr.Write(' ');
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < emptyTestsLeft; k++) wrtr.Write(" ");
|
||||
|
||||
/// Error
|
||||
foreach (var mtr in wm.RegularMeterTestRslts())
|
||||
{
|
||||
if (mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
wrtr.Write(toPrint = mtr.Error.ToString("F2"));
|
||||
for (int j = 0; j < Math.Max(1, 7 - toPrint.Length); j++) wrtr.Write(' ');
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < emptyTestsLeft; k++) wrtr.Write(" ");
|
||||
|
||||
wrtr.Write(" ");
|
||||
wrtr.Write(wm.Passed ? "OK" : "Not suitable");
|
||||
wrtr.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
wrtr.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||
wrtr.WriteLine();
|
||||
|
||||
wrtr.Write("Producer: ");
|
||||
wrtr.Write(toPrint = sampleWM.WaterMeterData.Producer);
|
||||
for (int j = 0; j < Math.Max(1, 30 - toPrint.Length); j++) wrtr.Write(' ');
|
||||
wrtr.WriteLine("Explanation :");
|
||||
|
||||
wrtr.WriteLine(" M - Mass Method");
|
||||
wrtr.WriteLine(" V - Volumetric Method");
|
||||
wrtr.WriteLine(" P - Start / Stop");
|
||||
wrtr.WriteLine(" F - Flow start");
|
||||
wrtr.WriteLine(" S - Synchro");
|
||||
wrtr.WriteLine(" C - Count imp.");
|
||||
wrtr.WriteLine();
|
||||
wrtr.WriteLine("-------------------------------------------------------------------------");
|
||||
|
||||
///----------
|
||||
/// Footer
|
||||
///----------
|
||||
if (!string.IsNullOrEmpty(writerCfg.Footer)) wrtr.Write(footer);
|
||||
|
||||
wrtr.Write('\f'); /// Form feed
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Output.FileWriters.Elde
|
||||
{
|
||||
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 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()
|
||||
{
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,373 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.Output.FileWriters.Elde
|
||||
{
|
||||
public partial class WriterCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(WriterCfgCtrl));
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
WriterCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as WriterCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
string header;
|
||||
string[] commonItems;
|
||||
string[] testItems;
|
||||
string footer;
|
||||
|
||||
public WriterCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
Localize();
|
||||
}
|
||||
|
||||
private void WriterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
for (YearFolders s = 0; s < YearFolders.Count; s++) yearFoldersComboBox.Items.Add(s.ToString());
|
||||
for (MonthFolders s = 0; s < MonthFolders.Count; s++) monthFoldersComboBox.Items.Add(s.ToString());
|
||||
for (DayFolders s = 0; s < DayFolders.Count; s++) dayFoldersComboBox.Items.Add(s.ToString());
|
||||
for (Culture s = 0; s < Culture.Count; s++) cultureComboBox.Items.Add(s.ToString());
|
||||
for (Separator s = 0; s < Separator.Count; s++) separatorComboBox.Items.Add(s.ToString());
|
||||
|
||||
header = config.Header;
|
||||
commonItems = config.CommonItems;
|
||||
testItems = config.SelectedItems;
|
||||
footer = config.Footer;
|
||||
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
nameLabel.Text = Strings.Name;
|
||||
destinationLabel.Text = "Destination";
|
||||
destination2Label.Text = "Destination" + " 2";
|
||||
yearFoldersLabel.Text = "Year folders";
|
||||
monthFoldersLabel.Text = "Month folders";
|
||||
dayFoldersLabel.Text = "Day folders";
|
||||
fileNameFmtLabel.Text = "File name format";
|
||||
cultureLabel.Text = "Culture";
|
||||
separatorLabel.Text = "Separator";
|
||||
eliminateSpacesCheckBox.Text = "No spaces";
|
||||
goodOnlyCheckBox.Text = "Good only";
|
||||
headerButton.Text = Strings.Header;
|
||||
commonItemsButton.Text = "Common items";
|
||||
testItemsButton.Text = "Test items";
|
||||
footerButton.Text = Strings.Footer;
|
||||
upgradeWizardButton.Text = "Upgrade wizard";
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
destinationTextBox.Text = config.DestinationPath;
|
||||
destination2TextBox.Text = config.DestinationPath2;
|
||||
yearFoldersComboBox.Text = config.YearFolders.ToString();
|
||||
monthFoldersComboBox.Text = config.MonthFolders.ToString();
|
||||
dayFoldersComboBox.Text = config.DayFolders.ToString();
|
||||
fileNameFmtTextBox.Text = config.FileNameFormat;
|
||||
cultureComboBox.Text = config.Culture.ToString();
|
||||
separatorComboBox.Text = config.Separator.ToString();
|
||||
eliminateSpacesCheckBox.Checked = config.EliminateSpaces;
|
||||
goodOnlyCheckBox.Checked = config.SaveGoodOnly;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
destinationTextBox.Enabled = true;
|
||||
destinationButton.Enabled = true;
|
||||
destination2TextBox.Enabled = true;
|
||||
destination2Button.Enabled = true;
|
||||
yearFoldersComboBox.Enabled = true;
|
||||
monthFoldersComboBox.Enabled = true;
|
||||
dayFoldersComboBox.Enabled = true;
|
||||
fileNameFmtTextBox.Enabled = true;
|
||||
cultureComboBox.Enabled = true;
|
||||
separatorComboBox.Enabled = true;
|
||||
eliminateSpacesCheckBox.Enabled = true;
|
||||
goodOnlyCheckBox.Enabled = true;
|
||||
headerButton.Enabled = true;
|
||||
commonItemsButton.Enabled = true;
|
||||
testItemsButton.Enabled = true;
|
||||
footerButton.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
if (!yearFoldersComboBox.Items.Contains(yearFoldersComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid year folders selection";
|
||||
}
|
||||
|
||||
if (!monthFoldersComboBox.Items.Contains(monthFoldersComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid month folders selection";
|
||||
}
|
||||
|
||||
if (!dayFoldersComboBox.Items.Contains(dayFoldersComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid day folder selection";
|
||||
}
|
||||
|
||||
if (!cultureComboBox.Items.Contains(cultureComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid culture";
|
||||
}
|
||||
|
||||
if (!separatorComboBox.Items.Contains(separatorComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid separator";
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
if (config.Name != nameTextBox.Text)
|
||||
{
|
||||
config.Name = nameTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.DestinationPath != destinationTextBox.Text)
|
||||
{
|
||||
config.DestinationPath = destinationTextBox.Text;
|
||||
if (!config.DestinationPath.EndsWith("\\")) config.DestinationPath += "\\";
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.DestinationPath2 != destination2TextBox.Text)
|
||||
{
|
||||
config.DestinationPath2 = destination2TextBox.Text;
|
||||
if (!config.DestinationPath2.EndsWith("\\")) config.DestinationPath2 += "\\";
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
for (YearFolders i = 0; i < YearFolders.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(yearFoldersComboBox.Text) && (config.YearFolders != i))
|
||||
{
|
||||
config.YearFolders = i;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (MonthFolders i = 0; i < MonthFolders.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(monthFoldersComboBox.Text) && (config.MonthFolders != i))
|
||||
{
|
||||
config.MonthFolders = i;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (DayFolders i = 0; i < DayFolders.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(dayFoldersComboBox.Text) && (config.DayFolders != i))
|
||||
{
|
||||
config.DayFolders = i;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (config.FileNameFormat != fileNameFmtTextBox.Text)
|
||||
{
|
||||
config.FileNameFormat = fileNameFmtTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
for (Culture i = 0; i < Culture.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(cultureComboBox.Text) && (config.Culture != i))
|
||||
{
|
||||
config.Culture = i;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (Separator i = 0; i < Separator.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(separatorComboBox.Text) && (config.Separator != i))
|
||||
{
|
||||
config.Separator = i;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (config.EliminateSpaces != eliminateSpacesCheckBox.Checked)
|
||||
{
|
||||
config.EliminateSpaces = eliminateSpacesCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.SaveGoodOnly != goodOnlyCheckBox.Checked)
|
||||
{
|
||||
config.SaveGoodOnly = goodOnlyCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.Header != header)
|
||||
{
|
||||
config.Header = header;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.CommonItems != commonItems)
|
||||
{
|
||||
config.CommonItems = commonItems;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.SelectedItems != testItems)
|
||||
{
|
||||
config.SelectedItems = testItems;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.Footer != footer)
|
||||
{
|
||||
config.Footer = footer;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
|
||||
{
|
||||
Writer.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
private void destinationButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void headerButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
HeaderFooterDlg dlg = new HeaderFooterDlg(true, string.IsNullOrEmpty(header) ? string.Empty : header.Replace("~", Environment.NewLine));
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
header = dlg.EditedText.Replace(Environment.NewLine, "~");
|
||||
}
|
||||
}
|
||||
|
||||
private void commonItemsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
|
||||
{
|
||||
MetersKind = config.MetersKind,
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems),
|
||||
};
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
commonItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
}
|
||||
}
|
||||
|
||||
private void testItemsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg(true)
|
||||
{
|
||||
MetersKind = config.MetersKind,
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(testItems),
|
||||
};
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
testItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
}
|
||||
}
|
||||
|
||||
private void footerButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
HeaderFooterDlg dlg = new HeaderFooterDlg(false, string.IsNullOrEmpty(footer) ? string.Empty : footer.Replace("~", Environment.NewLine));
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
footer = dlg.EditedText.Replace(Environment.NewLine, "~");
|
||||
}
|
||||
}
|
||||
|
||||
private void upgradeWizardButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("This wizzard will overwrite curent settings." + Environment.NewLine +
|
||||
"Do you want to continue?",
|
||||
"Confirmation",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
///
|
||||
/// Use legacy common items (English)
|
||||
///
|
||||
commonItems = new string[] {
|
||||
"3~Batch number:~~None~~~0~",
|
||||
"72~Date and time:~~None~{0:yyyy.MM.dd HH:mm}~~0~",
|
||||
"2~Procedure:~~None~~~0~",
|
||||
"66~User:~~None~~~0~",
|
||||
"26~Ambient temperature:~~C~{0} °C~F1~0~",
|
||||
"27~Ambient pressure:~~mbar~{0} mbar~F0~0~",
|
||||
"28~Ambient humidity:~~Pct~{0} %~F0~0~",
|
||||
};
|
||||
commonItemsButton_Click(this, null);
|
||||
|
||||
testItemsButton_Click(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
#region Configuration Change Handling
|
||||
|
||||
public static void OnCmdResponse(object sender, CmdResponseArgs args)
|
||||
{
|
||||
if (CmdResponseHandler == null) return;
|
||||
try { CmdResponseHandler(sender, args); }
|
||||
catch (Exception e) { log.Error("CmdResponseHandler(...) failed", e); }
|
||||
}
|
||||
|
||||
public static event EventHandler<CmdResponseArgs> CmdResponseHandler;
|
||||
|
||||
public void StartResponseHandler() { }
|
||||
public void StopResponseHandler() { }
|
||||
|
||||
#endregion Configuration Change Handling
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,397 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig.Output.FileWriters.Elde
|
||||
{
|
||||
partial class WriterCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.destinationTextBox = new System.Windows.Forms.TextBox();
|
||||
this.destinationLabel = new System.Windows.Forms.Label();
|
||||
this.destinationButton = new System.Windows.Forms.Button();
|
||||
this.separatorLabel = new System.Windows.Forms.Label();
|
||||
this.separatorComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.testItemsButton = new System.Windows.Forms.Button();
|
||||
this.yearFoldersLabel = new System.Windows.Forms.Label();
|
||||
this.monthFoldersLabel = new System.Windows.Forms.Label();
|
||||
this.dayFoldersLabel = new System.Windows.Forms.Label();
|
||||
this.yearFoldersComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.monthFoldersComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.dayFoldersComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.destination2Button = new System.Windows.Forms.Button();
|
||||
this.destination2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.destination2Label = new System.Windows.Forms.Label();
|
||||
this.fileNameFmtTextBox = new System.Windows.Forms.TextBox();
|
||||
this.fileNameFmtLabel = new System.Windows.Forms.Label();
|
||||
this.eliminateSpacesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.headerButton = new System.Windows.Forms.Button();
|
||||
this.footerButton = new System.Windows.Forms.Button();
|
||||
this.commonItemsButton = new System.Windows.Forms.Button();
|
||||
this.upgradeWizardButton = new System.Windows.Forms.Button();
|
||||
this.cultureComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.cultureLabel = new System.Windows.Forms.Label();
|
||||
this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(108, 28);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(17, 31);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(105, 6);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// destinationTextBox
|
||||
//
|
||||
this.destinationTextBox.Enabled = false;
|
||||
this.destinationTextBox.Location = new System.Drawing.Point(108, 49);
|
||||
this.destinationTextBox.Name = "destinationTextBox";
|
||||
this.destinationTextBox.Size = new System.Drawing.Size(146, 20);
|
||||
this.destinationTextBox.TabIndex = 4;
|
||||
//
|
||||
// destinationLabel
|
||||
//
|
||||
this.destinationLabel.AutoSize = true;
|
||||
this.destinationLabel.Location = new System.Drawing.Point(17, 52);
|
||||
this.destinationLabel.Name = "destinationLabel";
|
||||
this.destinationLabel.Size = new System.Drawing.Size(60, 13);
|
||||
this.destinationLabel.TabIndex = 3;
|
||||
this.destinationLabel.Text = "Destination";
|
||||
//
|
||||
// destinationButton
|
||||
//
|
||||
this.destinationButton.Enabled = false;
|
||||
this.destinationButton.Location = new System.Drawing.Point(269, 49);
|
||||
this.destinationButton.Name = "destinationButton";
|
||||
this.destinationButton.Size = new System.Drawing.Size(30, 20);
|
||||
this.destinationButton.TabIndex = 5;
|
||||
this.destinationButton.Text = "...";
|
||||
this.destinationButton.UseVisualStyleBackColor = true;
|
||||
this.destinationButton.Click += new System.EventHandler(this.destinationButton_Click);
|
||||
//
|
||||
// separatorLabel
|
||||
//
|
||||
this.separatorLabel.AutoSize = true;
|
||||
this.separatorLabel.Location = new System.Drawing.Point(17, 203);
|
||||
this.separatorLabel.Name = "separatorLabel";
|
||||
this.separatorLabel.Size = new System.Drawing.Size(53, 13);
|
||||
this.separatorLabel.TabIndex = 19;
|
||||
this.separatorLabel.Text = "Separator";
|
||||
//
|
||||
// separatorComboBox
|
||||
//
|
||||
this.separatorComboBox.Enabled = false;
|
||||
this.separatorComboBox.FormattingEnabled = true;
|
||||
this.separatorComboBox.Location = new System.Drawing.Point(108, 200);
|
||||
this.separatorComboBox.Name = "separatorComboBox";
|
||||
this.separatorComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.separatorComboBox.TabIndex = 20;
|
||||
//
|
||||
// testItemsButton
|
||||
//
|
||||
this.testItemsButton.Enabled = false;
|
||||
this.testItemsButton.Location = new System.Drawing.Point(108, 275);
|
||||
this.testItemsButton.Name = "testItemsButton";
|
||||
this.testItemsButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.testItemsButton.TabIndex = 25;
|
||||
this.testItemsButton.Text = "Test items";
|
||||
this.testItemsButton.UseVisualStyleBackColor = true;
|
||||
this.testItemsButton.Click += new System.EventHandler(this.testItemsButton_Click);
|
||||
//
|
||||
// yearFoldersLabel
|
||||
//
|
||||
this.yearFoldersLabel.AutoSize = true;
|
||||
this.yearFoldersLabel.Location = new System.Drawing.Point(17, 94);
|
||||
this.yearFoldersLabel.Name = "yearFoldersLabel";
|
||||
this.yearFoldersLabel.Size = new System.Drawing.Size(63, 13);
|
||||
this.yearFoldersLabel.TabIndex = 9;
|
||||
this.yearFoldersLabel.Text = "Year folders";
|
||||
//
|
||||
// monthFoldersLabel
|
||||
//
|
||||
this.monthFoldersLabel.AutoSize = true;
|
||||
this.monthFoldersLabel.Location = new System.Drawing.Point(17, 116);
|
||||
this.monthFoldersLabel.Name = "monthFoldersLabel";
|
||||
this.monthFoldersLabel.Size = new System.Drawing.Size(71, 13);
|
||||
this.monthFoldersLabel.TabIndex = 11;
|
||||
this.monthFoldersLabel.Text = "Month folders";
|
||||
//
|
||||
// dayFoldersLabel
|
||||
//
|
||||
this.dayFoldersLabel.AutoSize = true;
|
||||
this.dayFoldersLabel.Location = new System.Drawing.Point(17, 138);
|
||||
this.dayFoldersLabel.Name = "dayFoldersLabel";
|
||||
this.dayFoldersLabel.Size = new System.Drawing.Size(60, 13);
|
||||
this.dayFoldersLabel.TabIndex = 13;
|
||||
this.dayFoldersLabel.Text = "Day folders";
|
||||
//
|
||||
// yearFoldersComboBox
|
||||
//
|
||||
this.yearFoldersComboBox.Enabled = false;
|
||||
this.yearFoldersComboBox.FormattingEnabled = true;
|
||||
this.yearFoldersComboBox.Location = new System.Drawing.Point(108, 91);
|
||||
this.yearFoldersComboBox.Name = "yearFoldersComboBox";
|
||||
this.yearFoldersComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.yearFoldersComboBox.TabIndex = 10;
|
||||
//
|
||||
// monthFoldersComboBox
|
||||
//
|
||||
this.monthFoldersComboBox.Enabled = false;
|
||||
this.monthFoldersComboBox.FormattingEnabled = true;
|
||||
this.monthFoldersComboBox.Location = new System.Drawing.Point(108, 113);
|
||||
this.monthFoldersComboBox.Name = "monthFoldersComboBox";
|
||||
this.monthFoldersComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.monthFoldersComboBox.TabIndex = 12;
|
||||
//
|
||||
// dayFoldersComboBox
|
||||
//
|
||||
this.dayFoldersComboBox.Enabled = false;
|
||||
this.dayFoldersComboBox.FormattingEnabled = true;
|
||||
this.dayFoldersComboBox.Location = new System.Drawing.Point(108, 135);
|
||||
this.dayFoldersComboBox.Name = "dayFoldersComboBox";
|
||||
this.dayFoldersComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.dayFoldersComboBox.TabIndex = 14;
|
||||
//
|
||||
// destination2Button
|
||||
//
|
||||
this.destination2Button.Enabled = false;
|
||||
this.destination2Button.Location = new System.Drawing.Point(269, 70);
|
||||
this.destination2Button.Name = "destination2Button";
|
||||
this.destination2Button.Size = new System.Drawing.Size(30, 20);
|
||||
this.destination2Button.TabIndex = 8;
|
||||
this.destination2Button.Text = "...";
|
||||
this.destination2Button.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// destination2TextBox
|
||||
//
|
||||
this.destination2TextBox.Enabled = false;
|
||||
this.destination2TextBox.Location = new System.Drawing.Point(108, 70);
|
||||
this.destination2TextBox.Name = "destination2TextBox";
|
||||
this.destination2TextBox.Size = new System.Drawing.Size(146, 20);
|
||||
this.destination2TextBox.TabIndex = 7;
|
||||
//
|
||||
// destination2Label
|
||||
//
|
||||
this.destination2Label.AutoSize = true;
|
||||
this.destination2Label.Location = new System.Drawing.Point(17, 73);
|
||||
this.destination2Label.Name = "destination2Label";
|
||||
this.destination2Label.Size = new System.Drawing.Size(69, 13);
|
||||
this.destination2Label.TabIndex = 6;
|
||||
this.destination2Label.Text = "Destination 2";
|
||||
//
|
||||
// fileNameFmtTextBox
|
||||
//
|
||||
this.fileNameFmtTextBox.Enabled = false;
|
||||
this.fileNameFmtTextBox.Location = new System.Drawing.Point(108, 157);
|
||||
this.fileNameFmtTextBox.Name = "fileNameFmtTextBox";
|
||||
this.fileNameFmtTextBox.Size = new System.Drawing.Size(146, 20);
|
||||
this.fileNameFmtTextBox.TabIndex = 16;
|
||||
//
|
||||
// fileNameFmtLabel
|
||||
//
|
||||
this.fileNameFmtLabel.AutoSize = true;
|
||||
this.fileNameFmtLabel.Location = new System.Drawing.Point(17, 160);
|
||||
this.fileNameFmtLabel.Name = "fileNameFmtLabel";
|
||||
this.fileNameFmtLabel.Size = new System.Drawing.Size(84, 13);
|
||||
this.fileNameFmtLabel.TabIndex = 15;
|
||||
this.fileNameFmtLabel.Text = "File name format";
|
||||
//
|
||||
// eliminateSpacesCheckBox
|
||||
//
|
||||
this.eliminateSpacesCheckBox.AutoSize = true;
|
||||
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(20, 241);
|
||||
this.eliminateSpacesCheckBox.Name = "eliminateSpacesCheckBox";
|
||||
this.eliminateSpacesCheckBox.Size = new System.Drawing.Size(77, 17);
|
||||
this.eliminateSpacesCheckBox.TabIndex = 21;
|
||||
this.eliminateSpacesCheckBox.Text = "No spaces";
|
||||
this.eliminateSpacesCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// headerButton
|
||||
//
|
||||
this.headerButton.Enabled = false;
|
||||
this.headerButton.Location = new System.Drawing.Point(108, 225);
|
||||
this.headerButton.Name = "headerButton";
|
||||
this.headerButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.headerButton.TabIndex = 23;
|
||||
this.headerButton.Text = "Header";
|
||||
this.headerButton.UseVisualStyleBackColor = true;
|
||||
this.headerButton.Click += new System.EventHandler(this.headerButton_Click);
|
||||
//
|
||||
// footerButton
|
||||
//
|
||||
this.footerButton.Enabled = false;
|
||||
this.footerButton.Location = new System.Drawing.Point(108, 300);
|
||||
this.footerButton.Name = "footerButton";
|
||||
this.footerButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.footerButton.TabIndex = 26;
|
||||
this.footerButton.Text = "Footer";
|
||||
this.footerButton.UseVisualStyleBackColor = true;
|
||||
this.footerButton.Click += new System.EventHandler(this.footerButton_Click);
|
||||
//
|
||||
// commonItemsButton
|
||||
//
|
||||
this.commonItemsButton.Enabled = false;
|
||||
this.commonItemsButton.Location = new System.Drawing.Point(108, 250);
|
||||
this.commonItemsButton.Name = "commonItemsButton";
|
||||
this.commonItemsButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.commonItemsButton.TabIndex = 24;
|
||||
this.commonItemsButton.Text = "Common items";
|
||||
this.commonItemsButton.UseVisualStyleBackColor = true;
|
||||
this.commonItemsButton.Click += new System.EventHandler(this.commonItemsButton_Click);
|
||||
//
|
||||
// upgradeWizardButton
|
||||
//
|
||||
this.upgradeWizardButton.Location = new System.Drawing.Point(269, 250);
|
||||
this.upgradeWizardButton.Name = "upgradeWizardButton";
|
||||
this.upgradeWizardButton.Size = new System.Drawing.Size(80, 48);
|
||||
this.upgradeWizardButton.TabIndex = 27;
|
||||
this.upgradeWizardButton.Text = "Upgrade wizard";
|
||||
this.upgradeWizardButton.UseVisualStyleBackColor = true;
|
||||
this.upgradeWizardButton.Click += new System.EventHandler(this.upgradeWizardButton_Click);
|
||||
//
|
||||
// cultureComboBox
|
||||
//
|
||||
this.cultureComboBox.Enabled = false;
|
||||
this.cultureComboBox.FormattingEnabled = true;
|
||||
this.cultureComboBox.Location = new System.Drawing.Point(108, 178);
|
||||
this.cultureComboBox.Name = "cultureComboBox";
|
||||
this.cultureComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.cultureComboBox.TabIndex = 18;
|
||||
//
|
||||
// cultureLabel
|
||||
//
|
||||
this.cultureLabel.AutoSize = true;
|
||||
this.cultureLabel.Location = new System.Drawing.Point(17, 181);
|
||||
this.cultureLabel.Name = "cultureLabel";
|
||||
this.cultureLabel.Size = new System.Drawing.Size(42, 13);
|
||||
this.cultureLabel.TabIndex = 17;
|
||||
this.cultureLabel.Text = "Cullture";
|
||||
//
|
||||
// goodOnlyCheckBox
|
||||
//
|
||||
this.goodOnlyCheckBox.AutoSize = true;
|
||||
this.goodOnlyCheckBox.Location = new System.Drawing.Point(20, 264);
|
||||
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
|
||||
this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
|
||||
this.goodOnlyCheckBox.TabIndex = 22;
|
||||
this.goodOnlyCheckBox.Text = "Good only";
|
||||
this.goodOnlyCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// WriterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.goodOnlyCheckBox);
|
||||
this.Controls.Add(this.cultureComboBox);
|
||||
this.Controls.Add(this.cultureLabel);
|
||||
this.Controls.Add(this.upgradeWizardButton);
|
||||
this.Controls.Add(this.commonItemsButton);
|
||||
this.Controls.Add(this.footerButton);
|
||||
this.Controls.Add(this.headerButton);
|
||||
this.Controls.Add(this.eliminateSpacesCheckBox);
|
||||
this.Controls.Add(this.fileNameFmtTextBox);
|
||||
this.Controls.Add(this.fileNameFmtLabel);
|
||||
this.Controls.Add(this.destination2Button);
|
||||
this.Controls.Add(this.destination2TextBox);
|
||||
this.Controls.Add(this.destination2Label);
|
||||
this.Controls.Add(this.dayFoldersComboBox);
|
||||
this.Controls.Add(this.monthFoldersComboBox);
|
||||
this.Controls.Add(this.yearFoldersComboBox);
|
||||
this.Controls.Add(this.dayFoldersLabel);
|
||||
this.Controls.Add(this.monthFoldersLabel);
|
||||
this.Controls.Add(this.yearFoldersLabel);
|
||||
this.Controls.Add(this.testItemsButton);
|
||||
this.Controls.Add(this.separatorComboBox);
|
||||
this.Controls.Add(this.separatorLabel);
|
||||
this.Controls.Add(this.destinationButton);
|
||||
this.Controls.Add(this.destinationTextBox);
|
||||
this.Controls.Add(this.destinationLabel);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "WriterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(400, 350);
|
||||
this.Load += new System.EventHandler(this.WriterCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.TextBox destinationTextBox;
|
||||
private System.Windows.Forms.Label destinationLabel;
|
||||
private System.Windows.Forms.Button destinationButton;
|
||||
private System.Windows.Forms.Label separatorLabel;
|
||||
private System.Windows.Forms.ComboBox separatorComboBox;
|
||||
private System.Windows.Forms.Button testItemsButton;
|
||||
private System.Windows.Forms.Label yearFoldersLabel;
|
||||
private System.Windows.Forms.Label monthFoldersLabel;
|
||||
private System.Windows.Forms.Label dayFoldersLabel;
|
||||
private System.Windows.Forms.ComboBox yearFoldersComboBox;
|
||||
private System.Windows.Forms.ComboBox monthFoldersComboBox;
|
||||
private System.Windows.Forms.ComboBox dayFoldersComboBox;
|
||||
private System.Windows.Forms.Button destination2Button;
|
||||
private System.Windows.Forms.TextBox destination2TextBox;
|
||||
private System.Windows.Forms.Label destination2Label;
|
||||
private System.Windows.Forms.TextBox fileNameFmtTextBox;
|
||||
private System.Windows.Forms.Label fileNameFmtLabel;
|
||||
private System.Windows.Forms.CheckBox eliminateSpacesCheckBox;
|
||||
private System.Windows.Forms.Button headerButton;
|
||||
private System.Windows.Forms.Button footerButton;
|
||||
private System.Windows.Forms.Button commonItemsButton;
|
||||
private System.Windows.Forms.Button upgradeWizardButton;
|
||||
private System.Windows.Forms.ComboBox cultureComboBox;
|
||||
private System.Windows.Forms.Label cultureLabel;
|
||||
private System.Windows.Forms.CheckBox goodOnlyCheckBox;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user