Otput.FileWriters.Enhanced modified, makes 2 copies, filename can be formatter, header and footer added, ver.2.7.293
This commit is contained in:
@@ -29,6 +29,8 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
}
|
||||
|
||||
string[] selectedItems;
|
||||
string header;
|
||||
string footer;
|
||||
|
||||
public WriterCfgCtrl()
|
||||
{
|
||||
@@ -37,12 +39,19 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
|
||||
private void WriterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < (int)Separator.Count; i++)
|
||||
{
|
||||
separatorComboBox.Items.Add(((Separator)i).ToString());
|
||||
}
|
||||
for (Separator s = 0; s < Separator.Count; s++) separatorComboBox.Items.Add(s.ToString());
|
||||
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 (int i = 0; i < (int)Separator.Count; i++)
|
||||
{
|
||||
separatorComboBox.Items.Add(((Separator)i).ToString());
|
||||
}
|
||||
|
||||
selectedItems = config.SelectedItems;
|
||||
header = config.Header;
|
||||
footer = config.Footer;
|
||||
|
||||
Redraw();
|
||||
}
|
||||
@@ -57,11 +66,13 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
destinationTextBox.Text = config.DestinationPath;
|
||||
yearFoldersCheckBox.Checked = config.YearFolders;
|
||||
monthFoldersCheckBox.Checked = config.MonthFolders;
|
||||
dayFoldersCheckBox.Checked = config.DayFolders;
|
||||
destination2TextBox.Text = config.DestinationPath2;
|
||||
yearFoldersComboBox.Text = config.YearFolders.ToString();
|
||||
monthFoldersComboBox.Text = config.MonthFolders.ToString();
|
||||
dayFoldersComboBox.Text = config.DayFolders.ToString();
|
||||
fileNameFmtTextBox.Text = config.FileNameFormat;
|
||||
separatorComboBox.Text = config.Separator.ToString();
|
||||
eliminateSpacesCheckBox.Checked = config.EliminateSpaces;
|
||||
goodOnlyCheckBox.Checked = config.EliminateSpaces;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -69,18 +80,41 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
nameTextBox.Enabled = true;
|
||||
destinationTextBox.Enabled = true;
|
||||
destinationButton.Enabled = true;
|
||||
yearFoldersCheckBox.Enabled = true;
|
||||
monthFoldersCheckBox.Enabled = true;
|
||||
dayFoldersCheckBox.Enabled = true;
|
||||
destination2TextBox.Enabled = true;
|
||||
destination2Button.Enabled = true;
|
||||
yearFoldersComboBox.Enabled = true;
|
||||
monthFoldersComboBox.Enabled = true;
|
||||
dayFoldersComboBox.Enabled = true;
|
||||
fileNameFmtTextBox.Enabled = true;
|
||||
separatorComboBox.Enabled = true;
|
||||
eliminateSpacesCheckBox.Enabled = true;
|
||||
selectItemsButton.Enabled = true;
|
||||
}
|
||||
goodOnlyCheckBox.Enabled = true;
|
||||
selectItemsButton.Enabled = true;
|
||||
headerButton.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 (!separatorComboBox.Items.Contains(separatorComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
@@ -104,37 +138,64 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
if (yearFoldersCheckBox.Checked != config.YearFolders)
|
||||
{
|
||||
config.YearFolders = yearFoldersCheckBox.Checked;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
if (monthFoldersCheckBox.Checked != config.MonthFolders)
|
||||
{
|
||||
config.MonthFolders = monthFoldersCheckBox.Checked;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
if (dayFoldersCheckBox.Checked != config.DayFolders)
|
||||
{
|
||||
config.DayFolders = dayFoldersCheckBox.Checked;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
if (config.DestinationPath2 != destination2TextBox.Text)
|
||||
{
|
||||
config.DestinationPath2 = destination2TextBox.Text;
|
||||
if (!config.DestinationPath2.EndsWith("\\")) config.DestinationPath2 += "\\";
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)Separator.Count; i++)
|
||||
for (YearFolders i = 0; i < YearFolders.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(yearFoldersComboBox.Text) && (config.YearFolders != i))
|
||||
{
|
||||
config.YearFolders = i;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (MonthFolders i = 0; i < MonthFolders.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(monthFoldersComboBox.Text) && (config.MonthFolders != i))
|
||||
{
|
||||
config.MonthFolders = i;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (DayFolders i = 0; i < DayFolders.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(dayFoldersComboBox.Text) && (config.DayFolders != i))
|
||||
{
|
||||
config.DayFolders = i;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (config.FileNameFormat != fileNameFmtTextBox.Text)
|
||||
{
|
||||
config.FileNameFormat = fileNameFmtTextBox.Text;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
for (Separator i = 0; i < Separator.Count; i++)
|
||||
{
|
||||
if (((Separator)i).ToString().Equals(separatorComboBox.Text) && (config.Separator != (Separator)i))
|
||||
if (i.ToString().Equals(separatorComboBox.Text) && (config.Separator != i))
|
||||
{
|
||||
config.Separator = (Separator)i;
|
||||
config.Separator = i;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (eliminateSpacesCheckBox.Checked != config.EliminateSpaces)
|
||||
{
|
||||
config.EliminateSpaces = eliminateSpacesCheckBox.Checked;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
if (config.EliminateSpaces != goodOnlyCheckBox.Checked)
|
||||
{
|
||||
config.EliminateSpaces = goodOnlyCheckBox.Checked;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
if (config.SelectedItems != selectedItems)
|
||||
{
|
||||
@@ -142,6 +203,18 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
if (config.Header != header)
|
||||
{
|
||||
config.Header = header;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
if (config.Footer != footer)
|
||||
{
|
||||
config.Footer = footer;
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -155,20 +228,31 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
ResultsConfigDlg dlg = new ResultsConfigDlg();
|
||||
dlg.Compound = config.Factory.ClassName.Contains("Compound");
|
||||
dlg.SelectedItems = Results.ItemSpec.FromStrArray(selectedItems);
|
||||
dlg.AvailableItems = new List<Results.ItemSpec>();
|
||||
if (dlg.Compound)
|
||||
{
|
||||
foreach (var v in Results.ItemSpec.AllItems) if (v.CanPrintCombined) dlg.AvailableItems.Add(v);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var v in Results.ItemSpec.AllItems) if (v.CanPrintSingle) dlg.AvailableItems.Add(v);
|
||||
}
|
||||
dlg.AvailableItems = new List<Results.ItemSpec>();
|
||||
foreach (var v in Results.ItemSpec.AllItems) dlg.AvailableItems.Add(v);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
selectedItems = Results.ItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
}
|
||||
}
|
||||
|
||||
private void headerButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
HeaderFooterDlg dlg = new HeaderFooterDlg(header.Replace("~", "\r\n"));
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
header = dlg.EditedText.Replace("\r\n", "~");
|
||||
}
|
||||
}
|
||||
|
||||
private void footerButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
HeaderFooterDlg dlg = new HeaderFooterDlg(footer.Replace("~", "\r\n"));
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
footer = dlg.EditedText.Replace("\r\n", "~");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user