Beispiel #1
0
        private void BuildThread(ContentItem item)
        {
            FailedBuilds = 0;

            IsBuilding = true;
            string outputDir = GetOutputDir();

            CreateFolderIfNeeded(outputDir);
            PipelineHelper.PreBuilt(Project);
            using (engenious.Content.Pipeline.ContentImporterContext importerContext = new engenious.Content.Pipeline.ContentImporterContext())
                using (engenious.Content.Pipeline.ContentProcessorContext processorContext = new engenious.Content.Pipeline.ContentProcessorContext())
                {
                    importerContext.BuildMessage  += RaiseBuildMessage;
                    processorContext.BuildMessage += RaiseBuildMessage;

                    if (item == null)
                    {
                        BuildDir(Project, importerContext, processorContext);
                    }
                    else if (item is ContentFolder)
                    {
                        BuildDir((ContentFolder)item, importerContext, processorContext);
                    }
                    else if (item is ContentFile)
                    {
                        BuildFile((ContentFile)item, importerContext, processorContext);
                    }
                }
            //System.Threading.Thread.Sleep(8000);
            cache.Save(GetCacheFile());
            IsBuilding = false;

            BuildStatusChanged?.BeginInvoke(this, BuildStep.Build | BuildStep.Finished, null, null);
        }
Beispiel #2
0
 /// <summary>
 /// Builds a Directory based on the given folder, importerContext and processorContext
 /// </summary>
 /// <param name="folder"></param>
 /// <param name="importerContext"></param>
 /// <param name="processorContext"></param>
 private void BuildDir(ContentFolder folder, engenious.Content.Pipeline.ContentImporterContext importerContext, engenious.Content.Pipeline.ContentProcessorContext processorContext)
 {
     foreach (var item in folder.Contents)
     {
         if (item is ContentFile)
         {
             BuildFile(item as ContentFile, importerContext, processorContext);
         }
         else if (item is ContentFolder)
         {
             BuildDir(item as ContentFolder, importerContext, processorContext);
         }
     }
 }