HaloMap.Meta.Meta.RelinkReferences C# (CSharp) Method

RelinkReferences() public method

The relink references.
public RelinkReferences ( ) : void
return void
        public void RelinkReferences()
        {
            for (int x = 0; x < this.items.Count; x++)
            {
                Item i = items[x];
                switch (i.type)
                {
                    case ItemType.Ident:
                        Ident id = (Ident)i;
                        id.pointstoTagIndex = Map.Functions.ForMeta.FindByNameAndTagType(
                            id.pointstotagtype, id.pointstotagname);
                        if (id.pointstoTagIndex == -1)
                        {
                            id.ident = -1;
                        }
                        else
                        {
                            id.ident = Map.MetaInfo.Ident[id.pointstoTagIndex];
                        }

                        items[x] = id;
                        break;
                    case ItemType.String:
                        String s = (String)i;
                        if (Array.IndexOf(Map.Strings.Name, s.name) == -1)
                        {
                            s.name = string.Empty;
                            s.id = 0;
                        }

                        items[x] = s;
                        break;
                }
            }
        }

Usage Example

Example #1
0
        /// <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();
        }
All Usage Examples Of HaloMap.Meta.Meta::RelinkReferences