FormatFactory Class
Provides base operations to recognize files of different formats.
Inheritance Hierarchy
SystemObject
  GroupDocs.Metadata.ToolsFormatFactory

Namespace: GroupDocs.Metadata.Tools
Assembly: GroupDocs.Metadata (in GroupDocs.Metadata.dll) Version: 19.5
Syntax
public static class FormatFactory
Methods
  NameDescription
Public methodStatic memberRecognizeFormat(Stream)
Recognizes a file and returns the appropriate descendant of FormatBase.
Public methodStatic memberRecognizeFormat(String)
Recognizes a file and returns the appropriate descendant of FormatBase.
Examples
This example demonstrates how to recognize files in a specific directory
C#
 foreach (string path in Directory.GetFiles(@"D:\Files"))
{
    // Recognize the format by the file signature
    using (FormatBase format = FormatFactory.RecognizeFormat(path))
    {
        if (format != null)
        {
            Console.WriteLine("File: {0}, type: {1}", Path.GetFileName(path), format.Type);
        }
    }
}
See Also