コード例 #1
0
        private void openTOC(TOCHandler tocHnd)
        {
            treeViewTOC.BeginUpdate();
            treeViewTOC.Nodes.Clear();

            foreach (TOCHandler.chunk chunk in tocHnd.chunkList)
            {
                blockToTreeView(chunk);
            }

            treeViewTOC.EndUpdate();
        }
コード例 #2
0
ファイル: TOCEditorAK.cs プロジェクト: Dybuk/ME3Explorer
        private void blockToTreeView(TOCHandler.chunk block, TreeNode selNode = null)
        {
            int blockIdx = tocHnd.chunkList.IndexOf(block);
            string blockText = "Block " + (blockIdx + 1) + ": " + block.countNextFiles + " files" +
                ((block.countNextFiles == 0)
                    ? ""
                    : ", relative offset 0x" + block.relPosition.ToString("X4") + ", block size: " + block.globalSize.ToString("#,##0.") + " bytes"
                );
            TreeNode root;
            if (selNode == null)
            {
                root = treeViewTOC.Nodes.Add("Block_" + blockIdx, blockText);
            }
            else
            {
                root = selNode;
                selNode.Nodes.Clear();
                selNode.Text = blockText;
            }
            root.ToolTipText = "Right click to edit block";

            if (block.countNextFiles == 0)
                return;

            int fileCount = 0;
            foreach (TOCHandler.fileStruct fileStruct in block.fileList)
            {
                TreeNode file = root.Nodes.Add(fileStruct.filePath, Path.GetFileName(fileStruct.filePath));
                file.ToolTipText = "Right click to edit file";
                fileCount++;
                if (!File.Exists(ME3Paths.gamePath + fileStruct.filePath))
                {
                    fileStruct.exist = false;
                    file.BackColor = Color.Red;
                }
                file.Nodes.Add("Flag: " + fileStruct.flag.ToString("X4"));
                file.Nodes.Add("Block size: " + fileStruct.blockSize + " bytes");
                file.Nodes.Add("Full path: " + fileStruct.filePath);
                file.Nodes.Add("File size: " + fileStruct.fileSize.ToString("#,##0.") + " bytes");
                file.Nodes.Add("SHA1 hash: 0x" + BitConverter.ToString(fileStruct.sha1).Replace("-", string.Empty));
            }
        }
コード例 #3
0
ファイル: TOCEditorAK.cs プロジェクト: Dybuk/ME3Explorer
        private void openTOCFile(string tocbin, string gamePath)
        {
            tocHnd = new TOCHandler(tocbin, ME3Paths.gamePath);

            openTOC(tocHnd);
        }