SevenZipPackage

SevenZipPackage class

Represents ZIP archive metadata.

public sealed class SevenZipPackage : CustomPackage

Properties

Name Description
Count { get; } Gets the number of metadata properties.
Files { get; } Gets an array of ZipFile entries inside the ZIP archive.
Item { get; } Gets the MetadataProperty with the specified name.
Keys { get; } Gets a collection of the metadata property names.
MetadataType { get; } Gets the metadata type.
PropertyDescriptors { get; } Gets a collection of descriptors that contain information about properties accessible through the GroupDocs.Metadata search engine.
TotalEntries { get; } Gets the total number of entries inside the ZIP archive.

Methods

Name Description
virtual AddProperties(Func<MetadataProperty, bool>, PropertyValue) Adds known metadata properties satisfying the specified predicate. The operation is recursive so it affects all nested packages as well.
Contains(string) Determines whether the package contains a metadata property with the specified name.
virtual FindProperties(Func<MetadataProperty, bool>) Finds the metadata properties satisfying the specified predicate. The search is recursive so it affects all nested packages as well.
GetEnumerator() Returns an enumerator that iterates through the collection.
virtual RemoveProperties(Func<MetadataProperty, bool>) Removes metadata properties satisfying the specified predicate.
virtual Sanitize() Removes writable metadata properties from the package. The operation is recursive so it affects all nested packages as well.
virtual SetProperties(Func<MetadataProperty, bool>, PropertyValue) Sets known metadata properties satisfying the specified predicate. The operation is recursive so it affects all nested packages as well. This method is a combination of AddProperties and UpdateProperties. If an existing property satisfies the predicate its value is updated. If there is a known property missing in the package that satisfies the predicate it is added to the package.
virtual UpdateProperties(Func<MetadataProperty, bool>, PropertyValue) Updates known metadata properties satisfying the specified predicate. The operation is recursive so it affects all nested packages as well.

Remarks

Learn more

Examples

The following code snippet shows how to get metadata from a ZIP archive.

Encoding encoding = Encoding.GetEncoding(866);

using (Metadata metadata = new Metadata(Constants.InputSevenZip))
{
    var root = metadata.GetRootPackage<SevenZipRootPackage>();

    Console.WriteLine(root.SevenZipPackage.TotalEntries);

    foreach (var file in root.SevenZipPackage.Files)
    {
        Console.WriteLine(file.Name);
        Console.WriteLine(file.CompressedSize);
        Console.WriteLine(file.ModificationDateTime);
        Console.WriteLine(file.UncompressedSize);

        // Use a specific encoding for the file names
        Console.WriteLine(encoding.GetString(file.RawName));
    }
}

See Also