private static byte[] decode_bytes(byte[] x, ref int f)
{
string s = "";
while (x[f] != ':')
{
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");
int l = int.Parse(s);
if (l > 0)
{
byte[] rv = new byte[l];
Buffer.BlockCopy(x, f, rv, 0, l);
f += l;
return rv;
}
return null;
}