public string DisplayString(int indent = 0, bool includefront = true, MaterialCommoditiesList historicmatlist = null, MaterialCommoditiesList currentmatlist = null) { string inds = new string(' ', indent); StringBuilder scanText = new StringBuilder(); scanText.Append(inds); if (includefront) { scanText.AppendFormat("{0} {1}\n\n", BodyName, IsEDSMBody ? " (EDSM)" : ""); if (IsStar) { scanText.AppendFormat(GetStarTypeName()); } else if (PlanetClass != null) { scanText.AppendFormat("{0}", PlanetClass); if (!PlanetClass.ToLower().Contains("gas")) { scanText.AppendFormat((Atmosphere == null || Atmosphere == String.Empty) ? ", No Atmosphere" : (", " + Atmosphere)); } } if (IsLandable) { scanText.AppendFormat(", Landable"); } scanText.AppendFormat("\n"); if (HasAtmosphericComposition) { scanText.Append("\n" + DisplayAtmosphere(2)); } if (HasPlanetaryComposition) { scanText.Append("\n" + DisplayComposition(2)); } if (HasPlanetaryComposition || HasAtmosphericComposition) { scanText.Append("\n\n"); } if (nAge.HasValue) { scanText.AppendFormat("Age: {0} million years\n", nAge.Value.ToString("N0")); } if (nStellarMass.HasValue) { scanText.AppendFormat("Solar Masses: {0:0.00}\n", nStellarMass.Value); } if (nMassEM.HasValue) { scanText.AppendFormat("Earth Masses: {0:0.0000}\n", nMassEM.Value); } if (nRadius.HasValue) { if (IsStar) { scanText.AppendFormat("Solar Radius: {0:0.00} Sols\n", (nRadius.Value / solarRadius_m)); } else { scanText.AppendFormat("Body Radius: {0:0.00}km\n", (nRadius.Value / 1000)); } } } if (nSurfaceTemperature.HasValue) { scanText.AppendFormat("Surface Temp: {0}K\n", nSurfaceTemperature.Value.ToString("N0")); } if (Luminosity != null) { scanText.AppendFormat("Luminosity: {0}\n", Luminosity); } if (nSurfaceGravity.HasValue) { scanText.AppendFormat("Gravity: {0:0.0}g\n", nSurfaceGravity.Value / oneGee_m_s2); } if (nSurfacePressure.HasValue && nSurfacePressure.Value > 0.00 && !PlanetClass.ToLower().Contains("gas")) { if (nSurfacePressure.Value > 1000) { scanText.AppendFormat("Surface Pressure: {0} Atmospheres\n", (nSurfacePressure.Value / oneAtmosphere_Pa).ToString("N2")); } else { { scanText.AppendFormat("Surface Pressure: {0} Pa\n", (nSurfacePressure.Value).ToString("N2")); } } } if (Volcanism != null) { scanText.AppendFormat("Volcanism: {0}\n", Volcanism == String.Empty ? "No Volcanism" : System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo. ToTitleCase(Volcanism.ToLower())); } if (DistanceFromArrivalLS > 0) { scanText.AppendFormat("Distance from Arrival Point {0:N1}ls\n", DistanceFromArrivalLS); } if (nOrbitalPeriod.HasValue && nOrbitalPeriod > 0) { scanText.AppendFormat("Orbital Period: {0} days\n", (nOrbitalPeriod.Value / oneDay_s).ToString("N1")); } if (nSemiMajorAxis.HasValue) { if (IsStar || nSemiMajorAxis.Value > oneAU_m / 10) { scanText.AppendFormat("Semi Major Axis: {0:0.00}AU\n", (nSemiMajorAxis.Value / oneAU_m)); } else { scanText.AppendFormat("Semi Major Axis: {0}km\n", (nSemiMajorAxis.Value / 1000).ToString("N1")); } } if (nEccentricity.HasValue) { scanText.AppendFormat("Orbital Eccentricity: {0:0.000}\n", nEccentricity.Value); } if (nOrbitalInclination.HasValue) { scanText.AppendFormat("Orbital Inclination: {0:0.000}°\n", nOrbitalInclination.Value); } if (nPeriapsis.HasValue) { scanText.AppendFormat("Arg Of Periapsis: {0:0.000}°\n", nPeriapsis.Value); } if (nAbsoluteMagnitude.HasValue) { scanText.AppendFormat("Absolute Magnitude: {0:0.00}\n", nAbsoluteMagnitude.Value); } if (nAxialTilt.HasValue) { scanText.AppendFormat("Axial tilt: {0:0.00}°\n", nAxialTilt.Value * 180.0 / Math.PI); } if (nRotationPeriod.HasValue) { scanText.AppendFormat("Rotation Period: {0} days\n", (nRotationPeriod.Value / oneDay_s).ToString("N1")); } if (nTidalLock.HasValue && nTidalLock.Value) { scanText.Append("Tidally locked\n"); } if (Terraformable) { scanText.Append("Candidate for terraforming\n"); } if (HasRings) { scanText.Append("\n"); if (IsStar) { scanText.AppendFormat("Belt{0}", Rings.Count() == 1 ? ":" : "s:"); for (int i = 0; i < Rings.Length; i++) { if (Rings[i].MassMT > (oneMoon_MT / 10000)) { scanText.Append("\n" + RingInformation(i, 1.0 / oneMoon_MT, " Moons")); } else { scanText.Append("\n" + RingInformation(i)); } } } else { scanText.AppendFormat("Ring{0}", Rings.Count() == 1 ? ":" : "s:"); for (int i = 0; i < Rings.Length; i++) { scanText.Append("\n" + RingInformation(i)); } } } if (HasMaterials) { scanText.Append("\n" + DisplayMaterials(2, historicmatlist, currentmatlist) + "\n"); } string habzonestring = HabZoneString(); if (habzonestring != null) { scanText.Append("\n" + habzonestring); } if (scanText.Length > 0 && scanText[scanText.Length - 1] == '\n') { scanText.Remove(scanText.Length - 1, 1); } if (EstimatedValue > 0) { scanText.AppendFormat("\nEstimated value: {0:N0}", EstimatedValue); } if (EDSMDiscoveryCommander != null) { scanText.AppendFormat("\n\nDiscovered by " + EDSMDiscoveryCommander + " on " + EDSMDiscoveryUTC.ToStringZulu()); } return(scanText.ToNullSafeString().Replace("\n", "\n" + inds)); }
public string DisplayString(int indent = 0, bool includefront = true) { string inds = new string(' ', indent); StringBuilder scanText = new StringBuilder(); scanText.Append(inds); if (includefront) { scanText.AppendFormat("{0}\n\n", BodyName); if (IsStar) { scanText.AppendFormat(GetStarTypeImage().Item2); } else if (PlanetClass != null) { scanText.AppendFormat("{0}", PlanetClass); if (!PlanetClass.ToLower().Contains("gas")) { scanText.AppendFormat((Atmosphere == null || Atmosphere == String.Empty) ? ", No Atmosphere" : (", " + Atmosphere)); } } if (IsLandable) { scanText.AppendFormat(", Landable"); } scanText.AppendFormat("\n"); if (nAge.HasValue) { scanText.AppendFormat("Age: {0} million years\n", nAge.Value.ToString("N0")); } if (nStellarMass.HasValue) { scanText.AppendFormat("Solar Masses: {0:0.00}\n", nStellarMass.Value); } if (nMassEM.HasValue) { scanText.AppendFormat("Earth Masses: {0:0.0000}\n", nMassEM.Value); } if (nRadius.HasValue) { if (IsStar) { scanText.AppendFormat("Solar Radius: {0:0.00} Sols\n", (nRadius.Value / solarRadius_m)); } else { scanText.AppendFormat("Body Radius: {0:0.00}km\n", (nRadius.Value / 1000)); } } } if (nSurfaceTemperature.HasValue) { scanText.AppendFormat("Surface Temp: {0}K\n", nSurfaceTemperature.Value.ToString("N0")); } if (nSurfaceGravity.HasValue) { scanText.AppendFormat("Gravity: {0:0.0}g\n", nSurfaceGravity.Value / 9.8); } if (nSurfacePressure.HasValue && nSurfacePressure.Value > 0.00 && !PlanetClass.ToLower().Contains("gas")) { if (nSurfacePressure.Value > 1000) { scanText.AppendFormat("Surface Pressure: {0} Atmospheres\n", (nSurfacePressure.Value / 100000).ToString("N2")); } else { { scanText.AppendFormat("Surface Pressure: {0} Pa\n", (nSurfacePressure.Value).ToString("N2")); } } } if (Volcanism != null) { scanText.AppendFormat("Volcanism: {0}\n", Volcanism == String.Empty ? "No Volcanism" : System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo. ToTitleCase(Volcanism.ToLower())); } if (DistanceFromArrivalLS > 0) { scanText.AppendFormat("Distance from Arrival Point {0:N1}ls\n", DistanceFromArrivalLS); } if (nOrbitalPeriod.HasValue && nOrbitalPeriod > 0) { scanText.AppendFormat("Orbital Period: {0} days\n", (nOrbitalPeriod.Value / oneDay_s).ToString("N1")); } if (nSemiMajorAxis.HasValue) { if (IsStar || nSemiMajorAxis.Value > oneAU_m / 10) { scanText.AppendFormat("Semi Major Axis: {0:0.00}AU\n", (nSemiMajorAxis.Value / oneAU_m)); } else { scanText.AppendFormat("Semi Major Axis: {0}km\n", (nSemiMajorAxis.Value / 1000).ToString("N1")); } } if (nEccentricity.HasValue) { scanText.AppendFormat("Orbital Eccentricity: {0:0.000}°\n", nEccentricity.Value); } if (nOrbitalInclination.HasValue) { scanText.AppendFormat("Orbital Inclination: {0:0.000}°\n", nOrbitalInclination.Value); } if (nPeriapsis.HasValue) { scanText.AppendFormat("Arg Of Periapsis: {0:0.000}°\n", nPeriapsis.Value); } if (nAbsoluteMagnitude.HasValue) { scanText.AppendFormat("Absolute Magnitude: {0:0.00}\n", nAbsoluteMagnitude.Value); } if (nRotationPeriod.HasValue) { scanText.AppendFormat("Rotation Period: {0} days\n", (nRotationPeriod.Value / oneDay_s).ToString("N1")); } if (nTidalLock.HasValue && nTidalLock.Value) { scanText.Append("Tidally locked\n"); } if (TerraformState != null && TerraformState == "Terraformable") { scanText.Append("Candidate for terraforming\n"); } if (HasRings) { scanText.Append("\n"); if (IsStar) { scanText.AppendFormat("Belt{0}", Rings.Count() == 1 ? ":" : "s:"); for (int i = 0; i < Rings.Length; i++) { if (Rings[i].MassMT > 7342000000) { scanText.Append("\n" + RingInformation(i, 1.0 / oneMoon_MT, " Moons")); } else { scanText.Append("\n" + RingInformation(i)); } } } else { scanText.AppendFormat("Ring{0}", Rings.Count() == 1 ? ":" : "s:"); for (int i = 0; i < Rings.Length; i++) { scanText.Append("\n" + RingInformation(i)); } } } if (HasMaterials) { scanText.Append("\n" + DisplayMaterials(2) + "\n"); } if (IsStar && HabitableZoneInner.HasValue && HabitableZoneOuter.HasValue) { StringBuilder habZone = new StringBuilder(); habZone.AppendFormat("Habitable Zone Approx. {0}ls to {1}ls\n", HabitableZoneInner.Value.ToString("N0"), HabitableZoneOuter.Value.ToString("N0")); if (nSemiMajorAxis.HasValue && nSemiMajorAxis.Value > 0) { habZone.AppendFormat(" (This star only, others not considered)\n"); } scanText.Append("\n" + habZone); } if (scanText.Length > 0 && scanText[scanText.Length - 1] == '\n') { scanText.Remove(scanText.Length - 1, 1); } int estvalue = EstimatedValue(); if (estvalue > 0) { scanText.AppendFormat("\nEstimated value: {0}", estvalue); } return(scanText.ToNullSafeString().Replace("\n", "\n" + inds)); }