using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace TD.SandDock
{
	internal class c
	{
		[DllImport("gdi32.dll")]
		private static extern IntPtr CreateBitmap(int A_0, int A_1, int A_2, int A_3, short[] A_4);

		[DllImport("gdi32.dll")]
		private static extern IntPtr CreateBrushIndirect(c.a A_0);

		[DllImport("gdi32.dll")]
		private static extern bool DeleteObject(HandleRef A_0);

		[DllImport("user32.dll")]
		private static extern int ReleaseDC(HandleRef A_0, HandleRef A_1);

		[DllImport("gdi32.dll")]
		private static extern IntPtr SelectObject(HandleRef A_0, HandleRef A_1);

		[DllImport("gdi32.dll")]
		private static extern bool PatBlt(HandleRef A_0, int A_1, int A_2, int A_3, int A_4, int A_5);

		[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
		private static extern IntPtr GetDC(HandleRef A_0);

		public static void a(Control A_0, Rectangle A_1, bool A_2, int A_3)
		{
			c.a(A_0, new Rectangle(A_1.X, A_1.Y, A_1.Width, 4));
			if (A_2)
			{
				c.a(A_0, new Rectangle(A_1.X, A_1.Y + 4, 4, A_1.Height - 4 - A_3));
				c.a(A_0, new Rectangle(A_1.Right - 4, A_1.Y + 4, 4, A_1.Height - 4 - A_3));
				c.a(A_0, new Rectangle(A_1.X, A_1.Bottom - A_3, 10, 4));
				c.a(A_0, new Rectangle(A_1.X + 80, A_1.Bottom - A_3, A_1.Width - 80, 4));
				c.a(A_0, new Rectangle(A_1.X + 10, A_1.Bottom - 4, 70, 4));
				c.a(A_0, new Rectangle(A_1.X + 10, A_1.Bottom - A_3, 4, A_3 - 4));
				c.a(A_0, new Rectangle(A_1.X + 76, A_1.Bottom - A_3, 4, A_3 - 4));
				return;
			}
			c.a(A_0, new Rectangle(A_1.X, A_1.Y + 4, 4, A_1.Height - 8));
			c.a(A_0, new Rectangle(A_1.Right - 4, A_1.Y + 4, 4, A_1.Height - 8));
			c.a(A_0, new Rectangle(A_1.X, A_1.Bottom - 4, A_1.Width, 4));
		}

		public static void a(Control A_0, Rectangle A_1)
		{
			IntPtr handle = IntPtr.Zero;
			if (A_1 == Rectangle.Empty)
			{
				return;
			}
			if (A_0 == null)
			{
				handle = IntPtr.Zero;
			}
			else
			{
				handle = A_0.Handle;
			}
			IntPtr dc = c.GetDC(new HandleRef(A_0, handle));
			IntPtr handle2 = c.a();
			IntPtr handle3 = c.SelectObject(new HandleRef(A_0, dc), new HandleRef(null, handle2));
			c.PatBlt(new HandleRef(A_0, dc), A_1.X, A_1.Y, A_1.Width, A_1.Height, 5898313);
			c.SelectObject(new HandleRef(A_0, dc), new HandleRef(null, handle3));
			c.DeleteObject(new HandleRef(null, handle2));
			c.ReleaseDC(new HandleRef(A_0, handle), new HandleRef(null, dc));
		}

		private static IntPtr a()
		{
			short[] array = new short[8];
			for (int i = 0; i < 8; i++)
			{
				array[i] = (short)(21845 << (i & 1));
			}
			IntPtr intPtr = c.CreateBitmap(8, 8, 1, 1, array);
			IntPtr result = c.CreateBrushIndirect(new c.a
			{
				b = ColorTranslator.ToWin32(Color.Black),
				a = 3,
				c = intPtr
			});
			c.DeleteObject(new HandleRef(null, intPtr));
			return result;
		}

		[StructLayout(LayoutKind.Sequential)]
		private class a
		{
			public int a;

			public int b;

			public IntPtr c;
		}
	}
}
