Book a Demo

Author Topic: API function to get EA version  (Read 5156 times)

Rick Meng

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
API function to get EA version
« on: August 30, 2011, 03:19:36 pm »
My plugin needs to know which EA version is used. Is there an API function can return the current EA version?

Thanks.

Shaggy Man

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: API function to get EA version
« Reply #1 on: August 31, 2011, 01:00:08 am »
Maybe useful Repository.LibraryVersion .

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: API function to get EA version
« Reply #2 on: August 31, 2011, 01:01:28 am »
As far as I know, and as far as I can discover this information is not available in the API.

However it can be discovered with a little work, well at least in .Net is can

Here is a one line pice of C# .net code

string licenceFilePath = Application.UserAppDataPath;[/b]

The contents of licenceFilePath for my installation running Windows 7 is

C:\Users\pchudley\AppData\Roaming\Sparx Systems Pty Ltd\Enterprise Architect 9\9, 0, 0, 908

If I change version of EA to say Version 8, the same line of code yields

C:\Users\pchudley\AppData\Roaming\Sparx Systems Pty Ltd\Enterprise Architect 8\8, 0, 0, 864

Split the string using \ as the delimiter and the last entry in the string [] will contain (for the first example) 9, 0, 0, 908

That is the version and build number of the EA version that is running your add-in.

Hope this helps in some way.

Cheers

Phil
Models are great!
Correct models are even greater!

clicht

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: API function to get EA version
« Reply #3 on: September 08, 2011, 02:41:38 am »
Try the following (not tested):
Code: [Select]
Process proc = Process.GetCurrentProcess();
FileVersionInfo myFI = FileVersionInfo.GetVersionInfo(proc.StartInfo.FileName);
myFI.FileVersion; //will give you the version number.

abruckner

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: API function to get EA version
« Reply #4 on: September 26, 2011, 04:57:32 pm »
if you have the repository object, call:
Code: [Select]
repository.LibraryVersionThis delivers something like 860 for version 8.60

To get the EA-Version (like Corporate and stuff), call:
Code: [Select]
repository.EAVersion
sorry, I was wrong: LibraryVersion does not return the full version of EA.
but clicht was very close how to succeed:
Process proc = Process.GetCurrentProcess();
FileVersionInfo fileVersionInfo = proc.MainModule.FileVersionInfo;

this returns something like "8, 0, 0, 864"
« Last Edit: September 27, 2011, 11:47:38 pm by abruckner »