public static int Main(string[] args) { int left = 0; int top = 0; try { left = Console.CursorLeft; top = Console.CursorTop; } catch { } // suppress bool wantPause = (left == 0 && top == 0); int rc = 0; try { CommandLineSelfExtractor me = new CommandLineSelfExtractor(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); }
public static int Main(string[] args) { int left = 0; int top = 0; try { left = Console.CursorLeft; top = Console.CursorTop; } catch { } // suppress bool wantPause = (left==0 && top==0); int rc = 0; try { CommandLineSelfExtractor me = new CommandLineSelfExtractor(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; }