Пример #1
0
 /// <inherit />
 /// <exception cref="DataIOException">Thrown when the manager cannot delete the map.</exception>
 public void DeleteMap(int id)
 {
     try {
         new MapFile(Path.Combine(_world.Path, _world.DataDirectory), id).Delete();
     }
     catch (Exception ex) {
         DataIOException pex = new DataIOException("Could not remove map", ex);
         pex.Data["MapId"] = id;
         throw pex;
     }
 }
Пример #2
0
 /// <inherit />
 /// <exception cref="DataIOException">Thrown when the manager cannot write out the map</exception>
 public void SetMap(int id, Map map)
 {
     try {
         SetMapTree(id, new NbtTree(map.BuildTree() as TagNodeCompound));
     }
     catch (Exception ex) {
         DataIOException pex = new DataIOException("Could not save map", ex);
         pex.Data["MapId"] = id;
         throw pex;
     }
 }
Пример #3
0
        /// <inherit />
        /// <exception cref="DataIOException">Thrown when the manager cannot read in a map that should exist.</exception>
        public Map GetMap(int id)
        {
            if (!MapExists(id))
            {
                return(null);
            }

            try {
                Map m = new Map().LoadTreeSafe(GetMapTree(id).Root);
                m.Id = id;
                return(m);
            }
            catch (Exception ex) {
                DataIOException pex = new DataIOException("Could not load map", ex);
                pex.Data["MapId"] = id;
                throw pex;
            }
        }