Пример #1
0
        public async Tasks.Task <bool> Write(Generic.IEnumerator <byte> buffer)
        {
            bool result = buffer.NotNull();

            if (result)
            {
                int seek = this.peeked.Reset();
                if (seek != 0)
                {
                    await this.Seek(seek);
                }
                try
                {
                    byte[] array = buffer.ToArray();
                    await this.backend.WriteAsync(array, 0, array.Length);

                    if (this.AutoFlush)
                    {
                        await this.Flush();
                    }
                }
                catch (System.Exception)
                {
                    result = false;
                }
            }
            return(result);
        }
Пример #2
0
 static T[] ToArray <T>(this Generic.IEnumerator <T> me, int count)
 {
     T[] result;
     if (me.MoveNext())
     {
         var head = me.Current;
         result        = me.ToArray(count + 1);
         result[count] = head;
     }
     else
     {
         result = new T[count];
     }
     return(result);
 }
Пример #3
0
 public void Test(char[] expected, Generic.IEnumerator <char> actual)
 {
     Assert.Equal(expected, actual.ToArray());
 }
Пример #4
0
 public Builder Prepend(Generic.IEnumerator <char> value)
 {
     this.data.Add(value.ToArray());
     return(this);
 }
Пример #5
0
 public static T[] ToArray <T>(this Generic.IEnumerator <T> me)
 {
     return(me.NotNull() ? me.ToArray(0) : null);
 }