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); } }
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}"; } } }
////// まとめてテキスト化終了 /// <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"); } }
////// まとめてテキスト化 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(); }