Exemplo n.º 1
0
        public IBNode Analyse(byte[] torrentStream)
        {
            // 清空上一次处理的信息
            BNodeList     = new List <IBNode>();
            _bNodeFactory = new BNodeFactory(BNodeList);
            index         = 0;

            this.torrentStream = torrentStream;
            // bt文件一定是一个字典开始的

            DictNode rootNode = _bNodeFactory.GetBNode('d') as DictNode;

            AnalyseDictionary(rootNode);
            return(rootNode);
        }
Exemplo n.º 2
0
 public IBNode GetBNode(char type)
 {
     IBNode node = null;
     switch (type)
     {
         case 'l': // listitem node
             node = new ListItemNode();
             break;
         case 'd': // dict node
             node = new DictNode();
             break;
         case 'k': // key value node
             node = new KeyValueNode();
             break;
     }
     _bNodeList.Add(node);
     return node;
 }
Exemplo n.º 3
0
        public IBNode GetBNode(char type)
        {
            IBNode node = null;

            switch (type)
            {
            case 'l':     // listitem node
                node = new ListItemNode();
                break;

            case 'd':     // dict node
                node = new DictNode();
                break;

            case 'k':     // key value node
                node = new KeyValueNode();
                break;
            }
            _bNodeList.Add(node);
            return(node);
        }