Added try/catch logic to code that loads formats
Add defaults for user configuration data
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user