示例#1
0
        public SolarSystemInfo GetSolarSystemInfo(int solarSystemID)
        {
            try
            {
                MySqlConnection connection = null;
                MySqlDataReader reader     = Database.PrepareQuery(ref connection,
                                                                   "SELECT regionID, constellationID, x, y, z, xMin, yMin, zMin, xMax, yMax, zMax, luminosity, border, fringe, corridor, hub, international, regional, constellation, security, factionID, radius, sunTypeID, securityClass FROM mapSolarSystems WHERE solarSystemID = @solarSystemID",
                                                                   new Dictionary <string, object>()
                {
                    { "@solarSystemID", solarSystemID }
                }
                                                                   );

                using (connection)
                    using (reader)
                    {
                        if (reader.Read() == false)
                        {
                            throw new SolarSystemLoadException();
                        }

                        SolarSystemInfo info = new SolarSystemInfo();

                        info.regionID        = reader.GetInt32(0);
                        info.constellationID = reader.GetInt32(1);
                        info.x             = reader.GetDouble(2);
                        info.y             = reader.GetDouble(3);
                        info.z             = reader.GetDouble(4);
                        info.xMin          = reader.GetDouble(5);
                        info.yMin          = reader.GetDouble(6);
                        info.zMin          = reader.GetDouble(7);
                        info.xMax          = reader.GetDouble(8);
                        info.yMax          = reader.GetDouble(9);
                        info.zMax          = reader.GetDouble(10);
                        info.luminosity    = reader.GetDouble(11);
                        info.border        = reader.GetBoolean(12);
                        info.fringe        = reader.GetBoolean(13);
                        info.corridor      = reader.GetBoolean(14);
                        info.hub           = reader.GetBoolean(15);
                        info.international = reader.GetBoolean(16);
                        info.regional      = reader.GetBoolean(17);
                        info.constellation = reader.GetBoolean(18);
                        info.security      = reader.GetDouble(19);
                        info.factionID     = reader.GetInt32(20);
                        info.radius        = reader.GetDouble(21);
                        info.sunTypeID     = reader.GetInt32(22);
                        info.securityClass = reader.GetString(23);

                        return(info);
                    }
            }
            catch (Exception e)
            {
                throw new SolarSystemLoadException();
            }
        }
示例#2
0
文件: ItemDB.cs 项目: Tratos/EVESharp
        public static SolarSystemInfo GetSolarSystemInfo(int solarSystemID)
        {
            MySqlDataReader reader = null;

            if (Database.Query(ref reader, "SELECT regionID, constellationID, x, y, z, xMin, yMin, zMin, xMax, yMax, zMax, luminosity, border, fringe, corridor, hub, international, regional, constellation, security, factionID, radius, sunTypeID, securityClass FROM mapsolarsystems WHERE solarSystemID=" + solarSystemID) == false)
            {
                throw new SolarSystemLoadException();
            }

            if (reader == null)
            {
                throw new SolarSystemLoadException();
            }

            if (reader.Read() == false)
            {
                reader.Close();
                throw new SolarSystemLoadException();
            }

            SolarSystemInfo info = new SolarSystemInfo();

            info.regionID        = reader.GetInt32(0);
            info.constellationID = reader.GetInt32(1);
            info.x             = reader.GetDouble(2);
            info.y             = reader.GetDouble(3);
            info.z             = reader.GetDouble(4);
            info.xMin          = reader.GetDouble(5);
            info.yMin          = reader.GetDouble(6);
            info.zMin          = reader.GetDouble(7);
            info.xMax          = reader.GetDouble(8);
            info.yMax          = reader.GetDouble(9);
            info.zMax          = reader.GetDouble(10);
            info.luminosity    = reader.GetDouble(11);
            info.border        = reader.GetBoolean(12);
            info.fringe        = reader.GetBoolean(13);
            info.corridor      = reader.GetBoolean(14);
            info.hub           = reader.GetBoolean(15);
            info.international = reader.GetBoolean(16);
            info.regional      = reader.GetBoolean(17);
            info.constellation = reader.GetBoolean(18);
            info.security      = reader.GetDouble(19);
            info.factionID     = reader.GetInt32(20);
            info.radius        = reader.GetDouble(21);
            info.sunTypeID     = reader.GetInt32(22);
            info.securityClass = reader.GetString(23);

            return(info);
        }