Beispiel #1
0
        /// <summary>
        /// Recupera o próximo pedaço.
        /// </summary>
        /// <param name="pointer">Ponteiro para o pedaço.</param>
        /// <returns></returns>
        internal EnumerationDataChunk GetNextChunk(EnumerationPointer pointer)
        {
            EnumerationDataChunk nextChunk = null;
            IEnumerationProvider provider  = this.GetProvider(pointer);

            if (pointer.IsDisposable && (provider != null))
            {
                provider.Dispose();
                if (_index.ContainsKey(pointer))
                {
                    _index.Remove(pointer);
                }
                nextChunk         = new EnumerationDataChunk();
                nextChunk.Pointer = pointer;
                return(nextChunk);
            }
            if (provider != null)
            {
                nextChunk = provider.GetNextChunk(pointer);
                if (nextChunk.IsLastChunk)
                {
                    provider.Dispose();
                    if (_index.ContainsKey(pointer))
                    {
                        _index.Remove(pointer);
                    }
                }
            }
            return(nextChunk);
        }
Beispiel #2
0
        /// <summary>
        /// Compara com outra instancia.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            bool flag = false;

            if (obj is EnumerationPointer)
            {
                EnumerationPointer pointer = obj as EnumerationPointer;
                flag = Id.Equals(pointer.Id);
            }
            return(flag);
        }
Beispiel #3
0
        /// <summary>
        /// Recupera o provedor de enumeração.
        /// </summary>
        /// <param name="pointer"></param>
        /// <returns></returns>
        private IEnumerationProvider GetProvider(EnumerationPointer pointer)
        {
            if (_index == null)
            {
                _index = new Dictionary <EnumerationPointer, IEnumerationProvider>();
            }
            IEnumerationProvider provider = null;

            if (_index.ContainsKey(pointer))
            {
                return(_index[pointer]);
            }
            return(provider);
        }
 /// <summary>
 /// Deserializa os dados da instancia.
 /// </summary>
 /// <param name="reader"></param>
 public void Deserialize(CompactReader reader)
 {
     _data    = (List <string>)reader.ReadObject();
     _pointer = (EnumerationPointer)reader.ReadObject();
 }
Beispiel #5
0
 /// <summary>
 /// Verifica se na instancia contem o ponteiro informado.
 /// </summary>
 /// <param name="pointer">Instancia do ponteiro que será verificado.</param>
 /// <returns></returns>
 internal bool Contains(EnumerationPointer pointer)
 {
     return((_index != null) && _index.ContainsKey(pointer));
 }