Added code to support automatic updating of formats at start-up via command line parameter

This commit is contained in:
Rich 2013-06-14 22:36:34 +00:00
parent ad2e39dc4d
commit 4847cf0f4b

View File

@ -221,6 +221,13 @@ namespace VEPROMS
ChangeLogFileName("LogFileAppender", Database.SelectedDatabase + " " + dtSunday.ToString("yyyyMMdd") + " ErrorLog.txt");
_MyLog.InfoFormat("\r\nSession Beginning\r\n<===================== User: {0}/{1} Started {2} =====================>"
, Environment.UserDomainName,Environment.UserName, DateTime.Now.ToString("dddd MMMM d, yyyy h:mm:ss tt"));
foreach (string parameter in parameters)
{
if (parameter.ToUpper().StartsWith("/UF="))
UpdateFormats(parameter.Substring(4));
else if (parameter.ToUpper().StartsWith("/UF"))
UpdateFormats(null);
}
VETreeNode tn = VETreeNode.GetFolder(1);
tv.Nodes.Add(tn);
tv.NodePSI += new vlnTreeViewPSIEvent(tv_NodePSI);
@ -2098,25 +2105,34 @@ namespace VEPROMS
}
private void btnUpdateFormat_Click(object sender, EventArgs e)
{
string fmtPath = Properties.Settings.Default.FormatPath ?? "";
DirectoryInfo di = null;
do
UpdateFormats(null);
}
private void UpdateFormats(string mypath)
{
if (mypath == null)
{
fbd.Description = "Select folder containing FmtAll and GenMacAll folders to update formats";
fbd.SelectedPath = fmtPath;
DialogResult dr = fbd.ShowDialog();
if (dr == DialogResult.Cancel)
string fmtPath = Properties.Settings.Default.FormatPath ?? "";
DirectoryInfo di = null;
do
{
bottomProgBar.Text = "Format Update Cancelled";
return;
}
di = new DirectoryInfo(fbd.SelectedPath);
fmtPath = di.FullName;
} while (((fmtPath ?? "") == "") || (!di.Exists || !Directory.Exists(di.FullName + @"\fmtall") || !Directory.Exists(di.FullName + @"\genmacall")));
Properties.Settings.Default.FormatPath = fbd.SelectedPath;
Properties.Settings.Default.Save();
string fmtPathAll = di.FullName + @"\fmtall";
string genmacPathAll = di.FullName + @"\genmacall";
fbd.Description = "Select folder containing FmtAll and GenMacAll folders to update formats";
fbd.SelectedPath = fmtPath;
DialogResult dr = fbd.ShowDialog();
if (dr == DialogResult.Cancel)
{
bottomProgBar.Text = "Format Update Cancelled";
return;
}
di = new DirectoryInfo(fbd.SelectedPath);
fmtPath = di.FullName;
} while (((fmtPath ?? "") == "") || (!di.Exists || !Directory.Exists(di.FullName + @"\fmtall") || !Directory.Exists(di.FullName + @"\genmacall")));
Properties.Settings.Default.FormatPath = fbd.SelectedPath;
Properties.Settings.Default.Save();
mypath = di.FullName;
}
string fmtPathAll = mypath + @"\fmtall";
string genmacPathAll = mypath + @"\genmacall";
Format.FormatLoaded += new FormatEvent(Format_FormatLoaded);
Format.UpdateFormats(fmtPathAll, genmacPathAll);
Format.FormatLoaded -= new FormatEvent(Format_FormatLoaded);