Exemple #1
0
		public static DesktopBrush Solid(System.Drawing.Color color)
		{
			DesktopBrush brush = new DesktopBrush (new SolidBrush (color));
			brush.Type = BrushType.Solid;
			brush.Color = color.Convert();
			return brush;
		}
        public void ConvertFixture()
        {
            var list = new[] { 1, 2, 3, 4, 5 };
            int idx = 0;

            list.Convert(item => item*2).ForEach(item => item.Should().Equal(list[idx++]*2));
        }
Exemple #3
0
 private void FlushDecoder(System.Text.Decoder decoder, bool allowControlCharacters, ref byte[] byteBuffer, ref char[] charBuffer, System.Text.StringBuilder sb)
 {
     int bytesUsed;
     int charsUsed;
     bool completed;
     decoder.Convert(byteBuffer, 0, 0, charBuffer, 0, charBuffer.Length, true, out bytesUsed, out charsUsed, out completed);
     if (charsUsed == 0)
         return;
     if (!allowControlCharacters)
         ValueDecoder.RemoveProhibitedControlCharacters(charBuffer, 0, charsUsed);
     sb.Append(charBuffer, 0, charsUsed);
 }
Exemple #4
0
 private void FlushDecodedBytes(byte[] byteBuffer, int byteBufferLength, System.Text.Decoder decoder, bool allowControlCharacters, char[] charBuffer, System.Text.StringBuilder sb)
 {
     var byteIndex = 0;
     bool completed;
     do {
         int bytesUsed;
         int charsUsed;
         decoder.Convert(byteBuffer, byteIndex, byteBufferLength, charBuffer, 0, charBuffer.Length, false, out bytesUsed, out charsUsed, out completed);
         if (charsUsed != 0) {
             if (!allowControlCharacters)
                 ValueDecoder.RemoveProhibitedControlCharacters(charBuffer, 0, charsUsed);
             sb.Append(charBuffer, 0, charsUsed);
         }
         byteIndex += bytesUsed;
         byteBufferLength -= bytesUsed;
     } while (!completed);
 }
Exemple #5
0
 private void ConvertRawFragment(ValuePosition start, ValuePosition end, System.Text.Decoder decoder, bool allowControlCharacters, ref char[] charBuffer, System.Text.StringBuilder sb)
 {
     var valueIterator = new ValueIterator(iterator.Lines, iterator.LinesMask, start, end);
     if (valueIterator.Eof)
         return;
     if (charBuffer == null)
         charBuffer = Internal.ScratchPad.GetCharBuffer(System.Math.Min(1024, iterator.TotalLength));
     int bytesUsed;
     int charsUsed;
     bool completed;
     do {
         decoder.Convert(valueIterator.Bytes, valueIterator.Offset, valueIterator.Length, charBuffer, 0, charBuffer.Length, false, out bytesUsed, out charsUsed, out completed);
         if (charsUsed != 0) {
             if (!allowControlCharacters)
                 ValueDecoder.RemoveProhibitedControlCharacters(charBuffer, 0, charsUsed);
             sb.Append(charBuffer, 0, charsUsed);
         }
         valueIterator.Get(bytesUsed);
     } while (!completed || !valueIterator.Eof);
     decoder.Convert(MimeString.EmptyByteArray, 0, 0, charBuffer, 0, charBuffer.Length, true, out bytesUsed, out charsUsed, out completed);
     if (charsUsed == 0)
         return;
     if (!allowControlCharacters)
         ValueDecoder.RemoveProhibitedControlCharacters(charBuffer, 0, charsUsed);
     sb.Append(charBuffer, 0, charsUsed);
 }