Esempio n. 1
0
        static void CheckBody(string body, out int radius, out long gm)
        {
            // Checks KSP_Library.KerbolSystem.SystemBodies() for Body named (body)
            Body LocalBody = KerbolSystem.SystemBodies(body);

            if (LocalBody.Name != "NOBODY")
            {
                radius = LocalBody.Radius;
                gm     = LocalBody.GM;
            }

            // If celestial body is not found, asks user for body info (GM, radius)
            else
            {
                Console.WriteLine("Unrecognized celestial body.");
                Console.WriteLine("What is the celestial body's radius?");
                bool isRadiusInt = int.TryParse(Console.ReadLine(), out radius);
                if (isRadiusInt != true)
                {
                    throw new Exception("Unrecognized celestial body radius");
                }

                Console.WriteLine("What is the celestial body's standard gravitational parameter?");
                bool isGMLong = long.TryParse(Console.ReadLine(), out gm);
                if (isGMLong != true)
                {
                    throw new Exception("Unrecognized standard gravitational paramter");
                }
            }
        }
Esempio n. 2
0
        private Body selectBody()
        {
            SolarSystem solarSystem;

            if (KspParentBodyDropDownList.Visible)
            {
                solarSystem = new KerbolSystem();
                Body body = solarSystem.GetSystemBody(KspParentBodyDropDownList.SelectedItem.Text);
                return(body);
            }
            else if (RssParentBodyDropDownList.Visible)
            {
                solarSystem = new RealSolarSystem();
                Body body = solarSystem.GetSystemBody(RssParentBodyDropDownList.SelectedItem.Text);
                return(body);
            }
            else
            {
                return(null);
            }
        }