コード例 #1
0
ファイル: Settings.cs プロジェクト: ndefilippis/EDDiscovery
 private void textBoxHomeSystem_Validated(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(textBoxHomeSystem.Text))
     {
         HomeSystem = SystemClassDB.GetSystem(textBoxHomeSystem.Text);
     }
 }
コード例 #2
0
        private float CalculateRouteMaxDistFromOrigin()
        {
            if (dataGridViewRouteSystems.Rows.Count < 2)
            {
                return(100);
            }

            double maxdist = 25;
            var    systems = dataGridViewRouteSystems.Rows.OfType <DataGridViewRow>()
                             .Where(r => r.Index < dataGridViewRouteSystems.NewRowIndex && r.Cells[0].Tag != null)
                             .Select(r => r.Cells[0].Tag as ISystemBase)
                             .Where(s => s.HasCoordinate);
            var sys0 = systems.FirstOrDefault();

            if (sys0 != null)
            {
                foreach (var sys in systems)
                {
                    double dist = SystemClassDB.Distance(sys0, sys);

                    if (dist > maxdist)
                    {
                        maxdist = dist;
                    }
                }
            }

            return((float)maxdist);
        }
コード例 #3
0
ファイル: Settings.cs プロジェクト: ndefilippis/EDDiscovery
        public void InitSettingsTab()
        {
            checkBoxEDSMLog.Checked              = EDDiscoveryForm.EDDConfig.EDSMLog;
            checkBoxOrderRowsInverted.Checked    = EDDiscoveryForm.EDDConfig.OrderRowsInverted;
            checkBoxMinimizeToNotifyIcon.Checked = EDDiscoveryForm.EDDConfig.MinimizeToNotifyIcon;
            checkBoxKeepOnTop.Checked            = EDDiscoveryForm.EDDConfig.KeepOnTop;
            checkBoxUseNotifyIcon.Checked        = EDDiscoveryForm.EDDConfig.UseNotifyIcon;
            checkBoxUTC.Checked      = EDDiscoveryForm.EDDConfig.DisplayUTC;
            checkBoxAutoLoad.Checked = EDDiscoveryForm.EDDConfig.AutoLoadPopOuts;
            checkBoxAutoSave.Checked = EDDiscoveryForm.EDDConfig.AutoSavePopOuts;

            checkBoxMinimizeToNotifyIcon.Enabled = EDDiscoveryForm.EDDConfig.UseNotifyIcon;

            HomeSystem = SystemClassDB.GetSystem(SQLiteDBClass.GetSettingString("DefaultMapCenter", "Sol"));

            textBoxDefaultZoom.Text = SQLiteDBClass.GetSettingDouble("DefaultMapZoom", 1.0).ToString();

            bool selectionCentre = SQLiteDBClass.GetSettingBool("CentreMapOnSelection", true);

            radioButtonHistorySelection.Checked = selectionCentre;
            radioButtonCentreHome.Checked       = !selectionCentre;

            dataGridViewCommanders.AutoGenerateColumns = false;             // BEFORE assigned to list..
            dataGridViewCommanders.DataSource          = EDCommander.GetList();

            panel_defaultmapcolor.BackColor = Color.FromArgb(EDDConfig.Instance.DefaultMapColour);

            this.comboBoxTheme.SelectedIndexChanged += this.comboBoxTheme_SelectedIndexChanged;    // now turn on the handler..
        }
コード例 #4
0
        private void textBoxName_Validated(object sender, EventArgs e)
        {
            if (!freeSystemEntry)
            {
                return;
            }
            string  t = textBoxName.Text.Trim();
            ISystem s = SystemClassDB.GetSystem(t);

            if (s != null)
            {
                var edsm = new EDSMClass();
                edsmurl = edsm.GetUrlToEDSMSystem(t);
                userControlSurfaceBookmarks1.NewForSystem(t);
                SystemNoteClass sn = SystemNoteClass.GetNoteOnSystem(t);
                textBoxNotes.Text = (sn != null) ? sn.Note : "";
                InitialisePos(s);
                buttonOK.Enabled    = true;
                labelBadSystem.Text = "";
            }
            else
            {
                buttonOK.Enabled = false;
                textBoxName.SelectAll();
                labelBadSystem.Text = "System name not recognised";
            }
        }
コード例 #5
0
        private ISystem GetSystem(string sysname)
        {
            ISystem sys;

            SystemClassDB.TryGetSystem(sysname, out sys, true);
            return(sys);
        }
コード例 #6
0
        private void RefreshTargetDisplay(Object sender)              // called when a target has been changed.. via EDDiscoveryform
        {
            string name;
            double x, y, z;

            //System.Diagnostics.Debug.WriteLine("Refresh target display");

            if (TargetClass.GetTargetPosition(out name, out x, out y, out z))
            {
                textBoxTarget.Text = name;
                textBoxTarget.Select(textBoxTarget.Text.Length, textBoxTarget.Text.Length);
                textBoxTargetDist.Text = "No Pos";

                HistoryEntry cs = discoveryform.history.GetLastWithPosition;
                if (cs != null)
                {
                    textBoxTargetDist.Text = SystemClassDB.Distance(cs.System, x, y, z).ToString("0.0");
                }

                textBoxTarget.SetTipDynamically(toolTip1, "Position is " + x.ToString("0.00") + "," + y.ToString("0.00") + "," + z.ToString("0.00"));
            }
            else
            {
                textBoxTarget.Text     = "?";
                textBoxTargetDist.Text = "";
                textBoxTarget.SetTipDynamically(toolTip1, "On 3D Map right click to make a bookmark, region mark or click on a notemark and then tick on Set Target, or type it here and hit enter");
            }
        }
コード例 #7
0
        // Runs as a thread.
        private void ViewPushedSystems()
        {
            try
            {
                pushed = edsm.GetPushedSystems();

                foreach (String system in pushed)
                {
                    SystemClassDB star = SystemClassDB.GetSystem(system);
                    if (star == null)
                    {
                        star = new SystemClassDB(system);
                    }

                    this.BeginInvoke(new MethodInvoker(() =>
                    {
                        var index = dataGridViewClosestSystems.Rows.Add("EDSM");
                        dataGridViewClosestSystems[1, index].Value = system;
                        dataGridViewClosestSystems[1, index].Tag   = star;
                    }));
                }
            }
            catch (Exception ex)
            {
                this.BeginInvoke(new MethodInvoker(() =>
                {
                    LogTextHighlight("ViewPushedSystems Exception:" + ex.Message);
                    LogText(ex.StackTrace);
                }));
            }
        }
コード例 #8
0
        public AssignTravelLogSystemForm(ISystem refsys, DateTime?visited = null)
        {
            InitializeComponent();
            EliteDangerousCore.EDSM.SystemClassEDSM.CheckSystemAliases();
            SystemClassDB.GetSystemAndAlternatives(refsys, out _linkSystem, out _alternatives, out _namestatus);

            this.tbLogSystemName.Text  = refsys.Name;
            this.tbVisitedDate.Text    = visited == null ? "-" : visited.ToString();
            this.tbLogCoordX.Text      = refsys.HasCoordinate ? refsys.X.ToString("0.00") : "?";
            this.tbLogCoordY.Text      = refsys.HasCoordinate ? refsys.Y.ToString("0.00") : "?";
            this.tbLogCoordZ.Text      = refsys.HasCoordinate ? refsys.Z.ToString("0.00") : "?";
            this.tbLogCoordX.TextAlign = refsys.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;
            this.tbLogCoordY.TextAlign = refsys.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;
            this.tbLogCoordZ.TextAlign = refsys.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;

            UpdateLinkedSystemList(_linkSystem);
            tbManualSystemName.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            tbManualSystemName.AutoCompleteSource = AutoCompleteSource.CustomSource;

            tbManualSystemName.SetAutoCompletor(SystemClassDB.ReturnSystemListForAutoComplete);

            EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance;

            BaseUtils.Translator.Instance.Translate(this);
            theme.ApplyToFormStandardFontSize(this);
        }
コード例 #9
0
        public void AddWantedSystem(string sysName)
        {
            if (wanted == null)
            {
                PopulateLocalWantedSystems();
            }

            WantedSystemClass entry = wanted.Where(x => x.system == sysName).FirstOrDefault();  //duplicate?

            if (entry == null)
            {
                WantedSystemClass toAdd = new WantedSystemClass(sysName);       // make one..
                toAdd.Add();                                                    // add to db.

                wanted.Add(toAdd);

                SystemClassDB star = SystemClassDB.GetSystem(sysName);
                if (star == null)
                {
                    star = new SystemClassDB(sysName);
                }

                var index = dataGridViewClosestSystems.Rows.Add("Local");
                dataGridViewClosestSystems[1, index].Value = sysName;
                dataGridViewClosestSystems[1, index].Tag   = star;
            }
        }
コード例 #10
0
        private void LoadSphereData(Task <List <String> > task)
        {
            List <String> systems      = new List <String>();
            int           countunknown = 0;

            foreach (String name in task.Result)
            {
                SystemClassDB sc = GetSystem(name.Trim());
                if (sc == null)
                {
                    sc = new SystemClassDB(name.Trim());
                    countunknown++;
                }
                systems.Add(sc.name);
            }
            if (systems.Count == 0)
            {
                ExtendedControls.MessageBoxTheme.Show(_discoveryForm,
                                                      String.Format("There are no known system names in the import", countunknown),
                                                      "Unsaved", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }


            foreach (var sysname in systems)
            {
                dataGridViewExplore.Rows.Add(sysname, "", "");
            }
            UpdateSystemRows();
        }
コード例 #11
0
        private void editBookmarkToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int[] selectedRows = dataGridViewExplore.SelectedCells.OfType <DataGridViewCell>().Where(c => c.RowIndex != dataGridViewExplore.NewRowIndex).Select(c => c.RowIndex).OrderBy(v => v).Distinct().ToArray();

            if (selectedRows.Length == 0)
            {
                return;
            }
            var obj = dataGridViewExplore[0, selectedRows[0]].Value;

            if (obj == null)
            {
                return;
            }
            ISystem sc = SystemClassDB.GetSystem((string)obj);

            if (sc == null)
            {
                ExtendedControls.MessageBoxTheme.Show(FindForm(), "Unknown system, system is without co-ordinates", "Edit bookmark", MessageBoxButtons.OK);
            }
            else
            {
                TargetHelpers.showBookmarkForm(this, discoveryform, sc, null, false);
            }
        }
コード例 #12
0
        private void DBLookup(Task <List <ISystem> > task)
        {
            System.Diagnostics.Debug.Assert(Application.MessageLoop);

            dataGridViewEDSM.Rows.Clear();

            List <ISystem> systems = task.Result;

            HistoryEntry helast = discoveryform.history.GetLast;
            ISystem      home   = helast != null ? helast.System : new SystemClass("Sol", 0, 0, 0);

            foreach (ISystem sys in systems)
            {
                string sep = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator + " ";

                string dist = "";
                if (sys.HasCoordinate)
                {
                    dist = SystemClassDB.Distance(sys, home).ToString("0.#");
                }

                object[] rowobj = { sys.name, dist, sys.x.ToString("0.#") + sep + sys.y.ToString("0.#") + sep + sys.z.ToString("0.#"), sys.id_edsm.ToStringInvariant() };
                dataGridViewEDSM.Rows.Add(rowobj);
                dataGridViewEDSM.Rows[dataGridViewEDSM.Rows.Count - 1].Tag = sys;
            }

            Cursor = Cursors.Default;

            dataGridViewEDSM.Sort(ColumnStar, ListSortDirection.Ascending);
        }
コード例 #13
0
        public ISystem FindSystem(string name, EDSM.GalacticMapping glist = null) // in system or name
        {
            ISystem ds1 = SystemCache.FindSystem(name);                           // now go thru the cache..

            if (ds1 == null)
            {
                HistoryEntry vs = FindByName(name);

                if (vs != null)
                {
                    ds1 = vs.System;
                }
                else if (glist != null)
                {
                    EDSM.GalacticMapObject gmo = glist.Find(name, true, true);

                    if (gmo != null && gmo.points.Count > 0)
                    {
                        ds1 = SystemClassDB.GetSystem(gmo.galMapSearch);

                        if (ds1 != null)
                        {
                            return(new EDSM.GalacticMapSystem(ds1, gmo));
                        }
                        else
                        {
                            return(new EDSM.GalacticMapSystem(gmo));
                        }
                    }
                }
            }

            return(ds1);
        }
コード例 #14
0
        private float CalculateRouteMaxDistFromOrigin()
        {
            if (dataGridViewRouteSystems.Rows.Count < 2)
            {
                return(100);
            }

            double maxdist = 25;
            var    rows    = dataGridViewRouteSystems.Rows.OfType <DataGridViewRow>().Where(r => r.Cells[0].Value != null).ToList();
            List <SystemClassDB> systems = rows.Select(r => r.Cells[0].Tag as SystemClassDB).ToList();
            SystemClassDB        sys0    = systems.FirstOrDefault(s => s != null && s.HasCoordinate);

            if (sys0 != null)
            {
                foreach (var sys in systems.Where(s => s != null))
                {
                    double dist = SystemClassDB.Distance(sys0, sys);

                    if (dist > maxdist)
                    {
                        maxdist = dist;
                    }
                }
            }

            return((float)maxdist);
        }
コード例 #15
0
        // Done in UI thread after DoPerformSync completes

        private void PerformSyncCompleted()
        {
            Debug.Assert(System.Windows.Forms.Application.MessageLoop);

            if (syncstate.edsm_fullsync_count > 0 || syncstate.edsm_updatesync_count > 0)
            {
                LogLine(string.Format("EDSM update complete with {0} systems".Tx(this, "EDSMU"), syncstate.edsm_fullsync_count + syncstate.edsm_updatesync_count));
            }

            if (syncstate.eddb_sync_count > 0)
            {
                LogLine(string.Format("EDDB update complete with {0} systems".Tx(this, "EDDBU"), syncstate.eddb_sync_count));
            }

            long totalsystems = SystemClassDB.GetTotalSystems();

            LogLineSuccess(string.Format("Loading completed, total of {0:N0} systems stored".Tx(this, "SYST"), totalsystems));

            if (syncstate.edsm_fullsync_count > 0 || syncstate.eddb_sync_count > 0 || syncstate.edsm_updatesync_count > 20000)   // if we have done a resync, or a major update sync (arb no)
            {
                LogLine("Refresh due to updating EDSM or EDDB data".Tx(this, "Refresh"));
                RefreshHistoryAsync();
            }

            OnSyncComplete?.Invoke();

            ReportSyncProgress(-1, "");

            resyncEDSMEDDBRequestedFlag = 0;        // releases flag and allow another async to happen

            Debug.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Perform sync completed");
        }
コード例 #16
0
        private void UpdateTotalDistances()
        {
            double distance = 0;

            txtCmlDistance.Text = distance.ToString("0.00") + "LY";
            txtP2PDIstance.Text = distance.ToString("0.00") + "LY";
            if (dataGridViewRouteSystems.Rows.Count > 1)
            {
                ISystem firstSC = null;
                ISystem lastSC  = null;
                for (int i = 0; i < dataGridViewRouteSystems.Rows.Count; i++)
                {
                    if (firstSC == null && dataGridViewRouteSystems[0, i].Tag != null)
                    {
                        firstSC = (ISystem)dataGridViewRouteSystems[0, i].Tag;
                    }
                    if (dataGridViewRouteSystems[0, i].Tag != null)
                    {
                        lastSC = (ISystem)dataGridViewRouteSystems[0, i].Tag;
                    }
                    String value = dataGridViewRouteSystems[1, i].Value as string;
                    if (!String.IsNullOrWhiteSpace(value))
                    {
                        distance += Double.Parse(value);
                    }
                }
                txtCmlDistance.Text = distance.ToString("0.00") + "LY";
                distance            = 0;
                if (firstSC != null && lastSC != null)
                {
                    distance            = SystemClassDB.Distance(firstSC, lastSC);
                    txtP2PDIstance.Text = distance.ToString("0.00") + "LY";
                }
            }
        }
コード例 #17
0
        public ISystem PosAlongRoute(double percentage)             // go along route and give me a co-ord along it..
        {
            double dist = CumulativeDistance() * percentage / 100.0;

            ISystem last = null;

            for (int i = 0; i < Systems.Count; i++)
            {
                ISystem s = SystemClassDB.GetSystem(Systems[i]);
                if (s != null)
                {
                    if (last != null)
                    {
                        double d = s.Distance(last);

                        if (dist < d)
                        {
                            d = dist / d;

                            return(new SystemClass("WP" + (i).ToString() + "-" + "WP" + (i + 1).ToString() + "-" + d.ToString("#.00"), last.X + (s.X - last.X) * d, last.Y + (s.Y - last.Y) * d, last.Z + (s.Z - last.Z) * d));
                        }

                        dist -= d;
                    }

                    last = s;
                }
            }

            return(last);
        }
コード例 #18
0
        private SystemClassDB FindEDSM(HistoryEntry syspos, SQLiteConnectionSystem conn = null, bool reload = false)
        {
            if (syspos.System.status == SystemStatusEnum.EDSC || (!reload && syspos.System.id_edsm == -1))  // if set already, or we tried and failed..
            {
                return(null);
            }

            bool ownconn = false;

            try
            {
                if (conn == null)
                {
                    ownconn = true;
                    conn    = new SQLiteConnectionSystem();
                }

                return(SystemClassDB.FindEDSM(syspos.System, conn));
            }
            finally
            {
                if (ownconn && conn != null)
                {
                    conn.Dispose();
                }
            }
        }
コード例 #19
0
ファイル: Node.cs プロジェクト: ryczypior/EDDiscovery
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="PositionX">X coordinate.</param>
 /// <param name="PositionY">Y coordinate.</param>
 /// <param name="PositionZ">Z coordinate.</param>
 /// <param name="si">Node name.</param>
 public Node(double PositionX, double PositionY, double PositionZ, SystemClassDB si)
 {
     _Position     = new Point3D(PositionX, PositionY, PositionZ);
     _Passable     = true;
     _IncomingArcs = new ArrayList();
     _OutgoingArcs = new ArrayList();
     _si           = si;
 }
コード例 #20
0
        private void UpdateTo(bool updatename)
        {
            changesilence = true;

            if (textBox_To.ReadOnly == false)                // if entering system name..
            {
                ISystem ds1 = discoveryform.history.FindSystem(SystemNameOnly(textBox_To.Text), discoveryform.galacticMapping);

                if (ds1 != null)
                {
                    if (updatename)                          // can't fix it as you type.. so leave alone
                    {
                        if (ds1 is GalacticMapSystem)
                        {
                            GalacticMapSystem gms = (GalacticMapSystem)ds1;
                            textBox_To.Text = gms.GalMapObject.name;
                        }
                        else
                        {
                            textBox_To.Text = ds1.Name;
                        }
                    }

                    textBox_ToName.Text = ds1.Name;
                    textBox_ToX.Text = ds1.X.ToString("0.00");
                    textBox_ToY.Text = ds1.Y.ToString("0.00");
                    textBox_ToZ.Text = ds1.Z.ToString("0.00");
                }
                else
                    textBox_ToX.Text = textBox_ToY.Text = textBox_ToZ.Text = "";
            }
            else // Co-ords..
            {
                string res = "";
                Point3D curpos;
                if (GetCoordsTo(out curpos))
                {
                    ISystem nearest = SystemClassDB.FindNearestSystemTo(curpos.X, curpos.Y, curpos.Z);

                    if (nearest != null)
                    {
                        double distance = Point3D.DistanceBetween(curpos, new Point3D(nearest.X, nearest.Y, nearest.Z));
                        if (distance < 0.1)
                            res = nearest.Name;
                        else
                            res = nearest.Name + " @ " + distance.ToString("0.00") + "ly";
                    }
                }

                textBox_To.Text = res;
                textBox_ToName.Text = res;
            }

            UpdateDistance();

            changesilence = false;
            button_Route.Enabled = IsValid();
        }
コード例 #21
0
        override public bool GetData(Object d)
        {
            EDDiscoveryForm _discoveryForm = (EDDiscoveryForm)d;

            if (EDSMList == false)
            {
                var filter = _discoveryForm.TravelControl.GetPrimaryFilter;

                List <HistoryEntry> result = filter.Filter(_discoveryForm.history);

                scans = new List <JournalScan>();

                var entries = JournalEntry.GetByEventType(JournalTypeEnum.Scan, EDCommander.CurrentCmdrID, _discoveryForm.history.GetMinDate, _discoveryForm.history.GetMaxDate);
                scans = entries.ConvertAll <JournalScan>(x => (JournalScan)x);
            }
            else
            {
                string explorepath = Path.Combine(EDDOptions.Instance.AppDataDirectory, "Exploration");
                if (!Directory.Exists(explorepath))
                {
                    Directory.CreateDirectory(explorepath);
                }


                OpenFileDialog dlg = new OpenFileDialog();
                dlg.InitialDirectory = explorepath;
                dlg.DefaultExt       = "json";
                dlg.AddExtension     = true;
                dlg.Filter           = "Explore file| *.json";

                scans = new List <JournalScan>();

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    ExplorationSetClass _currentExplorationSet = new ExplorationSetClass();
                    _currentExplorationSet.Clear();
                    _currentExplorationSet.Load(dlg.FileName);

                    foreach (string system in _currentExplorationSet.Systems)
                    {
                        List <long> edsmidlist = SystemClassDB.GetEdsmIdsFromName(system);

                        if (edsmidlist.Count > 0)
                        {
                            for (int ii = 0; ii < edsmidlist.Count; ii++)
                            {
                                List <JournalScan> sysscans = EDSMClass.GetBodiesList((int)edsmidlist[ii]);
                                if (sysscans != null)
                                {
                                    scans.AddRange(sysscans);
                                }
                            }
                        }
                    }
                }
            }
            return(true);
        }
コード例 #22
0
        private void buttonExtDBLookup_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            Task taskEDSM = Task <List <ISystem> > .Factory.StartNew(() =>
            {
                return(SystemClassDB.GetSystemsByName(textBoxSystemName.Text, uselike: true));
            }).ContinueWith(task => this.Invoke(new Action(() => { DBLookup(task); })));
        }
コード例 #23
0
        private void dataGridViewDistances_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == 0)
                {
                    var value = e.FormattedValue.ToString();
                    var cell  = dataGridViewDistances[e.ColumnIndex, e.RowIndex];

                    if (value == "" && (cell.Value == null || cell.Value.ToString() == ""))
                    {
                        return;
                    }

                    var system         = SystemClassDB.GetSystem(value);
                    var enteredSystems = GetEnteredSystems();
                    if (cell.Value != null)
                    {
                        enteredSystems.RemoveAll(s => s.name == cell.Value.ToString());
                    }

                    if (system == null || (enteredSystems.Contains(system)))
                    {
                        return;
                    }
                }

                if (e.ColumnIndex == 1)
                {
                    var value = e.FormattedValue.ToString().Trim();
                    if (value == "")
                    {
                        dataGridViewDistances.Rows[e.RowIndex].ErrorText = null;
                        return;
                    }

                    var parsed = DistanceParser.ParseInterstellarDistance(value);
                    if (parsed.HasValue)
                    {
                        dataGridViewDistances.Rows[e.RowIndex].ErrorText = null;
                    }
                    else
                    {
                        e.Cancel = true;
                        dataGridViewDistances.Rows[e.RowIndex].ErrorText = "Invalid number";
                    }
                }
            }
            catch (Exception ex)
            {
                this.BeginInvoke(new MethodInvoker(() =>
                {
                    LogTextHighlight("Exception:" + ex.Message);
                    LogText(ex.StackTrace);
                }));
            }
        }
コード例 #24
0
 public static void RemoveSectors(List <int> sectors, Action <string> inform)
 {
     inform("Removing Names" + Environment.NewLine);
     SystemClassDB.RemoveGridNames(sectors, inform);     // MUST do first as relies on system grid for info
     inform("Removing System Information" + Environment.NewLine);
     SystemClassDB.RemoveGridSystems(sectors, inform);
     inform("Vacuum Database for size" + Environment.NewLine);
     SystemClassDB.Vacuum();
 }
コード例 #25
0
        public void Update(BookmarkClass bk)        // from multiple places, update this bookmark, region or system..
        {
            string note = "";
            string name;
            long?  edsmid = null;

            if (!bk.isRegion)
            {
                ISystem s = SystemClassDB.GetSystem(bk.StarName);
                if (s != null)    // paranoia
                {
                    InitialisePos(s);
                    edsmid = s.EDSMID;
                }
                else
                {
                    InitialisePos(bk.x, bk.y, bk.z);
                }

                SystemNoteClass sn = SystemNoteClass.GetNoteOnSystem(bk.StarName);
                note = (sn != null) ? sn.Note : "";

                name = bk.StarName;
            }
            else
            {       // region, set position, set name
                InitialisePos(bk.x, bk.y, bk.z);
                name = bk.Heading;
            }

            this.Text                 = "Update Bookmark".Tx(this, "UB");
            buttonOK.Text             = "Update".Tx(this);
            textBoxName.Text          = name;
            textBoxName.ReadOnly      = !bk.isRegion;
            textBoxBookmarkNotes.Text = bk.Note;
            textBoxBookmarkNotes.CursorToEnd();
            textBoxBookmarkNotes.ScrollToCaret();
            textBoxTravelNote.Text = note;
            textBoxTime.Text       = bk.Time.ToString();
            checkBoxTarget.Checked = bk.id == TargetClass.GetTargetBookmark();      // who is the target of a bookmark (0=none)

            if (bk.isRegion)
            {
                HideEDSM();
                HideTravelNote();
                HideSurfaceBookmarks();
            }
            else
            {
                var edsm = new EDSMClass();
                edsmurl = edsm.GetUrlToEDSMSystem(name, edsmid);
                SurfaceBookmarks.Init(bk.StarName, bk.PlanetaryMarks);
            }

            buttonOK.Enabled = true;
        }
コード例 #26
0
        private void btnFindSystem_Click(object sender, EventArgs e)
        {
            string name = tbManualSystemName.Text.ToLower();
            List <SystemClassDB> systems = SystemClassDB.GetSystemsByName(name);

            if (systems.Count != 0)
            {
                UpdateLinkedSystemList(systems[0], systems.ToList <ISystem>());
            }
        }
コード例 #27
0
        private void btnFindSystem_Click(object sender, EventArgs e)
        {
            string         name    = tbManualSystemName.Text.ToLower(System.Globalization.CultureInfo.InvariantCulture);
            List <ISystem> systems = SystemClassDB.GetSystemsByName(name);

            if (systems.Count != 0)
            {
                UpdateLinkedSystemList(systems[0], systems);
            }
        }
コード例 #28
0
        private ISystem GetSystem(string sysname)
        {
            ISystem sys = SystemCache.FindSystem(sysname);

            if (sys == null)
            {
                SystemClassDB.TryGetSystem(sysname, out sys, true);
            }

            return(sys);
        }
コード例 #29
0
        private ISystemBase GetSystem(string sysname)
        {
            ISystemBase sys;

            if (!SystemClassDB.TryGetSystem(sysname, out sys, true) && edsm.IsKnownSystem(sysname))
            {
                sys = new SystemClassDB(sysname);
            }

            return(sys);
        }
コード例 #30
0
 public void FillFromDB()        // does not affect the display object
 {
     if (array1displayed)
     {
         array2vertices = SystemClassDB.GetSystemVector(Id, ref array2, ref carray2, dBAsk, Percentage, (x, y, z) => new Vector3(x, y, z));       // MAY return array/carray is null
     }
     else
     {
         array1vertices = SystemClassDB.GetSystemVector(Id, ref array1, ref carray1, dBAsk, Percentage, (x, y, z) => new Vector3(x, y, z));
     }
 }