Esempio n. 1
0
        /// <summary>
        /// Adds a container file's children to a given node collection.
        /// </summary>
        /// <param name="currNode">node collection</param>
        /// <param name="toRead">container file</param>
        private void addChildFiles(TreeNodeCollection currNode, ContainerFile toRead)
        {
            List <string> filenames = toRead.getFilenames();

            for (int i = 0; i < filenames.Count; i++)
            {
                string   filename = filenames[i];
                TreeNode temp     = new TreeNode(filename);
                temp.ContextMenuStrip = treeViewContextMenu;
                if (toRead is AfsLoader || toRead is NblLoader || toRead is MiniAfsLoader) //AFS still doesn't lazy-load, meaning all my performance issues are STILL HERE.
                {
                    PsuFile child = toRead.getFileParsed(i);
                    if (child != null && child is ContainerFile)
                    {
                        addChildFiles(temp.Nodes, (ContainerFile)child);
                    }
                }
                else //NBL chunk as parent
                {
                    RawFile raw = toRead.getFileRaw(i);
                    if (filename.EndsWith(".nbl") || raw.fileheader == "NMLL" || raw.fileheader == "TMLL")
                    {
                        addChildFiles(temp.Nodes, (ContainerFile)toRead.getFileParsed(i));
                    }
                }
                temp.Tag = new object[] { toRead, filename };
                currNode.Add(temp);
            }
        }
Esempio n. 2
0
        /*
         * private void addAfsFiles(TreeNodeCollection currNode, AfsLoader toRead)
         * {
         *  for (int i = 0; i < toRead.fileCount; i++)
         *  {
         *      TreeNode temp = new TreeNode(toRead.afsList[i].fileName);
         *      if (toRead.subPaths[i] != null)
         *      {
         *          addAfsFiles(temp.Nodes, toRead.subPaths[i]);
         *      }
         *      else if (toRead.nblContents[i] != null)
         *      {
         *          temp.Tag = toRead.nblContents[i];
         *          addNblFiles(temp.Nodes, toRead.nblContents[i]);
         *      }
         *      currNode.Add(temp);
         *  }
         * }
         *
         * private void addNblFiles(TreeNodeCollection currNode, NblLoader toRead)
         * {
         *  foreach (NblChunk content in toRead.chunks)
         *  {
         *      currNode.Add(content.chunkID + " chunk");
         *      foreach (RawFile currFile in content.fileContents)
         *      {
         *          TreeNode temp = new TreeNode(currFile.filename);
         *          temp.Tag = new object[]{content, currFile.filename};//currFile.toRead.nmllFiles[i].actualFile;
         *          temp.ContextMenuStrip = treeViewContextMenu;
         *          if (temp.Text.Contains(".nbl") || currFile.fileheader == "NMLL")
         *          {
         *              addNblFiles(temp.Nodes, (NblLoader)content.getFileParsed(currFile.filename));
         *          }
         *          currNode[0].Nodes.Add(temp);
         *      }
         *  }
         *  /*
         *  currNode.Add("NMLL chunk");
         *  for (int i = 0; i < toRead.nmllFiles.Length; i++)
         *  {
         *      TreeNode temp = new TreeNode(toRead.nmllFiles[i].fileName);
         *      temp.Tag = toRead.nmllFiles[i].actualFile;
         *      temp.ContextMenuStrip = treeViewContextMenu;
         *      if (temp.Text.Contains(".nbl") || toRead.nmllFiles[i].actualFile.GetType() == typeof(NblLoader))
         *      {
         *          addNblFiles(temp.Nodes, (NblLoader)toRead.nmllFiles[i].actualFile);
         *      }
         *      currNode[0].Nodes.Add(temp);
         *  }
         *  if (toRead.tmllFiles != null && toRead.tmllFiles.Length > 0)
         *  {
         *      currNode.Add("TMLL chunk");
         *      for (int i = 0; i < toRead.tmllFiles.Length; i++)
         *      {
         *          TreeNode temp = new TreeNode(toRead.tmllFiles[i].fileName);
         *          temp.Tag = toRead.tmllFiles[i].actualFile;
         *          currNode[1].Nodes.Add(temp);
         *      }
         *  }
         * }*/


        private void setRightPanel(PsuFile toRead)
        {
            splitContainer1.Panel2.Controls.Clear();
            currentRight = toRead;
            UserControl toAdd = new UserControl();

            if (toRead is TextureFile)
            {
                toAdd = new XvrViewer((TextureFile)toRead);
            }
            else if (toRead.GetType() == typeof(PointeredFile))
            {
                toAdd = new PointeredFileViewer((PointeredFile)toRead);
            }
            else if (toRead.GetType() == typeof(PointeredFile360))
            {
                toAdd = new PointeredFileViewer((PointeredFile360)toRead);
            }
            else if (toRead.GetType() == typeof(ListFile))
            {
                toAdd = new ListFileViewer((ListFile)toRead);
            }
            else if (toRead.GetType() == typeof(XntFile))
            {
                toAdd = new XntFileViewer((XntFile)toRead);
            }
            else if (toRead.GetType() == typeof(NomFile))
            {
                toAdd = new NomFileViewer((NomFile)toRead);
            }
            else if (toRead.GetType() == typeof(EnemyLayoutFile))
            {
                toAdd = new EnemyLayoutViewer((EnemyLayoutFile)toRead);
            }
            else if (toRead.GetType() == typeof(ItemTechParamFile))
            {
                toAdd = new ItemTechParamViewer((ItemTechParamFile)toRead);
            }
            else if (toRead.GetType() == typeof(ItemSkillParamFile))
            {
                toAdd = new ItemSkillParamViewer((ItemSkillParamFile)toRead);
            }
            else if (toRead.GetType() == typeof(ItemBulletParamFile))
            {
                toAdd = new ItemBulletParamViewer((ItemBulletParamFile)toRead);
            }
            else if (toRead.GetType() == typeof(RmagBulletParamFile))
            {
                toAdd = new RmagBulletViewer((RmagBulletParamFile)toRead);
            }
            else if (toRead.GetType() == typeof(TextFile))
            {
                toAdd = new TextViewer((TextFile)toRead);
            }
            else if (toRead.GetType() == typeof(ScriptFile))
            {
                toAdd = new ScriptFileViewer((ScriptFile)toRead);
            }
            else if (toRead.GetType() == typeof(EnemyLevelParamFile))
            {
                toAdd = new EnemyStatEditor((EnemyLevelParamFile)toRead);
            }
            else if (toRead.GetType() == typeof(WeaponListFile))
            {
                toAdd = new WeaponListEditor((WeaponListFile)toRead);
            }
            else if (toRead.GetType() == typeof(PartsInfoFile))
            {
                toAdd = new PartsInfoViewer((PartsInfoFile)toRead);
            }
            else if (toRead.GetType() == typeof(ItemPriceFile))
            {
                toAdd = new ItemPriceViewer((ItemPriceFile)toRead);
            }
            else if (toRead.GetType() == typeof(EnemyDropFile))
            {
                toAdd = new EnemyDropViewer((EnemyDropFile)toRead);
            }
            else if (toRead.GetType() == typeof(SetFile))
            {
                toAdd = new SetFileViewer((SetFile)toRead);
            }
            else if (toRead.GetType() == typeof(ThinkDragonFile))
            {
                toAdd = new ThinkDragonViewer((ThinkDragonFile)toRead);
            }
            else if (toRead.GetType() == typeof(WeaponParamFile))
            {
                toAdd = new WeaponParamViewer((WeaponParamFile)toRead);
            }
            else if (toRead.GetType() == typeof(ItemSuitParamFile))
            {
                toAdd = new ClothingFileViewer((ItemSuitParamFile)toRead);
            }
            else if (toRead.GetType() == typeof(ItemUnitParamFile))
            {
                toAdd = new UnitParamViewer((ItemUnitParamFile)toRead);
            }
            else if (toRead.GetType() == typeof(EnemyLevelParamFile))
            {
                toAdd = new EnemyStatEditor((EnemyLevelParamFile)toRead);
            }
            else if (toRead.GetType() == typeof(CommonInfoFile))
            {
                toAdd = new ItemCommonInfoViewer((CommonInfoFile)toRead);
            }
            else if (toRead.GetType() == typeof(QuestListFile))
            {
                toAdd = new QuestListViewer((QuestListFile)toRead);
            }
            else if (toRead.GetType() == typeof(UnpointeredFile))
            {
                toAdd = new UnpointeredFileViewer((UnpointeredFile)toRead);
            }
            splitContainer1.Panel2.Controls.Add(toAdd);
            toAdd.Dock = DockStyle.Fill;
        }