Exemplo n.º 1
0
        public static int Main(String[] args)
        {
            Dictionary <String, String> switches = ArgsUtil.parseDictionary(ref args);

            try
            {
                if (switches.hasAny("-h", "--help"))
                {
                    return(printUsage());
                }
                if (switches.hasAny("-v", "--version"))
                {
                    return(runVersion());
                }
                if (switches.hasAny("-vs", "--verboseSettings"))
                {
                    return(runVerboseSettings(switches, args));
                }

                // Reads settings file
                SettingsYaml.parseSetting();

                // Undocumented flag / used for testing
                String example = switches.value("-e", "--example");
                if (example != null)
                {
                    return(runExample(example, switches, args));
                }

                return(runCSharp(switches, args));
            }
            catch (Exception e)
            {
                while (e.InnerException != null)
                {
                    e = e.InnerException;
                }
                Console.WriteLine(e.Message);
                if (switches.hasAny("-d", "--debug"))
                {
                    Console.WriteLine(e.StackTrace);
                }
                return(1);
            }
        }
Exemplo n.º 2
0
        private static int runVerboseSettings(Dictionary <String, String> switches, String[] args)
        {
            bool success = SettingsYaml.parseSetting(verboseSettings: true);

            if (success)
            {
                Console.WriteLine("\nShowing settings as configured from settings file:\n");
            }
            else
            {
                Console.WriteLine("\nShowing default settings of application:\n");
            }

            SettingsYaml sy = new SettingsYaml();

            sy.serializeSettings(Console.Out, SettingsHome.settingsFactory.buildSettings());
            return(0);
        }
Exemplo n.º 3
0
        public static int Main(String[] args)
        {
            Dictionary <String, String> switches = ArgsUtil.parseDictionary(ref args);

            try
            {
                if (switches.hasAny("-h", "--help"))
                {
                    return(printUsage());
                }
                if (switches.hasAny("-v", "--version"))
                {
                    return(runVersion());
                }
                if (switches.hasAny("-vs", "--verboseSettings"))
                {
                    return(runVerboseSettings(switches, args));
                }

                // Reads settings file
                SettingsYaml.parseSetting();

                return(runYaml(switches, args));
            }
            catch (Exception e)
            {
                while (e.InnerException != null)
                {
                    e = e.InnerException;
                }
                Console.WriteLine(e.Message);
                if (switches.hasAny("-d", "--debug"))
                {
                    Console.WriteLine(e.StackTrace);
                }
                return(1);
            }
        }