本文整理汇总了C#中HaloMap.Map.Map.CloseMap方法的典型用法代码示例。如果您正苦于以下问题:C# Map.CloseMap方法的具体用法?C# Map.CloseMap怎么用?C# Map.CloseMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HaloMap.Map.Map
的用法示例。
在下文中一共展示了Map.CloseMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: H1BSPConvert
/// <summary>
/// Initializes a new instance of the <see cref="BSPConvert"/> class.
/// </summary>
/// <param name="map">The map.</param>
/// <param name="test">The test.</param>
/// <remarks></remarks>
public H1BSPConvert(Map map, ref PropertyGrid test)
{
switch (map.HaloVersion)
{
case HaloVersionEnum.Halo1:
case HaloVersionEnum.HaloCE:
map.OpenMap(MapTypes.Internal);
H1SBSP h1bsp = new H1SBSP(map.BSP.sbsp[0].TagIndex, map);
test.SelectedObject = h1bsp.Header;
map.CloseMap();
break;
case HaloVersionEnum.Halo2:
case HaloVersionEnum.Halo2Vista:
MessageBox.Show("Open an H1 Map first");
break;
}
// OpenFileDialog open = new OpenFileDialog();
// open.Filter = "*.map|*.map";
// if (open.ShowDialog() == DialogResult.Cancel) return;
// int h2map=Maps.Add(open.FileName);
// Halo2BSP h2bsp = new Halo2BSP(h2map);
// Maps.Remove(h2map);
}
示例2: Scripts
/// <summary>
/// Initializes a new instance of the <see cref="Scripts"/> class.
/// </summary>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public Scripts(Map map)
{
map.OpenMap(MapTypes.Internal);
map.BR.BaseStream.Position = map.MetaInfo.Offset[3] + 568;
int tempc = map.BR.ReadInt32();
int tempr = map.BR.ReadInt32() - map.SecondaryMagic;
syntaxes = new Syntax[tempc];
map.BR.BaseStream.Position = tempr;
for (int x = 0; x < tempc; x++)
{
syntaxes[x] = new Syntax(ref map.BR);
}
map.CloseMap();
}
示例3: hlmtContainer
/// <summary>
/// Initializes a new instance of the <see cref="hlmtContainer"/> class.
/// </summary>
/// <param name="tagIndex">Index of the tag.</param>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public hlmtContainer(int tagIndex, Map map)
{
bool alreadyOpen = true;
if (!(map.isOpen && map.openMapType == MapTypes.Internal))
{
map.OpenMap(MapTypes.Internal);
alreadyOpen = false;
}
this.TagIndex = tagIndex;
Permutations = new PermutationInfo();
Permutations.Name = map.FileNames.Name[TagIndex];
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 112;
int tempc = map.BR.ReadInt32();
int tempr = map.BR.ReadInt32() - map.SecondaryMagic;
Permutations.Piece = new PermutationInfo.PermutationPiece[tempc];
for (int x = 0; x < tempc; x++)
{
Permutations.Piece[x] = new PermutationInfo.PermutationPiece();
map.BR.BaseStream.Position = tempr + (x * 16);
Permutations.Piece[x].PieceName = map.Strings.Name[map.BR.ReadInt16()];
map.BR.BaseStream.Position = tempr + (x * 16) + 8;
int tempc2 = map.BR.ReadInt32();
int tempr2 = map.BR.ReadInt32() - map.SecondaryMagic;
Permutations.Piece[x].Permutation = new PermutationInfo.PermutationPiece.PermutationVariation[tempc2];
for (int xx = 0; xx < tempc2; xx++)
{
Permutations.Piece[x].Permutation[xx] = new PermutationInfo.PermutationPiece.PermutationVariation();
map.BR.BaseStream.Position = tempr2 + (xx * 8);
string temps2 = map.Strings.Name[map.BR.ReadInt16()];
Permutations.Piece[x].Permutation[xx].PermutationNameX = temps2;
}
}
if (!alreadyOpen)
{
map.CloseMap();
}
}
示例4: H2ShaderInfo
//.........这里部分代码省略.........
Raw.ParsedBitmap pm = new Raw.ParsedBitmap(ref tempmeta, map);
Bitmaps.Add(pm.FindChunkAndDecode(0, 0, 0, ref tempmeta, map, 0));
BitmapNames.Add(map.FileNames.Name[tempcrap]);
}
*/
// map.BR.BaseStream.Position = tempr + 20;
// tempc2 = map.BR.ReadInt32();
// tempr2 = map.BR.ReadInt32() - map.SecondaryMagic;
// tempc2 = tempc;
// tempr2 = tempr;
if (tempc2 != 0)
{
map.BR.BaseStream.Position = tempr2;
int tempcrap = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
if (tempcrap != -1)
{
int test = map.FileNames.Name[tempcrap].IndexOf("reflection_maps");
if (map.FileNames.Name[tempcrap].IndexOf("_bump") != -1)
{
Meta tempmeta = new Meta(map);
tempmeta.ReadMetaFromMap(tempcrap, false);
ParsedBitmap pm = new ParsedBitmap(ref tempmeta, map);
// this.BumpMapBitmap = pm.FindChunkAndDecode(0, 0, 0, ref tempmeta, map, 0, 0);
this.BumpMapName = map.FileNames.Name[tempcrap];
}
else if (map.FileNames.Name[tempcrap].IndexOf("_cube_map") != -1)
{
Meta tempmeta = new Meta(map);
tempmeta.ReadMetaFromMap(tempcrap, false);
ParsedBitmap pm = new ParsedBitmap(ref tempmeta, map);
// this.CubeMapBitmap = pm.FindChunkAndDecode(0, 0, 0, ref tempmeta, map, 0, 0);
this.CubeMapName = map.FileNames.Name[tempcrap];
}
else if (map.FileNames.Name[tempcrap].IndexOf("default_") == -1 && this.MainBitmap == null &&
test == -1)
{
Meta tempmeta = new Meta(map);
tempmeta.ReadMetaFromMap(tempcrap, false);
ParsedBitmap pm = new ParsedBitmap(ref tempmeta, map);
// Try to load LOD2-MIP3 if that fails, load LOD2-MIP0, otherwise LOD0-MIP0
this.MainBitmap = pm.FindChunkAndDecode(0, 2, 3, ref tempmeta, map, 0, 0);
if (this.MainBitmap == null)
{
this.MainBitmap = pm.FindChunkAndDecode(0, 2, 0, ref tempmeta, map, 0, 0);
if (this.MainBitmap == null)
this.MainBitmap = pm.FindChunkAndDecode(0, 0, 0, ref tempmeta, map, 0, 0);
}
this.MainName = map.FileNames.Name[tempcrap];
this.levels = pm.Properties[0].mipMapCount;
}
else if (test != -1)
{
map.BR.BaseStream.Position += 8;
tempcrap = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
Meta tempmeta = new Meta(map);
tempmeta.ReadMetaFromMap(tempcrap, false);
ParsedBitmap pm = new ParsedBitmap(ref tempmeta, map);
// this.MainBitmap = pm.FindChunkAndDecode(0, 0, 0, ref tempmeta, map);
// this.MainName = map.FileNames.Name[tempcrap];
}
}
map.BR.BaseStream.Position = tempr2 + 24;
tempcrap = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
if (tempcrap != -1 && this.MainBitmap == null)
{
Meta tempmeta = new Meta(map);
tempmeta.ReadMetaFromMap(tempcrap, false);
ParsedBitmap pm = new ParsedBitmap(ref tempmeta, map);
this.MainBitmap = pm.FindChunkAndDecode(0, 0, 0, ref tempmeta, map, 0, 0);
this.MainName = map.FileNames.Name[tempcrap];
this.levels = pm.Properties[0].mipMapCount;
}
else if (this.MainBitmap == null)
{
map.BR.BaseStream.Position = tempr2 + 12;
tempcrap = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
if (tempcrap != -1)
{
Meta tempmeta = new Meta(map);
tempmeta.ReadMetaFromMap(tempcrap, false);
ParsedBitmap pm = new ParsedBitmap(ref tempmeta, map);
this.MainBitmap = pm.FindChunkAndDecode(0, 0, 0, ref tempmeta, map, 0, 0);
this.MainName = map.FileNames.Name[tempcrap];
this.levels = pm.Properties[0].mipMapCount;
}
}
}
if (!alreadyOpen)
{
map.CloseMap();
}
}
示例5: getStrings
/// <summary>
/// Loads the strings from "stringListIdent" into "strings"
/// </summary>
/// <param name="map"></param>
/// <returns></returns>
public bool getStrings(Map map)
{
if (!isPopulated | stringsListIdent == -1)
return false;
Meta m = Map.GetMetaFromTagIndex(map.Functions.ForMeta.FindMetaByID(stringsListIdent), map, false, false);
BinaryReader br = new BinaryReader(m.MS);
br.BaseStream.Position = 16; // English only...
int offset = br.ReadUInt16();
int count = br.ReadUInt16();
int uiOffset = map.Unicode.ut[0].indexOffset;
int utOffset = map.Unicode.ut[0].tableOffset;
if (map.Unicode.ut[0].SIDs == null)
map.Unicode.ut[0].Read();
map.OpenMap(MapTypes.Internal);
br = new BinaryReader(map.FS);
for (int i = 0; i < count; i++)
{
br.BaseStream.Position = utOffset + map.Unicode.ut[0].US[offset + i].offset;
strings.Add(
new entity.MetaFuncs.MEStringsSelector.Unicode(
offset + i,
map.Unicode.ut[0].US[offset + i].uString,
map.Unicode.ut[0].US[offset + i].size,
map.Unicode.ut[0].US[offset + i].offset,
null));
}
//new string(br.ReadChars(map.Unicode.ut[0].US[offset + i].size));
map.CloseMap();
return true;
}
示例6: 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();
}
示例7: ScanMapForLayOut
//.........这里部分代码省略.........
if (m.rawType != RawDataContainerType.Empty)
{
m.raw = map.Functions.ForMeta.ReadRaw(x, true);
LayOutChunk l = new LayOutChunk(map.MapHeader.fileSize);
int tempint = layout.FindByType(m.rawType);
if (tempint == -1)
{
l = new LayOutChunk(map.MapHeader.fileSize);
l.rawType = m.rawType;
layout.chunks.Add(l);
tempint = layout.FindByType(m.rawType);
}
else
{
l = (LayOutChunk)layout.chunks[tempint];
}
for (int y = 0; y < m.raw.rawChunks.Count; y++)
{
RawDataChunk r = m.raw.rawChunks[y];
if (r.offset == -1)
{
continue;
}
if (r.rawLocation == MapTypes.Internal)
{
RawInfoChunk tempr = new RawInfoChunk();
tempr.offset = (uint)r.offset;
tempr.size = r.size;
tempr.rawType = r.rawDataType;
tempr.location = r.rawLocation;
tempr.offsetOfPointer = m.offset + r.pointerMetaOffset;
l.rawPieces.Add(tempr);
}
else if (addexternalchunks)
{
RawInfoChunk tempr = new RawInfoChunk();
tempr.offset = (uint)r.offset;
tempr.size = r.size;
tempr.rawType = r.rawDataType;
tempr.location = r.rawLocation;
tempr.offsetOfPointer = m.offset + r.pointerMetaOffset;
l.rawPieces.Add(tempr);
}
if (r.offset < l.startoffset && r.rawLocation == MapTypes.Internal)
{
l.startoffset = r.offset;
l.size = l.endoffset - l.startoffset;
layout.chunks[tempint] = l;
}
if (r.offset + r.size > l.endoffset && r.rawLocation == MapTypes.Internal)
{
l.endoffset = r.offset + r.size;
l.endoffset += map.Functions.Padding(l.endoffset, 512);
l.size = l.endoffset - l.startoffset;
layout.chunks[tempint] = l;
}
}
}
m = null;
GC.WaitForPendingFinalizers();
// GC.Collect();
}
map.CloseMap();
if (map.HaloVersion == HaloVersionEnum.Halo2 ||
map.HaloVersion == HaloVersionEnum.Halo2Vista)
{
lo = new LayOutChunk(0);
LayOutChunk templo = (LayOutChunk)layout.chunks[layout.FindByType(RawDataContainerType.Model)];
lo.rawType = RawDataContainerType.Sound;
lo.startoffset = 2048;
lo.size = templo.startoffset - 2048;
lo.size += map.Functions.Padding(lo.size, 512);
lo.endoffset = lo.startoffset + lo.size;
layout.chunks.Add(lo);
}
for (int y = 0; y < layout.chunks.Count; y++)
{
LayOutChunk l = (LayOutChunk)layout.chunks[y];
if (l.size == 0)
{
layout.chunks.RemoveAt(y);
y--;
}
}
layout.SortChunksByOffset();
layout.SortRawByOffset();
return layout;
}
示例8: Halo2BSPContainer
//.........这里部分代码省略.........
// MessageBox.Show(sbsp[x].ident.ToString("X"));
sbsp[x].TagIndex = map.Functions.ForMeta.FindMetaByID(sbsp[x].ident);
map.MetaInfo.Offset[sbsp[x].TagIndex] = sbsp[x].offset;
map.MetaInfo.Size[sbsp[x].TagIndex] = sbsp[x].size;
map.BR.BaseStream.Position = tempr + (x * 68) + 28;
sbsp[x].lightmapident = map.BR.ReadInt32();
sbsp[x].lightmapTagIndex = map.Functions.ForMeta.FindMetaByID(sbsp[x].lightmapident);
if (sbsp[x].lightmapTagIndex == -1)
{
continue;
}
map.BR.BaseStream.Position = sbsp[x].offset + 8;
sbsp[x].lightmapoffset = map.BR.ReadInt32();
if (sbsp[x].lightmapoffset == 0)
{
sbsp[x].lightmapident = -1;
sbsp[x].lightmapTagIndex = -1;
if (
MessageBox.Show(
"There is no lightmap for this bsp and the scenario is currently linked to a broken ID.\n Would you like Entity to fix it?",
"Error",
MessageBoxButtons.YesNo) == DialogResult.Yes)
{
map.BW.BaseStream.Position = tempr + (x * 68) + 28;
map.BW.Write(int.Parse("FFFFFFFF", NumberStyles.HexNumber));
}
continue;
}
sbsp[x].lightmapoffset += -sbsp[x].magic;
sbsp[x].lightmapsize = sbsp[x].size + sbsp[x].offset - sbsp[x].lightmapoffset;
map.MetaInfo.Offset[sbsp[x].lightmapTagIndex] = sbsp[x].lightmapoffset;
map.MetaInfo.Size[sbsp[x].lightmapTagIndex] = sbsp[x].lightmapsize;
// light map bitmap
map.BR.BaseStream.Position = sbsp[x].lightmapoffset + 128;
int tempc = map.BR.ReadInt32();
int temprx = map.BR.ReadInt32() - sbsp[x].magic;
map.BR.BaseStream.Position = temprx + 28;
sbsp[x].LightMap_TagNumber = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
///light map palettes
map.BR.BaseStream.Position = temprx + 8;
int tempc2 = map.BR.ReadInt32();
int tempr2 = map.BR.ReadInt32() - sbsp[x].magic;
sbsp[x].palettesoffset = tempr2;
for (int y = 0; y < tempc2; y++)
{
map.BR.BaseStream.Position = tempr2 + (y * 1024);
Palette_Color[] pc = new Palette_Color[256];
for (int z = 0; z < 256; z++)
{
pc[z] = new Palette_Color();
pc[z].r = map.BR.ReadByte();
pc[z].g = map.BR.ReadByte();
pc[z].b = map.BR.ReadByte();
pc[z].a = map.BR.ReadByte();
}
sbsp[x].LightMap_Palettes.Add(pc);
}
map.BR.BaseStream.Position = temprx + 40;
tempc2 = map.BR.ReadInt32();
tempr2 = map.BR.ReadInt32() - sbsp[x].magic;
sbsp[x].VisualChunk_Bitmap_Index = new int[tempc2];
sbsp[x].VisualChunk_LightMap_Index = new int[tempc2];
if (tempc2 != 0)
{
map.BR.BaseStream.Position = tempr2;
for (int y = 0; y < tempc2; y++)
{
sbsp[x].VisualChunk_Bitmap_Index[y] = map.BR.ReadInt16();
sbsp[x].VisualChunk_LightMap_Index[y] = map.BR.ReadInt16();
}
}
map.BR.BaseStream.Position = temprx + 72;
tempc2 = map.BR.ReadInt32();
tempr2 = map.BR.ReadInt32() - sbsp[x].magic;
sbsp[x].SceneryChunk_Bitmap_Index = new int[tempc2];
sbsp[x].SceneryChunk_LightMap_Index = new int[tempc2];
if (tempc2 > 0)
{
map.BR.BaseStream.Position = tempr2;
for (int y = 0; y < tempc2; y++)
{
sbsp[x].SceneryChunk_Bitmap_Index[y] = map.BR.ReadInt16();
sbsp[x].SceneryChunk_LightMap_Index[y] = map.BR.ReadInt16();
}
}
}
map.CloseMap();
}
示例9: Refresh
/// <summary>
/// Reloads the map.
/// </summary>
/// <param name="map">The map.</param>
/// <returns>Returns the reloaded Map</returns>
/// <remarks>This needs to use a return value, because the loaded map changes were not being saved. They would be
/// lost when the function returned and we ?cannot pass Map as a ref?.</remarks>
public static Map Refresh(Map map)
{
map.CloseMap();
Meta tempmeta = new Meta(map);
if (map.SelectedMeta != null)
{
tempmeta = map.SelectedMeta;
}
map = LoadFromFile(map.filePath);
if (tempmeta.MS != null)
{
int tagIndex = map.Functions.ForMeta.FindByNameAndTagType(tempmeta.type, tempmeta.name);
// SelectedMeta belongs to map above, so keeps original map "locked"
Meta meta = Map.GetMetaFromTagIndex(tagIndex, map, tempmeta.scannedwithent, tempmeta.parsed);
map.SelectedMeta = meta;
tempmeta.Dispose();
}
return map;
}
示例10: H2SpawnInfo
//.........这里部分代码省略.........
if (vs.ModelTagNumber == -1)
{
continue;
}
vs.ModelName = map.FileNames.Name[vs.ModelTagNumber];
Spawn.Add(vs);
}
#endregion
#region //// cameras ////
//map.OpenMap(MapTypes.Internal);
map.BR.BaseStream.Position = map.MetaInfo.Offset[3] + 488;
tempc = map.BR.ReadInt32();
tempr = map.BR.ReadInt32() - map.SecondaryMagic;
for (int x = 0; x < tempc; x++)
{
//map.OpenMap(MapTypes.Internal);
CameraSpawn vs = new CameraSpawn();
map.BR.BaseStream.Position = tempr + (64 * x) + 36;
vs.offset = tempr + (64 * x) + 36;
vs.X = map.BR.ReadSingle();
vs.Y = map.BR.ReadSingle();
vs.Z = map.BR.ReadSingle();
vs.Roll = map.BR.ReadSingle();
vs.Pitch = map.BR.ReadSingle();
vs.Yaw = map.BR.ReadSingle();
vs.fov = map.BR.ReadSingle();
vs.ModelTagNumber = -1;
Spawn.Add(vs);
}
#endregion
#region //// AI_Squads ////
map.BR.BaseStream.Position = map.MetaInfo.Offset[3] + 376;
temppalette = new int[map.BR.ReadInt32()];
temppalette2 = new int[temppalette.Length];
tempr = map.BR.ReadInt32() - map.SecondaryMagic;
for (int x = 0; x < temppalette.Length; x++)
{
map.BR.BaseStream.Position = tempr + (x * 8) + 4;
int tempbase = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
temppalette2[x] = tempbase;
temppalette[x] = map.Functions.FindModelByBaseClass(tempbase);
}
// Reading ai squads reflexive
map.BR.BaseStream.Position = map.MetaInfo.Offset[3] + 352;
tempc = map.BR.ReadInt32();
tempr = map.BR.ReadInt32() - map.SecondaryMagic;
for (int x = 0; x < tempc; x++)
{
// Reads AI Squad palette chunk
map.BR.BaseStream.Position = tempr + (x * 116) + 54;
short charNum = map.BR.ReadInt16();
// Reading locations sub reflexive
map.BR.BaseStream.Position = tempr + 72;
int locc = map.BR.ReadInt32();
int locr = map.BR.ReadInt32() - map.SecondaryMagic;
AI_Squads vs = new AI_Squads();
// chunk size * x and starting position
map.BR.BaseStream.Position = locr + (100 * x);
vs.offset = tempr + (100 * x);
vs.ModelName = map.Strings.Name[(Int16)map.BR.ReadInt32()];
vs.X = map.BR.ReadSingle();
vs.Y = map.BR.ReadSingle();
vs.Z = map.BR.ReadSingle();
// facing direction
map.BR.BaseStream.Position = locr + (100 * x) + 20;
vs.RotationDirection = map.BR.ReadSingle();
if (charNum != -1)
{
vs.TagPath = map.FileNames.Name[temppalette2[charNum]];
vs.ModelTagNumber = temppalette[charNum];
if (vs.ModelTagNumber == -1)
{
continue;
}
// vs.ModelName = map.FileNames.Name[vs.ModelTagNumber];
Spawn.Add(vs);
}
}
#endregion
map.CloseMap();
}
示例11: WritePalettes
/// <summary>
/// The write palettes.
/// </summary>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public void WritePalettes(Map map)
{
map.OpenMap(MapTypes.Internal);
map.BW.BaseStream.Position = palettesoffset;
foreach (BSPContainer.Palette_Color[] palette in LightMap_Palettes)
{
for (int x = 0; x < 256; x++)
{
map.BW.Write((byte)palette[x].r);
map.BW.Write((byte)palette[x].g);
map.BW.Write((byte)palette[x].b);
map.BW.Write((byte)palette[x].a);
}
}
map.CloseMap();
}
示例12: GetUghContainerInfo
/// <summary>
/// The get ugh container info.
/// </summary>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public static void GetUghContainerInfo(Map map)
{
Meta.Meta tempughmeta = new Meta.Meta(map);
map.OpenMap(MapTypes.Internal);
tempughmeta.ReadMetaFromMap(map.IndexHeader.metaCount - 1, true);
map.ugh = new ugh_(ref tempughmeta);
map.CloseMap();
}
示例13: BuildMeta
/// <summary>
/// The build meta.
/// </summary>
/// <param name="metasplit">The metasplit.</param>
/// <param name="map">The map.</param>
/// <returns></returns>
/// <remarks></remarks>
public static Meta BuildMeta(MetaSplitter metasplit, Map map)
{
metasize = 0;
MetaStream = new MemoryStream(metasplit.Header.chunksize);
BinaryWriter BW = new BinaryWriter(MetaStream);
// BW.BaseStream.Position = 0;
// BW.Write(metasplit.Header.MS.ToArray(), 0, metasplit.Header.chunksize);
metasize += metasplit.Header.chunksize;
TagIndex = metasplit.TagIndex;
Meta m = new Meta(map);
List<Meta.Item> NewItems = new List<Meta.Item>();
// Major error here! Size is not calculated right!
RecursivelyAddPiecesToMeta(metasplit.Header, ref NewItems, ref BW);
m.items = NewItems;
if (MetaStream.Length % 4 != 0)
{
metasize += (int)MetaStream.Length % 4;
MetaStream.SetLength(MetaStream.Length + MetaStream.Length % 4);
}
m.MS = MetaStream;
m.size = metasize;
m.type = metasplit.type;
m.name = metasplit.name;
m.rawType = metasplit.rawtype;
m.raw = metasplit.raw;
m.magic = metasplit.magic;
m.offset = metasplit.offset;
m.TagIndex = TagIndex;
m.RelinkReferences();
m.WriteReferences();
// m.items.Clear();
// MetaScanner Ms = new MetaScanner();
if (m.rawType != RawDataContainerType.Empty)
{
map.OpenMap(MapTypes.Internal);
m.raw = map.Functions.ForMeta.ReadRaw(m.TagIndex, false);
map.CloseMap();
}
// map.OpenMap(MapTypes.Internal);
// IFPIO ifp=IFP.IFPHashMap.GetIfp(m.type);
// m.parsed = true;
// Ms.ScanWithIFP(ref ifp, ref m, map) ;
// map.CloseMap();
return m;
}
示例14: loadMainMenuData
private bool loadMainMenuData(string mainmenuFileName)
{
this.Cursor = Cursors.WaitCursor;
if (map != null)
{
map.CloseMap();
map = null;
}
map = Map.LoadFromFile(mainmenuFileName);
if (map == null)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show("Load failed! Map not found or inaccessible.\n" + mainmenuFileName);
return false;
}
cbBitmapIdent.DataSource = null;
cbBitmapIdent.Items.Clear();
cbBitmapIdent.Items.Add(new baseData(0));
((baseData)cbBitmapIdent.Items[0]).title = "<null>";
int orderCount = 0;
for (int i = 0; i < map.FileNames.Name.Length; i++)
{
if (map.MetaInfo.TagType[i] == "bitm")
{
baseData sd = new baseData(++orderCount);
sd.offset = i;
sd.title = map.FileNames.Name[i];
cbBitmapIdent.Items.Add(sd);
}
}
Meta meta;
// Get the tag index for [matg] globals\\globals
int matgIndex = map.Functions.ForMeta.FindByNameAndTagType("matg", "globals\\globals");
meta = Map.GetMetaFromTagIndex(matgIndex, map, false, true);
br = new BinaryReader(meta.MS);
br.BaseStream.Position = 272;
int interfaceItemCount = br.ReadInt32();
int interfaceItemOffset = br.ReadInt32() - map.SecondaryMagic - meta.offset;
br.BaseStream.Position = interfaceItemOffset + 128;
// Mainmenu Menus (Exists in Mainmenu.map)
char[] wgtzMMTag = br.ReadChars(4);
int wgtzMMIdent = br.ReadInt32();
// Single Player Menus (Exists in Shared / SPShared.map)
char[] wgtzSPTag = br.ReadChars(4);
int wgtzSPIdent = br.ReadInt32();
// Multiplayer Menus (Exists in Shared / SPShared.map)
char[] wgtzMPTag = br.ReadChars(4);
int wgtzMPIdent = br.ReadInt32();
int tagIndex = -1;
// Get the tag index for [wgtz] ui\\main_menu
if (wgtzMMIdent != -1)
tagIndex = (int)map.MetaInfo.identHT[wgtzMMIdent];
else if (wgtzSPIdent != -1)
tagIndex = (int)map.MetaInfo.identHT[wgtzSPIdent];
else if (wgtzMPIdent != -1)
tagIndex = (int)map.MetaInfo.identHT[wgtzMPIdent];
//int tagIndex = map.Functions.ForMeta.FindByNameAndTagType("wgtz", "ui\\main_menu");
if (tagIndex == -1)
{
map.CloseMap();
map = null;
this.Cursor = Cursors.Arrow;
MessageBox.Show("Load failed! Not a MAINMENU.MAP / SHARED.MAP / SPSHARED.MAP file.\n" + mainmenuFileName);
return false;
}
// [wgzt] ui\\main_menu meta
meta = Map.GetMetaFromTagIndex(tagIndex, map, false, true);
br = new BinaryReader(meta.MS);
#region Skins List Loading Section
br.BaseStream.Position = 0;
char[] wiglTag = br.ReadChars(4);
int wiglIdent = br.ReadInt32();
// Should be "ui\ui_shared_globals" by default
int tagNum = (int)map.MetaInfo.identHT[wiglIdent];
Meta metaSG = Map.GetMetaFromTagIndex(tagNum, map, false, true);
BinaryReader brSG = new BinaryReader(metaSG.MS);
// Get the default header font number
brSG.BaseStream.Position = 352;
defaultHeaderFont = brSG.ReadInt16();
// Get the default position of the header text
brSG.BaseStream.Position = 376;
short dhTop = brSG.ReadInt16();
short dhLeft = brSG.ReadInt16();
short dhBottom = brSG.ReadInt16();
short dhRight = brSG.ReadInt16();
defaultHeaderPos = new Rectangle(dhLeft, dhTop, dhRight-dhLeft, dhBottom-dhTop);
// Get the skin data
brSG.BaseStream.Position = 312;
//.........这里部分代码省略.........
示例15: GetMetaFromTagIndex
/// <summary>
/// The get meta from tag index.
/// </summary>
/// <param name="tag">The tag.</param>
/// <param name="map">The map.</param>
/// <param name="manualScan">The manual scan.</param>
/// <param name="parse">The parse.</param>
/// <returns></returns>
/// <remarks></remarks>
public static Meta GetMetaFromTagIndex(int tag, Map map, bool manualScan, bool parse)
{
map.OpenMap(MapTypes.Internal);
Meta meta = new Meta(map);
meta.TagIndex = tag;
meta.ScanMetaItems(manualScan, parse);
map.CloseMap();
meta.SortItemsByOffset();
return meta;
}