Esempio n. 1
0
 public void AddIntToTree(TreeNode treeNode, BenInt i)
 {
     treeNode.Nodes.Add("(i):" + i.value_.ToString());
 }
Esempio n. 2
0
 public static IBenNode NextNote(Bencoder file)
 {
     IBenNode node = null;
     char key = file.ReadChar();
     switch (key)
     {
         case '0':
         case '1':
         case '2':
         case '3':
         case '4':
         case '5':
         case '6':
         case '7':
         case '8':
         case '9':
             string stringLen = string.Empty;
             char c = key;
             while (c != ':')
             {
                 stringLen += c.ToString();
                 c = file.ReadChar();
             }
             BenString benString = new BenString(System.Int32.Parse(stringLen));
             benString.Decode(file);
             node = benString;
             break;
         case 'i':
             BenInt i = new BenInt();
             i.Decode(file);
             node = i;
             break;
         case 'd':
             BenDictionary dict = new BenDictionary();
             dict.Decode(file);
             node = dict;
             break;
         case 'l':
             BenList list = new BenList();
             list.Decode(file);
             node = list;
             break;
     }
     return node;
 }