// Decompiled with JetBrains decompiler
// Type: A.O
// Assembly: RansomGuard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 37652FF6-4FF5-4E76-944D-E6CA5073036F
// Assembly location: RansomGuard.dll inside C:\Users\WDAGUtilityAccount\Desktop\RansomGuard.exe)

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

#nullable enable
namespace A;

internal sealed class O : Control
{
  private bool cH;
  private float ch;
  private readonly Timer cI;
  private bool ci;
  private static readonly Color cJ = Color.FromArgb((int) byte.MaxValue, 60, 60, 70);
  private static readonly Color cj = b.aF;
  private static readonly Color cK = Color.White;
  private static readonly Color ck = Color.FromArgb((int) byte.MaxValue, 240 /*0xF0*/, 240 /*0xF0*/, 240 /*0xF0*/);

  public event EventHandler? CheckedChanged;

  [SpecialName]
  public bool A() => this.cH;

  [SpecialName]
  public void A([In] bool obj0)
  {
    if (this.cH == obj0)
      return;
    this.cH = obj0;
    this.cI.Start();
    // ISSUE: reference to a compiler-generated field
    EventHandler cL = this.cL;
    if (cL == null)
      return;
    cL((object) this, EventArgs.Empty);
  }

  public O()
  {
    this.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
    this.Size = new Size(44, 20);
    this.BackColor = Color.Transparent;
    this.Cursor = Cursors.Hand;
    this.cI = new Timer() { Interval = 15 };
    this.cI.Tick += new EventHandler(this.A);
  }

  private void A(object? sender, [In] EventArgs obj1)
  {
    float num1 = this.cH ? 1f : 0.0f;
    float num2 = 0.15f;
    if ((double) Math.Abs(this.ch - num1) < (double) num2)
    {
      this.ch = num1;
      this.cI.Stop();
    }
    else
      this.ch += (double) this.ch < (double) num1 ? num2 : -num2;
    this.Invalidate();
  }

  protected virtual void OnMouseEnter([In] EventArgs obj0)
  {
    this.OnMouseEnter(obj0);
    this.ci = true;
    this.Invalidate();
  }

  protected virtual void OnMouseLeave([In] EventArgs obj0)
  {
    this.OnMouseLeave(obj0);
    this.ci = false;
    this.Invalidate();
  }

  protected virtual void OnClick([In] EventArgs obj0)
  {
    this.OnClick(obj0);
    this.A(!this.A());
  }

  protected override void OnPaint([In] PaintEventArgs obj0)
  {
    base.OnPaint(obj0);
    Graphics graphics = obj0.Graphics;
    graphics.SmoothingMode = SmoothingMode.AntiAlias;
    int num1 = this.Height - 4;
    int num2 = this.Width - 4;
    int num3 = num1 - 4;
    int num4 = num1 / 2;
    Rectangle rectangle = new Rectangle(2, 2, num2, num1);
    using (SolidBrush solidBrush = new SolidBrush(this.A(O.cJ, O.cj, this.ch)))
      graphics.A((Brush) solidBrush, rectangle, num4);
    int num5 = rectangle.Right - num3 - 4;
    int num6 = rectangle.Left + 2;
    Rectangle rect1 = new Rectangle(num6 + (int) ((double) (num5 - num6) * (double) this.ch), rectangle.Top + 2, num3, num3);
    using (SolidBrush solidBrush = new SolidBrush(Color.FromArgb(50, 0, 0, 0)))
    {
      Rectangle rect2 = rect1;
      rect2.Offset(1, 1);
      graphics.FillEllipse((Brush) solidBrush, rect2);
    }
    using (SolidBrush solidBrush = new SolidBrush(this.ci ? O.ck : O.cK))
      graphics.FillEllipse((Brush) solidBrush, rect1);
  }

  private Color A([In] Color obj0, [In] Color obj1, [In] float obj2)
  {
    obj2 = Math.Max(0.0f, Math.Min(1f, obj2));
    return Color.FromArgb((int) ((double) obj0.R + (double) ((int) obj1.R - (int) obj0.R) * (double) obj2), (int) ((double) obj0.G + (double) ((int) obj1.G - (int) obj0.G) * (double) obj2), (int) ((double) obj0.B + (double) ((int) obj1.B - (int) obj0.B) * (double) obj2));
  }

  protected override void Dispose([In] bool obj0)
  {
    if (obj0)
      this.cI?.Dispose();
    base.Dispose(obj0);
  }
}
