Esempio n. 1
0
        static bool PrintMetadata(Com.Drew.Metadata.Metadata metadata)
        {
            foreach (Com.Drew.Metadata.Directory dir in metadata.GetDirectories())
            {
                if (dir.HasErrors())
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    foreach (string error in dir.GetErrors())
                    {
                        Console.Error.WriteLine("\t[{0}] {1}\n", dir.GetName(), error);
                    }
                }

                foreach (Com.Drew.Metadata.Tag tag in dir.GetTags())
                {
                    string tagName = tag.GetTagName();
                    string directoryName = dir.GetName();
                    string description = tag.GetDescription();
                    // truncate the description if it's too long
                    if (description != null && description.Length > 1024)
                    {
                        description = description.Substring(0,1024)  + "...";
                    }
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("[{0}] {1} = {2}\n", directoryName, tagName, description);
                }

            }

            return metadata.GetDirectories().Any(d => d.HasErrors()); //True if there are any metadata errors;
        }