Exclude Kewaunee, Point Beach, and un-used Sumer formats from the copy to the format folder

This commit is contained in:
John Jenko 2016-10-31 19:26:33 +00:00
parent 3787b73f6c
commit 5c1baa1ede

View File

@ -86,6 +86,15 @@ namespace Formats
if (!txbxPROMSFormatsPath.Text.EndsWith(@"\")) txbxPROMSFormatsPath.Text += @"\";
}
private bool ExcludeFromCopy(string fn)
{
// don't copy formats whos file name starts with..
string[] excludeThese = { "WPS", "WEP", "WPB", "VCBEPP" };
foreach (string excludeThis in excludeThese)
if (fn.ToUpper().StartsWith(excludeThis)) return true;
return false;
}
private void btnCopyFormats_Click(object sender, EventArgs e)
{
// make sure there is an ending back slash in the destination path
@ -107,22 +116,28 @@ namespace Formats
FileInfo[] fis = di_fmtgen.GetFiles("*.xml");
foreach (FileInfo fi in fis)
{
FileInfo fio = new FileInfo(destFmtallPath + fi.Name);
if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false;
fi.CopyTo(fio.FullName, true);
fio = new FileInfo(destFmtallPath + fi.Name);
if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false;
if (!ExcludeFromCopy(fi.Name))
{
FileInfo fio = new FileInfo(destFmtallPath + fi.Name);
if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false;
fi.CopyTo(fio.FullName, true);
fio = new FileInfo(destFmtallPath + fi.Name);
if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false;
}
}
// copy the genmacall format files
di_fmtgen = di.GetDirectories("genmacall")[0];
fis = di_fmtgen.GetFiles("*.svg");
foreach (FileInfo fi in fis)
{
FileInfo fio = new FileInfo(destGenmacallPath + fi.Name);
if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false;
fi.CopyTo(fio.FullName, true);
fio = new FileInfo(destGenmacallPath + fi.Name);
if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false;
if (!ExcludeFromCopy(fi.Name))
{
FileInfo fio = new FileInfo(destGenmacallPath + fi.Name);
if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false;
fi.CopyTo(fio.FullName, true);
fio = new FileInfo(destGenmacallPath + fi.Name);
if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false;
}
}
if(MessageBox.Show("Do you want to end the Format Copier?","Formats Copied.", MessageBoxButtons.YesNo, MessageBoxIcon.Question)== DialogResult.Yes)Application.Exit();
}