예제 #1
0
        static int Main(string[] args)
        {
            int retVal = OK_STATUS;

            try
            {
                CodeDomProvider    provider   = new ECProvider(new CommandLineResults(args));
                ICodeCompiler      compiler   = provider.CreateCompiler();
                CommandLineResults cmdResults = new CommandLineResults(args);

                CompilerResults results = compiler.CompileAssemblyFromFileBatch(
                    cmdResults.Parameters, cmdResults.Files);

                if (results != null)
                {
                    if (results.Errors != null && results.Errors.Count > 0)
                    {
                        Console.WriteLine(MESSAGE_ERRORS);
                        int errorCount = 1;

                        foreach (CompilerError error in results.Errors)
                        {
                            Console.WriteLine(string.Format(
                                                  MESSAGE_ERROR, errorCount,
                                                  error.ErrorNumber, error.ErrorText));
                            errorCount++;
                        }
                    }
                    else
                    {
                        Console.WriteLine(MESSAGE_OK);
                    }
                }
                else
                {
                    retVal = UNKNOWN_STATUS;
                    Console.WriteLine(MESSAGE_UNKNOWN);
                }
            }
            catch (Exception ex)
            {
                retVal = UNHANDLED_ERROR_STATUS;
                Console.WriteLine(MESSAGE_UNEXPECTED);
                Console.WriteLine(ex);
                Console.WriteLine(ex.StackTrace);
            }

            return(retVal);
        }
예제 #2
0
        public static CommandLineResults Run(string cartFile, string productCatalogFile)
        {
            var arguments = $"\"{cartFile}\" \"{productCatalogFile}\"";
            var processStartInfo = new ProcessStartInfo(_applicationPath, arguments)
            {
                CreateNoWindow = true,
                RedirectStandardOutput = true,
                UseShellExecute = false
            };

            var process = Process.Start(processStartInfo);
            process.WaitForExit(WaitTimeInMs);

            var output = process.StandardOutput.ReadToEnd();

            var lines = output.Split(new[] { "\r\n" }, StringSplitOptions.None);
            var results = new CommandLineResults();
            results.AddRange(lines);
            return results;
        }
예제 #3
0
파일: Program.cs 프로젝트: UIKit0/wintools
        static int Main(string[] args)
        {
            // Build mono runtime
            Console.WriteLine("Building the mono runtime..");

            string msbuild  = @"C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe";
            string solution = Utilities.CombinePaths(Environment.CurrentDirectory, "mono", "msvc", "mono.sln");

            string[] msbuild_args = new string[] { "/m", "\"" + solution + "\"", "/p:Configuration=Release_eglib", "/p:Platform=Win32" };

            CommandLineResults results = CommandLineRunner.ExecuteCommand(msbuild, null, string.Join(" ", msbuild_args));

            if (results.ExitCode != 0)
            {
                Console.WriteLine("Error compiling mono runtime:");
                Console.WriteLine(results.Output);
                return(1);
            }

            Console.WriteLine("Runtime successfully built.");

            // Build managed libraries/tools
            Console.WriteLine("Building the managed libraries..");

            MonoCompiler.MonoCompiler mc = new MonkeyBuilder.MonoCompiler.MonoCompiler();

            string config_file = Utilities.CombinePaths(Environment.CurrentDirectory, "mono", "msvc", "win32.xml");

            StepResults compile_results = mc.Compile("unknown", config_file);

            if (compile_results.ExitCode != 0)
            {
                Console.WriteLine("Error compiling managed libraries:");
                Console.WriteLine(compile_results.Log);
                return(1);
            }

            Console.WriteLine("Managed libraries successfully built.");

            return(0);
        }
예제 #4
0
        public static CommandLineResults Run(string cartFile, string productCatalogFile)
        {
            var arguments        = $"\"{cartFile}\" \"{productCatalogFile}\"";
            var processStartInfo = new ProcessStartInfo(_applicationPath, arguments)
            {
                CreateNoWindow         = true,
                RedirectStandardOutput = true,
                UseShellExecute        = false
            };

            var process = Process.Start(processStartInfo);

            process.WaitForExit(WaitTimeInMs);

            var output = process.StandardOutput.ReadToEnd();

            var lines   = output.Split(new[] { "\r\n" }, StringSplitOptions.None);
            var results = new CommandLineResults();

            results.AddRange(lines);
            return(results);
        }