private void compare_Click(object sender, EventArgs e)
        {
            string xmlFileName = string.Empty;

            if (open(out xmlFileName) == 0)
            {
                System.Collections.ArrayList array2 = ReadXML.Read(xmlFileName);

                MessageBox.Show(Exoplanets.Compare(Exoplanets.ExoplanetsArray, array2), "Comparison " + xmlFileName);
            }
        }
        private void merge_Click(object sender, EventArgs e)
        {
            string xmlFileName = string.Empty;

            if (open(out xmlFileName) == 0)
            {
                System.Collections.ArrayList array2 = ReadXML.Read(xmlFileName);

                Exoplanets.ExoplanetsArray = Exoplanets.Merge(Exoplanets.ExoplanetsArray, array2);
                WriteXML.WriteExoplanets(XmlFileName, Exoplanets.ExoplanetsArray);
                UpdateExoplanetListView(false);
            }
        }
        private void AddItemsToListView(ListView listView, bool addColumns, bool rebuildArray)
        {
            if (listView != null)
            {
                listView.BeginUpdate();
            }

            if (rebuildArray)
            {
                if (Exoplanets.ExoplanetsArray != null)
                {
                    Exoplanets.ExoplanetsArray.Clear();
                }

                Exoplanets.ExoplanetsArray = ReadXML.Read(XmlFileName);
            }
            else
            {
                if (ExoplanetListView != null)
                {
                    for (int index = ExoplanetListView.Items.Count - 1; index >= 0; --index)
                    {
                        ExoplanetListView.Items.RemoveAt(index);
                    }
                }
            }

            if (addColumns)
            {
                AddColumnsToListView(listView);
            }

            List <ListViewItem> items = new List <ListViewItem> ();

            if (Exoplanets.ExoplanetsArray != null)
            {
                foreach (Exoplanet exoplanet in Exoplanets.ExoplanetsArray)
                {
                    if (Queries.CurrentQueries != null)
                    {
                        if (!Queries.CurrentQueries.MatchesQuery(exoplanet))
                        {
                            continue;
                        }
                    }

                    ListViewItem item = new ListViewItem(exoplanet.Name, 0);

                    item.SubItems.Add(Helper.Format(exoplanet.DetectionType));
                    item.SubItems.Add(Helper.Format(Habitability.GetHabitability(exoplanet).ToString()));
                    item.SubItems.Add(Helper.Format(exoplanet.Mass));
                    item.SubItems.Add(Helper.Format(exoplanet.Radius));
                    item.SubItems.Add(Helper.Format(exoplanet.OrbitalPeriod));
                    item.SubItems.Add(Helper.Format(exoplanet.SemiMajorAxis));
                    item.SubItems.Add(Helper.Format(exoplanet.Eccentricity));
                    item.SubItems.Add(Helper.Format(exoplanet.AngularDistance));
                    item.SubItems.Add(Helper.Format(exoplanet.Inclination));
                    item.SubItems.Add(Helper.Format(exoplanet.Omega));
                    item.SubItems.Add(Helper.Format(exoplanet.VelocitySemiamplitude));

                    item.SubItems.Add(Helper.Format(exoplanet.Discovered));
                    item.SubItems.Add(Helper.Format(exoplanet.Updated));

                    item.SubItems.Add(Helper.Format(exoplanet.Star.Name));
                    item.SubItems.Add(Helper.Format(exoplanet.Star.Property.SPType));
                    item.SubItems.Add(Helper.Format(exoplanet.Star.Property.Mass));
                    item.SubItems.Add(Helper.Format(exoplanet.Star.Property.Radius));
                    item.SubItems.Add(Helper.Format(exoplanet.Star.Property.Distance));
                    item.SubItems.Add(Helper.Format(exoplanet.Star.Property.Age));
                    item.SubItems.Add(Helper.FormatHMS(exoplanet.Star.RightAccession));
                    item.SubItems.Add(Helper.FormatHMS(exoplanet.Star.Declination));
                    item.Tag = exoplanet;

                    items.Add(item);
                }
            }

            Text = "Exoplanet Library" + (XmlFileName.Length > 0 ? " - " + XmlFileName : string.Empty);

            if (listView != null)
            {
                listView.Items.AddRange(items.ToArray());
                listView.EndUpdate();
            }
        }