Top GitHub Comments
Hi, this was a long time ago… I did remember seeing his article when I already had a working prototype (but his article might predate my work, not sure). I started with it, because too many times, folks would write that this kind of thing would be impossible.
I remember that some things were eerily similar. I also used a state machine and my enum was almost the same. Even that eye sore “} // end of class” was in your code as well. I think, I saw someone else at that time searching for that string as well. (You were probably just as afraid to read over a class boundary than I was) The attribute had to be the same. We can only change the export name and the convention, everything else is just the result of mirroring DllImportAttribute.
However, if I remember correctly, I already used Cecil in my first prototypes to get the attributes and their values reliably. I must have liked some of the things I saw in your code, so that over time things in mine started to follow some of your ideas.
I am absolutely unsure (and curse myself for not using a VCS back then), whether I followed your approach to get rid of the attribute dependency or not. I think, I just didn’t care when it was still a project template. But when it became a nuget packages, I had to provide an assembly with that attribute, and I didn’t want to create a runtime dependency. But even if I already did that or did it later on, I probably recognized and skipped those lines according to my copy of Expert .NET 2.0 IL Assembler
The obvious pieces like naming a variable „trimmedLine“ are no indication for a copy, I used that name so many a hundred times for a trimmed line, as did probably everybody else. I don’t recall copying anything from your code, but looking at it now, I have to say I that some things got closer to yours over time.
And btw, this repo here is not my code. He used ilspy or reflector to get C# code from my binaries. And wasn’t the bulk of the work getting the correct locations and versions of il(d)asm and dealing with Microsoft’s constant campaign of breaking how to find those things. Which is why I stopped caring about it a long time ago.