Search code examples
c#dxcore

How can I get an unique SourceFile reference in DXCore?


I'm developing a plugin to interchange data between Enterprise Architect and Visual Studio 2012. My plugin uses the DXCore library, and so far I was able to do everything that I needed. But now I have problem that my plugin loses the track of a file if it is renamed.

I can handle the DocumentRenamed event from DXCore, but that's not the way I want it, because it will force me to rename the XML files that I'm creating for the EA interop.

So, it all boils down to the title: how can I have a property that is like the unique identifier for a given file on a project with DXCore?

Thanks.


Solution

  • I do not believe there is any existing unique (and unchanging) id which you can use.

    If you require such an id, I would suggest that you create one of your own and maintain a dictionary of sorts.

    You would name your xml files after the unique id, rather than after the project's files.

    When a file was renamed, you would alter the name associated with the uniqueid and prevent the need to rename the xml file.