コード例 #1
0
        /// <summary>
        /// Adds a given Ability to database.
        /// </summary>
        /// <param name="addAbility"></param>
        /// <returns></returns>
        public long AddAbility(Objects.Ability addAbility)
        {
            using (var db = new SQLiteConnection(_dataMan.WritableDatabase.Path))
            {
                try
                {
                    return(db.Insert(addAbility));
                }
                catch (Exception)
                {
                    //exception handling code to go here
                    Thread.Sleep(500);

                    try
                    {
                        return(db.Insert(addAbility));
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("Trying to add a non-unique name: '{0}'.", addAbility);
                        return(0);
                    }
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Updates a given collectable in a database.
 /// </summary>
 /// <param name="updColl">The collectable to update (still unsure how)</param>
 /// <returns></returns>
 public long UpdateAbility(Objects.Ability updColl)
 {
     using (var db = new SQLiteConnection(_dataMan.WritableDatabase.Path))
     {
         try
         {
             return(db.Update(updColl));
         }
         catch (Exception)
         {
             //exception handling code to go here
             Thread.Sleep(500);
             return(UpdateAbility(updColl));
         }
     }
 }