public void Add(BEncodeString key, BEncodeInteger value) { data.Add(key, value); }
private BEncodeInteger decodeInteger() { char start = (char)reader.ReadByte(); BEncodeInteger value; string nums = ""; bool hasFinal = false; if (start == 'i') { while (true) { char actual = (char)reader.ReadByte(); if (actual == 'e') { hasFinal = true; break; } else { if (char.IsDigit(actual)) { nums += actual; } else { throw new BEncodeException("integer cant contain numbers"); } } } } else { throw new BEncodeException("int must start with an i"); } if (!hasFinal) { throw new BEncodeException("integer need to finish with e"); } value = new BEncodeInteger(Convert.ToInt64(nums)); return value; }
public void Add(BEncodeInteger value) { data.Add(value); }