Starting the main Revit program needs to be accompanied by loading multiple components, which usually takes a long time. This is especially annoying after the file automatically calls the wrong version of Revit! So is there any way to read the Revit program without opening Revit? It should be clear that it will be very difficult not to read or modify member information in Revit (there may be legal issues). Revit uses** COM structured storage** of the file storage technology, we can use it to read some simple and necessary information

COM Structured Storage


Structured Storage provides file and data persistence in COM by handling a single file as a structured collection of objects known as storages and streams. Here is an introduction from Wikipedia.

COM Structured Storage (variously also known as COM structured storage or OLE structured storage) is a technology developed by Microsoft as part of its Windows operating system for storing hierarchical data within a single file.

Strictly speaking, the term structured storage refers to a set of COM interfaces that a conforming implementation must provide, and not to a specific implementation, nor to a specific file format (in fact, a structured storage implementation need not store its data in a file at all).

In addition to providing a hierarchical structure for data, structured storage may also provide a limited form of transactional support for data access. Microsoft provides an implementation that supports transactions, as well as one that does not (called simple-mode storage, the latter implementation is limited in other ways as well, although it performs better).

Structured storage is widely used in Microsoft Office applications, although newer releases (starting with Office 2007) use the XML-based Office Open XML by default. It is also an important part of both COM and the related Object Linking and Embedding (OLE) technologies. Other notable applications of structured storage include SQL Server, the Windows shell, and many third-party CAD programs.

It will be very complicated to read Structured Storage directly through the binary data of the file stream. I'll show you an easier way to do it (thanks to Github 🤣).

OpenMcdf


OpenMCDF is a 100% .net / C# component that allows developers to manipulate structured storage file. See details at https://github.com/ironfede/openmcdf.

Now we'll use it to read the Revit file.

static void Main(string[] args)
{
    CompoundFile compoundFile = new CompoundFile(args[0], CFSUpdateMode.ReadOnly, CFSConfiguration.Default);
    var root = compoundFile.RootStorage;
    List<CFItem> cFItems = new List<CFItem>();
    root.VisitEntries((CFItem cf) =>
    {
        Console.WriteLine($"Name : {cf.Name}");
        Console.WriteLine($"Size : {cf.Size}");
        Console.WriteLine();
    }, recursive:true);
}

And the test file output.

Test output

As we can see from the output, we can get the Basic file info , Preview image , Transmission Data and others by reading ole (more on this later in the article).

openmcdf also provides a simple ui to browse structured storage files. You can download it directly form Github Release.