public IEnumerable <ProjectResourceUpdate> ProcessImport(ImportProcessorContext context, IResource resource)
        {
            string metaPath = $"{resource.FullName}{options.MetaFileSuffix}";
            var    metaFile = new FileInfo(metaPath);

            if (metaFile.Exists)
            {
                var update = resource.AuthorUpdate();

                JsonMetaFileModel metaFileModel;

                var serializer = new JsonSerializer();
                using (var file = metaFile.OpenText())
                    using (var reader = new JsonTextReader(file))
                    {
                        metaFileModel = serializer.Deserialize <JsonMetaFileModel>(reader);
                    }

                if (metaFileModel.Tags != null)
                {
                    foreach (string tag in metaFileModel.Tags)
                    {
                        update.ImporterTags.Add(tag);
                    }
                }

                yield return(update);
            }
            else if (!options.IsMetaFilesOptional)
            {
                Console.WriteLine($"Missing meta file for {resource.FullName}");
            }
        }
Ejemplo n.º 2
0
        public IEnumerable <ProjectResourceUpdate> ProcessImport(ImportProcessorContext context, IResource resource)
        {
            var update = resource.AuthorUpdate();

            update.ImporterTags.Add("basic-tag");

            yield return(update);
        }