mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
40 lines
857 B
C#
40 lines
857 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Wabbajack.Common.CSP
|
|
{
|
|
class EnumeratorBuffer<T> : IBuffer<T>
|
|
{
|
|
private readonly IEnumerator<T> _enumerator;
|
|
private bool _empty;
|
|
|
|
public EnumeratorBuffer(IEnumerator<T> enumerator)
|
|
{
|
|
_enumerator = enumerator;
|
|
_empty = !_enumerator.MoveNext();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
}
|
|
|
|
public bool IsFull => true;
|
|
public bool IsEmpty => _empty;
|
|
public T Remove()
|
|
{
|
|
var val = _enumerator.Current;
|
|
_empty = !_enumerator.MoveNext();
|
|
return val;
|
|
}
|
|
|
|
public void Add(T itm)
|
|
{
|
|
throw new InvalidDataException();
|
|
}
|
|
}
|
|
}
|