本文整理汇总了C#中HaloMap.Map.Map.BufferReadWrite方法的典型用法代码示例。如果您正苦于以下问题:C# Map.BufferReadWrite方法的具体用法?C# Map.BufferReadWrite怎么用?C# Map.BufferReadWrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HaloMap.Map.Map
的用法示例。
在下文中一共展示了Map.BufferReadWrite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveToXml
/// <summary>
/// The save to xml.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public void SaveToXml(string path, Map map)
{
XmlTextWriter xtw = new XmlTextWriter(path, Encoding.Default);
xtw.Formatting = Formatting.Indented;
xtw.WriteStartElement("MapLayOut");
xtw.WriteAttributeString("Map", map.filePath);
int tempindex = path.LastIndexOf("\\");
string tempfilepath = path.Substring(0, tempindex) + "\\" +
path.Substring(tempindex + 1, path.Length - tempindex - 1) + " - Meta Chunks\\";
Directory.CreateDirectory(tempfilepath);
map.OpenMap(MapTypes.Internal);
for (int x = 0; x < chunks.Count; x++)
{
LayOutChunk c = (LayOutChunk)chunks[x];
// c.Read(map);
FileStream FS = new FileStream(
tempfilepath + "MapMetaChunk[" + x + "] - " + c.rawType + ".meta", FileMode.Create);
BinaryWriter BW = new BinaryWriter(FS);
// BW.Write(c.MS.ToArray());
// c.Write(BW, 0);
map.BR.BaseStream.Position = c.startoffset;
map.BufferReadWrite(ref map.BR, ref BW, c.size);
BW.Close();
FS.Close();
xtw.WriteStartElement("LayOutChunk");
xtw.WriteAttributeString("Type", c.rawType.ToString());
xtw.WriteAttributeString("StartOffset", c.startoffset.ToString("X"));
xtw.WriteAttributeString("EndOffset", c.endoffset.ToString("X"));
xtw.WriteAttributeString("Size", c.size.ToString("X"));
for (int xx = 0; xx < c.rawPieces.Count; xx++)
{
RawInfoChunk cc = (RawInfoChunk)c.rawPieces[xx];
xtw.WriteStartElement("RawDataPiece");
xtw.WriteAttributeString("Type", cc.rawType.ToString());
xtw.WriteAttributeString("Offset", cc.offset.ToString("X"));
xtw.WriteAttributeString("Size", cc.size.ToString("X"));
xtw.WriteAttributeString("PointerOffset", cc.offsetOfPointer.ToString("X"));
xtw.WriteEndElement();
}
xtw.WriteEndElement();
}
xtw.WriteEndElement();
xtw.Close();
map.CloseMap();
}