コード例 #1
0
 internal ContentImporterContext(BuildContent buildTask, string intermediateDirectory, string outputDirectory, ContentBuildLogger logger)
 {
     this.buildTask             = buildTask;
     this.intermediateDirectory = intermediateDirectory;
     this.outputDirectory       = outputDirectory;
     this.logger = logger;
 }
コード例 #2
0
        /// <summary>
        /// Inititalize the <see cref="RuntimeBuilder"/> so you can use its capabilities to build content during runtime.
        /// </summary>
        /// <param name="workingDir">The working dir is where your raw content files are (automatically) beeing copied to before building them.</param>
        /// <param name="intermediateDir">It specifies the directory where all intermediate files are written. If this option is omitted the intermediate data will be put into the current working directory.</param>
        /// <param name="outputPath">It specifies the directory where all content is written. If this option is omitted the output will be put into the current working directory.</param>
        /// <param name="platform">Set the target platform for this build. It must be a member of the <see cref="TargetPlatform"/> enum.</param>
        /// <param name="profile">Set the target graphics profile for this build. It must be a member of the <see cref="GraphicsProfile"/> enum.</param>
        /// <param name="compress">Uses LZ4 compression to compress the contents of the XNB files. Content build times will increase with this option enabled. Compression is not recommended for platforms such as Android, Windows Phone 8 and Windows 8 as the app package is already compressed. This is not compatible with LZX compression used in XNA content.</param>
        public RuntimeBuilder(
            string workingDir, string intermediateDir, string outputPath,
            TargetPlatform platform,
            GraphicsProfile profile,
            bool compress)
        {
            Directory.CreateDirectory(workingDir);
            Directory.CreateDirectory(intermediateDir);
            Directory.CreateDirectory(outputPath);

            _BuildContent = new BuildContent();
            _BuildContent.SetWorkingDir(workingDir);
            _BuildContent.SetIntermediateDir(intermediateDir);
            _BuildContent.SetOutputDir(outputPath);

            _BuildContent.Platform        = platform;
            _BuildContent.Profile         = profile;
            _BuildContent.CompressContent = compress;

            _ContentPipelineReference = AppDomain.CurrentDomain.GetAssemblies().ToList().Find(x => x.FullName.Contains("MonoGame.Framework.Content.Pipeline"));
            if (_ContentPipelineReference != null)
            {
                _BuildContent.References.Add(_ContentPipelineReference.Location);
            }
            else
            {
                throw new DllNotFoundException("Couldn't find the MonoGame.Framework.Content.Pipeline.dll! Please make sure that it is available in the current App Domain.");
            }
        }
コード例 #3
0
        public void ContentAnalyzerTests()
        {
            var Result = BuildContent.CreateScript("content", "content\\bin");

            Assert.IsTrue(Result.Contains("copy \"Skins\\Default.skin\" \"bin\\Skins\\Default.skin\""));
            Assert.IsTrue(Result.Contains("fxc.exe /T fx_2_0 \"shaders\\Normalmap.fx\" /Fo\"bin\\shaders\\Normalmap.fxb\""));
            Assert.IsTrue(Result.Contains("ContentCompiler.exe stacklogo.png bin\\stacklogo TextureImporter TextureProcessor"));
            Assert.IsTrue(Result.Contains("ContentCompiler.exe fonts\\stack.spritefont bin\\fonts\\stack FontDescriptionImporter FontDescriptionProcessor"));
        }