Exemplo n.º 1
0
        void AddModuleLine(ShipModule sm, ShipInformation si = null)
        {
            string infoentry = "";

            if (si != null)
            {
                infoentry = si.ShipNameIdentType;
            }
            else if (sm.AmmoHopper.HasValue)
            {
                infoentry = sm.AmmoHopper.Value.ToString();
                if (sm.AmmoClip.HasValue)
                {
                    infoentry += "/" + sm.AmmoClip.ToString();
                }
            }

            string value = (sm.Value.HasValue && sm.Value.Value > 0) ? sm.Value.Value.ToString("N0") : "";

            string typename = sm.LocalisedItem;

            if (typename.IsEmpty())
            {
                typename = ShipModuleData.Instance.GetItemProperties(sm.ItemFD).ModType;
            }

            string eng = "";

            if (sm.Engineering != null)
            {
                eng = sm.Engineering.FriendlyBlueprintName + ":" + sm.Engineering.Level.ToStringInvariant();
            }

            object[] rowobj = { typename,
                                sm.Item,                                           sm.Slot, infoentry,
                                sm.Mass > 0 ? (sm.Mass.ToString("0.#") + "t") : "",
                                eng,
                                value,                                             sm.PE() };

            dataGridViewModules.Rows.Add(rowobj);

            if (sm.Engineering != null)
            {
                string text = sm.Engineering.ToString();
                EliteDangerousCalculations.FSDSpec spec = sm.GetFSDSpec();
                if (spec != null)
                {
                    text += spec.ToString();
                }

                dataGridViewModules.Rows[dataGridViewModules.Rows.Count - 1].Cells[5].ToolTipText = text;
            }
        }
Exemplo n.º 2
0
        void AddModuleLine(ShipModule sm)
        {
            string ammo = "";

            if (sm.AmmoHopper.HasValue)
            {
                ammo = sm.AmmoHopper.Value.ToString();
                if (sm.AmmoClip.HasValue)
                {
                    ammo += "/" + sm.AmmoClip.ToString();
                }
            }

            string value = (sm.Value.HasValue && sm.Value.Value > 0) ? sm.Value.Value.ToString("N0") : "";

            string typename = sm.LocalisedItem;

            if (typename.IsEmpty())
            {
                typename = ShipModuleData.Instance.GetItemProperties(sm.ItemFD).ModType;
            }

            object[] rowobj = { typename,
                                sm.Item,                                           sm.Slot, ammo,
                                sm.Mass > 0 ? (sm.Mass.ToString("0.#") + "t") : "",
                                sm.Engineering?.FriendlyBlueprintName ?? "",
                                value,                                             sm.PE() };

            dataGridViewModules.Rows.Add(rowobj);

            if (sm.Engineering != null)
            {
                string text = sm.Engineering.ToString();
                EliteDangerousCalculations.FSDSpec spec = sm.GetFSDSpec();
                if (spec != null)
                {
                    text += spec.ToString();
                }

                dataGridViewModules.Rows[dataGridViewModules.Rows.Count - 1].Cells[5].ToolTipText = text;
            }
        }