# Get Grasshopper Document Object Count without opening grasshopper

**URL:** <https://discourse.mcneel.com/t/get-grasshopper-document-object-count-without-opening-grasshopper/78311>\
**Category:** Grasshopper Developer\
**Tags:** csharp\
**Created:** [February 5, 2019, 8:52am UTC](https://discourse.mcneel.com/t/get-grasshopper-document-object-count-without-opening-grasshopper/78311 "2019-02-05T08:52:56Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![DavidRutten](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/davidrutten/32/755688_2.png) [@DavidRutten](https://discourse.mcneel.com/u/DavidRutten)\
**Post date:** [February 5, 2019, 12:57pm UTC](https://discourse.mcneel.com/t/get-grasshopper-document-object-count-without-opening-grasshopper/78311/4 "2019-02-05T12:57:29Z")

</div>

[Program.cs](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/e/7/e78ff4882d5b77f785fdae134a9d68a8489a51bc.cs) (6.8 KB)

[GhFileAnalysis.zip](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/4/c/4c67d06d2f64c88f33a590381fed24b8acbc9bb8.zip) (44.0 KB)

 ![console](https://global.discourse-cdn.com/mcneel/original/3X/b/3/b3c0408b84f634bc977fb10d7e3990e9374053b7.png)

This is a typical function which extracts and displays some information stored in a `GH_Archive` instance. The code could probably have more error checking if you want it to deal with corrupt files too, although it is extremely unlikely that a `*.gh` file is corrupt and still in any way, shape or form readable. The file is compressed so any damage to it at all will cause a failure in decompression.

```auto
    private static void DisplayDocumentStatistics(GH_Archive archive)
    {
      var root = archive.GetRootNode;
      var definition = root.FindChunk("Definition");
      var header = definition.FindChunk("DocumentHeader");
      var properties = definition.FindChunk("DefinitionProperties");

      var archiveVersion = root.GetVersion("ArchiveVersion");
      var pluginVersion = definition.GetVersion("plugin_version");
      var documentId = header.GetGuid("DocumentID");
      var documentDate = properties.GetDate("Date");
      var documentName = properties.GetString("Name");

      Console.Write("Archive Version: "); WriteLine(ConsoleColor.DarkCyan, archiveVersion.ToString());
      Console.Write("Plug-In Version: "); WriteLine(ConsoleColor.DarkCyan, pluginVersion.ToString());
      Console.Write("Document ID: "); WriteLine(ConsoleColor.DarkCyan, $"{{{documentId}}}");
      Console.Write("Document Date: "); WriteLine(ConsoleColor.DarkCyan, documentDate.ToLongDateString() + " " + documentDate.ToLongTimeString());
      Console.Write("Document Name: "); WriteLine(ConsoleColor.DarkCyan, $"'{documentName}'");
    }

```

---

_[View the full topic](https://discourse.mcneel.com/t/get-grasshopper-document-object-count-without-opening-grasshopper/78311)._
