private void treeView_DoubleClick(object sender, EventArgs e) { TreeNode node = treeView.SelectedNode; if (node == null) { return; } if (node.Nodes.Count > 0) { foreach (TreeNode child in node.Nodes) { AITree.AIType type = AITree.StringToAIType[child.Text]; string pathIn = AITree.GetFolderPath(node.Text, type, AITree.AISource.work); string pathOut = AITree.GetFolderPath(node.Text, type, AITree.AISource.compiled); aism.AssembleFolder(pathIn, pathOut); } } else if (node.Parent != null) { AITree.AIType type = AITree.StringToAIType[node.Text]; string pathIn = AITree.GetFolderPath(node.Parent.Text, type, AITree.AISource.work); string pathOut = AITree.GetFolderPath(node.Parent.Text, type, AITree.AISource.compiled); aism.AssembleFolder(pathIn, pathOut); } }
private void compileToolStripMenuItem_Click(object sender, EventArgs e) { if (!CheckConfig()) { return; } FighterSelection selector = new FighterSelection(AITree.AISource.work); if (selector.ShowDialog() != DialogResult.OK) { return; } foreach (var ft in selector.selFighters) { foreach (var type in selector.selTypes) { string pathIn = AITree.GetFolderPath(ft, type, AITree.AISource.work); if (Directory.Exists(pathIn)) { string pathOut = AITree.GetFolderPath(ft, type, AITree.AISource.compiled); aism.AssembleFolder(pathIn, pathOut); } } } }
private static void ConsoleMain(string[] args) { //project handling variables AITree tree = null; string[] fighters = new string[0]; bool allFighters = true; AITree.AIType[] types = new AITree.AIType[0]; bool allTypes = true; try { for (int i = 0; i < args.Length; i++) { opcode op = (opcode)Enum.Parse(typeof(opcode), args[i].TrimStart('-')); string notOpenMsg = "ERROR: project must be open for opcode " + args[i]; string notClosedMsg = "ERROR: project must be closed for opcode " + args[i]; switch (op) { case opcode.h: ConsoleHelpText(); break; case opcode.wp: if (tree != null) { throw new Exception(notClosedMsg); } util.workDir = args[++i]; if (!Directory.Exists(util.workDir)) { Directory.CreateDirectory(util.workDir); } break; case opcode.cp: util.compDir = args[++i]; if (!Directory.Exists(util.compDir)) { Directory.CreateDirectory(util.compDir); } break; case opcode.gp: util.gameFtDir = args[++i]; break; case opcode.fl: i++; if (args[i] == "all") { allFighters = true; break; } allFighters = false; fighters = args[i].Split(','); break; case opcode.tl: { i++; if (args[i] == "all") { allTypes = true; break; } allTypes = false; string[] strTypes = args[i].Split(','); List <AITree.AIType> typeList = new List <AITree.AIType>(); for (int j = 0; j < strTypes.Length; j++) { AITree.AIType newType = AITree.StringToAIType[strTypes[j]]; if (!typeList.Contains(newType)) { typeList.Add(newType); } } types = typeList.ToArray(); break; } case opcode.d: aism.DisassembleFile(args[++i], util.workDir); break; case opcode.a: aism.AssembleFolder(args[++i], util.compDir); break; case opcode.po: if (tree != null) { throw new Exception(notClosedMsg); } tree = new AITree(); tree.InitOpenProject(); break; case opcode.pn: { if (tree != null) { throw new Exception(notClosedMsg); } tree = new AITree(); string[] loc_fighters = fighters; AITree.AIType[] loc_types = types; if (allFighters) { List <string> fighterNames = new List <string>(); foreach (string dir in Directory.EnumerateDirectories(util.gameFtDir)) { fighterNames.Add(util.GetFolderName(dir)); } loc_fighters = fighterNames.ToArray(); } if (allTypes) { loc_types = new AITree.AIType[] { AITree.AIType.attack_data, AITree.AIType.param, AITree.AIType.param_nfp, AITree.AIType.script } } ; tree.InitNewProject(loc_fighters, loc_types); break; } case opcode.pac: { if (tree == null) { throw new Exception(notOpenMsg); } string[] loc_fighters = fighters; AITree.AIType[] loc_types = types; if (allFighters) { List <string> fighterNames = new List <string>(); foreach (string dir in Directory.EnumerateDirectories(util.compDir)) { fighterNames.Add(util.GetFolderName(dir)); } loc_fighters = fighterNames.ToArray(); } if (allTypes) { loc_types = new AITree.AIType[] { AITree.AIType.attack_data, AITree.AIType.param, AITree.AIType.param_nfp, AITree.AIType.script } } ; tree.AddProjectFiles(loc_fighters, loc_types, AITree.AISource.compiled); break; } case opcode.pag: { if (tree == null) { throw new Exception(notOpenMsg); } string[] loc_fighters = fighters; AITree.AIType[] loc_types = types; if (allFighters) { List <string> fighterNames = new List <string>(); foreach (string dir in Directory.EnumerateDirectories(util.gameFtDir)) { fighterNames.Add(util.GetFolderName(dir)); } loc_fighters = fighterNames.ToArray(); } if (allTypes) { loc_types = new AITree.AIType[] { AITree.AIType.attack_data, AITree.AIType.param, AITree.AIType.param_nfp, AITree.AIType.script } } ; tree.AddProjectFiles(loc_fighters, loc_types, AITree.AISource.game_file); break; } case opcode.pcm: { if (tree == null) { throw new Exception(notOpenMsg); } string[] loc_fighters = fighters; AITree.AIType[] loc_types = types; if (allFighters) { List <string> fighterNames = new List <string>(); foreach (string dir in Directory.EnumerateDirectories(util.workDir)) { fighterNames.Add(util.GetFolderName(dir)); } loc_fighters = fighterNames.ToArray(); } if (allTypes) { loc_types = new AITree.AIType[] { AITree.AIType.attack_data, AITree.AIType.param, AITree.AIType.param_nfp, AITree.AIType.script } } ; foreach (var ft in loc_fighters) { foreach (var type in loc_types) { string pathIn = AITree.GetFolderPath(ft, type, AITree.AISource.work); if (Directory.Exists(pathIn)) { string pathOut = AITree.GetFolderPath(ft, type, AITree.AISource.compiled); aism.AssembleFolder(pathIn, pathOut); } } } break; } case opcode.pcl: if (tree == null) { throw new Exception(notOpenMsg); } tree = null; break; case opcode.pd: Console.WriteLine("workspace: " + util.workDir); Console.WriteLine("compile: " + util.compDir); Console.WriteLine("game: " + util.gameFtDir); break; case opcode.pt: { if (tree == null) { throw new Exception(notOpenMsg); } foreach (var ft in tree.fighters) { Console.Write(ft.name + ": {"); int count = ft.files.Count; for (int j = 0; j < count; j++) { Console.Write(AITree.AITypeToString[ft.files[j].type]); if (j < count - 1) { Console.Write(", "); } } Console.WriteLine("}"); } break; } } } } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(helpReminder); } }