Пример #1
0
        public void OpenProject(string projectFilePath, MGBuildParser.ErrorCallback errorCallback)
        {
            _errors = new List <string>();
            _project.ContentItems.Clear();

            // Store the file name for saving later.
            _project.OriginalPath = projectFilePath;

            var parser = new MGBuildParser(this);

            parser.Title = "Pipeline";

            if (errorCallback != null)
            {
                parser.OnError += errorCallback;
            }

            var commands = new string[]
            {
                string.Format("/@:{0}", projectFilePath),
            };

            parser.Parse(commands);

            if (_errors.Any())
            {
                errorCallback('\n' + string.Join("\n", _errors.ToArray()), new object[0]);
            }
        }
Пример #2
0
        static int Main(string[] args)
        {
            // We force all stderr to redirect to stdout
            // to avoid any out of order console output.
            Console.SetError(Console.Out);

            if (!Environment.Is64BitProcess && Environment.OSVersion.Platform != PlatformID.Unix)
            {
                Console.Error.WriteLine("The MonoGame content tools only work on a 64bit OS.");
                return -1;
            }

            var content = new BuildContent();

            // Parse the command line.
            var parser = new MGBuildParser(content)
            {
                Title = "MonoGame Content Builder\n" +
                        "Builds optimized game content for MonoGame projects."
            };

            if (!parser.Parse(args))
                return -1;           
            
            // Launch debugger if requested.
            if (content.LaunchDebugger)
            {
                try {
                    System.Diagnostics.Debugger.Launch();
                } catch (NotImplementedException) {
                    // not implemented under Mono
                }
            }

            // Print a startup message.            
            var buildStarted = DateTime.Now;
            if (!content.Quiet)
                Console.WriteLine("Build started {0}\n", buildStarted);

            // Let the content build.
            int successCount, errorCount;
            content.Build(out successCount, out errorCount);

            // Print the finishing info.
            if (!content.Quiet)
            {
                Console.WriteLine("\nBuild {0} succeeded, {1} failed.\n", successCount, errorCount);
                Console.WriteLine("Time elapsed {0:hh\\:mm\\:ss\\.ff}.", DateTime.Now - buildStarted);
            }

            // Return the error count.
            return errorCount;
        }
Пример #3
0
        static int Main(string[] args)
        {
            // We force all stderr to redirect to stdout
            // to avoid any out of order console output.
            Console.SetError(Console.Out);

            var content = new BuildContent();

            // Parse the command line.
            var parser = new MGBuildParser(content)
            {
                Title = "MonoGame Content Builder\n" +
                        "Builds optimized game content for MonoGame projects."
            };

            if (!parser.Parse(args))
                return -1;           
            
            // Do we have anything to do?
            if (!content.HasWork)
            {
                parser.ShowUsage();
                return 0;
            }

            // Launch debugger if requested.
            if (content.LaunchDebugger)
                System.Diagnostics.Debugger.Launch();

            // Print a startup message.            
            var buildStarted = DateTime.Now;
            if (!content.Quiet)
                Console.WriteLine("Build started {0}\n", buildStarted);

            // Let the content build.
            int successCount, errorCount;
            content.Build(out successCount, out errorCount);

            // Print the finishing info.
            if (!content.Quiet)
            {
                Console.WriteLine("\nBuild {0} succeeded, {1} failed.\n", successCount, errorCount);
                Console.WriteLine("Time elapsed {0:hh\\:mm\\:ss\\.ff}.", DateTime.Now - buildStarted);
            }

            // Return the error count.
            return errorCount;
        }
        public void OpenProject(string projectFilePath, MGBuildParser.ErrorCallback errorCallback)
        {
            _project.ContentItems.Clear();

            // Store the file name for saving later.
            _project.OriginalPath = projectFilePath;

            var parser = new MGBuildParser(this);

            parser.Title = "Pipeline";

            if (errorCallback != null)
            {
                parser.OnError += errorCallback;
            }

            var commands = new string[]
            {
                string.Format("/@:{0}", projectFilePath),
            };

            parser.Parse(commands);
        }
Пример #5
0
        public void OpenProject(string projectFilePath, MGBuildParser.ErrorCallback errorCallback)
        {
            _project.ContentItems.Clear();

            // Store the file name for saving later.
            _project.OriginalPath = projectFilePath;

            var parser = new MGBuildParser(this);
            parser.Title = "Pipeline";

            if (errorCallback != null)
                parser.OnError += errorCallback;

            var commands = new string[]
                {
                    string.Format("/@:{0}", projectFilePath),
                };
            parser.Parse(commands);
        }