Exemplo n.º 1
0
        /// <summary>
        /// 从文件中查询所有Tpl信息
        /// </summary>
        /// <param name="fileNameInfo"></param>
        private void SearchTplInfo(List <FilePosInfo> fileNameInfo, string folder)
        {
            TreeNode root = new TreeNode();

            root.Text = folder;

            foreach (FilePosInfo item in fileNameInfo)
            {
                if (item.IsFolder)
                {
                    continue;
                }

                if (item.File.EndsWith(".tpl", StringComparison.CurrentCultureIgnoreCase))
                {
                    // 如果是Tpl文件,直接追加
                    root.Nodes.Add(this.GetTplNodeType1(item.File));
                }
                else
                {
                    // 如果不是Tpl文件结尾,查找是否包括Tpl信息
                    List <int> tplList = new List <int>();
                    byte[]     byData  = this.IsTplFile(item.File, tplList);
                    if (byData != null)
                    {
                        root.Nodes.Add(this.GetTplNodeType2(item.File, byData, tplList));
                    }
                }
            }

            SzsViewer szsViewForm = new SzsViewer(root, null, null);

            szsViewForm.Show();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 打开RarcView
        /// </summary>
        private void ShowRarcView()
        {
            // 将文件中的数据,循环读取到byData中
            byte[] byData = File.ReadAllBytes(this.baseFile);

            string strMagic = Util.GetHeaderString(byData, 0, 3);

            if (byData[0] == 0 &&
                byData[1] == 0 &&
                byData[2] == 0 &&
                byData[3] == 0)
            {
                // 生化危机0Message特殊处理
                TreeNode  bio0Tree    = Util.Bio0ArcDecode(byData);
                SzsViewer szsViewForm = new SzsViewer(bio0Tree, byData, this.baseFile);
                szsViewForm.Show();
            }
            else if ("RARC".Equals(strMagic))
            {
                TreeNode  szsFileInfoTree = Util.RarcDecode(byData);
                SzsViewer szsViewForm     = new SzsViewer(szsFileInfoTree, byData, this.baseFile);
                szsViewForm.Show();
            }
            else if ("Uェ8-".Equals(strMagic))
            {
                TreeNode  szsFileInfoTree = Util.U8Decode(byData);
                SzsViewer szsViewForm     = new SzsViewer(szsFileInfoTree, byData, this.baseFile);
                szsViewForm.Show();
            }
            else
            {
                MessageBox.Show("不是正常的arc文件 : " + strMagic);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 文件编辑菜单事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void fileEditorMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            this.fileEditorMenu.Visible = false;
            string       strFolder = string.Empty;
            BaseCompTool compTool  = null;
            BaseComp     comp      = null;

            switch (e.ClickedItem.Name)
            {
            case "btnTresEdit":
                // 打开要分析的文件
                this.baseFile = Util.SetOpenDailog("TXTRES文件(*.txtres, *.dat)|*.txtres;*.dat|所有文件|*.*", string.Empty);
                if (string.IsNullOrEmpty(this.baseFile))
                {
                    return;
                }

                this.Do(this.ShowTresEditerView);
                break;

            case "btnSzsEdit":
                // 打开要分析的文件
                this.baseFile = Util.SetOpenDailog("SZS文件(*.szs)|*.szs|所有文件|*.*", string.Empty);
                if (string.IsNullOrEmpty(this.baseFile))
                {
                    return;
                }

                comp = new MarioYaz0Comp();
                byte[] szsData      = comp.Decompress(baseFile);
                string strFileMagic = Util.GetHeaderString(szsData, 0, 3);
                if ("RARC".Equals(strFileMagic))
                {
                    TreeNode  szsFileInfoTree = Util.RarcDecode(szsData);
                    SzsViewer szsViewForm     = new SzsViewer(szsFileInfoTree, szsData, this.baseFile);
                    szsViewForm.Show(this);
                }
                else
                {
                    MessageBox.Show("不是正常的szs文件 : " + strFileMagic);
                }
                break;

            case "btnArcEdit":
                // 打开要分析的文件
                this.baseFile = Util.SetOpenDailog("ARC文件(*.arc)|*.arc|所有文件|*.*", string.Empty);
                if (string.IsNullOrEmpty(this.baseFile))
                {
                    return;
                }

                this.Do(this.ShowRarcView);
                break;

            case "btnBio0LzEdit":
                compTool = new BaseCompTool(new Bio0LzComp());
                compTool.Show();
                break;

            case "btnBioCvRdxEdit":
                compTool = new BaseCompTool(new BioCvRdxComp());
                compTool.Show();
                break;

            case "btnBioCvAfsEdit":
                BioCvAfsEditor afsTool = new BioCvAfsEditor();
                afsTool.Show();
                break;

            case "btnRleEdit":
                compTool = new BaseCompTool(new ViewtifulJoeRleComp());
                compTool.Show();
                break;
            }
        }