Пример #1
0
        public bool Equals(BInt other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Equals(other.Value));
        }
Пример #2
0
        public int CompareTo(BInt other)
        {
            var returnVal = 0;

            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            if (Value < other.Value)
            {
                returnVal = -1;
            }

            if (Value > other.Value)
            {
                returnVal = 1;
            }

            return(returnVal);
        }
Пример #3
0
        public static IBencodingType Decode(BinaryReader inputStream, ref int bytesConsumed)
        {
            IBencodingType returnValue = null;

            char next = (char)inputStream.PeekChar();

            switch (next)
            {
            case 'i':
                // Integer
                returnValue = new BInt(0);
                break;

            case 'l':
                // List
                returnValue = new BList();
                break;

            case 'd':
                // Dictionary
                returnValue = new BDict();
                break;

            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                // String
                returnValue = new BString();
                break;
            }

            return(returnValue.Decode(inputStream, ref bytesConsumed));
        }
Пример #4
0
        public override bool Equals(object obj)
        {
            BInt other = obj as BInt;

            return(Equals(other));
        }