Meshwork meet C#
So I finally broke down today and converted libMeshwork from VB.net to C#. I used SharpDevelop which has a converter tool. Unfortunetly it’s quite incomplete and still left me with about 6 hours of cleanup work (over 700 build errors). The main problems were:
- Doesn’t convert
MyArray(index)toMyArray[index]. Manually replacing hundreds and hundreds of ()s with []s is extremely boring and takes a very long time. - Doesn’t create delegates for events. This also takes a long time to fix, especially because I had to constantly look back at the original VB.net source to remember what the parameters for each event were supposed to be.
- Doesn’t account for things that VB.net lets you get away with, such as not including the ()s after a method name that takes no parameters. I had lots and lots of
.ToString’s and.ToLower’s that needed some()loving.
Hm, so yeah, basically parentases are a bitch.
After I finally got the damn thing to compile I ran into a few remaining problems:
- Arrays were one size too small. In VB.Net
Dim myArray as Byte(19)creates an array of length 20, in C# you specify the actual size you want,byte[] myArray = new byte[20]; - The converter had totally screwed up all my ‘Is Object Not’ statements putting the
!in the wrong spot, so I had to go through and fix all of them.
But all in all it was suprisingly painless and works suprisingly well. Hopefully now I can create a nice testcase and figure out exactly why it doesn’t work in mono. I’ll also be able to add XML comments and generate some nice pretty documentation from them for those of you (Patrick) who have been asking for this for a while :).
Categorized as Technology/Software Development, Technology
Do you see the potential dangers of meshwork, possible bad uses: peadophile rings, piracy … etc?
Sure, but this isn’t my problem. Meshwork gives users the freedom to do whatever they want, it’s each individuals job to censor themselfs, not mine.