示例#1
0
        /// <summary>
        /// The get ifp.
        /// </summary>
        /// <param name="TagType">The tag type.</param>
        /// <param name="map">The map.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public static IFPIO GetIfp(string TagType, HaloVersionEnum HaloVersion)
        {
            IFPIO tempifp;

            if (HaloVersion == HaloVersionEnum.Halo2 ||
                HaloVersion == HaloVersionEnum.Halo2Vista)
            {
                tempifp = (IFPIO)H2IFPHash[TagType];
                if (tempifp == null)
                {
                    tempifp = new IFPIO();

                    // string temps = Global.StartupPath + "\\plugins\\" + TagType.Trim() + ".ifp";
                    string temps = Prefs.pathPluginsFolder + "\\" + TagType.Trim() + ".ent";
                    temps = temps.Replace("<", "_");
                    temps = temps.Replace(">", "_");
                    try
                    {
                        tempifp.ReadIFP(temps);
                    }
                    catch (Exception e)
                    {
                        throw new Exception("Error Reading Ifp: " + TagType, e);
                    }

                    // IFPHashMap.H2IFPHash.Remove(TagType);
                    H2IFPHash.Add(TagType, tempifp);
                }
            }
            else
            {
                // Halo 1 or Halo CE
                tempifp = (IFPIO)H1IFPHash[TagType];
                if (tempifp == null)
                {
                    tempifp = new IFPIO();

                    // string temps = Global.StartupPath + "\\plugins\\" + TagType.Trim() + ".ifp";
                    string temps = Global.StartupPath + "\\Plugins\\Halo 1\\ent\\" + TagType.Trim() + ".ent";
                    temps = temps.Replace("<", "_");
                    temps = temps.Replace(">", "_");
                    try
                    {
                        tempifp.ReadIFP(temps /* + "2"*/);
                    }
                    catch (Exception ex)
                    {
                        Global.ShowErrorMsg("Error Reading Ifp: " + TagType, ex);
                    }

                    H1IFPHash.Add(TagType, tempifp);
                }
            }

            return(tempifp);
        }
示例#2
0
        /// <summary>
        /// The format if ps in directory.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <remarks></remarks>
        public static void FormatIFPsInDirectory(string path)
        {
            string[] temps = Directory.GetFiles(path, "*.ifp2");

            for (int counter = 0; counter < 2; counter++)
            {
                foreach (string s in temps)
                {
                    IFPIO ifp = new IFPIO();
                    ifp.ReadIFP(s);
                    string tempentstring = s.Replace("ifp2", "ent");
                    tempentstring = tempentstring.Replace("ifp", "ent");
                    ifp.IFPOutput(tempentstring);
                }

                temps = Directory.GetFiles(path, "*.ifp");
            }
        }