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

namespace TD.SandDock
{
	internal class c
	{
		[StructLayout(LayoutKind.Sequential)]
		private class a
		{
			public int a;

			public int b;

			public IntPtr 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(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)
		{
			a(A_0, new Rectangle(A_1.X, A_1.Y, A_1.Width, 4));
			if (A_2)
			{
				a(A_0, new Rectangle(A_1.X, A_1.Y + 4, 4, A_1.Height - 4 - A_3));
				a(A_0, new Rectangle(A_1.Right - 4, A_1.Y + 4, 4, A_1.Height - 4 - A_3));
				a(A_0, new Rectangle(A_1.X, A_1.Bottom - A_3, 10, 4));
				a(A_0, new Rectangle(A_1.X + 80, A_1.Bottom - A_3, A_1.Width - 80, 4));
				a(A_0, new Rectangle(A_1.X + 10, A_1.Bottom - 4, 70, 4));
				a(A_0, new Rectangle(A_1.X + 10, A_1.Bottom - A_3, 4, A_3 - 4));
				a(A_0, new Rectangle(A_1.X + 76, A_1.Bottom - A_3, 4, A_3 - 4));
			}
			else
			{
				a(A_0, new Rectangle(A_1.X, A_1.Y + 4, 4, A_1.Height - 8));
				a(A_0, new Rectangle(A_1.Right - 4, A_1.Y + 4, 4, A_1.Height - 8));
				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 zero = IntPtr.Zero;
			if (!(A_1 == Rectangle.Empty))
			{
				zero = A_0?.Handle ?? IntPtr.Zero;
				IntPtr dC = GetDC(new HandleRef(A_0, zero));
				IntPtr handle = a();
				IntPtr handle2 = SelectObject(new HandleRef(A_0, dC), new HandleRef(null, handle));
				PatBlt(new HandleRef(A_0, dC), A_1.X, A_1.Y, A_1.Width, A_1.Height, 5898313);
				SelectObject(new HandleRef(A_0, dC), new HandleRef(null, handle2));
				DeleteObject(new HandleRef(null, handle));
				ReleaseDC(new HandleRef(A_0, zero), new HandleRef(null, dC));
			}
		}

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