fCraft  0.638
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
fCraft.MapConversion.MapUtility Class Reference

Utilities used to handle different map formats, including loading, parsing, and saving. More...

Static Public Member Functions

static void RegisterConverter (IMapConverter converter)
 Registers a new map importer or exporter. Only one importer/exporter may be registered for each supported format. If an importer/exporter for the given format has already been registered, it will be replaced.
 
static MapFormat Identify ([NotNull] string path, bool tryFallbackConverters)
 Identifies the map format from the specified file name.
 
static bool TryLoadHeader ([NotNull] string fileName, out Map map)
 Attempts to load the map excluding the block data from it's header using the specified file name.
 
static Map LoadHeader ([NotNull] string fileName)
 Loads the map excluding block data from it's header using the specified file name.
 
static bool TryLoad ([NotNull] string fileName, out Map map)
 Attempts to load the map including the block data from it's header using the specified file name.
 
static Map Load ([NotNull] string fileName)
 Loads the map from it's header using the specified file name.
 
static bool TrySave ([NotNull] Map mapToSave,[NotNull] string fileName, MapFormat mapFormat)
 Attempts to save the map, under the specified file name using the specified format.
 
static void Save ([NotNull] Map mapToSave,[NotNull] string fileName, MapFormat mapFormat)
 Save the map, under the specified file name using the specified format.
 
static IMapImporter GetImporter (MapFormat format)
 Looks up an appropriate importer for the given MapFormat.
 
static IMapExporter GetExporter (MapFormat format)
 Looks up an appropriate exporter for the given MapFormat.
 
static IMapImporter[] GetImporters ()
 Returns an array of all available map importers.
 
static IMapExporter[] GetExporters ()
 Returns an array of all available map exporters.
 

Detailed Description

Utilities used to handle different map formats, including loading, parsing, and saving.

Member Function Documentation

static IMapExporter fCraft.MapConversion.MapUtility.GetExporter ( MapFormat  format)
static

Looks up an appropriate exporter for the given MapFormat.

Parameters
formatMap format for which an exporter should be looked up.
Returns
IMapExporter object if an exporter was found for the given format; otherwise null.
static IMapExporter [] fCraft.MapConversion.MapUtility.GetExporters ( )
static

Returns an array of all available map exporters.

static IMapImporter fCraft.MapConversion.MapUtility.GetImporter ( MapFormat  format)
static

Looks up an appropriate importer for the given MapFormat.

Parameters
formatMap format for which an importer should be looked up.
Returns
IMapImporter object if an importer was found for the given format; otherwise null.
static IMapImporter [] fCraft.MapConversion.MapUtility.GetImporters ( )
static

Returns an array of all available map importers.

static MapFormat fCraft.MapConversion.MapUtility.Identify ( [NotNull] string  path,
bool  tryFallbackConverters 
)
static

Identifies the map format from the specified file name.

Parameters
pathPath to the file or directory to be identified.
tryFallbackConvertersWhether or this method should try ALL converters, including ones that do not typically handle files with the given file extension.
Returns
Map format of the specified file. MapFormat.Unknown, if the format could not be identified.
Exceptions
ArgumentNullExceptionfileName is null.
FileNotFoundExceptionThe file specified in path was not found.
static Map fCraft.MapConversion.MapUtility.Load ( [NotNull] string  fileName)
static

Loads the map from it's header using the specified file name.

Parameters
fileNameThe name of the file.
Returns
The loaded map excluding block data.
Exceptions
ArgumentNullExceptionfileName is null.
FileNotFoundExceptionFile/directory with the given name is missing.
NoMapConverterFoundExceptionNo converter can be found to load the given map file.
static Map fCraft.MapConversion.MapUtility.LoadHeader ( [NotNull] string  fileName)
static

Loads the map excluding block data from it's header using the specified file name.

Parameters
fileNameThe name of the file.
Returns
The loaded map excluding block data.
Exceptions
ArgumentNullExceptionfileName is null.
FileNotFoundExceptionFile/directory with the given name is missing.
NoMapConverterFoundExceptionNo converter can be found to load the map.
static void fCraft.MapConversion.MapUtility.RegisterConverter ( IMapConverter  converter)
static

Registers a new map importer or exporter. Only one importer/exporter may be registered for each supported format. If an importer/exporter for the given format has already been registered, it will be replaced.

Parameters
converterNew converter to add.
Exceptions
ArgumentExceptionGiven IMapConverter is nether an IMapImporter, nor an IMapExporter.
static void fCraft.MapConversion.MapUtility.Save ( [NotNull] Map  mapToSave,
[NotNull] string  fileName,
MapFormat  mapFormat 
)
static

Save the map, under the specified file name using the specified format.

Parameters
mapToSaveMap file to be saved.
fileNameThe name of the file to save to.
mapFormatThe format to use when saving the map.
Exceptions
ArgumentNullExceptionmapToSave or fileName are null.
ArgumentExceptionmapFormat is set to MapFormat.Unknown.
NoMapConverterFoundExceptionNo exporter could be found for the given format.
ExceptionOther kinds of exceptions may be thrown by the map exporter.
static bool fCraft.MapConversion.MapUtility.TryLoad ( [NotNull] string  fileName,
out Map  map 
)
static

Attempts to load the map including the block data from it's header using the specified file name.

Parameters
fileNameThe name of the file.
mapWhere the loaded map should be stored.
Returns
Whether or not the map was loaded successfully.
Exceptions
ArgumentNullExceptionfileName is null.
static bool fCraft.MapConversion.MapUtility.TryLoadHeader ( [NotNull] string  fileName,
out Map  map 
)
static

Attempts to load the map excluding the block data from it's header using the specified file name.

Parameters
fileNameThe name of the file.
mapWhere the loaded map should be stored.
Returns
Whether or not the map excluding block data was loaded successfully.
Exceptions
ArgumentNullExceptionfileName is null.
static bool fCraft.MapConversion.MapUtility.TrySave ( [NotNull] Map  mapToSave,
[NotNull] string  fileName,
MapFormat  mapFormat 
)
static

Attempts to save the map, under the specified file name using the specified format.

Parameters
mapToSaveMap file to be saved.
fileNameThe name of the file to save to.
mapFormatThe format to use when saving the map.
Returns
Whether or not the map save completed successfully.
Exceptions
ArgumentNullExceptionmapToSave or fileName are null.
ArgumentExceptionmapFormat is set to MapFormat.Unknown.
NoMapConverterFoundExceptionNo exporter could be found for the given format.

The documentation for this class was generated from the following file: