Esempio n. 1
0
        private static void Main(string[] args)
        {
            Container = BootStrapper.Components();
            Console.CancelKeyPress += BreakConsole;
            if (args.Length == 0)
            {
                ShowHelp();
                return;
            }
            var param0 = args[0].ToLowerInvariant();

            if (args.Length == 2 && param0 == "--scan")
            {
                CreateCache(args[1]);
            }
            else if (args.Length == 2 && param0 == "--scan2")
            {
                CreateCache2(args[1]);
            }
            else if (args.Length == 2 && Find.FindParams.Contains(param0))
            {
                Find.StaticFind(args[1], param0);
            }
            else if (args.Length == 2 && param0 == "--replgreppath")
            {
                FindRepl(Find.ParamGreppath, args[1]);
            }
            else if (args.Length == 2 && param0 == "--replgrep")
            {
                FindRepl(Find.ParamGrep, args[1]);
            }
            else if (args.Length == 2 && param0 == "--replfind")
            {
                FindRepl(Find.ParamFind, args[1]);
            }
            else if (args.Length == 1 && param0 == "--hash")
            {
                CreateMd5OnCache();
            }
            else if (args.Length == 1 && param0 == "--hash2")
            {
                CreateMd5OnCache2();
            }
            else if (args.Length == 1 && param0 == "--dupes")
            {
                FindDupes();
            }
            else if (args.Length == 1 && param0 == "--treedump1")
            {
                PrintPathsHaveHashEnumerator();
            }
            else if (args.Length == 1 && param0 == "--treedump2")
            {
                EntryStore.PrintPathsHaveHash();
            }
            else if (args.Length == 1 && param0 == "--version")
            {
                Console.WriteLine(Version);
            }
            else if (args.Length == 1 && param0 == "--loadwait")
            {
                Console.WriteLine(Version);
                RootEntry.LoadCurrentDirCache();
                Console.ReadLine();
            }
            else if (args.Length == 1 && param0 == "--loadwait2")
            {
                Console.WriteLine(Version);
                EntryStore.LoadCurrentDirCache();
                Console.ReadLine();
            }
            else if (args.Length == 1 && param0 == "--repl")
            {
                var    le = new LineEditor(null);
                string s;
                var    running = true;

                while (running && (s = le.Edit("shell> ", string.Empty)) != null)
                {
                    Console.WriteLine($"----> [{s}]");
                    switch (s)
                    {
                    case "quit":
                        running = false;
                        break;

                    case "history":
                    case "!":
                        le.CmdHistoryDump();
                        break;

                    case "help":
                    case "?":
                        Console.WriteLine("Builtin Commands:");
                        Console.WriteLine("  quit - quit, ");
                        Console.WriteLine("  help - show help, ? - show help");
                        Console.WriteLine("  history - show history, ! - show history");
                        Console.WriteLine("Keystrokes:");
                        Console.WriteLine("  Home, End, Left, Right,  Up, Down, Back, Del, Tab");
                        Console.WriteLine("  C-a,  C-e,  C-b,   C-f, C-p,  C-n,       C-d");
                        Console.WriteLine("  C-l - clear console to top");
                        Console.WriteLine("  C-r - reverse seach history");
                        Console.WriteLine("  A-b - move backward word");
                        Console.WriteLine("  A-f - move forward word");
                        Console.WriteLine("  A-d - delete word forward");
                        Console.WriteLine("  A-Backspace - delete word backward");
                        break;
                    }
                }
            }
            else if (args.Length == 2 && param0 == "--populousfolders")
            {
                int count;
                if (int.TryParse(args[1], out count))
                {
                    FindPouplous(count);
                }
                else
                {
                    Console.WriteLine("Populous folders option requires an integer as second parameter");
                }
            }
            else
            {
                ShowHelp();
            }
        }