/// <summary>
/// The over write.
/// </summary>
/// <param name="map">The map.</param>
/// <param name="tagIndex">Index of the tag.</param>
/// <param name="newMeta">The new meta.</param>
/// <remarks></remarks>
public static void OverWrite(Map map, int tagIndex, ref Meta newMeta)
{
TagIndex = tagIndex;
if (map.MetaInfo.TagType[tagIndex] == "sbsp")
{
MessageBox.Show("Can't OverWrite The Bsp");
return;
}
newMeta.RelinkReferences();
ArrayList metas = new ArrayList(0);
map.OpenMap(MapTypes.Internal);
for (int x = 0; x < map.IndexHeader.metaCount; x++)
{
if (tagIndex == x)
{
newMeta.type = map.MetaInfo.TagType[x];
newMeta.name = map.FileNames.Name[x];
SizeOfShift = newMeta.size - map.MetaInfo.Size[x];
metas.Add(newMeta);
continue;
}
Meta m = new Meta(map);
m.ReadMetaFromMap(x, true);
try
{
IFPIO ifpx = IFPHashMap.GetIfp(m.type, map.HaloVersion);
m.headersize = ifpx.headerSize;
m.scanner.ScanWithIFP(ref ifpx);
// metaScanner.ScanManually(ref m, ref map);
metas.Add(m);
}
catch (System.Exception ex)
{
Globals.Global.ShowErrorMsg(string.Empty, ex);
}
}
FixReflexives(metas, map);
map.CloseMap();
}