コード例 #1
0
        public void Remove(HotseatSavedGameInfo savedGameInfo)
        {
            using (DbContextTransaction transaction = Database.BeginTransaction())
            {
                try
                {
                    var objectToBeRemoved = HotseatSavedGameInfos.First(x => x.Id == savedGameInfo.Id);

                    string path = objectToBeRemoved.Path;

                    HotseatSavedGameInfos.Remove(objectToBeRemoved);

                    File.Delete(path);

                    SaveChanges();

                    transaction.Commit();
                }
                catch (Exception)
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
コード例 #2
0
        public byte[] LoadGame(HotseatSavedGameInfo info)
        {
            var savedGameInfo = HotseatSavedGameInfos.First(x => x.Id == info.Id);

            return(savedGameInfo.GetFileBytes());
        }