I was decompiling an open-source project (because the source for the latest version hasn't been released yet). Using RedGate's Reflector tool, it gave me this block of code:
if(somecondition == true)
{
ref Vector3i vectoriRef;
float num17 = length - num;
Vector3i end = vectori3;
(vectoriRef = (Vector3i) &end)[1] = vectoriRef[1] - ((int) num17);
}
somecondition
is a boolean. length
and num
are floats defined outside the code. vectori3
is also defined outside the code and is of type Vector3i. The type Vector3i is essentially this code, but with x, y, and z stored as integers.
When I try to compile this decompiled code, I get the following errors:
- Line 2: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- Line 3: ; expected
- Line 3: Invalid expression term 'ref'
- Line 6: 'Vector3i' is a 'type' but is used like a 'variable'
Any thoughts on how I can fix this code so it compiles correctly and does whatever it was intended to do?
UPDATE: It turns out the source is available in their repository, but you have to follow a maze of links and clues to even find it. Thanks to everyone who posted!