示例#1
0
        /// <summary>
        /// This gets the ship information for the ship of that ID.
        /// </summary>
        /// <param name="ship_id"></param>
        /// <returns></returns>
        public List <Shipdata> getShip(int ship_id)
        {
            List <Shipdata> result = new List <Shipdata>();

            if (Check())
            {
                string Query = string.Format("SELECT ship.Ship_id, ship.Model, ship.Ammo_Level, ship.Health_Level, ship.Cargo_Level, ship.Fuel_Level, ship.Owner, ship.Extenstions, ship.x_loc, ship.y_loc, media.Media_id, media.file_Loc FROM ship, media, shipmedia WHERE ship.Ship_id == shipmedia.Ship_id AND shipmedia.Media_id == media.Media_id AND ship.Ship_id = {1};", ship_id);
                using (SQLiteCommand command = new SQLiteCommand(Query, dbc))
                {
                    try
                    {
                        using (SQLiteDataReader rdq = command.ExecuteReader())
                        {
                            while (rdq.Read())
                            {
                                Shipdata record = new Shipdata(rdq.GetInt32(0), rdq.GetInt32(1), rdq.GetInt32(2), rdq.GetInt32(3), rdq.GetInt32(4), rdq.GetInt32(5), rdq.GetInt32(6), rdq.GetString(7), rdq.GetInt32(8), rdq.GetInt32(9), rdq.GetInt32(10), rdq.GetString(11));
                                result.Add(record);
                            }
                        }
                    }
                    catch (Exception ex) { Console.WriteLine("Error " + ex); }
                }
            }

            return(result);
        }
示例#2
0
        public List <Shipdata> getShip(int ship_id)
        {
            List <Shipdata> result = new List <Shipdata>();
            Shipdata        record = new Shipdata(0, 1, 2, 3, 4, 5, 6, "ex", 1, 2, 3, "loc");

            result.Add(record);
            return(result);
        }