Exemple #1
0
        private static bool DoProcessOptions(GetOptions options)
        {
            bool processed = true;

            if (options.Has("-help"))
            {
                DoShowHelp(options);
            }

            else if (options.Has("-version"))
            {
                DoShowVersion();
            }

            else if (options.Has("-usage"))
            {
                DoShowUsage();
            }

#if DEBUG
            else if (options.Has("-check-xml"))
            {
                CheckXml checker = new CheckXml();
                checker.Check();
            }
            else if (options.Has("-generate-html-violations"))
            {
                ViolationDatabase.Init();

                HtmlViolations html = new HtmlViolations();
                html.Write(options.Value("-generate-html-violations"));
            }
            else if (options.Has("-dump-strings"))
            {
                string assemblyPath = options.Operands[0];
                DumpStrings.Dump(assemblyPath);
            }
#endif
            else
            {
                processed = false;
            }

            return(processed);
        }
Exemple #2
0
        private static void DoPostOptionsInit(GetOptions options, string[] args)
        {
            if (options.Has("-not-localized"))
            {
                Settings.Add("*localized*", "false");
            }

            Log.Init(options.Has("-append"));
            Log.InfoLine(true, "started up on {0}, version {1}", DateTime.Now, Assembly.GetExecutingAssembly().GetName().Version);
            Log.InfoLine(true, "arguments are '{0}'", string.Join(", ", args));

            string paths = Settings.Get("custom", string.Empty);

            foreach (string path in paths.Split(':'))
            {
                if (path.Length > 0)
                {
                    try
                    {
                        Unused.Value = System.Reflection.Assembly.LoadFrom(path);                               // need to load these before we init the logger
                    }
                    catch (Exception e)
                    {
                        Console.Error.WriteLine("Couldn't load the '{0}' custom assembly. See the log for details.", path);
                        Log.ErrorLine(true, e.Message);
                        Log.ErrorLine(true, e.StackTrace);
                    }
                }
            }

#if DEBUG
            AssertTraceListener.Install();
#endif

            foreach (string entry in options.Values("-set"))
            {
                string key   = entry.Split(':')[0];
                string value = entry.Split(':')[1];
                Settings.Add(key, value);
            }

            ViolationDatabase.Init();
        }