0

For my programe i need decompile a swf ... I use flasm for this !

for my first try i export result in txt file and read this txt

string newPath = Path.GetTempPath() + @"DasLol.txt";

        if(File.Exists(newPath))
        {
            File.Delete(newPath);
        }

        string dasCmd = "/c flasm.exe -d \"" + path + "\" > " + newPath;

        ProcessStartInfo procStartInfo = new ProcessStartInfo(@"C:\Windows\System32\cmd.exe", dasCmd);

        Process flasm = new Process {StartInfo = procStartInfo};

        flasm.Start();
        flasm.WaitForExit();
string dasString = File.ReadAllText(newPath);

but how to redirect de StandardOutput for read directly my "dasString" in console ? ( and don't use a temporary txt )

user1740962
  • 111
  • 2
  • 16
  • See http://stackoverflow.com/questions/285760/how-to-spawn-a-process-and-capture-its-stdout-in-net – Bala R Sep 26 '13 at 17:32

1 Answers1

0

Allow the standard output to be redirected, wait for the process to exit, read it.

procStartInfo.UseShellExecute = false;
procStartInfo.RedirectStandartOutput = true;
...
flasm.WaitForExit();
string output = flasm.StandartOutput.ReadToEnd();
Nikola Dimitroff
  • 6,127
  • 2
  • 25
  • 31