Parse() публичный Метод

public Parse ( Stream s ) : void
s Stream
Результат void
Пример #1
0
        public static BEncodeValue Parse(Stream d, byte firstByte)
        {
            BEncodeValue value2;
            char         ch = (char)firstByte;

            switch (ch)
            {
            case 'd':
                value2 = new ValueDictionary();
                break;

            case 'l':
                value2 = new ValueList();
                break;

            case 'i':
                value2 = new ValueNumber();
                break;

            default:
                value2 = new ValueString();
                break;
            }
            if (value2 is ValueString)
            {
                ((ValueString)value2).Parse(d, (byte)ch);
                return(value2);
            }
            value2.Parse(d);
            return(value2);
        }
Пример #2
0
 public void Parse(Stream s)
 {
     for (byte num1 = (byte)s.ReadByte(); num1 != 0x65; num1 = (byte)s.ReadByte())
     {
         if (!char.IsNumber((char)num1))
         {
             throw new TorrentException("Key expected to be a string.");
         }
         ValueString text1 = new ValueString();
         text1.Parse(s, num1);
         BEncodeValue value1 = BEncode.Parse(s);
         if (dict.ContainsKey(text1.String))
         {
             dict[text1.String] = value1;
         }
         else
         {
             dict.Add(text1.String, value1);
         }
     }
 }
Пример #3
0
 public void Parse(Stream s)
 {
     for (byte num1 = (byte)s.ReadByte(); num1 != 0x65; num1 = (byte)s.ReadByte())
     {
         if (!char.IsNumber((char)num1))
         {
             throw new TorrentException("Key expected to be a string.");
         }
         ValueString text1 = new ValueString();
         text1.Parse(s, num1);
         BEncodeValue value1 = BEncode.Parse(s);
         if (dict.ContainsKey(text1.String))
         {
             dict[text1.String] = value1;
         }
         else
         {
             dict.Add(text1.String, value1);
         }
     }
 }
 public void Parse(Stream s)
 {
     for (byte i = (byte)s.ReadByte(); i != 0x65; i = (byte)s.ReadByte())
     {
         if (!char.IsNumber((char)i))
         {
             return;
         }
         ValueString str = new ValueString();
         str.Parse(s, i);
         BEncodeValue value2 = BEncode.Parse(s);
         if (str.String != null)
         {
             if (this.dict.ContainsKey(str.String))
             {
                 this.dict[str.String] = value2;
             }
             else
             {
                 this.dict.Add(str.String, value2);
             }
         }
     }
 }