Show / Hide Table of Contents

Class BEncodedDictionary

Class representing a BEncoded Dictionary

Inheritance
System.Object
BEncodedValue
BEncodedDictionary
Implements
System.Collections.Generic.IDictionary<BEncodedString, BEncodedValue>
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<BEncodedString, BEncodedValue>>
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<BEncodedString, BEncodedValue>>
System.Collections.IEnumerable
Inherited Members
BEncodedValue.Encode()
BEncodedValue.Clone<T>(T)
BEncodedValue.Decode(Byte[])
BEncodedValue.Decode(Byte[], Int32, Int32)
BEncodedValue.Decode(Byte[], Int32, Int32, Boolean)
BEncodedValue.Decode(Stream)
BEncodedValue.Decode(RawReader)
BEncodedValue.Decode<T>(Byte[])
BEncodedValue.Decode<T>(Byte[], Int32, Int32)
BEncodedValue.Decode<T>(Byte[], Int32, Int32, Boolean)
BEncodedValue.Decode<T>(Stream)
BEncodedValue.Decode<T>(RawReader)
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: MonoTorrent.BEncoding
Assembly: MonoTorrent.dll
Syntax
public class BEncodedDictionary : BEncodedValue, IDictionary<BEncodedString, BEncodedValue>, ICollection<KeyValuePair<BEncodedString, BEncodedValue>>, IEnumerable<KeyValuePair<BEncodedString, BEncodedValue>>, IEnumerable

Constructors

BEncodedDictionary()

Create a new BEncodedDictionary

Declaration
public BEncodedDictionary()

Properties

Count

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32

IsReadOnly

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean

Item[BEncodedString]

Declaration
public BEncodedValue this[BEncodedString key] { get; set; }
Parameters
Type Name Description
BEncodedString key
Property Value
Type Description
BEncodedValue

Keys

Declaration
public ICollection<BEncodedString> Keys { get; }
Property Value
Type Description
System.Collections.Generic.ICollection<BEncodedString>

Values

Declaration
public ICollection<BEncodedValue> Values { get; }
Property Value
Type Description
System.Collections.Generic.ICollection<BEncodedValue>

Methods

Add(BEncodedString, BEncodedValue)

Declaration
public void Add(BEncodedString key, BEncodedValue value)
Parameters
Type Name Description
BEncodedString key
BEncodedValue value

Add(KeyValuePair<BEncodedString, BEncodedValue>)

Declaration
public void Add(KeyValuePair<BEncodedString, BEncodedValue> item)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<BEncodedString, BEncodedValue> item

Clear()

Declaration
public void Clear()

Contains(KeyValuePair<BEncodedString, BEncodedValue>)

Declaration
public bool Contains(KeyValuePair<BEncodedString, BEncodedValue> item)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<BEncodedString, BEncodedValue> item
Returns
Type Description
System.Boolean

ContainsKey(BEncodedString)

Declaration
public bool ContainsKey(BEncodedString key)
Parameters
Type Name Description
BEncodedString key
Returns
Type Description
System.Boolean

CopyTo(KeyValuePair<BEncodedString, BEncodedValue>[], Int32)

Declaration
public void CopyTo(KeyValuePair<BEncodedString, BEncodedValue>[] array, int arrayIndex)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<BEncodedString, BEncodedValue>[] array
System.Int32 arrayIndex

DecodeTorrent(RawReader)

Special decoding method for torrent files - allows dictionary attributes to be out of order for the overall torrent file, but imposes strict rules on the info dictionary.

Declaration
public static (BEncodedDictionary torrent, InfoHash infohash) DecodeTorrent(RawReader reader)
Parameters
Type Name Description
RawReader reader
Returns
Type Description
System.ValueTuple<BEncodedDictionary, InfoHash>

DecodeTorrent(Byte[])

Declaration
public static (BEncodedDictionary torrent, InfoHash infohash) DecodeTorrent(byte[] bytes)
Parameters
Type Name Description
System.Byte[] bytes
Returns
Type Description
System.ValueTuple<BEncodedDictionary, InfoHash>

DecodeTorrent(Stream)

Declaration
public static (BEncodedDictionary torrent, InfoHash infohash) DecodeTorrent(Stream s)
Parameters
Type Name Description
System.IO.Stream s
Returns
Type Description
System.ValueTuple<BEncodedDictionary, InfoHash>

Encode(Byte[], Int32)

Encodes the dictionary to a byte[]

Declaration
public override int Encode(byte[] buffer, int offset)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to encode the data to

System.Int32 offset

The offset to start writing the data to

Returns
Type Description
System.Int32
Overrides
BEncodedValue.Encode(Byte[], Int32)

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

GetEnumerator()

Declaration
public IEnumerator<KeyValuePair<BEncodedString, BEncodedValue>> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<BEncodedString, BEncodedValue>>

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

GetValueOrDefault(BEncodedString)

Declaration
public BEncodedValue GetValueOrDefault(BEncodedString key)
Parameters
Type Name Description
BEncodedString key
Returns
Type Description
BEncodedValue

GetValueOrDefault(BEncodedString, BEncodedValue)

Declaration
public BEncodedValue GetValueOrDefault(BEncodedString key, BEncodedValue defaultValue)
Parameters
Type Name Description
BEncodedString key
BEncodedValue defaultValue
Returns
Type Description
BEncodedValue

LengthInBytes()

Returns the size of the dictionary in bytes using UTF8 encoding

Declaration
public override int LengthInBytes()
Returns
Type Description
System.Int32
Overrides
BEncodedValue.LengthInBytes()

Remove(BEncodedString)

Declaration
public bool Remove(BEncodedString key)
Parameters
Type Name Description
BEncodedString key
Returns
Type Description
System.Boolean

Remove(KeyValuePair<BEncodedString, BEncodedValue>)

Declaration
public bool Remove(KeyValuePair<BEncodedString, BEncodedValue> item)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<BEncodedString, BEncodedValue> item
Returns
Type Description
System.Boolean

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

TryGetValue(BEncodedString, out BEncodedValue)

Declaration
public bool TryGetValue(BEncodedString key, out BEncodedValue value)
Parameters
Type Name Description
BEncodedString key
BEncodedValue value
Returns
Type Description
System.Boolean

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

Implements

System.Collections.Generic.IDictionary<TKey, TValue>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
In This Article
Back to top Generated by DocFX