Ejemplo n.º 1
0
        private void extButtonEDSY_Click(object sender, EventArgs e)
        {
            if (lasthe != null)
            {
                string loadoutjournalline = lasthe.ShipInformation.ToJSONLoadout();

                //     File.WriteAllText(@"c:\code\loadoutout.txt", loadoutjournalline);

                string uri = EDDConfig.Instance.EDDShipyardURL + "#/I=" + BaseUtils.HttpUriEncode.URIGZipBase64Escape(loadoutjournalline);

                if (!BaseUtils.BrowserInfo.LaunchBrowser(uri))
                {
                    ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                    info.Info("Cannot launch browser, use this JSON for manual ED Shipyard import", FindForm().Icon, loadoutjournalline);
                    info.ShowDialog(FindForm());
                }
            }
        }
Ejemplo n.º 2
0
        private void extButtonCoriolis_Click(object sender, EventArgs e)
        {
            if (lasthe != null)
            {
                string errstr;
                string s = lasthe.ShipInformation.ToJSONCoriolis(out errstr);

                if (errstr.Length > 0)
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), errstr + Environment.NewLine + "This is probably a new or powerplay module" + Environment.NewLine + "Report to EDD Team by Github giving the full text above", "Unknown Module Type");
                }

                string uri = EDDConfig.Instance.CoriolisURL + "data=" + BaseUtils.HttpUriEncode.URIGZipBase64Escape(s) + "&bn=" + Uri.EscapeDataString(lasthe.ShipInformation.Name);

                if (!BaseUtils.BrowserInfo.LaunchBrowser(uri))
                {
                    ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                    info.Info("Cannot launch browser, use this JSON for manual Coriolis import", FindForm().Icon, s);
                    info.ShowDialog(FindForm());
                }
            }
        }
Ejemplo n.º 3
0
        private void buttonExtCoriolis_Click(object sender, EventArgs e)
        {
            ShipInformation si = null;

            if (comboBoxShips.Text.Contains("Travel") || comboBoxShips.Text.Length == 0)  // second is due to the order History gets called vs this on start
            {
                if (last_he != null && last_he.ShipInformation != null)
                {
                    si = last_he.ShipInformation;
                }
            }
            else
            {
                si = discoveryform.history.shipinformationlist.GetShipByNameIdentType(comboBoxShips.Text);
            }

            if (si != null)
            {
                string errstr;
                string s = si.ToJSONCoriolis(out errstr);

                if (errstr.Length > 0)
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), errstr + Environment.NewLine + "This is probably a new or powerplay module" + Environment.NewLine + "Report to EDD Team by Github giving the full text above", "Unknown Module Type");
                }

                string uri = Properties.Resources.URLCoriolis + "data=" + BaseUtils.HttpUriEncode.URIGZipBase64Escape(s) + "&bn=" + Uri.EscapeDataString(si.Name);

                if (!BaseUtils.BrowserInfo.LaunchBrowser(uri))
                {
                    ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                    info.Info("Cannot launch browser, use this JSON for manual Coriolis import", Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetExecutingAssembly().Location),
                              s, new int[] { 0, 100 });
                    info.ShowDialog(FindForm());
                }
            }
        }
Ejemplo n.º 4
0
        private void buttonExtCoriolis_Click(object sender, EventArgs e)
        {
            ShipInformation si = null;

            if (comboBoxShips.Text == travelhistorytext || comboBoxShips.Text.Length == 0)  // second is due to the order History gets called vs this on start
            {
                if (last_he != null && last_he.ShipInformation != null)
                {
                    si = last_he.ShipInformation;
                }
            }
            else
            {
                si = discoveryform.history.ShipInformationList.GetShipByNameIdentType(comboBoxShips.Text);
            }

            if (si != null)
            {
                string errstr;
                string s = si.ToJSONCoriolis(out errstr);

                if (errstr.Length > 0)
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), errstr + Environment.NewLine + "This is probably a new or powerplay module" + Environment.NewLine + "Report to EDD Team by Github giving the full text above", "Unknown Module Type");
                }

                string uri = EDDConfig.Instance.CoriolisURL + "data=" + BaseUtils.HttpUriEncode.URIGZipBase64Escape(s) + "&bn=" + Uri.EscapeDataString(si.Name);

                if (!BaseUtils.BrowserInfo.LaunchBrowser(uri))
                {
                    ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                    info.Info("Cannot launch browser, use this JSON for manual Coriolis import", FindForm().Icon, s);
                    info.ShowDialog(FindForm());
                }
            }
        }
Ejemplo n.º 5
0
        private void buttonExtCoriolis_Click(object sender, EventArgs e)
        {
            ShipInformation si = null;

            if (comboBoxShips.Text.Contains("Travel") || comboBoxShips.Text.Length == 0)  // second is due to the order History gets called vs this on start
            {
                if (last_he != null && last_he.ShipInformation != null)
                {
                    si = last_he.ShipInformation;
                }
            }
            else
            {
                si = discoveryform.history.shipinformationlist.GetShipByShortName(comboBoxShips.Text);
            }

            if (si != null)
            {
                string errstr;
                string s = si.ToJSON(out errstr);

                if (errstr.Length > 0)
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), errstr + Environment.NewLine + "This is probably a new or powerplay module" + Environment.NewLine + "Report to EDD Team by Github giving the full text above", "Unknown Module Type");
                }

                string uri = null;

                var bytes = Encoding.UTF8.GetBytes(s);
                using (MemoryStream indata = new MemoryStream(bytes))
                {
                    using (MemoryStream outdata = new MemoryStream())
                    {
                        using (System.IO.Compression.GZipStream gzipStream = new System.IO.Compression.GZipStream(outdata, System.IO.Compression.CompressionLevel.Optimal, true))
                            indata.CopyTo(gzipStream);      // important to clean up gzip otherwise all the data is not written.. using

                        uri += Properties.Resources.URLCoriolis + "data=" + Uri.EscapeDataString(Convert.ToBase64String(outdata.ToArray()));
                        uri += "&bn=" + Uri.EscapeDataString(si.Name);

                        string browser = BaseUtils.BrowserInfo.GetDefault();

                        if (browser != null)
                        {
                            string path = BaseUtils.BrowserInfo.GetPath(browser);

                            if (path != null)
                            {
                                try
                                {
                                    System.Diagnostics.ProcessStartInfo p = new System.Diagnostics.ProcessStartInfo(path, uri);
                                    p.UseShellExecute = false;
                                    System.Diagnostics.Process.Start(p);
                                    return;
                                }
                                catch (Exception ex)
                                {
                                    ExtendedControls.MessageBoxTheme.Show(FindForm(), "Unable to launch browser" + ex.Message, "Browser Launch Error");
                                }
                            }
                        }
                    }
                }

                ExtendedControls.InfoForm info = new ExtendedControls.InfoForm();
                info.Info("Cannot launch browser, use this JSON for manual Coriolis import", Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetExecutingAssembly().Location),
                          s, new Font("MS Sans Serif", 10), new int[] { 0, 100 });
                info.ShowDialog(FindForm());
            }
        }