/// <summary> /// /// this sub starts special things to do if this version runs /// for the first time /// /// <param name="parent"></param> internal async static System.Threading.Tasks.Task DoSpecial(Form parent) { Boolean didUpdate = false; try { if (!Program.Data.InitImportDone) { if (m_OldDBVersion != new Version(0,1,0)) { // here it's required to import all master data var DataIO = new frmDataIO(); Program.SplashScreen.InfoAdd("importing master data..."); Thread.Sleep(1500); DataIO.InfoTarget = Program.SplashScreen.SplashInfo; await DataIO.StartMasterImport(Program.GetDataPath("Data")); if(!Program.SplashScreen.IsDisposed) Program.SplashScreen.TopMost = false; MessageBox.Show(parent, "Do you want to get a starters data kit ?\r\n\r\n" + "You will get the existing market data from all stations in\r\n" + "the bubble of 20 ly around your current location.\r\n\r\n" + "Go to the 'Data' => 'Import&Export' menu.\r\n" + "Download the latest EDDB files and start\r\n" + "the import with the 'Starters Kit' option enabled.\r\n" + "More information in the 'StarterTipps' files.", "wanna get a starters data kit ?", MessageBoxButtons.OK, MessageBoxIcon.Information); if(!Program.SplashScreen.IsDisposed) Program.SplashScreen.TopMost = true; DataIO.Close(); DataIO.Dispose(); Program.SplashScreen.InfoAdd("importing master data...<OK>"); } Program.Data.InitImportDone = true; } else if(m_OldDBVersion < m_NewDBVersion) { // new version installed if(!Program.SplashScreen.IsDisposed) Program.SplashScreen.TopMost = false; var dResult = MessageBox.Show(parent, "Want to update your master data using the supplied files ?", "Update master data", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if(!Program.SplashScreen.IsDisposed) Program.SplashScreen.TopMost = true; if(dResult == System.Windows.Forms.DialogResult.Yes) { var DataIO = new frmDataIO(); Program.SplashScreen.InfoAdd("updating master data..."); Thread.Sleep(1500); DataIO.InfoTarget = Program.SplashScreen.SplashInfo; await DataIO.StartMasterUpdate(Program.GetDataPath("Data")); DataIO.Close(); DataIO.Dispose(); didUpdate = true; Program.SplashScreen.InfoAdd("updating master data...<OK>"); } if(m_NewDBVersion == new Version(0,2,1,0)) { if( Program.DBCon.getIniValue<Boolean>(IBE.EDDN.EDDNView.DB_GROUPNAME, "AutoListen", false.ToString(), false) && (!Program.DBCon.getIniValue<Boolean>(IBE.EDDN.EDDNView.DB_GROUPNAME, "AutoSend", false.ToString(), false))) { if(!Program.SplashScreen.IsDisposed) Program.SplashScreen.TopMost = false; if(MessageBox.Show(parent, "You decided to recieve data from the EDDN permanently\r\n" + "but not to send to EDDN.\r\n\r\n" + "The EDDN/EDDB lives from the data. If you want to receive data\r\n" + "permanently, it would be fair in return also to send data.\r\n\r\n" + "Shall I activate sending of market data for you?", "EDDN Network", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes) { Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "AutoSend", true.ToString()); if(!Program.EDDNComm.SenderIsActivated) Program.EDDNComm.ActivateSender(); } if(!Program.SplashScreen.IsDisposed) Program.SplashScreen.TopMost = true; } } if(m_NewDBVersion == new Version(0,3,0,0)) { Program.SplashScreen.InfoAdd("checking spell of commodity names once..."); var count = Program.Data.CorrectMisspelledCommodities(); if(count > 0) Program.SplashScreen.InfoAdd("checking spell of commodity names once...<OK>"); else Program.SplashScreen.InfoAppendLast("<OK>"); var wasOn = Program.DBCon.getIniValue<Boolean>(IBE.EDDN.EDDNView.DB_GROUPNAME, "AutoSend", true.ToString(), false) && Program.DBCon.getIniValue<Boolean>(IBE.EDDN.EDDNView.DB_GROUPNAME, "EDDNPostCompanionData", true.ToString(), false);; if(wasOn) { Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "AutoSend", true.ToString()); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "EDDNPostOCRData", true.ToString()); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "EDDNPostCompanionData", true.ToString()); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "QuickDecisionDefault", "Send"); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "EDDNPostOutfittingData", true.ToString()); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "EDDNPostShipyardData", true.ToString()); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "QuickDecisionValue", true.ToString()); } else { Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "AutoSend", true.ToString()); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "EDDNPostOCRData", true.ToString()); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "EDDNPostCompanionData", true.ToString()); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "QuickDecisionDefault", "Hold"); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "EDDNPostOutfittingData", true.ToString()); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "EDDNPostShipyardData", true.ToString()); Program.DBCon.setIniValue(IBE.EDDN.EDDNView.DB_GROUPNAME, "QuickDecisionValue", false.ToString()); } } if (m_NewDBVersion == new Version(0,4,0,0)) { // at least one time this data has to be imported var DataIO = new frmDataIO(); Program.SplashScreen.InfoAdd("importing FDevIDs for the first time..."); DataIO.InfoTarget = Program.SplashScreen.SplashInfo; await DataIO.StartFDevIDImport(Program.GetDataPath("Data")); DataIO.Close(); DataIO.Dispose(); didUpdate = true; Program.SplashScreen.InfoAdd("importing FDevIDs for the first time...<OK>"); } if (m_NewDBVersion == new Version(0,5,0,0)) { if (!Program.DBCon.getIniValue<Boolean>("EDDN", "AutoSend", true.ToString(), false)) { Program.DBCon.setIniValue("EDDN", "AutoSend", true.ToString()); if(!Program.SplashScreen.IsDisposed) Program.SplashScreen.TopMost = false; MessageBox.Show(parent, "EDDN sender activated once, please check if not wanted.", "EDDN Network", MessageBoxButtons.OK, MessageBoxIcon.Question); if(!Program.SplashScreen.IsDisposed) Program.SplashScreen.TopMost = true; } } } } catch (Exception ex) { throw new Exception("Error while doing special things (2)", ex); } }
/// <summary> /// this sub starts special things to do if this version runs /// for the first time /// </summary> internal static void DoSpecial() { Version dbVersion; Version appVersion; Version testVersion = new Version(); try { dbVersion = Program.DBCon.getIniValue<Version>("Database", "Version", new Version(0,0,0,0).ToString(), false); appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; if (dbVersion < appVersion) { if (dbVersion < (testVersion = new Version(0,1,0))) { // here it's required to import all master data var DataIO = new frmDataIO(); Program.SplashScreen.InfoAdd("Importing master data..."); Thread.Sleep(3000); DataIO.InfoTarget = Program.SplashScreen.SplashInfo; DataIO.ReUseLine = true; DataIO.StartMasterImport(GetDataPath("Data")); DataIO.Close(); DataIO.Dispose(); Program.DBCon.setIniValue("Database", "Version", appVersion.ToString()); } Program.DBCon.setIniValue("Database", "Version", appVersion.ToString()); } } catch (Exception ex) { throw new Exception("Error while doing special things", ex); } }