Example #1
0
        private void fileToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.Filter = "ACMD Binary (*.bin)|*.bin| All Files (*.*)|*.*";
                DialogResult result = dlg.ShowDialog();
                if (result == DialogResult.OK)
                {
                    FileName = rootPath = string.Empty;
                    tabControl1.TabPages.Clear();
                    isRoot = false;

                    if ((_curFile = Manager.OpenFile(dlg.FileName)) == null)
                    {
                        return;
                    }

                    FileTree.BeginUpdate();
                    foreach (CommandList cml in _curFile.EventLists.Values)
                    {
                        FileTree.Nodes.Add(new CommandListNode($"[{cml.AnimationCRC:X8}]", cml));
                    }
                    FileTree.EndUpdate();

                    FileName = dlg.FileName;
                    Text     = $"Main Form - {FileName}";
                }
            }
        }
Example #2
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (_nodeCache == null)
            {
                _nodeCache = new TreeNode[FileTree.Nodes.Count];
                FileTree.Nodes.CopyTo(_nodeCache, 0);
            }
            bool addAll = string.IsNullOrEmpty(textBox1.Text);

            FileTree.BeginUpdate();
            FileTree.Nodes.Clear();

            foreach (TreeNode root in _nodeCache)
            {
                TreeNode n = (TreeNode)root.Clone();
                n.Nodes.Clear();
                foreach (TreeNode leaf in root.Nodes)
                {
                    if (addAll || leaf.Text.Contains(textBox1.Text, StringComparison.OrdinalIgnoreCase))
                    {
                        n.Nodes.Add(leaf);
                    }
                }
                FileTree.Nodes.Add(n);
            }
            FileTree.ExpandAll();
            FileTree.EndUpdate();
        }
Example #3
0
        private void fighterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FileName = rootPath = String.Empty;
            _curFile = null;
            FileTree.Nodes.Clear();
            tabControl1.TabPages.Clear();
            isRoot = true;

            FolderSelectDialog dlg = new FolderSelectDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                FileTree.BeginUpdate();
                _curFighter = _manager.OpenFighter(dlg.SelectedPath);
                TreeNode nScript = new TreeNode("AnimCmd");
                foreach (uint u in from uint u in _curFighter.MotionTable where u != 0 select u)
                {
                    nScript.Nodes.Add(new CommandListGroup(_curFighter, u)
                    {
                        ToolTipText = $"[{u:X8}]"
                    });
                }
                TreeNode nParams = new TreeNode("Params");
                TreeNode nMscsb  = new TreeNode("MSCSB");
                FileTree.Nodes.AddRange(new TreeNode[] { nScript, nParams, nMscsb });
                FileTree.EndUpdate();

                Runtime.isRoot        = true;
                Runtime.rootPath      = dlg.SelectedPath;
                Runtime.Instance.Text = String.Format("Main Form - {0}", dlg.SelectedPath);
            }
        }
Example #4
0
 private void OpenFile(string Path)
 {
     m_workingpath = Path;
     m_workingfile.Open(m_workingpath);
     FileTree.BeginUpdate();
     FileTree.Nodes.Clear();
     foreach (TenshiEntry i in m_workingfile.Entries)
     {
         AddNode(i);
     }
     FileTree.EndUpdate();
 }
Example #5
0
        public void OpenWorkspace(string wrkspce)
        {
            Manager.ReadWRKSPC(wrkspce);
            List <TreeNode> col = new List <TreeNode>();

            FileTree.BeginUpdate();
            foreach (Project p in Manager.Projects)
            {
                _curFighter = Manager.OpenFighter(p.ACMDPath);
                _curFighter.AnimationHashPairs = Manager.getAnimNames(p.AnimationFile);

                string name = $"{p.ProjectName} - [{(p.ProjectType == ProjType.Fighter ? "Fighter" : "Weapon")}]";

                TreeNode pNode = new TreeNode(name);

                TreeNode Actions    = new TreeNode("MSCSB (ActionScript)");
                TreeNode ACMD       = new TreeNode("ACMD (AnimCmd)");
                TreeNode Weapons    = new TreeNode("Weapons");
                TreeNode Parameters = new TreeNode("Parameters");


                foreach (uint u in _curFighter.MotionTable)
                {
                    if (u == 0)
                    {
                        continue;
                    }

                    CommandListGroup g = new CommandListGroup(_curFighter, u)
                    {
                        ToolTipText = $"[{u:X8}]"
                    };

                    if (AnimHashPairs.ContainsKey(u))
                    {
                        g.Text = AnimHashPairs[u];
                    }

                    ACMD.Nodes.Add(g);
                }

                pNode.Nodes.AddRange(new[] { Actions, ACMD, Weapons, Parameters });
                col.Add(pNode);
            }
            FileTree.Nodes.AddRange(col.ToArray());
            Runtime.isRoot = true;
            FileTree.EndUpdate();
        }
Example #6
0
        private void RefreshTree()
        {
            FileTree.BeginUpdate();

            FileTree.Nodes.Clear();

            var rootNode = new TreeNode();

            _nodes      = new Dictionary <string, TreeNode>(StringComparer.InvariantCultureIgnoreCase);
            _nodes["/"] = rootNode;

            if (_currentEnvironment != null)
            {
                rootNode.Text = _currentEnvironment.Name;
                var dirs = new[] { _currentEnvironment.BaseFolder, _currentEnvironment.ModFolder }
                .Where(x => !String.IsNullOrWhiteSpace(x) && Directory.Exists(x))
                .Distinct()
                .Select(x => new DirectoryInfo(x))
                .ToList();
                AddTreeNodes(rootNode, dirs);
            }
            else
            {
                rootNode.Text = "No environment";
            }

            FileTree.Nodes.Add(rootNode);

            if (_currentFile != null && _nodes.ContainsKey(_currentFile))
            {
                var currentNode = _nodes[_currentFile];
                while (currentNode != rootNode && currentNode != null)
                {
                    currentNode.Expand();
                    currentNode = currentNode.Parent;
                }

                FileTree.SelectedNode = _nodes[_currentFile];
                FileTree.SelectedNode.EnsureVisible();
            }

            FileTree.EndUpdate();
        }
Example #7
0
 /* Clear the UI */
 private void ClearUI(bool clear_flowgraph_list, bool clear_node_list, bool clear_parameter_list)
 {
     if (clear_flowgraph_list)
     {
         FileTree.BeginUpdate();
         FileTree.Nodes.Clear();
         FileTree.EndUpdate();
         first_executed_flowgraph.Text = "Entry point: ";
         flowgraph_count.Text          = "Flowgraph count: ";
     }
     if (clear_node_list)
     {
         node_search_box.Text = "";
         currentSearch        = "";
         groupBox1.Text       = "Selected Flowgraph Content";
         flowgraph_content.BeginUpdate();
         flowgraph_content.Items.Clear();
         flowgraph_content_RAW.Clear();
         flowgraph_content.EndUpdate();
         CurrentInstance.selectedFlowgraph = null;
         editFlowgraphResources.Visible    = false;
     }
     if (clear_parameter_list)
     {
         CurrentInstance.selectedEntity      = null;
         selected_node_id.Text               = "";
         selected_node_type.Text             = "";
         selected_node_type_description.Text = "";
         selected_node_name.Text             = "";
         for (int i = 0; i < NodeParams.Controls.Count; i++)
         {
             NodeParams.Controls[i].Dispose();
         }
         NodeParams.Controls.Clear();
         node_children.Items.Clear();
         currentlyShowingChildLinks         = true;
         node_to_flowgraph_jump.Visible     = false;
         editCAGEAnimationKeyframes.Visible = false;
         editNodeResources.Visible          = false;
     }
 }
Example #8
0
        private async Task TreeView_LoadRoots()
        {
            FileTree.Nodes.Clear();
            FileTree.BeginUpdate();
            var rootNode = new TreeNode(Environment.MachineName, 3, 3)
            {
                Tag         = FactoryConstants.PC,
                ToolTipText = Environment.MachineName,
                Name        = Environment.MachineName
            };

            FileTree.EndUpdate();
            var nodes = await TreeNodeFactory.GetRootNodesAsync();

            FileTree.BeginUpdate();
            foreach (var node in nodes)
            {
                rootNode.Nodes.Add(node);
            }
            FileTree.Nodes.Add(rootNode);
            FileTree.EndUpdate();
        }
Example #9
0
        private void parseAnimationsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (fsDlg.ShowDialog() == DialogResult.OK)
            {
                FileTree.BeginUpdate();

                var      dict = Runtime.ParseAnimations(fsDlg.SelectedPath);
                TreeNode n;
                if ((n = FileTree.Nodes.Find("nACMD", false).FirstOrDefault()) != null)
                {
                    foreach (ScriptNode node in n.Nodes)
                    {
                        if (dict.ContainsKey(node.Identifier))
                        {
                            node.Text = $"{node.Index:X} - {dict[node.Identifier]}";
                        }
                    }
                }

                FileTree.EndUpdate();
            }
        }
Example #10
0
        private void fighterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderSelectDialog dlg = new FolderSelectDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                FileName = rootPath = String.Empty;
                _curFile = null;
                FileTree.Nodes.Clear();
                tabControl1.TabPages.Clear();
                isRoot = true;

                FileTree.BeginUpdate();
                _curFighter = _manager.OpenFighter(dlg.SelectedPath);
                TreeNode nScript = new ACMDNode()
                {
                    Text = "ACMD"
                };

                for (int i = 0; i < _curFighter.MotionTable.Count; i++)
                {
                    uint CRC = _curFighter.MotionTable[i];
                    nScript.Nodes.Add(new CommandListGroup(_curFighter, CRC)
                    {
                        Text = $"{i:X}-[{CRC:X8}]"
                    });
                }
                TreeNode nParams = new TreeNode("Params");
                TreeNode nMscsb  = new TreeNode("MSCSB");
                FileTree.Nodes.AddRange(new TreeNode[] { nScript, nParams, nMscsb });
                FileTree.EndUpdate();

                cboMode.SelectedIndex = (int)Runtime.WorkingEndian;
                cboMode.Enabled       = true;
                Runtime.isRoot        = true;
                Runtime.rootPath      = dlg.SelectedPath;
                Runtime.Instance.Text = String.Format("Main Form - {0}", dlg.SelectedPath);
            }
        }
Example #11
0
        private void fileToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.Filter = "ACMD Binary (*.bin)|*.bin| All Files (*.*)|*.*";
                DialogResult result = dlg.ShowDialog();
                if (result == DialogResult.OK)
                {
                    FileName = rootPath = string.Empty;
                    tabControl1.TabPages.Clear();
                    FileTree.Nodes.Clear();
                    isRoot = false;

                    if ((_curFile = Manager.OpenFile(dlg.FileName)) == null)
                    {
                        return;
                    }

                    FileTree.BeginUpdate();
                    TreeNode root = new ACMDNode()
                    {
                        Text = "ACMD"
                    };
                    for (int i = 0; i < _curFile.EventLists.Count; i++)
                    {
                        ACMDScript cml = _curFile.EventLists.Values[i];
                        root.Nodes.Add(new CommandListNode($"{i:X}-[{cml.AnimationCRC:X8}]", cml));
                    }
                    FileTree.Nodes.Add(root);
                    FileTree.EndUpdate();

                    cboMode.Enabled       = true;
                    cboMode.SelectedIndex = (int)Runtime.WorkingEndian;

                    FileName = dlg.FileName;
                    Text     = $"Main Form - {FileName}";
                }
            }
        }
Example #12
0
        public void MakeFileTree()
        {
            FileTree.Nodes.Clear();

            treeNodesAndSubfiles = new Dictionary <TreeNode, Subfile>();
            foldersProcessed     = new Dictionary <string, TreeNode>();


            FileTree.BeginUpdate();

            List <Subfile> subfiles = global.activePackage.subfiles;


            foreach (Subfile file in subfiles)
            {
                //now add entries to the file tree

                List <string> dirs = new List <string>();

                string tempfilepath = Path.GetFileName(global.activePackage.filename).Replace("/", "");;


                if (file.filename[0] != '/')
                {
                    tempfilepath += "/";
                }
                tempfilepath += file.filename;

                if (tempfilepath[tempfilepath.Length - 1] == '/')
                {
                    tempfilepath.Remove(tempfilepath.Length - 1);
                }

                if (tempfilepath[0] == '/')
                {
                    tempfilepath = tempfilepath.Substring(1, tempfilepath.Length - 1);
                }

                int number_of_dir_levels = tempfilepath.Split('/').Length;

                for (int d = 0; d < number_of_dir_levels - 1; d++)  //store a string for each level of the directory, so that we can check each folder individually (by this I mean checking whether or not it already exists in the tree)
                {
                    dirs.Add(Path.GetDirectoryName(tempfilepath));
                    tempfilepath = Path.GetDirectoryName(tempfilepath);

                    if (tempfilepath[tempfilepath.Length - 1] == '/')
                    {
                        tempfilepath.Remove(tempfilepath.Length - 1);
                    }
                }

                bool     isRoot     = true;
                TreeNode newestNode = new TreeNode();

                for (int f = dirs.Count - 1; f >= 0; f--)
                {
                    if (!foldersProcessed.Keys.Contains(dirs[f].ToLower()))    //if the folder isn't in the tree yet
                    {
                        if (!isRoot)
                        {   //add to the chain of nodes
                            FileTree.SelectedNode         = newestNode;
                            newestNode                    = new TreeNode(Path.GetFileName(dirs[f]));
                            newestNode.ImageIndex         = 0;
                            newestNode.SelectedImageIndex = 0;
                            FileTree.SelectedNode.Nodes.Add(newestNode);
                        }
                        else
                        { //create a root node first
                            newestNode                    = new TreeNode(Path.GetFileName(dirs[f]));
                            newestNode.ImageIndex         = 0;
                            newestNode.SelectedImageIndex = 0;
                            FileTree.Nodes.Add(newestNode);
                            isRoot = false;
                        }

                        foldersProcessed.Add(dirs[f].ToLower(), newestNode);  //add it to the list of folders we've put in the tree
                    }
                    else
                    {
                        newestNode                    = foldersProcessed[dirs[f].ToLower()]; //set the parent node of the next folder to the existing node
                        newestNode.ImageIndex         = 0;
                        newestNode.SelectedImageIndex = 0;
                        FileTree.SelectedNode         = newestNode;
                        isRoot = false;
                    }
                }
                FileTree.SelectedNode         = newestNode;
                newestNode                    = new TreeNode(Path.GetFileName(file.filename));
                newestNode.ImageIndex         = 1;
                newestNode.SelectedImageIndex = 1;
                FileTree.SelectedNode.Nodes.Add(newestNode);
                file.treeNode = newestNode;
                treeNodesAndSubfiles.Add(newestNode, file);
            }

            FileTree.Sort();
            FileTree.CollapseAll();
            FileTree.EndUpdate();
        }
Example #13
0
        ////// まとめてテキスト化終了



        /// <summary>
        /// fighterをまとめて開く!!!!
        /// </summary>

        private void fighterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderSelectDialog dlg = new FolderSelectDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                FileName = rootPath = String.Empty;
                _curFile = null;
                FileTree.Nodes.Clear();
                tabControl1.TabPages.Clear();
                isRoot = true;

                string fightername = System.IO.Path.GetFileName(dlg.SelectedPath); //見るファイターの名前
                Console.WriteLine(dlg.SelectedPath);

                FileTree.BeginUpdate();

                if (System.IO.File.Exists(dlg.SelectedPath + "\\game.bin")) //直下にgame.binがなければbodyまで下りる
                {
                    _curFighter = _manager.OpenFighter(dlg.SelectedPath);
                }
                else
                {
                    _curFighter = _manager.OpenFighter(dlg.SelectedPath + "\\script\\animcmd\\body");
                }

                TreeNode nScript = new ACMDNode()
                {
                    Text = "ACMD"
                };

                for (int i = 0; i < _curFighter.MotionTable.Count; i++)
                {
                    uint CRC = _curFighter.MotionTable[i];
                    nScript.Nodes.Add(new ScriptGroupNode(_curFighter, CRC)
                    {
                        Text = $"{i:X}-[{CRC:X8}]"
                    });
                }
                TreeNode nParams = new TreeNode("Params");
                TreeNode nMscsb  = new TreeNode("MSCSB");
                FileTree.Nodes.AddRange(new TreeNode[] { nScript, nParams, nMscsb });
                FileTree.EndUpdate();

                cboMode.SelectedIndex = (int)Runtime.WorkingEndian;
                cboMode.Enabled       = true;
                Runtime.isRoot        = true;
                Runtime.rootPath      = dlg.SelectedPath;
                Runtime.Instance.Text = String.Format("Main Form - {0}", dlg.SelectedPath);


                //parseディレクトリの読込
                StreamReader sr = new StreamReader(
                    System.Environment.CurrentDirectory + "\\fighter_directory.ini", Encoding.GetEncoding("utf-8"));

                string text = sr.ReadLine();

                sr.Close();
                Console.WriteLine(text);
                Console.WriteLine(text + "\\" + fightername + "\\motion");
                parseAnimations(text + "\\" + fightername + "\\motion");
            }
        }
Example #14
0
        ////// まとめてテキスト化
        private void AllText_ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //parseディレクトリの読込
            StreamReader sr2 = new StreamReader(
                System.Environment.CurrentDirectory + "\\fighter_directory.ini", Encoding.GetEncoding("utf-8"));
            string parse = sr2.ReadLine();

            sr2.Close();

            StreamReader sr = new StreamReader(
                System.Environment.CurrentDirectory + "\\charlist.txt", Encoding.GetEncoding("utf-8")); //キャラ名リストopen

            string basePath = "";

            FolderBrowserDialog dlg = new FolderBrowserDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                basePath = dlg.SelectedPath;
                Console.WriteLine(basePath);
            }


            string prepath = parse; //fighterフォルダ

            while (sr.Peek() > -1)
            {
                string fightername = sr.ReadLine(); //キャラ名読み込み
                Console.WriteLine(fightername);

                string charpath = prepath + "\\" + fightername; //作業フォルダcharpath

                FileName = rootPath = String.Empty;
                _curFile = null;
                FileTree.Nodes.Clear();
                tabControl1.TabPages.Clear();
                isRoot = true;

                FileTree.BeginUpdate();

                if (System.IO.File.Exists(charpath + "\\game.bin")) //直下にgame.binがなければbodyまで下りる
                {
                    _curFighter = _manager.OpenFighter(charpath);
                }
                else
                {
                    _curFighter = _manager.OpenFighter(charpath + "\\script\\animcmd\\body");
                }

                TreeNode nScript = new ACMDNode()
                {
                    Text = "ACMD"
                };

                for (int i = 0; i < _curFighter.MotionTable.Count; i++)
                {
                    uint CRC = _curFighter.MotionTable[i];
                    nScript.Nodes.Add(new ScriptGroupNode(_curFighter, CRC)
                    {
                        Text = $"{i:X}-[{CRC:X8}]"
                    });
                }
                TreeNode nParams = new TreeNode("Params");
                TreeNode nMscsb  = new TreeNode("MSCSB");
                FileTree.Nodes.AddRange(new TreeNode[] { nScript, nParams, nMscsb });
                FileTree.EndUpdate();

                cboMode.SelectedIndex = (int)Runtime.WorkingEndian;
                cboMode.Enabled       = true;
                Runtime.isRoot        = true;
                Runtime.rootPath      = charpath;
                Runtime.Instance.Text = String.Format("Main Form - {0}", charpath);

                parseAnimations(parse + "\\" + fightername + "\\motion");

                // テキスト出力
                string filePath = fightername + "\\" + fightername + ".txt"; //bodyを開いている場合はこう

                DirectoryUtils.SafeCreateDirectory(basePath + "\\" + fightername);

                //2つのパスを結合する
                string absolutePath = System.IO.Path.Combine(basePath, filePath);
                //結果を表示する

                using (StreamWriter writer = new StreamWriter(absolutePath, false, Encoding.UTF8))
                {
                    if (isRoot)//isRoot=trueはfighter,falseはFile
                    {
                        writer.Write(_curFighter.Serialize());
                    }
                    else
                    {
                        writer.Write(_curFile.Serialize());
                    }
                }
                //bodyテキスト入力終了

                //weapon内全て書き出し

                FileName = rootPath = String.Empty;
                _curFile = null;
                FileTree.Nodes.Clear();
                tabControl1.TabPages.Clear();
                isRoot = true;

                FileTree.BeginUpdate();


                //char以下の直下のサブフォルダをすべて取得する
                //ワイルドカード"*"は、すべてのフォルダを意味する

                string weaponpath = charpath + "\\script\\animcmd\\weapon";

                if (System.IO.Directory.Exists(weaponpath))
                {
                    string[] subFolders = System.IO.Directory.GetDirectories(weaponpath, "*");

                    foreach (string preweapon in subFolders)

                    {
                        string weapon = System.IO.Path.GetFileName(preweapon);

                        FileName = rootPath = string.Empty;
                        tabControl1.TabPages.Clear();
                        FileTree.Nodes.Clear();
                        isRoot = false;

                        string weapongame = weaponpath + "\\" + weapon + "\\game.bin";

                        if ((_curFile = Manager.OpenFile(weapongame)) == null)
                        {
                            return;
                        }

                        FileTree.BeginUpdate();
                        TreeNode root = new ACMDNode()
                        {
                            Text = "ACMD"
                        };
                        for (int i = 0; i < _curFile.EventLists.Count; i++)
                        {
                            ACMDScript cml = _curFile.EventLists.Values[i];
                            root.Nodes.Add(new ScriptNode($"{i:X}-[{cml.AnimationCRC:X8}]", cml));
                        }
                        FileTree.Nodes.Add(root);
                        FileTree.EndUpdate();

                        cboMode.Enabled       = true;
                        cboMode.SelectedIndex = (int)Runtime.WorkingEndian;

                        FileName = weapongame;
                        Text     = $"Main Form - {FileName}";

                        // テキスト出力
                        string filePath2 = fightername + "\\" + weapon + ".txt"; //bodyを開いている場合はこう

                        //2つのパスを結合する
                        string absolutePath2 = System.IO.Path.Combine(basePath, filePath2);
                        //結果を表示する
                        // C:\dir\file.txt

                        using (StreamWriter writer = new StreamWriter(absolutePath2, false, Encoding.UTF8))
                        {
                            if (isRoot)//isRoot=trueはfighter,falseはFile
                            {
                                writer.Write(_curFighter.Serialize());
                            }
                            else
                            {
                                writer.Write(_curFile.Serialize());
                            }
                        }
                    }
                }
            }
            sr.Close();
        }