The program calls the decryptor via the command line, after which the next program is called that brings the decompiled file into a text form, after which the text file is edited and operations are performed in the reverse order (“preparation for compilation” -> compilation). The problem is that the decompilation and the drive to the textual form (as well as the inverse operations) are not time-normalized, in some files 20,000 lines are decompiled, in the other 65,000 lines. Tried to put the divide between operations to close the command line, but it does not work. I tried through Thread, Task.Delay and other options offered on the Internet. Maybe I'm doing something wrong? Here is the code for the class that runs all processes:

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using l2patcher.Modules.SkillGrpEdit; using l2patcher.Engine.EncDec; using System.Threading; using System.Windows.Forms; using System.Diagnostics; namespace l2patcher.Engine.Editing { class EditBegin { public void Prepare(string skillsBTD,string skillsDA, string skillsDI, bool skillsTalis, bool skillsLS, bool skillsCocktail) { Decrypt.l2encdec(); while (CheckProcess()) { Thread.Sleep(100); } //MessageBox.Show("decyrpted!"); DisAsm.l2disasm(); while (CheckProcess()) { Thread.Sleep(100); } //MessageBox.Show("disasm'ed!"); Editor.BuffToDebuff(skillsBTD); while (CheckState() == false) { Thread.Sleep(100); } //MessageBox.Show("added to debuff!"); Editor.DeleteAnimation(skillsDA); while (CheckState() == false) { Thread.Sleep(100); } //MessageBox.Show("deleted animation!"); Editor.ChangeIcons(skillsDI); while (CheckState() == false) { Thread.Sleep(100); } //MessageBox.Show("deleted icons!"); Asm.l2asm(); while (CheckProcess()) { Thread.Sleep(100); } //MessageBox.Show("asm'ed!"); Encrypt.l2encdec(); while (CheckProcess()) { Thread.Sleep(100); } //MessageBox.Show("encyrpted!"); MessageBox.Show("OK"); } bool CheckProcess() { Process[] pname = Process.GetProcessesByName("cmd.exe"); if (pname.Length != 0) { MessageBox.Show(Convert.ToString(pname.Length)); return true; } else { return false; } } bool CheckState() { if (Modules.SkillGrpEdit.Editor.State) { return true; } else { return false; } } } } 
  • var process = new Process() {StartInfo = new ProcessStartInfo("cmd", "arguments")}; process.WaitForExit(); ? - tym32167
  • @ tym32167 thank, works. The main thing is not to forget to run) - Alexandr Nokhrin
  • Well, yes, I wrote from memory, I forgot the details, it's good that they themselves saw about the launch :) - tym32167

0