示例#1
0
 private static void DemoConsoleLogger()
 {
     // Use the ConsoleLogger and set minimum logging level
     var logger = new ConsoleLogger {LogLevel = LogLevel.Information};
     logger.Log("this won't show up...");
     logger.Log("using standard ConsoleLogger", LogLevel.Information);
 }
        public void Test_Standard_Out()
        {
            var standardOut = new StringWriter();
            var errorOut = new StringWriter();
            var logger = new ConsoleLogger(standardOut, errorOut);

            logger.Log("Test Message");

            Assert.AreEqual("Test Message\r\n", standardOut.ToString());
            Assert.AreEqual(string.Empty, errorOut.ToString());
        }
        public void Test_Standard_Out_Formatted()
        {
            var standardOut = new StringWriter();
            var errorOut = new StringWriter();
            var logger = new ConsoleLogger(standardOut, errorOut);

            logger.Log("{0}:{1}", 1, 2);

            Assert.AreEqual("1:2\r\n", standardOut.ToString());
            Assert.AreEqual(string.Empty, errorOut.ToString());
        }
        static void Main(string[] args)
        {
            string solutionPath, solutionName;
            ConsoleLogger logger = new ConsoleLogger();

            if (!PrintDisclaimer())
            {
                return;
            }

            Console.WriteLine("\n");

            if (args.Length == 2) //pass path and solution name via command args
            {
                solutionPath = args[0];
                solutionName = args[1];
            }
            else
            {
                Console.Write("\nEnter path to solution: ");
                solutionPath = Console.ReadLine();
                Console.Write("\nEnter solution name (.sln): ");
                solutionName = Console.ReadLine();
            }

            ReTarget reTarget = new ReTarget(solutionPath, solutionName, logger);

            reTarget.ConvertSolution();

            logger.Log("Next steps:");
            logger.Log("\tOpen Solution");
            logger.Log("\tBuild Solution (NuGet packages will get restored)");
            logger.Log("\tClose Solution");
            logger.Log("\tOpen Solution");
            logger.Log("\tManually add missing NuGet packages (see list, if any)");

            Console.ReadKey();
        }