Exemplo n.º 1
0
        static int Main(string[] args)
        {
            ICommandLine  commandLine = new CommandLine(args);
            ILogger       logger      = new RepackLogger();
            IFile         file        = new FileWrapper();
            RepackOptions options     = new RepackOptions(commandLine, logger, file);
            int           returnCode  = -1;

            try
            {
                if (options.ShouldShowUsage())
                {
                    Usage();
                    Exit(2);
                }
                options.Parse();

                //TODO: Open the Logger before the parse
                if (logger.Open(options.LogFile))
                {
                    options.Log             = true;
                    logger.ShouldLogVerbose = options.LogVerbose;
                }

                ILRepack repack = new ILRepack(options, logger);
                repack.Repack();
                returnCode = 0;
            }
            catch (RepackOptions.InvalidTargetKindException e)
            {
                Console.WriteLine(e.Message);
                Usage();
                Exit(2);
            }
            catch (Exception e)
            {
                logger.Log(e);
                returnCode = 1;
            }
            finally
            {
                logger.Close();
                if (options.PauseBeforeExit)
                {
                    Console.WriteLine("Press Any Key To Continue");
                    Console.ReadKey(true);
                }
            }
            return(returnCode);
        }
Exemplo n.º 2
0
        static int Main(string[] args)
        {
            RepackLogger logger = new RepackLogger();
            RepackOptions options = new RepackOptions(args);
            int returnCode = -1;
            try
            {
                if (options.ShouldShowUsage)
                {
                    Usage();
                    Exit(2);
                }
                logger.ShouldLogVerbose = options.LogVerbose;
                //TODO: Open the Logger before the parse
                if (logger.Open(options.LogFile))
                {
                    options.Log = true;
                }

                ILRepack repack = new ILRepack(options, logger);
                repack.Repack();
                returnCode = 0;
            }
            catch (RepackOptions.InvalidTargetKindException e)
            {
                Console.WriteLine(e.Message);
                Usage();
                Exit(2);
            }
            catch (Exception e)
            {
                logger.Log(e);
                returnCode = 1;
            }
            finally
            {
                logger.Close();
                if (options.PauseBeforeExit)
                {
                    Console.WriteLine("Press Any Key To Continue");
                    Console.ReadKey(true);
                }
            }
            return returnCode;
        }
Exemplo n.º 3
0
        static int Main(string[] args)
        {
            RepackOptions options    = new RepackOptions(args);
            var           logger     = new RepackLogger(options);
            int           returnCode = -1;

            try
            {
                if (options.ShouldShowUsage)
                {
                    Usage();
                    Exit(2);
                }

                ILRepack repack = new ILRepack(options, logger);
                repack.Repack();
                repack.Dispose();
                returnCode = 0;
            }
            catch (RepackOptions.InvalidTargetKindException e)
            {
                Console.WriteLine(e.Message);
                Usage();
                Exit(2);
            }
            catch (Exception e)
            {
                logger.Log(e);
                returnCode = 1;
            }
            finally
            {
                logger.Dispose();
                if (options.PauseBeforeExit)
                {
                    Console.WriteLine("Press Any Key To Continue");
                    Console.ReadKey(true);
                }
            }
            return(returnCode);
        }
Exemplo n.º 4
0
 public void GivenAnEmptyOutputFile__OpenFile_LogLine__OpenReturnsFalse_LogDoesNotThrowError()
 {
     RepackLogger logger = new RepackLogger();
     Assert.IsFalse(logger.Open(""));
     logger.Log("Hello");
 }