예제 #1
0
        public void Remove(SingleplayerSavedGameInfo savedGameInfo)
        {
            using (DbContextTransaction transaction = Database.BeginTransaction())
            {
                try
                {
                    var objectToBeRemoved = SingleplayerSavedGameInfos.First(x => x.Id == savedGameInfo.Id);

                    string path = objectToBeRemoved.Path;

                    SingleplayerSavedGameInfos.Remove(objectToBeRemoved);
                    File.Delete(path);

                    SaveChanges();

                    transaction.Commit();
                }
                catch (Exception)
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
예제 #2
0
        public byte[] LoadGame(SingleplayerSavedGameInfo info)
        {
            var savedGameInfo = SingleplayerSavedGameInfos.First(x => x.Id == info.Id);

            return(savedGameInfo.GetFileBytes());
        }