Example #1
0
        public static BaseFetch Create(MetaMode metaMode)
        {
            switch (metaMode)
            {
            case MetaMode.Mutil:
                return(DefaultFetch.Instance);

            case MetaMode.Single:
                return(CompentFetch.Instance);

            case MetaMode.SubType:
                return(SubFetch.Instance);
            }

            return(null);
        }
Example #2
0
        private static void LoadMetadataAndReport(MetaMode mode, string filename)
        {
            Console.WriteLine("Image metadata from {0}", filename);
            switch (mode)
            {
            case MetaMode.MetadataExtractor:
                var metaDirectories = ImageMetadataReader.ReadMetadata(filename);
                foreach (var metaDir in metaDirectories)
                {
                    foreach (var tag in metaDir.Tags)
                    {
                        Console.WriteLine($"{metaDir.Name}: \"{tag.Name}\" = \"{tag.Description}\"");
                    }
                    if (metaDir is XmpDirectory)
                    {
                        var properties = (metaDir as XmpDirectory).GetXmpProperties();
                        foreach (var prop in properties)
                        {
                            Console.WriteLine($"    XMP \"{prop.Key}\" = \"{prop.Value}\"");
                        }
                    }
                }
                MemoryManagement.CheckMemory($"With metadata extracted using {mode}", true);
                break;

            case MetaMode.Palaso:
                var meta = SIL.Windows.Forms.ClearShare.Metadata.FromFile(filename);
                Console.WriteLine("meta.AttributionUrl = {0}", meta.AttributionUrl);
                Console.WriteLine("meta.CollectionName = {0}", meta.CollectionName);
                Console.WriteLine("meta.CollectionUri = {0}", meta.CollectionUri);
                Console.WriteLine("meta.CopyrightNotice = {0}", meta.CopyrightNotice);
                Console.WriteLine("meta.Creator = {0}", meta.Creator);
                Console.WriteLine("meta.License.Token = {0}", meta.License.Token);
                Console.WriteLine("meta.License.RightsStatement = {0}", meta.License.RightsStatement);
                Console.WriteLine("meta.License.Url = {0}", meta.License.Url);
                Console.WriteLine("meta.License.Description = {0}", meta.License.GetDescription(new[] { "en" }, out string langId));
                Console.WriteLine("meta.ShortCopyrightNotice = {0}", meta.ShortCopyrightNotice);
                MemoryManagement.CheckMemory($"With metadata extracted using {mode}", true);
                break;

            case MetaMode.Taglib:
                var tagFile = TagLib.File.Create(filename);
                WriteTaglibValues(tagFile);
                MemoryManagement.CheckMemory($"With metadata extracted using {mode}", true);
                break;
            }
        }
Example #3
0
        internal void Analysis()
        {
            if (SubTypes.Count < 2)
            {
                MetaMode = MetaMode.Single;
            }
            else
            {
                MetaMode = MetaMode.Mutil;
            }

            foreach (var subType in SubTypes)
            {
                var attributes = AttributeLoader.Instance.GetFactoryAttributes(subType);
                var config     = new ClassConfig(subType, attributes);
                ClassPropertySetter.Instance.ApplyAttibuteSetting(config);
                Configs.Add(subType, config);
            }
        }