public static void Cleanup() { try { if (EDDNComm != null) { EDDNComm.Dispose(); EDDNComm = null; } if (JournalScanner != null) { JournalScanner.Dispose(); JournalScanner = null; } if (DBCon != null) { DBCon.Dispose(); DBCon = null; } // if EliteDBProcess is not null the process is created // by this program, so we also have to do the cleanup if ((EliteDBProcess != null) && (!EliteDBProcess.WasRunning)) { String user = IniFile.GetValue("DB_Connection", "User", "RN_User"); String pass = IniFile.GetValue("DB_Connection", "Pass", "Elite"); EliteDBProcess.StopServer(user, pass); EliteDBProcess.Dispose(); EliteDBProcess = null; } Data.Dispose(); #if useVNC if (VNCAppServer != null) { VNCAppServer.Stop(); } #endif //VNCServerThread = new System.Threading.Thread(new System.Threading.ThreadStart(s.Start)); } catch (Exception ex) { throw new Exception("Error while cleaning up", ex); } }