Beispiel #1
0
 public static T Clone <T> (T value)
     where T : BEncodedValue
 {
     //Check.Value (value);
     return (T) BEncodedValue.Decode (value.Encode ());
 }
Beispiel #2
0
 public static T Decode<T>(RawReader reader) where T : BEncodedValue
 {
     return (T)BEncodedValue.Decode(reader);
 }
Beispiel #3
0
 /// <summary>
 /// Decode BEncoded data in the given stream 
 /// </summary>
 /// <param name="stream">The stream containing the BEncoded data</param>
 /// <returns>BEncodedValue containing the data that was in the stream</returns>
 public static T Decode<T>(Stream stream) where T : BEncodedValue
 {
     return (T)BEncodedValue.Decode(stream);
 }
Beispiel #4
0
 public static T Decode<T>(byte[] buffer, int offset, int length, bool strictDecoding) where T : BEncodedValue
 {
     return (T)BEncodedValue.Decode(buffer, offset, length, strictDecoding);
 }
Beispiel #5
0
 /// <summary>
 /// Decode BEncoded data in the given byte array
 /// </summary>
 /// <param name="buffer">The byte array containing the BEncoded data</param>
 /// <param name="offset">The offset at which the data starts at</param>
 /// <param name="length">The number of bytes to be decoded</param>
 /// <returns>BEncodedValue containing the data that was in the byte[]</returns>
 public static T Decode<T>(byte[] buffer, int offset, int length) where T : BEncodedValue
 {
     return BEncodedValue.Decode<T>(buffer, offset, length, true);
 }
Beispiel #6
0
 /// <summary>
 /// Interface for all BEncoded values
 /// </summary>
 /// <param name="data">The byte array containing the BEncoded data</param>
 /// <returns></returns>
 public static T Decode<T>(byte[] data) where T : BEncodedValue
 {
     return (T)BEncodedValue.Decode(data);
 }