How ILSpy saved me

So today I will tell you a story.
So there i was, coding a usual, and I pressed “Save all…” and EXACTLY at that moment there was a power outage. After 10 minutes or so, the power went back on, turned my computer on, and surprise surprise, half of my code (about 500 lines) was corrupted. (Wouldn’t open). Then I went to bed. In the morning I remembered reading an article how you can extract C# (This is important) code from a finished unity game. So I remember 10 minutes before the “accident” happend, I built a standalone. So I went to that article, downloaded “ILSpy” (the software needed for the code extraction) and BAM! in “Game_Data/managed/Assembly-UnityScript-firstpass.dll” was my whole code library. Then I realized how lucky I was because right after I read that article my reaction was “I must obfuscate my code then!”, And i’m happy I failed! BUT, I wasn’t done just yet. First of all, all the code was in C#, and second, I suck a C#. So there I was, reading C# syntax on wikipedia, and slowly but surely translating code, And I have ONE thing to say, C# IS TIRING! all i did was: copy → paste → remove HALF of the code → ??? → PROFIT! (sorry wrong place) examples of what I mean: C#: “GUI.Label (new Rect((float)123.4f …” JS: “GUI.Label(Rect(123.4 …” and so on. basically, It’s too much work! :cry:
So what is the lesson?
-Keep backups!
-Use version control?
-Keep standalones around!
-JS for ease of use, C# for ease of recovery.

“GUI.Label (new Rect((float)123.4f”

…why are you converting a float to a float?

Don’t be so judgmental. First off, the extra parts of that would get removed by the compiler. Secondly, if you read his post, that code is from the IL translator from the DLL IL code, not from him…

Because 500 lines is so much. -_-

1 Like

C# is easy, and explicit declarations are a good thing.

Heh, maybe for today’s bloated world of Languages does 500 lines mean nowt, but in the days of old, especially the amiga scene, the stuff I saw people do with just 200 lines of code would have amazed you.

Another thing, the amount of lines of code you have written does not a professional make.

That may be true, but the amount of lines of code you have does indicate actually good efficient level at.

At what? I’ve seen certain Unity code from various different people all of it trying to achieve the same thing, all similarly around the same amount lines written; some achieved what they wanted with efficient well written and thought out code and others with what has to be considered the worst of unordered code, still though achieving their goal.

There’s a difference between 1000 lines of code that is well thought out and implemented and 1000 lines of spaghetti code that is hacked together even though the end goal was reached.

I totally agree with you lol I was just yanking your chain because of your weirdly structured sentence

“Another thing, the amount of lines of code you have written does not a professional make.”

It’s pretty impressive that you made sense of my reply though lol.

oh! lol. Well the sentence structure in the part you highlighted Bold is a sort of Victorian Style Posh. It’s how things were worded back then.

You’ll find it in poetry, old plays and across the world. It’s not a weirdly structured sentence for anyone well versed in historic English (Germanic), plays, poetry and classical English.

Couldn’t have put it better myself me auld’ friend. :slight_smile:

The fact that English is not my first language probably has something to do with finding the sentence structure weird. Oh well, the more I know.

this thread went to a weird place quickly

Mere on-topicness does not a thread make.

–Eric

1 Like

Op’s claims are a bit over-dramatic. (Letting the obvious made known to all). :slight_smile:

@KheltonHeadley Those weren’t JUST 500 lines, those were 500 lines that including heavy networking (PITA!) and (alot) of variables that were declared in the inspector (complex guistyles for ex.) and also, I forgot to mention the code I got from ILSpy was spaghetti code… ex. JS: [a,b,c] C#: new object[ ]{
a,
b,
c,
}

and it was very confusing until I realized that it was an array.

Chapter 7, verse 16

And it came to pass, that a certain scribe came by night to meet Joseph and inquired, wherefore should I do, when my parchments corrupt and moths attacks? What language shall works be thy written?

Joseph replied, that thou shalt learn version control, for what a scribe has written, let not the machine put asunder.

For the copying of texts, that the scribe must copy it diligently, without compilation and syntax errors, thou shalt make back-ups and put them unto off-line storage, along with ye other prized parchments and jars of wine.

If thy project turn bad, ye shall make weekly stand-alone backups of thy scrolls, so ye compareth thy previous works and restoreth back, so that thy works be saved.

When thou wrote some texts, diligently understand concepts for, though each language is different, concepts are same. Thus, speak ye animation in JavaScript greek or C# latin, know both are same things.

lol

Yeah I usually kill myself when I lose 500 lines of code.