示例#1
0
        public iTunesDataReader(System.Data.CommandBehavior behavior, iTunesConnection conn, iTunesCommand cmd)
        {
            _xconn    = conn;
            _xcmd     = cmd;
            _behavior = behavior;

            _Data = new object[_Names.Length];                  // allocate enough room for data

            if (behavior == CommandBehavior.SchemaOnly)
            {
                return;
            }

            // create an iterator to the selected rows
            _xpd        = new XPathDocument(_xconn.File);
            _xpn        = _xpd.CreateNavigator();
            _xpni       = _xpn.Select("/plist/dict"); // select the rows
            _NameSpaces = new ListDictionary();

            // Now determine the actual structure of the row depending on the command
            switch (_xcmd.Table)
            {
            case "Tracks":
            default:
                _xpni = GetTracksColumns();
                break;
            }

            if (_NameSpaces.Count > 0)
            {
                _nsmgr = new XmlNamespaceManager(new NameTable());
                foreach (string nsprefix in _NameSpaces.Keys)
                {
                    _nsmgr.AddNamespace(nsprefix, _NameSpaces[nsprefix] as string);                     // setup namespaces
                }
            }
            else
            {
                _nsmgr = null;
            }
        }
        public iTunesDataReader(System.Data.CommandBehavior behavior, iTunesConnection conn, iTunesCommand cmd)
		{
			_xconn = conn;
			_xcmd = cmd;
			_behavior = behavior;

            _Data = new object[_Names.Length];			// allocate enough room for data

            if (behavior == CommandBehavior.SchemaOnly)
                return;

            // create an iterator to the selected rows
            _xpd = new XPathDocument(_xconn.File);
            _xpn = _xpd.CreateNavigator();
            _xpni = _xpn.Select("/plist/dict");	// select the rows
            _NameSpaces = new ListDictionary();

			// Now determine the actual structure of the row depending on the command
			switch (_xcmd.Table)
			{
				case "Tracks":
                default:
                    _xpni = GetTracksColumns();
					break;
			}

			if (_NameSpaces.Count > 0)
			{
				_nsmgr = new XmlNamespaceManager(new NameTable()); 
				foreach (string nsprefix in _NameSpaces.Keys)
				{
					_nsmgr.AddNamespace(nsprefix, _NameSpaces[nsprefix] as string); // setup namespaces
				}
			}
			else
				_nsmgr = null;
		}