Ported "Extract Till you drop" from php to C#