protected override void OnClosing(CancelEventArgs e) { controller.Stop(); EDSMJournalSync.StopSync(); UserDatabase.Instance.PutSettingDouble("DataLogSplitter", splitContainerDataLogs.GetSplitterDistance()); UserDatabase.Instance.PutSettingDouble("CmdrDataLogSplitter", splitContainerCmdrDataLogs.GetSplitterDistance()); UserDatabase.Instance.PutSettingDouble("NamesButtonsScreenshotSplitter", splitContainerNamesButtonsScreenshot.GetSplitterDistance()); screenshot.Stop(); screenshot.SaveSettings(); DLLManager.UnLoad(); base.OnClosing(e); }
private void buttonStop_Click(object sender, EventArgs e) { mgr.UnLoad(); richTextBox1.Text += "DLL UnLoad" + Environment.NewLine; }
protected override void OnShown(EventArgs e) { base.OnShown(e); screenshot.Start((a) => Invoke(a), (b) => LogLine(b), () => { if (lasthe != null) // lasthe should have name and whereami, and an indication of commander { return(new Tuple <string, string, string>(lasthe.System.Name, lasthe.WhereAmI, lasthe.Commander?.Name ?? "Unknown")); } else { return(new Tuple <string, string, string>("Unknown", "Unknown", "Unknown")); } } ); screenshot.OnScreenshot += DisplayScreenshot; EDDDLLAssemblyFinder.AssemblyFindPath = EDDOptions.Instance.DLLAppDirectory(); // any needed assemblies from here AppDomain.CurrentDomain.AssemblyResolve += EDDDLLAssemblyFinder.AssemblyResolve; DLLManager = new EDDDLLManager(); DLLCallBacks = new EDDDLLInterfaces.EDDDLLIF.EDDCallBacks(); DLLCallBacks.ver = 2; DLLCallBacks.RequestHistory = DLLRequestHistory; DLLCallBacks.RunAction = (s1, s2) => { return(false); }; DLLCallBacks.GetShipLoadout = (s) => { return(null); }; string verstring = EDDOptions.Instance.Version; string[] options = new string[] { EDDDLLInterfaces.EDDDLLIF.FLAG_HOSTNAME + "EDLITE", EDDDLLInterfaces.EDDDLLIF.FLAG_JOURNALVERSION + "2", EDDDLLInterfaces.EDDDLLIF.FLAG_CALLBACKVERSION + "2", }; string alloweddlls = EDDConfig.Instance.DLLPermissions; Tuple <string, string, string> res = DLLManager.Load(EDDOptions.Instance.DLLAppDirectory(), verstring, options, DLLCallBacks, alloweddlls); if (res.Item3.HasChars()) // new DLLs { string[] list = res.Item3.Split(','); bool changed = false; foreach (var dll in list) { if (ExtendedControls.MessageBoxTheme.Show(this, string.Format(("The following application extension DLL have been found" + Environment.NewLine + "Do you wish to allow these to be used?" + Environment.NewLine + "{0} " + Environment.NewLine ).T(EDTx.EDDiscoveryForm_DLLW), dll), "Warning".T(EDTx.Warning), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { alloweddlls = alloweddlls.AppendPrePad("+" + dll, ","); changed = true; } else { alloweddlls = alloweddlls.AppendPrePad("-" + dll, ","); } } EDDConfig.Instance.DLLPermissions = alloweddlls; if (changed) { DLLManager.UnLoad(); res = DLLManager.Load(EDDOptions.Instance.DLLAppDirectory(), verstring, options, DLLCallBacks, alloweddlls); } } if (res.Item1.HasChars()) { LogLine(string.Format("DLLs loaded: {0}".T(EDTx.EDDiscoveryForm_DLLL), res.Item1)); } if (res.Item2.HasChars()) { LogLine(string.Format("DLLs failed to load: {0}".T(EDTx.EDDiscoveryForm_DLLF), res.Item2)); } //EDDOptions.Instance.CheckRelease = true; // use this to force check for debugging Installer.CheckForNewInstallerAsync((rel) => // in thread { BeginInvoke((MethodInvoker) delegate { LogLine(string.Format("New EDDLite installer available: {0}".T(EDTx.EDDiscoveryForm_NI), rel.ReleaseName)); labelInfoBoxTop.Text = "New Release Available!".T(EDTx.EDDiscoveryForm_NRA); if (ExtendedControls.MessageBoxTheme.Show("New EDDLite Available, please upgrade!", "Warning".T(EDTx.Warning), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { System.Diagnostics.Process.Start(Properties.Resources.URLProjectReleases); } }); }); controller.Start(a => BeginInvoke(a)); }
protected override void OnShown(EventArgs e) { base.OnShown(e); screenshot.Start((a) => Invoke(a), (b) => LogLine(b), () => { if (lasthe != null) // lasthe should have name and whereami, and an indication of commander { return(new Tuple <string, string, string>(lasthe.System.Name, lasthe.WhereAmI, lasthe.Commander?.Name ?? "Unknown")); } else { return(new Tuple <string, string, string>("Unknown", "Unknown", "Unknown")); } } ); string alloweddlls = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString("DLLAllowed", ""); string verstring = EDDOptions.Instance.Version + ";EDLITE"; Tuple <string, string, string> res = DLLManager.Load(EDDOptions.Instance.DLLAppDirectory(), verstring, EDDOptions.Instance.DLLAppDirectory(), DLLCallBacks, alloweddlls); if (res.Item3.HasChars()) { if (ExtendedControls.MessageBoxTheme.Show(this, string.Format(("The following application extension DLLs have been found" + Environment.NewLine + "Do you wish to allow these to be used?" + Environment.NewLine + "{0} " + Environment.NewLine + "If you do not, either remove the DLLs from the DLL folder in EDDLite Appdata" ).T(EDTx.EDDiscoveryForm_DLLW), res.Item3), "Warning".T(EDTx.Warning), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { alloweddlls = alloweddlls.AppendPrePad(res.Item3, ","); EliteDangerousCore.DB.UserDatabase.Instance.PutSettingString("DLLAllowed", alloweddlls); DLLManager.UnLoad(); res = DLLManager.Load(EDDOptions.Instance.DLLAppDirectory(), verstring, EDDOptions.Instance.DLLAppDirectory(), DLLCallBacks, alloweddlls); } } if (res.Item1.HasChars()) { LogLine(string.Format("DLLs loaded: {0}".T(EDTx.EDDiscoveryForm_DLLL), res.Item1)); } if (res.Item2.HasChars()) { LogLine(string.Format("DLLs failed to load: {0}".T(EDTx.EDDiscoveryForm_DLLF), res.Item2)); } //EDDOptions.Instance.CheckRelease = true; // use this to force check for debugging Installer.CheckForNewInstallerAsync((rel) => // in thread { BeginInvoke((MethodInvoker) delegate { LogLine(string.Format("New EDDLite installer available: {0}".T(EDTx.EDDiscoveryForm_NI), rel.ReleaseName)); labelInfoBoxTop.Text = "New Release Available!".T(EDTx.EDDiscoveryForm_NRA); if (ExtendedControls.MessageBoxTheme.Show("New EDDLite Available, please upgrade!", "Warning".T(EDTx.Warning), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { System.Diagnostics.Process.Start(Properties.Resources.URLProjectReleases); } }); }); controller.Start(a => BeginInvoke(a)); }