private static int decode_int(byte[] x, ref int f)
{
string s = "";
while (x[f] != 'e')
{
s += (char)x[f];
f++;
}
f++;
Regex r = new Regex("^(0|-?[1-9][0-9]*)$", RegexOptions.Compiled);
//if (!r.IsMatch(s))
//throw new BitTorrentException("Integer value is invalid");
return int.Parse(s);
}