diff --git a/PROMS/fmtxml/Form1.cs b/PROMS/fmtxml/Form1.cs index 5c7ea879..adeb49cd 100644 --- a/PROMS/fmtxml/Form1.cs +++ b/PROMS/fmtxml/Form1.cs @@ -582,55 +582,48 @@ namespace fmtxml private void btnWestinghouse_Click(object sender, EventArgs e) { DateTime tStart = DateTime.Now; - if (File.Exists("wst1all.xml")) - { - FileInfo fi1 = new FileInfo("wst1all.xml"); - fi1.CopyTo(tbResultPath.Text + @"fmtall\wst1all.xml", true); - } - if (File.Exists("wst2all.xml")) - { - FileInfo fi2 = new FileInfo("wst2all.xml"); - fi2.CopyTo(tbResultPath.Text + @"fmtall\wst2all.xml", true); - - } - if (File.Exists("wstcklall.xml")) - { - FileInfo fi2 = new FileInfo("wstcklall.xml"); - fi2.CopyTo(tbResultPath.Text + @"fmtall\wstcklall.xml", true); - - } - if (File.Exists("wstalrall.xml")) - { - FileInfo fi2 = new FileInfo("wstalrall.xml"); - fi2.CopyTo(tbResultPath.Text + @"fmtall\wstalrall.xml", true); - - } - if (File.Exists("wst1.svg")) - { - FileInfo fi1 = new FileInfo("wst1.svg"); - fi1.CopyTo(tbResultPath.Text + @"genmacall\wst1.svg", true); - } - if (File.Exists("wst2.svg")) - { - FileInfo fi2 = new FileInfo("wst2.svg"); - fi2.CopyTo(tbResultPath.Text + @"genmacall\wst2.svg", true); - - } - if (File.Exists("wstckl.svg")) - { - FileInfo fi2 = new FileInfo("wstckl.svg"); - fi2.CopyTo(tbResultPath.Text + @"genmacall\wstckl.svg", true); - - } - if (File.Exists("wstalr.svg")) - { - FileInfo fi2 = new FileInfo("wstalr.svg"); - fi2.CopyTo(tbResultPath.Text + @"genmacall\wstalr.svg", true); - - } + CopyFormat("wst1all.xml"); + CopyFormat("wst2all.xml"); + CopyFormat("wstcklall.xml"); + CopyFormat("wstalrall.xml"); + CopySVG("wst1.svg"); + CopySVG("wst2.svg"); + CopySVG("wstckl.svg"); + CopySVG("wstalr.svg"); MyStatus = string.Format("Copied Westinghouse Format/Genmac {0:F3} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - tStart.Ticks).TotalSeconds); MessageBox.Show("DONE Copy Westinghouse Format/Genmac - Results are in " + tbResultPath.Text + @"fmtall' and 'genmacall'"); } + private void CopyFormat(string fileName) + { + FileInfo fi1 = new FileInfo(Application.StartupPath + "\\" + fileName); + FileInfo fi2 = new FileInfo(@"..\..\" + fileName); + if (fi2.Exists && fi1.Exists && fi2.LastAccessTimeUtc > fi1.LastAccessTimeUtc) + { + fi2.CopyTo(fi1.FullName, true); + } + if (fi1.Exists) + { + FileInfo fio = new FileInfo(tbResultPath.Text + @"fmtall\" + fileName); + if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false; + fi1.CopyTo(fio.FullName, true); + } + } + private void CopySVG(string fileName) + { + FileInfo fi1 = new FileInfo(Application.StartupPath + "\\" + fileName); + FileInfo fi2 = new FileInfo(@"..\..\" + fileName); + if (fi2.Exists && fi1.Exists && fi2.LastAccessTimeUtc > fi1.LastAccessTimeUtc) + { + if (fi1.Exists && fi1.IsReadOnly) fi1.IsReadOnly = false; + fi2.CopyTo(fi1.FullName, true); + } + if (fi1.Exists) + { + FileInfo fio = new FileInfo(tbResultPath.Text + @"genmacall\" + fileName); + if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false; + fi1.CopyTo(fio.FullName, true); + } + } // old code: //private void button5_Click(object sender, System.EventArgs e) //{ diff --git a/PROMS/fmtxml/WSTALRall.xml b/PROMS/fmtxml/WSTALRall.xml index 7aa058bb..816395c6 100644 Binary files a/PROMS/fmtxml/WSTALRall.xml and b/PROMS/fmtxml/WSTALRall.xml differ diff --git a/PROMS/fmtxml/wstalr.svg b/PROMS/fmtxml/wstalr.svg index 082920df..6e8f93b0 100644 Binary files a/PROMS/fmtxml/wstalr.svg and b/PROMS/fmtxml/wstalr.svg differ