Пример #1
0
        private void buttonExtEDShipyard_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)
            {
                Newtonsoft.Json.Linq.JObject jo = si.ToJSONLoadout();

                string loadoutjournalline = jo.ToString(Newtonsoft.Json.Formatting.Indented);

                //     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());
                }
            }
        }
Пример #2
0
        private void buttonExtEDShipyard_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 s = si.ToJSONLoadout();

                string uri = Properties.Resources.URLEDShipyard + "#/I=" + BaseUtils.HttpUriEncode.URIGZipBase64Escape(s);

                //File.WriteAllText(@"c:\code\out.txt", uri);

                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, s);
                    info.ShowDialog(FindForm());
                }
            }
        }