Esempio n. 1
0
File: Tool.cs Progetto: wjindra/wcf
        public static int Main(string[] args)
        {
            try
            {
                // ValidateUICulture() makes sure that this command-line tool can run on RightToLeft systems.
                ValidateUICulture();

                Options     options = Options.ParseArguments(args);
                ToolRuntime runtime = new ToolRuntime(options);
                return((int)runtime.Run());
            }
            catch (ToolArgumentException ae)
            {
                ToolConsole.WriteHeader();
                ToolConsole.WriteToolError(ae);
                return((int)ae.ExitCode);
            }
            catch (ToolRuntimeException re)
            {
                ToolConsole.WriteToolError(re);
                return((int)re.ExitCode);
            }
#pragma warning suppress 56500 // covered by FxCOP
            catch (Exception e)
            {
                if (Tool.IsFatal(e))
                {
                    throw;
                }

                ToolConsole.WriteUnexpectedError(e);
                Tool.FailFast(e.ToString());
                return((int)ToolExitCodes.Unknown); // unreachable code;
            }
        }
Esempio n. 2
0
File: Tool.cs Progetto: wjindra/wcf
        internal static void Assert(bool condition, string message)
        {
            if (!condition)
            {
#if DEBUG
                ToolConsole.WriteError("Please file a bug or report the following issue with this tool:");
                StackTrace st = new StackTrace(true);
                ToolConsole.WriteLine(st.ToString());
#endif
                ToolConsole.WriteUnexpectedError(message);
                Tool.FailFast(message);
            }
        }