Un-commented code to handle some dBase errors

This commit is contained in:
Rich 2010-03-25 19:25:17 +00:00
parent df1a2a1d47
commit 01ca268595

View File

@ -522,33 +522,30 @@ namespace DataLoader
catch (Exception ex)
{
//FileInfo fi;
//switch (ex.Message)
//{
// case "Index file not found.":// then delete inf file
// fi = new FileInfo(frmMain.tbSourceText + "\\" + FileName + ".inf");
// fi.Delete();
// LoadSection(ds, da, FileName);// Try Again
// break;
// case "External table is not in the expected format.": // then pad dbt file with 128 zeros.
// fi = new FileInfo(frmMain.tbSourceText + "\\" + FileName + ".dbt");
// FileStream fs = fi.OpenWrite();
// fs.Position = fs.Length;
// byte[] buf = new byte[128];
// for (int i = 0; i < 128; i++) buf[i] = 0;
// fs.Write(buf, 0, 128);
// fs.Close();
// LoadSection(ds, da, FileName);// Try Again
// break;
// default: // Unrecognized error
// frmMain.AddError(ex, "Unrecognized error in LoadSection {0}", FileName);
// Console.WriteLine("Unrecognized error: error = {0}", ex.Message);
// log.ErrorFormat("File - {0}.DBF\r\n\r\n{1}\r\n\r\n{2}", FileName, ex.Message, ex.InnerException);
// break;
//}
frmMain.AddError(ex, "Unrecognized error in LoadSection {0}", FileName);
Console.WriteLine("Unrecognized error: error = {0}", ex.Message);
log.ErrorFormat("File - {0}.DBF\r\n\r\n{1}\r\n\r\n{2}", FileName, ex.Message, ex.InnerException);
FileInfo fi;
switch (ex.Message)
{
case "Index file not found.":// then delete inf file
fi = new FileInfo(frmMain.tbSourceText + "\\" + FileName + ".inf");
fi.Delete();
LoadSection(ds, da, FileName);// Try Again
break;
case "External table is not in the expected format.": // then pad dbt file with 128 zeros.
fi = new FileInfo(frmMain.tbSourceText + "\\" + FileName + ".dbt");
FileStream fs = fi.OpenWrite();
fs.Position = fs.Length;
byte[] buf = new byte[128];
for (int i = 0; i < 128; i++) buf[i] = 0;
fs.Write(buf, 0, 128);
fs.Close();
LoadSection(ds, da, FileName);// Try Again
break;
default: // Unrecognized error
frmMain.AddError(ex, "Unrecognized error in LoadSection {0}", FileName);
Console.WriteLine("Unrecognized error: error = {0}", ex.Message);
log.ErrorFormat("File - {0}.DBF\r\n\r\n{1}\r\n\r\n{2}", FileName, ex.Message, ex.InnerException);
break;
}
}
}
}