Added logic to delete "bad" user.config files.
This commit is contained in:
@@ -112,11 +112,32 @@ namespace VEPROMS
|
|||||||
#endregion
|
#endregion
|
||||||
public frmVEPROMS()
|
public frmVEPROMS()
|
||||||
{
|
{
|
||||||
if (Properties.Settings.Default.UpdateSettings)
|
// The following Try/Catch was added to protect against a problem seen by Kathy and Michelle
|
||||||
|
// on January 1, 2013. Michelle's user.config file was empty and PROMS would not run.
|
||||||
|
// This logic will delete a "Bad" config file to attempt to eliminate the problem, and
|
||||||
|
// instructs the user to try again.
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Properties.Settings.Default.Upgrade();
|
if (Properties.Settings.Default.UpdateSettings)
|
||||||
Properties.Settings.Default.UpdateSettings = false;
|
{
|
||||||
Properties.Settings.Default.Save();
|
Properties.Settings.Default.Upgrade();
|
||||||
|
Properties.Settings.Default.UpdateSettings = false;
|
||||||
|
Properties.Settings.Default.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_MyLog.Error(ex.GetType().Name + " - " + ex.InnerException, ex);
|
||||||
|
if (ex.Message.StartsWith("Configuration system failed to initialize"))
|
||||||
|
{
|
||||||
|
string filename = ex.InnerException.Message;
|
||||||
|
filename = filename.Substring(filename.IndexOf("(") + 1);
|
||||||
|
filename = filename.Substring(0, filename.IndexOf("user.config") + 11);
|
||||||
|
FileInfo myfile = new FileInfo(filename);
|
||||||
|
myfile.Delete();
|
||||||
|
MessageBox.Show("Config file was corrupt, it has been deleted.\r\nTry Again", "Corrupt config file", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
System.Diagnostics.Process.GetCurrentProcess().Kill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// cleanup from previous run:
|
// cleanup from previous run:
|
||||||
Volian.Base.Library.TmpFile.RemoveAllTmps();
|
Volian.Base.Library.TmpFile.RemoveAllTmps();
|
||||||
|
Reference in New Issue
Block a user