private static void setupLogging(string[] args)
 {
     if (ArgsExtension.isVerbose(args))
     {
         fabl.globalLogLevel = LogLevel.On;
     }
     else if (ArgsExtension.isSilent(args))
     {
         fabl.globalLogLevel = LogLevel.Error;
     }
     else
     {
         fabl.globalLogLevel = LogLevel.Info;
     }
     fabl.AddAppender(delegate(Logger logger, LogLevel logLevel, string message)
     {
         if (Entitas.CodeGeneration.CodeGenerator.CLI.MainClass._consoleColors.ContainsKey(logLevel))
         {
             Console.ForegroundColor = Entitas.CodeGeneration.CodeGenerator.CLI.MainClass._consoleColors[logLevel];
             Console.WriteLine(message);
             Console.ResetColor();
         }
         else
         {
             Console.WriteLine(message);
         }
     });
 }
        private static void printException(Exception ex, string[] args)
        {
            ReflectionTypeLoadException ex2 = ex as ReflectionTypeLoadException;

            if (ex2 != null)
            {
                Exception[] loaderExceptions = ex2.LoaderExceptions;
                for (int i = 0; i < loaderExceptions.Length; i++)
                {
                    fabl.Error(loaderExceptions[i].ToString());
                }
            }
            else if (ArgsExtension.isVerbose(args))
            {
                fabl.Error(ex.ToString());
            }
            else
            {
                fabl.Error(ex.Message);
            }
        }
Beispiel #3
0
        public override void Run(string[] args)
        {
            string text = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar.ToString() + "Entitas.properties";

            if (ArgsExtension.isForce(args) || !File.Exists(text))
            {
                CodeGeneratorConfig codeGeneratorConfig = new CodeGeneratorConfig();
                Properties          properties          = new Properties(codeGeneratorConfig.defaultProperties);
                //codeGeneratorConfig.Configure(properties);
                string text2 = codeGeneratorConfig.ToString();
                File.WriteAllText(text, text2);
                fabl.Info("Created " + text);
                fabl.Debug(text2);
                new EditConfig().Run(args);
            }
            else
            {
                fabl.Warn(text + " already exists!");
                fabl.Info("Use entitas new -f to overwrite the exiting file.");
                fabl.Info("Use entitas edit to open the exiting file.");
            }
        }