internal void Build(ContentProjectContext context, object content) { string name = context.ReplaceVariables(this.Name); Dictionary<string, string> parameters = context.ReplaceVariables(this.Parameters); context.Logger.BeginSection(string.Format("Processor: {0}", name)); var processor = context.GetContentProcessor(name); ReflectionHelper.ApplyParameters(context, processor, parameters); processor.Process(content, new ContentProcessorContext(context)); context.Logger.EndSection(); }
internal void Build(ContentProjectContext context) { string fileName = context.ReplaceVariables(this.FileName); bool exists = false; context.Logger.LogInfo(string.Format("Loading assembly {0}...", fileName)); if (File.Exists(fileName)) { exists = true; } else { string globalPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), fileName); if (File.Exists(globalPath)) { fileName = globalPath; exists = true; } } if (exists) { Assembly assembly = Assembly.LoadFile(Path.GetFullPath(fileName)); context.RegisterAssembly(assembly); } else { throw new ContentProjectException(string.Format("Unable to load referenced assembly {0}.", fileName)); } }
internal object Build(ContentProjectContext context, object content) { string fileName = context.ReplaceVariables(this.FileName); Dictionary<string, string> parameters = context.ReplaceVariables(this.Parameters); context.Logger.BeginSection(string.Format("Serialize: {0}", fileName)); var serializer = context.GetContentSerializer(content.GetType()); ReflectionHelper.ApplyParameters(context, serializer, parameters); using (FileStream file = File.Open(fileName, FileMode.Create, FileAccess.ReadWrite)) { serializer.Serialize(content, file, new ContentSerializerContext(context)); } context.Logger.EndSection(); return content; }
internal object Build(ContentProjectContext context) { string fileName = context.ReplaceVariables(this.FileName); context.Logger.BeginSection(string.Format("Import: {0}", fileName)); var importer = context.GetContentImporter(fileName); object content = importer.Import(fileName, new ContentImporterContext(context)); context.Logger.EndSection(); return content; }