本文整理匯總了C#中fCraft.Map.ReadMetadata方法的典型用法代碼示例。如果您正苦於以下問題:C# Map.ReadMetadata方法的具體用法?C# Map.ReadMetadata怎麽用?C# Map.ReadMetadata使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fCraft.Map
的用法示例。
在下文中一共展示了Map.ReadMetadata方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Load
public Map Load( Stream MapStream )
{
// Reset the seeker to the front of the stream
// This should probably be done differently.
MapStream.Seek( 0, SeekOrigin.Begin );
Map map = new Map();
BinaryReader reader = new BinaryReader( MapStream );
// Read in the magic number
if ( reader.ReadUInt32() != Identifier ) {
throw new FormatException();
}
// Read in the map dimesions
map.widthX = reader.ReadInt16();
map.widthY = reader.ReadInt16();
map.height = reader.ReadInt16();
// Read in the spawn location
map.spawn.x = reader.ReadInt16();
map.spawn.y = reader.ReadInt16();
map.spawn.h = reader.ReadInt16();
// Read in the spawn orientation
map.spawn.r = reader.ReadByte();
map.spawn.l = reader.ReadByte();
// Read the metadata
map.ReadMetadata( reader );
if( !map.ValidateHeader() ) {
throw new Exception( "One or more of the map dimensions are invalid." );
}
// Read in the map data
map.blocks = new Byte[map.GetBlockCount()];
using ( GZipStream decompressor = new GZipStream( MapStream, CompressionMode.Decompress, true ) ) {
decompressor.Read( map.blocks, 0, map.blocks.Length );
}
return map;
}