Exemple #1
0
        static void Main(string[] args)
        {
            if (args.Length > 0 && String.Equals("dbg", args[0], StringComparison.OrdinalIgnoreCase))
            {
                args = args.Skip(1).ToArray();
                Debugger.Launch();
            }

            try
            {
                if (args.Length == 0)
                {
                    PrintUsage();
                    return;
                }

                switch (args[0])
                {
                case "package2catalog":
                    Feed2Catalog.Package(args);
                    break;

                case "feed2catalog":
                    Feed2Catalog.Run(args);
                    break;

                case "catalog2registration":
                    Catalog2Registration.Run(args);
                    break;

                case "catalog2lucene":
                    Catalog2Lucene.Run(args);
                    break;

                case "catalog2dnx":
                    Catalog2Dnx.Run(args);
                    break;

                case "frameworkcompatibility":
                    FrameworkCompatibility.Run(args);
                    break;

                case "copylucene":
                    CopyLucene.Run(args);
                    break;

                case "checklucene":
                    CheckLucene.Run(args);
                    break;

                case "clearlucene":
                    ResetLucene.Run(args);
                    break;

                default:
                    PrintUsage();
                    break;
                }
            }
            catch (Exception e)
            {
                Utils.TraceException(e);
            }
            Trace.Close();
        }
        static void Main(string[] args)
        {
            if (args.Length > 0 && String.Equals("dbg", args[0], StringComparison.OrdinalIgnoreCase))
            {
                args = args.Skip(1).ToArray();
                Debugger.Launch();
            }

            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();

            try
            {
                if (args.Length == 0)
                {
                    PrintUsage();
                    return;
                }

                switch (args[0])
                {
                    case "package2catalog":
                        var packageToCatalog = new Feed2Catalog();
                        packageToCatalog.Package(args, cancellationTokenSource.Token);
                        break;
                    case "feed2catalog":
                        var feedToCatalog = new Feed2Catalog();
                        feedToCatalog.Run(args, cancellationTokenSource.Token);
                        break;
                    case "catalog2registration":
                        var catalog2Registration = new Catalog2Registration();
                        catalog2Registration.Run(args, cancellationTokenSource.Token);
                        break;
                    case "catalog2lucene":
                        Catalog2Lucene.Run(args, cancellationTokenSource.Token);
                        break;
                    case "catalog2dnx":
                        var catalogToDnx = new Catalog2Dnx();
                        catalogToDnx.Run(args, cancellationTokenSource.Token);
                        break;
                    case "catalog2elfie":
                        Catalog2Elfie catalog2Elfie = new Catalog2Elfie();
                        catalog2Elfie.Run(args, cancellationTokenSource.Token);
                        break;
                    case "frameworkcompatibility":
                        FrameworkCompatibility.Run(args);
                        break;
                    case "copylucene":
                        CopyLucene.Run(args);
                        break;
                    case "checklucene":
                        CheckLucene.Run(args);
                        break;
                    case "clearlucene":
                        ResetLucene.Run(args);
                        break;
                    default:
                        PrintUsage();
                        break;
                }
            }
            catch (Exception e)
            {
                // Write the error directly to the conosle in case the error was thrown by the trace listeners.
                Console.WriteLine("Unhanded exception on main thread.");
                Console.WriteLine(e.ToString());

                SarifTraceListener.TraceError("NG001", "Unhandled exception on main thread.", e);
                Utils.TraceException(e);
            }
            Trace.Close();
        }