Exemplo n.º 1
0
 public void ShowTxtEditor()
 {
     treeview = Mainfrm.TreeSource;
     nodeTxt  = treeview.SelectedNode;
     msd      = nodeTxt.Tag as MSDEntry;
     MSDEntry.LoadMSDInTexEditorForm(txtMSDBox, msd);
     this.Text = "MSD Editor - " + nodeTxt.Text;
     this.ShowDialog();
 }
Exemplo n.º 2
0
 public static void MSDEntryWriter(string filename, MSDEntry entrytowrite)
 {
     try
     {
         using (BinaryWriter bw = new BinaryWriter(File.Open(filename, FileMode.Create)))
         {
             bw.Write(entrytowrite.UncompressedData);
             bw.Close();
         }
     }
     catch (UnauthorizedAccessException)
     {
         MessageBox.Show("Unable to access the file. Maybe it's already in use by another proccess?", "Cannot write this file.");
         return;
     }
 }
Exemplo n.º 3
0
 public static void MSDEntryWriter(string filename, MSDEntry entrytowrite)
 {
     try
     {
         using (BinaryWriter bw = new BinaryWriter(File.Open(filename, FileMode.Create)))
         {
             bw.Write(entrytowrite.UncompressedData);
             bw.Close();
         }
     }
     catch (Exception ex)
     {
         ExceptionCatchAll(ex);
         return;
     }
 }
Exemplo n.º 4
0
        private void btnReplaceReplace_Click(object sender, EventArgs e)
        {
            if (AllFiles == true)
            {
                //Checks All filenames for searched term. Gets to the parent node, checks all the children nodes, their tags, filenames, etc. for the term.

                //Goes to top node to begin iteration.
                TreeNode tn = Mainfrm.FindRootNode(Mainfrm.TreeSource.SelectedNode);
                Mainfrm.TreeSource.SelectedNode = tn;

                List <TreeNode> Nodes = new List <TreeNode>();
                Mainfrm.AddChildren(Nodes, Mainfrm.TreeSource.SelectedNode);

                Mainfrm.TreeSource.BeginUpdate();

                int RenameCount = 0;

                foreach (TreeNode tno in Nodes)
                {
                    //Gets the node as a ArcEntryWrapper to allow access to all the variables and data.
                    ArcEntryWrapper awrapper = tno as ArcEntryWrapper;

                    if (awrapper != null)
                    {
                        if (awrapper.Tag as MaterialTextureReference == null || awrapper.Tag as LMTM3AEntry == null || awrapper.Tag as ModelBoneEntry == null ||
                            awrapper.Tag as MaterialMaterialEntry == null || awrapper.Tag as ModelGroupEntry == null || awrapper.Tag as Mission == null ||
                            awrapper.Tag as EffectNode == null)
                        {
                            {
                                if (awrapper.Tag as string != null)
                                {
                                    //Replaces the Term in the folder.
                                    string FolderName = awrapper.Tag as string;
                                    FolderName = FolderName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    tno.Text   = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    tno.Name   = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    RenameCount++;
                                }
                                else
                                {
                                    //Goes through the treenode to replace all the names of the node.
                                    ArcEntry              enty     = new ArcEntry();
                                    TextureEntry          tenty    = new TextureEntry();
                                    ResourcePathListEntry lrpenty  = new ResourcePathListEntry();
                                    MSDEntry              msdenty  = new MSDEntry();
                                    MaterialEntry         matent   = new MaterialEntry();
                                    LMTEntry              lmtenty  = new LMTEntry();
                                    ChainListEntry        cstenty  = new ChainListEntry();
                                    ChainEntry            chnenty  = new ChainEntry();
                                    ChainCollisionEntry   cclentry = new ChainCollisionEntry();
                                    ModelEntry            mdlentry = new ModelEntry();
                                    MissionEntry          misenty  = new MissionEntry();
                                    GemEntry              gementy  = new GemEntry();
                                    EffectListEntry       eflenty  = new EffectListEntry();

                                    if (tno.Tag as ArcEntry != null)
                                    {
                                        enty           = tno.Tag as ArcEntry;
                                        enty.EntryName = enty.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        enty.TrueName  = enty.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        enty.FileName  = enty.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag        = enty;
                                        tno.Text       = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name       = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as TextureEntry != null)
                                    {
                                        tenty           = tno.Tag as TextureEntry;
                                        tenty.EntryName = tenty.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tenty.TrueName  = tenty.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tenty.FileName  = tenty.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag         = tenty;
                                        tno.Text        = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name        = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as ResourcePathListEntry != null)
                                    {
                                        lrpenty           = tno.Tag as ResourcePathListEntry;
                                        lrpenty.EntryName = lrpenty.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        lrpenty.TrueName  = lrpenty.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        lrpenty.FileName  = lrpenty.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag           = lrpenty;
                                        tno.Text          = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name          = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as LMTEntry != null)
                                    {
                                        lmtenty           = tno.Tag as LMTEntry;
                                        lmtenty.EntryName = lmtenty.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        lmtenty.TrueName  = lmtenty.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        lmtenty.FileName  = lmtenty.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag           = lmtenty;
                                        tno.Text          = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name          = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as MaterialEntry != null)
                                    {
                                        matent           = tno.Tag as MaterialEntry;
                                        matent.EntryName = matent.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        matent.TrueName  = matent.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        matent.FileName  = matent.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag          = matent;
                                        tno.Text         = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name         = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as MSDEntry != null)
                                    {
                                        msdenty           = tno.Tag as MSDEntry;
                                        msdenty.EntryName = msdenty.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        msdenty.TrueName  = msdenty.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        msdenty.FileName  = msdenty.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag           = msdenty;
                                        tno.Text          = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name          = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as ChainListEntry != null)
                                    {
                                        cstenty           = tno.Tag as ChainListEntry;
                                        cstenty.EntryName = cstenty.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        cstenty.TrueName  = cstenty.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        cstenty.FileName  = cstenty.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag           = cstenty;
                                        tno.Text          = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name          = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as ChainEntry != null)
                                    {
                                        chnenty           = tno.Tag as ChainEntry;
                                        chnenty.EntryName = chnenty.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        chnenty.TrueName  = chnenty.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        chnenty.FileName  = chnenty.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag           = chnenty;
                                        tno.Text          = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name          = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as ChainCollisionEntry != null)
                                    {
                                        cclentry           = tno.Tag as ChainCollisionEntry;
                                        cclentry.EntryName = cclentry.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        cclentry.TrueName  = cclentry.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        cclentry.FileName  = cclentry.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag            = cclentry;
                                        tno.Text           = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name           = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as ModelEntry != null)
                                    {
                                        mdlentry           = tno.Tag as ModelEntry;
                                        mdlentry.EntryName = mdlentry.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        mdlentry.TrueName  = mdlentry.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        mdlentry.FileName  = mdlentry.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag            = mdlentry;
                                        tno.Text           = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name           = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as MissionEntry != null)
                                    {
                                        misenty           = tno.Tag as MissionEntry;
                                        misenty.EntryName = misenty.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        misenty.TrueName  = misenty.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        misenty.FileName  = misenty.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag           = misenty;
                                        tno.Text          = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name          = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as GemEntry != null)
                                    {
                                        gementy           = tno.Tag as GemEntry;
                                        gementy.EntryName = gementy.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        gementy.TrueName  = gementy.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        gementy.FileName  = gementy.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag           = gementy;
                                        tno.Text          = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name          = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }
                                    else if (tno.Tag as EffectListEntry != null)
                                    {
                                        eflenty           = tno.Tag as EffectListEntry;
                                        eflenty.EntryName = eflenty.EntryName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        eflenty.TrueName  = eflenty.TrueName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        eflenty.FileName  = eflenty.FileName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Tag           = eflenty;
                                        tno.Text          = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                        tno.Name          = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                                    }

                                    RenameCount++;
                                }
                            }
                        }
                    }

                    if (tno.Tag as string != null && tno.Tag as string == "Folder")
                    {
                        //Replaces the Term in the folder.
                        string FolderName = tno.Text as string;
                        FolderName = FolderName.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                        tno.Text   = tno.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                        tno.Name   = tno.Name.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                        RenameCount++;
                    }
                }

                Mainfrm.TreeSource.Update();

                Mainfrm.TreeSource.EndUpdate();

                MessageBox.Show("Replaced " + txtReplaceFind.Text + " with " + txtReplaceReplace.Text + " in " + RenameCount + " file and folder names.");

                Mainfrm.OpenFileModified = true;
                RenameCount = 0;
            }
            else
            {
                if (Mainfrm.TreeSource.SelectedNode.Tag is ResourcePathListEntry)
                {
                    //Gets the text, then replaces every instance of the search term with the new term.
                    string text = Mainfrm.txtRPList.Text;
                    text = text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                    Mainfrm.txtRPList.Text = text;
                }
                else if (Mainfrm.TreeSource.SelectedNode.Tag is MaterialEntry)
                {
                    TreeNodeCollection TNoCollection = Mainfrm.TreeSource.SelectedNode.Nodes;

                    foreach (TreeNode node in TNoCollection)
                    {
                        if (node.Tag as string != null)
                        {
                            if (node.Text as string == "Textures")
                            {
                                Mainfrm.TreeSource.SelectedNode = node;
                                break;
                            }
                        }
                    }

                    TNoCollection = Mainfrm.TreeSource.SelectedNode.Nodes;
                    Mainfrm.TreeSource.BeginUpdate();

                    foreach (TreeNode node in TNoCollection)
                    {
                        string Namer = node.Name as string;
                        node.Text = node.Text.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                        Namer     = Namer.Replace(txtReplaceFind.Text, txtReplaceReplace.Text);
                        node.Name = Namer;
                    }

                    Mainfrm.TreeSource.SelectedNode = Mainfrm.TreeSource.SelectedNode.Parent;

                    //Now to update the Material file with all these, Whether they're changed or not.
                    TreeNode                 Parentnode    = Mainfrm.TreeSource.SelectedNode;
                    MaterialEntry            ParentMateial = Parentnode.Tag as MaterialEntry;
                    MaterialTextureReference texref        = new MaterialTextureReference();
                    string TermToInject = "";
                    //int count = 0;

                    for (int i = 0; i < TNoCollection.Count; i++)
                    {
                        texref = TNoCollection[i].Tag as MaterialTextureReference;

                        TermToInject = TNoCollection[i].Text;

                        //Now for the actual file update.
                        List <byte> NameToInject = new List <byte>();
                        NameToInject.AddRange(Encoding.ASCII.GetBytes(TermToInject));
                        int OffsetToUse;
                        OffsetToUse = 64 + (88 * (texref.Index - 1));
                        byte[] NewName = new byte[64];
                        Array.Copy(NameToInject.ToArray(), 0, NewName, 0, NameToInject.ToArray().Length);
                        Array.Copy(NewName, 0, ParentMateial.UncompressedData, OffsetToUse, NewName.Length);
                        ParentMateial.CompressedData = Zlibber.Compressor(ParentMateial.UncompressedData);
                    }

                    Mainfrm.TreeSource.SelectedNode.Tag = ParentMateial;

                    Mainfrm.OpenFileModified = true;
                    Mainfrm.TreeSource.Update();
                    Mainfrm.TreeSource.EndUpdate();
                }
            }
        }
Exemplo n.º 5
0
        public static ArcFile LoadArc(TreeView tree, string filename, List<string> foldernames, bool IsBigEndian, bool Verifier = false,Type filetype = null, int arcsize = -1)
        {
            
            ArcFile arcfile = new ArcFile();
            byte[] Bytes = File.ReadAllBytes(filename);

            using (BinaryReader br = new BinaryReader(File.Open(filename, FileMode.Open)))
            {

                arcsize = Bytes.Length;
                int Totalsize = arcsize;
                arcfile.FileLength = arcsize;
                arcfile.Tempname = filename;

                br.BaseStream.Position = 0;
                byte[] HeaderMagic = br.ReadBytes(4);
                //Checks file signature/Endianess.
                if (HeaderMagic[0] == 0x00 && HeaderMagic[1] == 0x43 && HeaderMagic[2] == 0x52 && HeaderMagic[3] == 0x41)
                {
                    /*
                    MessageBox.Show("This .arc file is not in the kind of endian I can deal with right now, so these will be in read only.\nDon't expect save to work... or for the program to be stable", "Just so you know....");

                    IsBigEndian = true;
                    arcfile.HeaderMagic = HeaderMagic;
                    arcfile.MaterialCount = 0;
                    arcfile.arctable = new List<ArcEntry>();
                    arcfile.arcfiles = new List<object>();
                    arcfile.FileList = new List<string>();
                    arcfile.TypeHashes = new List<string>();

                    br.BaseStream.Position = 4;
                    var data = br.ReadBytes(2);
                    Array.Reverse(data);
                    arcfile.UnknownFlag = br.ReadByte();



                    return arcfile;

                    
                     
                    */

                    MessageBox.Show("This .arc file is not in the kind of endian I can deal with right now. Closing.", "Just so you know....");
                    br.Close();
                    return null;

                }

                if (HeaderMagic[0] != 0x41 && HeaderMagic[1] != 0x52 && HeaderMagic[2] != 0x43 && HeaderMagic[3] != 0x00)
                {
                    MessageBox.Show("This .arc file is either not the correct kind or is not properly extracted, so I'm closing it.", "Oh dear");
                    br.Close();
                    return null;
                }

                #region PC Arc
                IsBigEndian = false;
                arcfile.HeaderMagic = HeaderMagic;
                arcfile.MaterialCount = 0;
                arcfile.arctable = new List<ArcEntry>();
                arcfile.arcfiles = new List<object>();
                arcfile.FileList = new List<string>();
                arcfile.TypeHashes = new List<string>();

                br.BaseStream.Position = 4;
                arcfile.UnknownFlag = br.ReadByte();

                br.BaseStream.Position = 6;
                arcfile.FileCount = BitConverter.ToInt16((br.ReadBytes(2)), 0);
                arcfile.Version = arcfile.UnknownFlag;

                List<String> filenames = new List<String>();

                List<string> subdref = new List<string>();
                foldernames = subdref;


                //byte[] BytesTemp;
                //BytesTemp = new byte[] { };
                List<byte> BytesTemp = new List<byte>();
                byte[] HTTemp = new byte[] { };
                int j = 8;
                int l = 64;
                int m = 80;
                int n = 4;

                //Iterates through the header/first part of the arc to get all the filenames and occupy the filename list.
                for (int i = 0; i < arcfile.FileCount; i++)
                {
                    BytesTemp.Clear();
                    BytesTemp.TrimExcess();
                    j = 8 + (m * i);
                    //Copies the specified range to isolate the bytes containing a filename.
                    br.BaseStream.Position = j;
                    BytesTemp.AddRange(br.ReadBytes(l));
                    BytesTemp.RemoveAll(ByteUtilitarian.IsZeroByte);
                    filenames.Add(ByteUtilitarian.BytesToStringL(BytesTemp));
                    //For The Typehashes.
                    n = 72 + (m * i);

                    br.BaseStream.Position = n;
                    HTTemp = br.ReadBytes(4);
                    Array.Reverse(HTTemp);
                    arcfile.TypeHashes.Add(ByteUtilitarian.HashBytesToString(HTTemp));

                }

                //Fills in each file as an ArcEntry or TextureEntry as needed. 
                j = 8;
                int IDCounter = 0;
                for (int i = 0; i < arcfile.FileCount; i++)
                {
                    j = 8 + (80 * i);
                    switch (arcfile.TypeHashes[i])
                    {
                        //Texture Files.
                        case "241F5DEB":
                            TextureEntry newtexen = TextureEntry.FillTexEntry(filename, foldernames, tree, br, j, IDCounter);
                            arcfile.arcfiles.Add(newtexen);
                            arcfile.FileList.Add(newtexen.EntryName);
                            foldernames.Clear();
                            IDCounter++;
                            break;

                        //Resource Path Lists.
                        case "357EF6D4":
                            ResourcePathListEntry newplen = ResourcePathListEntry.FillRPLEntry(filename, foldernames, tree, br, j, IDCounter);
                            arcfile.arcfiles.Add(newplen);
                            arcfile.FileList.Add(newplen.EntryName);
                            foldernames.Clear();
                            IDCounter++;
                            break;


                        //Materials. Incomplete.                        
                        case "2749C8A8":
                            MaterialEntry Maten = MaterialEntry.FillMatEntry(filename, foldernames, tree, br, j, IDCounter);
                            arcfile.arcfiles.Add(Maten);
                            arcfile.FileList.Add(Maten.EntryName);
                            foldernames.Clear();
                            IDCounter++;
                            arcfile.MaterialCount++;
                            break;
                            

                        //LMT Files.
                        case "76820D81":
                            LMTEntry LMTen = LMTEntry.FillLMTEntry(filename, foldernames, tree, br, j, IDCounter);
                            arcfile.arcfiles.Add(LMTen);
                            arcfile.FileList.Add(LMTen.EntryName);
                            foldernames.Clear();
                            IDCounter++;
                            break;
                        
                        //MSD Files.
                        case "5B55F5B1":
                            MSDEntry newmsden = MSDEntry.FillMSDEntry(filename, foldernames, tree, br, Bytes, j, IDCounter);
                            arcfile.arcfiles.Add(newmsden);
                            arcfile.FileList.Add(newmsden.EntryName);
                            foldernames.Clear();
                            IDCounter++;
                            break;

                        //CST Files.
                        case "326F732E":
                            ChainListEntry CSTen = ChainListEntry.FillCSTEntry(filename, foldernames, tree, br, j, IDCounter);
                            arcfile.arcfiles.Add(CSTen);
                            arcfile.FileList.Add(CSTen.EntryName);
                            foldernames.Clear();
                            IDCounter++;
                            break;

                        //CHN Files.
                        case "3E363245":
                            ChainEntry CHNen = ChainEntry.FillChainEntry(filename, foldernames, tree, br, j, IDCounter);
                            arcfile.arcfiles.Add(CHNen);
                            arcfile.FileList.Add(CHNen.EntryName);
                            foldernames.Clear();
                            IDCounter++;
                            break;

                        //CCL Files.
                        case "0026E7FF":
                            ChainCollisionEntry CCLen = ChainCollisionEntry.FillChainCollEntry(filename, foldernames, tree, br, j, IDCounter);
                            arcfile.arcfiles.Add(CCLen);
                            arcfile.FileList.Add(CCLen.EntryName);
                            foldernames.Clear();
                            IDCounter++;
                            break;

                        //MOD Files.
                        case "58A15856":
                            ModelEntry MODen = ModelEntry.FillModelEntry(filename, foldernames, tree, br, j, IDCounter);
                            arcfile.arcfiles.Add(MODen);
                            arcfile.FileList.Add(MODen.EntryName);
                            foldernames.Clear();
                            IDCounter++;
                            break;

                        case "361EA2A5":
                            MissionEntry MISen = MissionEntry.FillMissionEntry(filename, foldernames, tree, br, j, IDCounter);
                            arcfile.arcfiles.Add(MISen);
                            arcfile.FileList.Add(MISen.EntryName);
                            foldernames.Clear();
                            IDCounter++;
                            break;

                        //Gem Files.
                        case "448BBDD4":
                           GemEntry GEMen = GemEntry.FillGEMEntry(filename, foldernames, tree, br, j, IDCounter);
                           arcfile.arcfiles.Add(GEMen);
                           arcfile.FileList.Add(GEMen.EntryName);
                           foldernames.Clear();
                           IDCounter++;
                           break;

                        //EFL Files.
                        case "6D5AE854":
                           EffectListEntry EFLen = EffectListEntry.FillEFLEntry(filename, foldernames, tree, br, j, IDCounter);
                           arcfile.arcfiles.Add(EFLen);
                           arcfile.FileList.Add(EFLen.EntryName);
                           foldernames.Clear();
                           IDCounter++;
                           break;
                        

                        //New Formats go like this!   
                        /*
                        case "********":
                           *****Entry ****en = *****Entry.Fill*****Entry(filename, foldernames, tree, br, j, IDCounter);
                           arcfile.arcfiles.Add(*****en);
                           arcfile.FileList.Add(*****.EntryName);
                           foldernames.Clear();
                           IDCounter++;
                           break;
                        */

                        default:
                            //Everything not listed above.
                            ArcEntry newentry = ArcEntry.FillArcEntry(filename, foldernames, tree, br, j, IDCounter);
                            arcfile.arcfiles.Add(newentry);
                            arcfile.FileList.Add(newentry.EntryName);
                            foldernames.Clear();
                            IDCounter++;
                            break;
                    }
                }

                arcfile._FileAmount = Convert.ToUInt16(IDCounter);                

                br.Close();
            }

            return arcfile;

            #endregion

        }