Added try/catch logic to code that loads formats

Add defaults for user configuration data
This commit is contained in:
Rich
2009-02-06 15:58:25 +00:00
parent 9df3bccd71
commit 211e8b086c
3 changed files with 60 additions and 21 deletions

View File

@@ -88,20 +88,35 @@ namespace DataLoader
foreach (FileInfo fi in fis)
{
bool issub = (fi.Name.IndexOf("_") > 0) ? true : false;
if (!issub && fi.Name.ToLower()!="baseall.xml")
if (!issub && fi.Name.ToLower() != "baseall.xml")
{
string fmtname = fi.Name.Substring(0, fi.Name.Length - 7);
// remove the all.xml part of the filename.
parent = AddFormatToDB(basefmt, fmtname, issub, DateTime.Now, "Migration");
// now see if there are any subformats associated with this, if so
// add them here...
DirectoryInfo sdi = new DirectoryInfo("c:\\development\\fmtall");
FileInfo[] sfis = di.GetFiles(fmtname+"_*.xml");
foreach (FileInfo sfi in sfis)
try
{
string nm = sfi.Name.Substring(0, sfi.Name.Length-7);
Format subfmt = AddFormatToDB(parent, nm, true, DateTime.Now, "Migration");
parent = AddFormatToDB(basefmt, fmtname, issub, DateTime.Now, "Migration");
// now see if there are any subformats associated with this, if so
// add them here...
DirectoryInfo sdi = new DirectoryInfo("c:\\development\\fmtall");
FileInfo[] sfis = di.GetFiles(fmtname + "_*.xml");
foreach (FileInfo sfi in sfis)
{
string nm = sfi.Name.Substring(0, sfi.Name.Length - 7);
Console.WriteLine("Processing {0}", sfi.Name);
try
{
Format subfmt = AddFormatToDB(parent, nm, true, DateTime.Now, "Migration");
}
catch (Exception ex)
{
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
}
}
}
catch (Exception ex)
{
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
}
}
}