diff --git a/PROMS/Formats/frmFormatCopy.cs b/PROMS/Formats/frmFormatCopy.cs index ca6d080a..f8430f2b 100644 --- a/PROMS/Formats/frmFormatCopy.cs +++ b/PROMS/Formats/frmFormatCopy.cs @@ -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(); }