A while ago I asked on StackOverflow for some help with System.Diagnostics.Process. I was unable to make it work correctly to interact with the Flex Compiler Shell (fcsh.exe).
I accepted my own answer where I just gave up on the managed Process class and dealt directly with the Windows API.
Recently someone commented on my answer saying it doesn't work for him or her. I couldn't really help the commentator as my code had evolved a lot since I posted that answer. So I decided to blog about the code I now use.
In my latest code, I created an abstract class, ShellProcess, which should, in theory, allow interacting with any shell. ShellProcess is then sub-classed as FcshProcess. Both classes are shown below.
In this example, I obtain the output of the help command:
In debug, the output is:
List of fcsh commands:
mxmlc arg1 arg2 ... full compilation and optimization; return a target id
compc arg1 arg2 ... full SWC compilation
compile id incremental compilation
clear [id] clear target(s)
info [id] display compile target info
Note that ShellProcess.cs also holds a static class named Kernel32 that contains the API methods, structs and consts. I keep these separate in my project.