Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

C# plantuml.jar alternative?

0 votes
Hi!

First of all I really like PlantUML. It is pretty convenient and simple, not having to use drag&drop and mouse in general to create diagrams.

This brought me to writing extension for Visual Studio 2015 that will parse diagram text and render it in window so I do not need any external tool for this. I am somewhat done (need to tune the window UI a bit), but my problem is that using the .jar file is kinda slow. The java process in general takes some time to call and init and whatnot, so I wonder if there is any C# dll that could do the same job as plantuml.jar (which is I guess parse file, generate objects and pass them to GraphViz to render image)? This would really help me and I believe significantly speed up the diagram generating.

Thanks for any info!
asked Mar 17 by anonymous

1 Answer

0 votes
 
Best answer
Starting a new java process is indeed slow.
Unfortunately, porting PlantUML in C# is a huge task and there is no plan for this in the future.

However, there is a solution to improve general speed.
The idea is to run PlantUML as a daemon, so that you do not have to launch a new Java process for each diagram modification.

This may sound weird but you can run PlantUML as FTP server:
http://plantuml.com/ftp

This has been successfully used in CodeUML:

https://www.codeproject.com/Articles/397629/Codeuml-design-UML-diagrams-as-fast-as-you-can-cod

I think it can solve your performance issue.
Keep us informed on your progress on this side!

Thanks
answered Mar 18 by plantuml (117,910 points)
Okay so I am working on using FTP functionality. There is some catch however. When I upload file to the PlantUML FTP (localhost:4242), the file gets there, but the generated image is empty, has 0 byte size and I have no idea why. Do I need to somehow tell the FTP what to do with the file? I am using CodeUML as example and I cannot find anything like that. I even use the same FTP client by Alex Pilotti.

I tried putting 1000ms sleep between upload and download to make sure there is enough time for the diagram to be generated, but that didn't help.

Any idea what might be wrong? Some local setting or whatever?
No, you don't have to tell anything to the FTP : the .png file should be automatically generated
Did you put @startuml/@enduml on the uploaded text file ?
Try this one:
@startuml
version
@enduml
Ok, we've just test it and have the same issue (0 byte file).
We're going to investigate on this
Ok, there have been some recent changes that break the FTP server.
Sorry about that.
This should be fixed in last beta:
https://www.dropbox.com/s/koo42q3d9gxw288/plantuml.jar?dl=0
Tell us if it's not working for you now.
It is working now, thanks for the fast fix. :)

I am now facing another problem and that is finding out when diagram is rendered. Using sleep for 100 milliseconds between upload and download is too short interval, but sleep for 1000 milliseconds is far too long and beats the purpose of using FTP as it performs roughly the same as the non-FTP approach.

Can I somehow query the FTP to find out if it has finished the diagram?

Other than that, it works like a charm.
Ok, I think we are going to enhance the FTP server, so that even if you request the PNG file 10 milliseconds after the upload, the download connection is accepted. Of course, the transfert will really begin when the diagram has been really generated. So you won't have any delay to configure.
We'll post a message here when this will be ready.
That would be really cool, as long as the FTP client could handle such behavior.
You can try Beta 2017.08beta2
https://www.dropbox.com/s/koo42q3d9gxw288/plantuml.jar?dl=0
The FTP client may have issues to handle such behavior (you have to test).
However, you could pool (say every 100ms) the FTP client with a LIST command. The PNG file will be listed with a 0 size as long as it is not yet available. As soon as size is positive, it means that the generation is ok.
This have not been widely tested, so please feedback if you find issues!
Thanks
THANK YOU SO VERY MUCH!

This works like a charm! I do not need to wait a tiniest bit nor use LIST command at all. I just go directly to read output file and it works perfectly. Even FTP client works flawlessly with this without need for any specific handling.

I really appreciate your cooperation. This was amazing experience for me. :)
Drop us a note when your extension for Visual Studio 2015 will be ready : we'll post a news about it!
Thanks!
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...