Guest User

Malwarebytes progressbar

a guest
Jun 7th, 2015
1,087
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' Made by AeroRev9 for HackForums.
  2.  
  3. Imports System.Drawing.Drawing2D
  4.  
  5. Module Helpers
  6.  
  7.     Public Enum ProgressType As Byte
  8.         Min = 0
  9.         Progressing = 1
  10.         Max = 2
  11.     End Enum
  12.  
  13.     Public Function CodeToImage(ByVal Code As String) As Image
  14.         Return Image.FromStream(New System.IO.MemoryStream(Convert.FromBase64String(Code)))
  15.     End Function
  16.  
  17.     Public Function GetBase64StringIcon(prog As ProgressType) As String
  18.  
  19.         If prog = ProgressType.Min Then
  20.             Return "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAC6UlEQVRYhc3XMYhcVRQG4G8fi4Qt
  21. QrCw2iJVsNxiiAbLrFtYBES49XaSTrPFZguLaLFJsatdSGd9QQSRhWw2lYjJMoQtxUK2WCwsJKQI
  22. IjJY3PNmxsmbmTtCWH8YuPe8c89/5tz7zv3fkkrknC9gHdexhsu4GI9f4BQneIyjlNKfNXGXKohX
  23. sYVNXKrM9zm+xl5K6ew/JZBzXsZt7GBl7NFL9PEL/gjbm7iCXofvLu6mlP6uTiD+9Te4GqYBDvAA
  24. hymlv6asewMb+BgfoIlHx/ioqxqvJJBzfhuPsBqmPm6mlPpdpNOQc+7hvlIVOMP7KaWfx/2aiUWr
  25. E+T7uLYoOcSaaxFDxHwUHEMMKxB7/qNR2bdSSvumIOf8Lr6I6WcppSczfG9hL6bHeK89E+MVuD1G
  26. vj+H/C08VF7LdTwMWyciVhvvanAZJhBl2QlbH9vTggVuGPUAMb4xZ812xIaddivaCmwpr89AOXCd
  27. r8wEYY1tiIh5MzhWglMTHW4z/A4qD1xXl5vb+SL2QUw3c84XGmUP2w73oIKcUQOaZ+tCy3EJ643S
  28. 2yld67AyyO+Vti4cBhdcb5SLBfrTOlwHfqu0vYLgaLd5rVFuNUpvr8WpcphaDMJWi5brcmN0emv3
  29. UFy144SntdfvBNfFZqbbbJxMGS+ERhETlCt1EfwwZVyDlutFY1TKKwsG+U7Z+0GMF0HLddoYla8X
  30. 93kVUkq/4g7uxLgKwdFe0SfLiob7RGmPG/h+gSQ+r/Udw4aRanrc4EjRcBQl87rRcjzH0RLknL9U
  31. qjDAOzX3Qc55Bd/G9MOU0stZ/rGmh6fK4f8qpfRp+xruKe2xwf0QJ/OwppRzw6ibziJfViRaE1x7
  32. YiLE4m749nCvIoHJTjgP94wO324rUMcb0V1FLsGtkFGz8Aw5fs9mOUasNt5xcGFCFYdK+cm/Rel2
  33. hUCZRrys/POW/EwRuUN5fu6y/P/3YTIW7Pw+zSYSOZ+P045EXsvn+T/nYyK/KE7IRwAAAABJRU5E
  34. rkJggg=="
  35.         ElseIf prog = ProgressType.Progressing
  36.             '            Return "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADLklEQVRYhbXXX2gdRRgF8F8uFwnS
  37.             'h5ItUXwQkT5YkFJs0bL+K5SoSCnkQYUFRUUsiFJ8EvGhD7UUK6WCIBTqgwrrH0QQxBZstIIuWFSC
  38.             'FAkFawghiHRLCSWESwg+zK5s996bbMK952mZmf3OmW9mznwzoiGSLGrjIUzgPtyNrWhhEbOYxg84
  39.             'n8b5cpO4Iw2It+E1vIQ7Guq9jo/xbhrn85sSkGRRC6/gqDDTzWAZJ3AsjfNOYwFJFm3Fp3hik8R1
  40.             '/I7JNM7n1hWQZNE4pnDvgMhLzGMijfOZvgKKmf+InQMmL7GAB9M4ny0bWhXyFj4ZIjlhE3+dZNFo
  41.             '2dCudL6MAw0DreIS/sA1bCmC78G2df7diSN4k2IJitT/hbF1fp7HKaRpnP9T7yyy+AgO46BKhmvo
  42.             'YEca51fKDLzag/xXYUblD8dwYi2DSeN8FRdwIcmiffgId/YYegvewKGRQvXfPQbuwDuFiMk0zi/2
  43.             'I+6H4kSdFZyzjiXc1ioIeqns4Cns3gw5pHH+Lx4XbLqOW3GgjX1rBOiga61LJFl0jzCBUaxgBheL
  44.             'pShjXE2y6FnheNf3xP42djeYTJ34fmEzxj26Z5MsOo4zpZA0zn9KsuhLPF0bu6uFuzZI/hx+7kOu
  45.             'iHcaZ5Ms2lJpf7/X2JaNXzSTbvaPfngMnxebHDLBM6po9zuna+EZfNNw7JOKtBfL8Wd9QFsoJnrh
  46.             'VJJFN/r0LQtu2GQCh/BZ8V3n6rSFI7JHNw42CN4Ee5MsaqdxviKclirmWvhtQET9MCrcFbC91jfd
  47.             'wvdDFrCCpSSLtus2vKmW4PmzQxRwuTC0F2rtS/i2VezO00MUcC7JojGhvqziizTOF8td/AGuDoF8
  48.             'FR/ipJv9poPjFMcojfNFvDUEAV9hL56vtb+Xxvnl/wUUOINzAyS/gV90L+8loSJCd1E6Jtxag6iI
  49.             'p4s4VdtewMNpnF/pKaAQcTu+G5CIKhawv16Wd1lpUes9ivMDJJ8WyvGZekdPL0/j/JpQyRzW/65o
  50.             'gmW8jQeqb4EqmjxOx/E6XsR4Q+LycXqy13NsQwIqQtpCyT2BXcLzfEzI4nXMCamesoHn+X9QwPJf
  51.             '/5GEeQAAAABJRU5ErkJggg=="
  52.  
  53.             Return "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADDElEQVRYhbWXT0hVQRTGf0qIiIQ0
  54. Ei5cRFQLkwyLFgMlBUEFgWiWDBUUCekmiooiQlpIBdE/KioSWtgsKoogahNEUIOFi1rkIlqkSEQ4
  55. IhEiEtJirjrMm2vvXV/f6t0zc873vbnnnnOmhIxQRqwB9gHdWtqJrHFKszoC5cBx4LMyYkfWICVZ
  56. nJQRFUAz8MAzPwSOamm//xcByogaYD/QCjQCiyLbxoHTwF0t7XRRBCgjKoFzQBfu2PPBW+CAlvbr
  57. vzbG/oVP3gg8ApbnSTyDH0BeiZmahMqILcCbAsmHgZ1a2jY/F5QRVQUJUEasBZ4BlZHlUeAW0O3Z
  58. /gCXgdVa2udBrF3AkDJCxrhyciDJ8E/AimBpEpcL17W0E8qIDcB7oB/o1NJ+jMQ6DNzE/dERoEFL
  59. O+bvieXA2Qj5KLBdSzvg2caBTlIyXhnRlZDPoBboSXxmURI4VQNDQIVnngKatLT9EbGpUEbU4U7I
  60. f41TwEot7fCMIcyBvQE5QE+h5ABa2kHgTGAuAzp8QyigNXgeAy4VSu7hNu7d+2iOClBGlAEbgs1P
  61. FtJotLRTgA7MdcqIJTkCgGW4I/LxLiv5PDFKgVUxAdUR5/D4siAWY5ZrIe24KPAFjEbWa4vAEYsx
  62. y+UL+Iardj42FkFAU8T2JUdAkrHh996StONMSL6s3YF50C/HYQ48DZ6rgBNZBeBmiPAVPPYfQgF9
  63. wO/Adiqtk82HpKP2BOYpoDdVQHI0VwOnMmBTCkmpMuKgMmJ9YG8EXpJb1u/5fSBHQILzzCXJNG7Q
  64. vBAhr8cNLL0k37UyolwZcRJXfGoClxFye0N8Jkxm/tfAES1tX7BWgWvZx5irnDeS3y3EC9oksDnW
  65. 1FKHUmXEYi3tr8C2DdfjCxnTJoA2Le2L2GJeY7kyYilwDWgvgBhcbdmjpf2QtiHfUlxKfD5MwyRu
  66. RmyYjxwKvBkpI9qBK+QmGLjBdABXS+5raX/mE7Pgq1kyYl8EDjF3gh2AzjI7ZLobJkIkcAeoB7Zq
  67. aV9liZO5HWtpDbAOdxfMPDX9Ba4m4yf9OQ8TAAAAAElFTkSuQmCC"
  68.         Else
  69.             Return "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAC5ElEQVRYhbXXTYgcRRjG8d80yxJC
  70. kJCWsIJgCB70IkEDYkdCcJWIJ0E82DEEQTSKiDGnCB4kfoEYEBUxF9FDiV4UDx78FrS8LDKoiEgM
  71. S/QQAg2yhGVZluChunEy6Z3pncw+l6G6uuf/9Ftdb71vT0eVMZ/F3bgHt2I3tmEVyziPBXyNL0JR
  72. LXf5314H8E4cx6PY0dHvEj7Aa6Gozk1koIz5DJ7B87imI3hYKziFk6GoVjobKGM+h4+wf0LwsPp4
  73. IBTV2bEGypjvxpfSGk9TF3AwFFV/XQP1ev+0CfBBE3cMRiIbgGf4cBPhsBOflDHfcoUBPIW7NhHe
  74. 6Ba80Ax6UMZ8B/7C9ilBLuJPKV+0aRU3h6I620Tg2BThcAi34bCUE4Y1ixPQq/f735ibEvx0KKrH
  75. m0EZ8+fwUst9y7guw51ThJ+RsmYD3yJFoU1bcV+G+SnBL+GRUFQXB66dxE0jnpnPsHdKBk6Fovqh
  76. GZQxL6RUPkp7Mlw/Bfjv0pnRwLfifcyMeW5XJq3F1WgNR4YOm1dwY4dnZzJp7cbpM9yAT1vmXg5F
  77. tdAMypgfkJJaJ2XSkTlK30gn2Tk8iI8H5n6WPrQGvg3vuTzDjtJahn/G3PRHKKo1qH8PIdTGjzRz
  78. tV7Hro5wWMykMmqUjpYxf7IZ1MDD0tH6W3O9jPm9UtW0EfV7Zcz34/sxN17CE6GoTrdNljHfjl9t
  79. fEc9lCFKBeUoZXinjPlj68y/OQF8GZ9ndUhb32wdE0cHL5Yxvx8PbxAOIRTVUvO1voF/O5p4u4z5
  80. szV8Du9OAF+VcsX/JVkZ86drI121IIV9koPs1VBUJ7h8v74l7fmu2jshvG+4ImpUF6U/6pZGJ9F5
  81. 7GstSiEU1QWp9TqzSfCDw73BFSkzFNUi9uG7KcL70pv/MjzRmrPrSMxL1U1bTddVK3gRt7d1RXRv
  82. To9JafbajuCrb05bjMzigPSN7JEamKaSXsKiFOpv8VXX9vw/9LbblYIHwywAAAAASUVORK5CYII="
  83.         End If
  84.  
  85.     End Function
  86.  
  87. End Module
  88.  
  89. Public Class Progress
  90.     Inherits Control
  91.  
  92.     Private _Val As Integer = 0
  93.     Private _Min As Integer = 0
  94.     Private _Max As Integer = 100
  95.  
  96.     Public Property HideLoading As Boolean = False
  97.  
  98.     Public Property Value As Integer
  99.         Get
  100.             Return _Val
  101.         End Get
  102.         Set(value As Integer)
  103.             _Val = value
  104.             Invalidate()
  105.         End Set
  106.     End Property
  107.  
  108.     Public Property Minimum As Integer
  109.         Get
  110.             Return _Min
  111.         End Get
  112.         Set(value As Integer)
  113.             _Min = value
  114.             Invalidate()
  115.         End Set
  116.     End Property
  117.  
  118.     Public Property Maximum As Integer
  119.         Get
  120.             Return _Max
  121.         End Get
  122.         Set(value As Integer)
  123.             _Max = value
  124.             Invalidate()
  125.         End Set
  126.     End Property
  127.  
  128.  
  129.     Sub New()
  130.         DoubleBuffered = True
  131.     End Sub
  132.  
  133.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  134.  
  135.         Dim G As Graphics = e.Graphics
  136.         G.SmoothingMode = SmoothingMode.HighQuality
  137.  
  138.         MyBase.OnPaint(e)
  139.  
  140.         G.Clear(Parent.BackColor)
  141.  
  142.         If Not HideLoading Then
  143.             G.FillRectangle(New SolidBrush(Color.FromArgb(180, 180, 180)), New Rectangle(31, 13, Width - 1, 3))
  144.         End If
  145.  
  146.         If Value = Minimum Then
  147.             G.DrawImage(CodeToImage(GetBase64StringIcon(ProgressType.Min)), New Point(0, 0))
  148.  
  149.             If Not HideLoading Then
  150.                 G.FillRectangle(New SolidBrush(Color.FromArgb(180, 180, 180)), New Rectangle(31, 13, CInt(Value / Maximum * Width - 32), 3))
  151.             End If
  152.  
  153.         ElseIf Not Value = Maximum And Not Value = Minimum
  154.             G.DrawImage(CodeToImage(GetBase64StringIcon(ProgressType.Progressing)), New Point(0, 0))
  155.  
  156.             If Not HideLoading Then
  157.                 G.FillRectangle(New SolidBrush(Color.FromArgb(90, 198, 19)), New Rectangle(31, 13, CInt(Value / Maximum * Width - 32), 3))
  158.             End If
  159.  
  160.         ElseIf Value >= Maximum
  161.             G.DrawImage(CodeToImage(GetBase64StringIcon(ProgressType.Max)), New Point(0, 0))
  162.  
  163.             If Not HideLoading Then
  164.                 G.FillRectangle(New SolidBrush(Color.FromArgb(90, 198, 19)), New Rectangle(31, 13, CInt(Value / Maximum * Width - 32), 3))
  165.             End If
  166.  
  167.         End If
  168.  
  169.     End Sub
  170.  
  171.     Protected Overrides Sub OnResize(e As EventArgs)
  172.         MyBase.OnResize(e)
  173.         Size = New Point(Width, 32)
  174.     End Sub
  175.  
  176. End Class
RAW Paste Data