Hi there,
I know, there are other libraries for C# (and compatible VB.NET) around. Anyway, I started to work on my own library, just because I wanted to do it on my own to see where I get. I really want to make sure, that this library is not intended to criticise any of the existing ones!
Anyway, I think this library has some Pros (of course I do think, as it's mine
), while having other drawbacks.
Some Pros:
- Connecting to LFS is easy, just supply a string like "localhost:29999" and you're on your way
- You don't have to care about receiving messages, there is a clean event for any InSim message, no need to convert a byte-array to an object.
- To send a message, you just have to create an object and send it, no need to bother with getting it an byte-array or anything else.
- The "structs" (I chose to go for classes) don't know about there byte representation, therefore, it's easy to add new messages or change existing ones
- Although hurting .NET naming conventions, I chose to use class-names as defined in InSim.txt to ease finding, what you're looking for.
- The TestApplication is 90%-reflective, making it ready to go, if the library will be extended / updated.
- Trying to hide C++-specifics, whenever possible (e.g. you don't have to care about zero-ending strings or Numberplates with fixed char[8]).
Anyway, some Cons:
- It's not yet finished, missing a lot of "IS_Sendable"-Attributes [mostly(?) done in V1.0.0.1]
- No udpSocket implemented yet (although it should be quite easy)
- No support for OutGauge yet (missing the right idea for reacting to "no-header-packets" atm)
- Needs some refactoring (IS_Enums and IS_SubPackets both have bad, inconsistent names).
- The RequestManager was a bad idea, the packet themselves should know, how they can be requested.
- The ctor contains fixed size of the packets, will be replaced with dynamic calculation.
I'm posting that library in this early stage, because I will be on vacations next week and I fear that I won't like going on with this library immediatly after. On the other side, I think it would be to sad not to publish this library, as it might be useful for some coders to get some ideas.
I'm considering posting this lib at SourceForge to make it easier keeping up-to-date with it.
Sadly, I saw that there's nearly no traffic at JInSimLib, why is that? Is the audience for an InSimLib really that small?
This is my very first post of own code on the internet, so please be kind to me :-). But of course, I'd appreciate some honest statements about this library and the idea of making an SourceForge-Project.
Kind Regards
Jens Buchta (Red Runner)
Update 05.06.2007:
- Library updated to V1.0.0.1 (I accidently released the first version as 1.0.0.0 and don'T want to decrease the version number. This one is still not finished).
- All packets marked as "instruction" oder "both ways" in "ISP_enum" are now sendable
- Fixed a bug in IS_NLP - packet that caused application to crash
- Updated IS_NLP and IS_MCI to InSim of W32-Patch (variable size)
- Receive / Send - ComboBox in TestApp is now sorted
- minor bugfixes
Update 07.06.2007:
- Library updated to V1.0.0.2
- IS_NLP / IS_MCI contained wrong information, if received length < maximum length
- replaced Logging-Listviews with Treeviews in TestApp
- Added the abbility to see the contents of Sub-Packets (like NodeLap / Compcar) in TestApp - TreeViews
Known Issues
Library related:
- Library doesn't react to invalid packets properly
- Variable length packets always consume full length in memory
TestApp related:
- UI becomes unresponsive, if too many packets arrive (usually, if interval < 500ms and receiving IS_NLP / IS_MCI packets)
- TestApp doesn't handle any exceptions