Example #1
0
        static void Main(string[] args)
        {
            var menu = new Menu();

            menu.addDefaultCommands();
            var deodexer = new Deodexer();

            menu.commands.Add("deodex", new DeodexCommand(deodexer));
            menu.commands.Add("framework", new FrameworkCommand(deodexer));
            menu.commands.Add("zipalign", new ZipAlignCommand(deodexer));

            var frPlh = new FrameworkPlaceholder {
                deodexer = deodexer
            };

            foreach (var cmd in menu.commands)
            {
                cmd.Value.placeholders.Add(frPlh);
            }


            if (args.Length > 0)
            {
                menu.exec(args[0], (args.Length >= 1 ? args.Skip(1) : null));
                return;
            }

            menu.exec("help");

            while (true)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write("deodexer> ");
                Console.ResetColor();
                var line = Console.ReadLine();
                if (line == null)
                {
                    continue;
                }

                var commandTextRep = CommandLineToArgs(line);
                if (commandTextRep.Count > 0)
                {
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.BackgroundColor = ConsoleColor.White;
                    menu.exec(commandTextRep[0], (commandTextRep.Count >= 2 ? commandTextRep.Skip(1) : null));
                    Console.ResetColor();
                }
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            var menu = new Menu();
            menu.addDefaultCommands();
            var deodexer = new Deodexer();
            menu.commands.Add("deodex",new DeodexCommand(deodexer));
            menu.commands.Add("framework", new FrameworkCommand(deodexer));
            menu.commands.Add("zipalign", new ZipAlignCommand(deodexer));

            var frPlh = new FrameworkPlaceholder{deodexer=deodexer};
            foreach (var cmd in menu.commands) {
                cmd.Value.placeholders.Add(frPlh);
            }

            if (args.Length > 0)
            {
                menu.exec(args[0], (args.Length >= 1 ? args.Skip(1) : null));
                return;
            }

            menu.exec("help");

            while (true){
                Console.ForegroundColor=ConsoleColor.Green;
                Console.Write("deodexer> ");
                Console.ResetColor();
                var line = Console.ReadLine();
                if(line==null)continue;

                var commandTextRep=CommandLineToArgs(line);
                if (commandTextRep.Count>0) {
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.BackgroundColor = ConsoleColor.White;
                    menu.exec(commandTextRep[0], (commandTextRep.Count >= 2 ? commandTextRep.Skip(1) : null));
                    Console.ResetColor();
                }
            }
        }