Show Xojo: A command line tool for getting information about a Xojo project

Any plans to support the Xojo binary format? @Geoff_Perlman could you provide @GarryPettet with some documentation on the Xojo file formats?
Or better yet, publish the documentation for the Xojo file formats, this could open up a whole new area of tools.
For instance I’d love to know what constants, methods and properties are not used and can be safely removed.

2 Likes

Did not Garry say it was?

If it’s not binary, what is “project”?

I would be really grateful if Xojo would publish some (any!) documentation on the file formats.

I get that they can change them as they like and that’s their perogative but there is no competitive advantage that I can see to keeping them secret. Whereas opening them up, like @Sam_Rowlands says would open up a bunch of new tool opportunities. For example, see my hack for the latest release where I have to guess whether a class is a window or a container by looking for an ImplicitInstance property on the class. I’m sure this isn’t how the IDE actually does it but I’m flying in the dark here.

For example, I’m toying with the idea (now that I can reasonably reliably parse Xojo projects) to crate some sort of “package manager” that would simplify adding modules to a project.

@Sam_Rowlands: Your suggestion to check for member use to see if it’s possible to safely remove is interesting. I’m close to being able to do that for unused classes and interfaces. The challenge with advising the removal of members is I’d need to parse the code contained within the project and build an AST. Not impossible as I already have a Xojo language parser.

As for supporting the binary format - there is zero chance I will do this unless Xojo publish the format.

3 Likes

Xojo can save in three file formats:

  1. XML
  2. Binary
  3. Project (I think this used to be called “Text”)

Got it, it’s something that I’ve wanted for a while now with Xojo and have filed feedbacks…

I hope that Xojo does this. Better tools will lead to better apps and better apps will lead to more people promoting Xojo and the more people promoting Xojo…

2 Likes

Ah, “project” means “text” in this context. Why so? Binary is a project also (the extension is even “binary_project”).

AFAIK @Thomas_Tempelmann has decoded the binay file format for Arbed.

2 Likes

The project is not 100% binary; many things are pure text.

Easier installation with Homebrew and Scoop!

It’s now possible to install xojotool on macOS with Homebrew or on Windows with Scoop. This will also make it a lot easier to keep it up to date.

macOS

If you’re using macOS you can use the excellent Homebrew package manager to quickly install xojotool:

brew tap gkjpettet/homebrew-xojotool
brew install xojotool

You can make sure that you’ve always got the latest version of xojotool by running brew update in the Terminal. You’ll know there’s an update available if you see the following:

==> Updated Formulae
gkjpettet/xojotool/xojotool ✔

Then you’ll know there’s a new version available. To install it simply type brew upgrade in the Terminal.

Windows

If you’re using Windows I recommend using Scoop to install xojotool. Once You’ve setup Scoop, simply type the following into the Command Prompt or the Powershell:

scoop bucket add xojotool https://github.com/gkjpettet/scoop-xojotool
scoop install xojotool

To update xojotool run the following commands:

scoop update
scoop update xojotool

Enjoy!

4 Likes

I put in a pull request with some small changes.
for instance if you have a parameter that is a multi dimension array
as in strMyArray(, ) As string
That didn’t work when I tried with the original project.

1 Like

Already merged into the main branch and a new release pushed out onto the package managers.

Thank you.

1 Like

The binary format is practically structurally identical to the XML format, with just using shorter codes for the XML tags. Arbed contains a “Tag-Translate-XML.txt” file that contains a mapping between these 4-char-codes and the equivalent XML tags. So, anyone who can read/write XML should have little trouble handling the binary format as well.

4 Likes

Opening a binary file in a text editor like Nova gives me garbage:

Is this just a simple encoding issue?

I think you need to read it as a BinaryStream to get the things you’re looking for. I never bothered, since Lite licenses can open source code projects and I didn’t have a need to write a binary project.

I do recall hearing that reverse engineering the binary format is a sensitive topic, so you might want to contact Xojo directly.

Meh, “reverse engineering” the binary format is hardly different from REing the xml format. Both require understanding what their meaning is, and since Xojo does not provide any guidance on that, reading the yml format could be just as problematic, one could argue.

The binary format simply uses uint32 values where xml uses textual codes to separate the parts and types. Eg the first long gives the length, the next the type (int, string etc.) and then the value is following. Just open the file in a hex editor instead of a text editor. Oh, and the first 30 bytes are a header that you can mostly ignore

3 Likes

Version 1.0.6 Released

Improvements

  • Adds support for parsing the contents of MobileScreen items in iOS projects

Available via Homebrew (macOS) and Scoop (Windows) or direct from Github (repo).

No.

Your screenshot is misleading because later in the file you can read Xojo Source Code as text.

Think html with service code as binary.

Or as TT says compare the hex with the xml and you will start to see the light. Below a screen shot of a Xojo 2021r2.1 project (start of it) as xojo_binary_project.

1 Like

One might add the binary format is a paged one – every block uses a multiple of I think it was 4096 bytes. Which is why binary doesn’t necessarily mean “much shorter”.

2 Likes

Nope - that padding happens only in a very few places, i.e. it’s not significantly affecting the binary file size.
The major space takers are icons in the project and the source lines - they are not compressed, and since the source code is a major part of the project’s contents, binary won’t make them occupy much less space than XML or Text formats do.

1 Like

They are compressed as of 2021r3 if the app class is a DesktopApplication.

2 Likes