Exemple #1
0
        public void GetTagNames()
        {
            List <string> tags = ExifUtils.GetNames().ToList();

            const string expected = "FaxProfile";
            string       actual   = tags[0];

            Assert.Equal(expected, actual);
        }
Exemple #2
0
        public SchemaController(ILogger <PreviewController> logger)
        {
            _logger = logger;

            _exifTags = ExifUtils.GetNames().ToList();
            _exifTags.Sort();

            string[] iptcTags = Enum.GetNames(typeof(IptcTag));
            _iptcTags = new List <string>(iptcTags);
            _iptcTags.Remove("Unknown");
            _iptcTags.Sort();

            string[] filtersArray = Enum.GetNames(typeof(FilterType));
            _resizeFilters = new List <string>(filtersArray).ToList();
            _resizeFilters.Remove("Undefined");
            _resizeFilters.Sort();
            _resizeFilters.Insert(0, "Default");

            _fontFamilies = FontFamilies.Select((family) => family.Name).Distinct().ToList();
            _fontFamilies.Sort();
            _fontFamilies.Insert(0, "Default");

            _logger.LogInformation("Loading JSON Schema from: {0}", SchemaLocation);
            string schemaTemplate = System.IO.File.ReadAllText(SchemaLocation);

            _schema = JsonSerializer.Deserialize <JsonSchema>(schemaTemplate);

            Dictionary <string, JsonSchemaProperty> buildProperties = _schema.Properties["build"].Properties;

            buildProperties["resize"].Properties["filter"].Enum = _resizeFilters;

            JsonSchemaProperty metadataProperties = buildProperties["metadata"];

            metadataProperties.Properties["exif"].Items.Properties["tag"].Enum = _exifTags;
            metadataProperties.Properties["iptc"].Items.Properties["tag"].Enum = _iptcTags;

            Dictionary <string, JsonSchemaProperty> montageProperties = _schema.Properties["montages"].Items.Properties;

            montageProperties["font-family"].Enum = _fontFamilies;
        }