コード例 #1
0
        public void RemoveTileban(RtRegion rt, short tileId)
        {
            if (!rt.TileIsBanned(tileId))
            {
                return;
            }

            var origin = rt.Tilebans;

            if (rt.RemoveBannedTile(tileId) &&
                _database.Query("UPDATE RtRegions SET Tilebans = @0 WHERE Id = @1", rt.Tilebans, rt.Id) != 0)
            {
                return;
            }

            rt.Tilebans = origin;
            throw new Exception("Database error: No affected rows.");
        }
コード例 #2
0
        public void RemoveTileban(string regionName, short tileId)
        {
            RtRegion rt = GetRtRegionByName(regionName);

            if (rt == null)
            {
                throw new Exception("Invalid region!");
            }
            if (!rt.TileIsBanned(tileId))
            {
                throw new Exception($"Tile {tileId} is not banned in this region.");
            }
            var origin = rt.Tilebans;

            if (rt.RemoveBannedTile(tileId) &&
                _database.Query("UPDATE RtRegions SET Tilebans = @0 WHERE Id = @1", rt.Tilebans, rt.Id) != 0)
            {
                return;
            }

            rt.Tilebans = origin;
            throw new Exception("Database error: No affected rows.");
        }