public static int Main(string[] args) { int rc = 0; try { SelfExtractor me = new SelfExtractor(args); rc = me.Run(); } catch (System.Exception exc1) { Console.WriteLine("Exception while extracting: {0}", exc1.ToString()); rc = 255; } return(rc); }
public static int Main(string[] args) { int left = Console.CursorLeft; int top = Console.CursorTop; bool wantPause = (left == 0 && top == 0); int rc = 0; try { SelfExtractor me = new SelfExtractor(args); // Hide my own console window if there is no parent console // (which means, it was launched rom explorer). if (!me.Verbose) { IntPtr myHandle = Process.GetCurrentProcess().MainWindowHandle; ShowWindow(myHandle, SW_HIDE); } rc = me.Run(); // If there was an error, and this is a new console, and // we're still displaying the console, then do a // ReadLine. This gives the user a chance to read the // window error messages before dismissing. if (rc != 0 && wantPause && me.Verbose) { //Console.WriteLine("rc({0}) wantPause({1}) verbose({2})", rc, wantPause, me.Verbose); Console.Write("<ENTER> to continue..."); Console.ReadLine(); } } catch (System.Exception exc1) { Console.WriteLine("Exception while extracting: {0}", exc1.ToString()); rc = 255; } FreeConsole(); return(rc); }