[quote user="Renan "C#" Sousa"]
Lurk more and you might find worse
[/quote]
I don't doubt that for a second. This is probably somewhere around just the third circle of hell, or so. As bad as it is, it could be a lot worse.
[quote user="Renan "C#" Sousa"]
Lurk more and you might find worse
[/quote]
I don't doubt that for a second. This is probably somewhere around just the third circle of hell, or so. As bad as it is, it could be a lot worse.
That's exactly the point. How could someone writing this code not notice that they just made the ugliest variant of a while loop?
Too bad the only C# loop constructs introduced in C# were the for-loop and the goto statement.
public bool reAquireHardware()
{
_settings._experiment.unlockRequiredHardware();
string error = string.Empty;
tryAgain:
if (!_settings._experiment.lockRequiredHardware(ref error))
{
if (MessageBox.Show(this, error, "Hardware Error(s)", MessageBoxButtons.RetryCancel) == DialogResult.Retry)
goto tryAgain;
else
return false;
}
return true;
}
Losing my sanity as I maintain this dirty-gas-station-bathroom of a code base...