static void Main(string[] args) { var parser = new Parser((settings) => { settings.CaseInsensitiveEnumValues = true; settings.CaseSensitive = false; settings.HelpWriter = Console.Error; }); parser .ParseArguments <LoadOptions, MetaOptions, ResizeOptions>(args) .WithParsed <LoadOptions>(options => { options.ValidateOptions(); ImageLoader.Run(options); }) .WithParsed <MetaOptions>(options => { options.ValidateOptions(); MetaExtract.Run(options); }) .WithParsed <ResizeOptions>(options => { options.ValidateOptions(); ResizeImage.Run(options); }) ; Console.Write("FINISHED: hit Return (but not too hard!)"); Console.ReadLine(); }
private static void CopyTags(File originalTags, File newTags) { if ((originalTags.TagTypes & TagTypes.Png) == TagTypes.Png) { if (originalTags.GetTag(TagTypes.Png) is PngTag tag && newTags.GetTag(TagTypes.Png, true) is PngTag newTag) { foreach (KeyValuePair <string, string> kvp in tag) { newTag.SetKeyword(kvp.Key, kvp.Value); } } } if ((originalTags.TagTypes & TagTypes.XMP) == TagTypes.XMP) { if (originalTags.GetTag(TagTypes.XMP) is XmpTag tag && newTags.GetTag(TagTypes.XMP, true) is XmpTag newTag) { Console.WriteLine("DEBUG: new XMP Tag values"); foreach (var node in newTag.NodeTree.Children) { MetaExtract.WriteTaglibXmpNodeTree(node, ""); } // Don't bother copying camera/scanner related information. // We just want the creator/copyright/description type information. foreach (var node in tag.NodeTree.Children) { if (node.Namespace == "http://purl.org/dc/elements/1.1/" || node.Namespace == "http://creativecommons.org/ns#" || node.Namespace == "http://www.metadataworkinggroup.com/schemas/collections/" || (node.Namespace == "http://ns.adobe.com/exif/1.0/" && node.Name == "UserComment")) { newTag.NodeTree.AddChild(node); } } } } }