MalwareSourceCode/MSIL/Virus/Win32/L/Virus.Win32.Lykov.b-5b4c66fd4c89a7645d7912c18b43ddd7b8db068aa896fea714881ce355eaf833/CubesCollection.cs
2022-08-18 06:28:56 -05:00

376 lines
16 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Boggle.CubesCollection
// Assembly: Boggle, Version=1.0.1320.31511, Culture=neutral, PublicKeyToken=null
// MVID: B8BB850A-887A-43B2-B89D-3D1301289D01
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare.00004-msil\Virus.Win32.Lykov.b-5b4c66fd4c89a7645d7912c18b43ddd7b8db068aa896fea714881ce355eaf833.exe
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Collections;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Windows.Forms;
namespace Boggle
{
public class CubesCollection : CollectionBase
{
private string clsWordToShow;
private CubesCollection.StateOfCubes clsCubesState;
private string clsDisplayText;
private PictureBox clsCubesPicBox;
private bool clsDisplayTextFadeOut;
private bool clsDisplayTextStartUp;
private int clsDisplayTextMaxSize;
private int clsDisplayPosition;
private Thread SpinCubesThread;
private Thread ScrambleCubesThread;
private bool clsCubesAreSpinning;
private bool clsCubesAreScrambling;
private bool clsKillThread;
[SpecialName]
private double \u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle;
[SpecialName]
private StaticLocalInitFlag \u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle\u0024Init;
[SpecialName]
private double \u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact;
[SpecialName]
private StaticLocalInitFlag \u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact\u0024Init;
[SpecialName]
private double \u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontSize;
[SpecialName]
private StaticLocalInitFlag \u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue\u0024Init;
[SpecialName]
private int \u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue;
public CubesCollection()
{
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle\u0024Init = new StaticLocalInitFlag();
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact\u0024Init = new StaticLocalInitFlag();
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue\u0024Init = new StaticLocalInitFlag();
}
public bool CubesAreScrambling
{
get => this.clsCubesAreScrambling;
set => this.clsCubesAreScrambling = value;
}
public bool CubesAreSpinning
{
get => this.clsCubesAreSpinning;
set => this.clsCubesAreSpinning = value;
}
public int DisplayPosition
{
get => this.clsDisplayPosition;
set => this.clsDisplayPosition = value;
}
public int DisplayTextMaxSize
{
get => this.clsDisplayTextMaxSize;
set => this.clsDisplayTextMaxSize = value;
}
public bool DisplayTextStartUp
{
get => this.clsDisplayTextStartUp;
set => this.clsDisplayTextStartUp = value;
}
public bool DisplayTextFadeOut
{
get => this.clsDisplayTextFadeOut;
set => this.clsDisplayTextFadeOut = value;
}
public PictureBox CubesPicBox
{
get => this.clsCubesPicBox;
set => this.clsCubesPicBox = value;
}
public string DisplayText
{
get => this.clsDisplayText;
set => this.clsDisplayText = value;
}
public void Add(Cube Cube) => this.List.Add((object) Cube);
public Cube this[int Index] => (Cube) this.List[Index];
public void Remove(Cube Cube)
{
if (!this.List.Contains((object) Cube))
return;
this.List.Remove((object) Cube);
}
public string WordToShow
{
get => this.clsWordToShow;
set => this.clsWordToShow = value;
}
public void DrawCubes(PaintEventArgs e, CubesCollection.StateOfCubes State)
{
Bitmap bitmap = new Bitmap(modGlobal.AppPath + "\\CubesUp.jpg");
int num1 = 10;
if (this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle\u0024Init.State != (short) 1)
{
Monitor.Enter((object) this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle\u0024Init);
try
{
if (this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle\u0024Init.State == (short) 0)
{
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle\u0024Init.State = (short) 2;
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle = -0.777;
}
else if (this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle\u0024Init.State == (short) 2)
throw new IncompleteInitialization();
}
finally
{
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle\u0024Init.State = (short) 1;
Monitor.Exit((object) this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle\u0024Init);
}
}
if (this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact\u0024Init.State != (short) 1)
{
Monitor.Enter((object) this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact\u0024Init);
try
{
if (this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact\u0024Init.State == (short) 0)
{
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact\u0024Init.State = (short) 2;
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact = (double) checked (bitmap.Height * -1);
}
else if (this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact\u0024Init.State == (short) 2)
throw new IncompleteInitialization();
}
finally
{
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact\u0024Init.State = (short) 1;
Monitor.Exit((object) this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact\u0024Init);
}
}
if (this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue\u0024Init.State != (short) 1)
{
Monitor.Enter((object) this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue\u0024Init);
try
{
if (this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue\u0024Init.State == (short) 0)
{
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue\u0024Init.State = (short) 2;
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue = 1;
}
else if (this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue\u0024Init.State == (short) 2)
throw new IncompleteInitialization();
}
finally
{
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue\u0024Init.State = (short) 1;
Monitor.Exit((object) this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue\u0024Init);
}
}
double a1;
double a2;
double a3;
double a4;
double a5;
double a6;
switch (State)
{
case CubesCollection.StateOfCubes.Clear:
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle = -0.777;
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact = (double) checked (bitmap.Height * -1);
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontSize = 0.0;
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue = 1;
this.clsCubesPicBox.Image = (Image) null;
break;
case CubesCollection.StateOfCubes.Normal:
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle = -0.777;
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact = (double) checked (bitmap.Height * -1);
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontSize = 0.0;
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue = 1;
double num2 = Math.Sqrt((double) checked (bitmap.Width * bitmap.Width + bitmap.Height * bitmap.Height)) / 2.0;
a1 = (double) num1 + (num2 * 2.0 - (double) bitmap.Width) / 2.0;
a2 = (num2 * 2.0 - (double) bitmap.Height) / 2.0;
a3 = a1 + (double) bitmap.Width;
a4 = (num2 * 2.0 - (double) bitmap.Height) / 2.0;
a5 = (double) num1 + (num2 * 2.0 - (double) bitmap.Width) / 2.0;
a6 = a2 + (double) bitmap.Height;
break;
case CubesCollection.StateOfCubes.Spinning:
double num3 = Math.Sqrt((double) checked (bitmap.Width * bitmap.Width + bitmap.Height * bitmap.Height)) / 2.0;
a1 = (double) num1 + Math.Cos(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle) * num3 + num3;
a2 = num3 - Math.Sin(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle) * num3;
a3 = Math.Cos(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle + 1.6) * num3 + num3;
a4 = num3 - Math.Sin(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle + 1.6) * num3;
a5 = (double) num1 + Math.Cos(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle - 1.6) * num3 + num3;
a6 = num3 - Math.Sin(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle - 1.6) * num3;
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle += 0.3;
break;
case CubesCollection.StateOfCubes.ZoomSpinning:
double num4 = Math.Sqrt(((double) bitmap.Width + this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact) * ((double) bitmap.Width + this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact) + ((double) bitmap.Height + this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact) * ((double) bitmap.Height + this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact)) / 2.0;
a1 = (double) num1 + Math.Cos(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle) * num4 + num4;
a2 = num4 - Math.Sin(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle) * num4;
a3 = (double) num1 + Math.Cos(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle + 1.6) * num4 + num4;
a4 = num4 - Math.Sin(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle + 1.6) * num4;
a5 = (double) num1 + Math.Cos(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle - 1.6) * num4 + num4;
a6 = num4 - Math.Sin(this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle - 1.6) * num4;
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024Angle += 0.3;
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024ZoomFact += 2.0;
break;
case CubesCollection.StateOfCubes.Text:
try
{
GraphicsPath path = new GraphicsPath();
Rectangle rect = new Rectangle(0, 0, this.clsCubesPicBox.Width, this.clsCubesPicBox.Height);
LinearGradientBrush linearGradientBrush = new LinearGradientBrush(rect, Color.LightBlue, Color.DarkBlue, LinearGradientMode.Vertical);
if (this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontSize > (double) checked ((int) Math.Round(unchecked ((double) this.clsDisplayTextMaxSize / 2.0))) & this.clsDisplayTextFadeOut)
checked { this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue *= -1; }
this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontSize += (double) this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontAddValue;
Font font1 = new Font("Arial", (float) this.\u0024STATIC\u0024DrawCubes\u0024202112D112C\u0024FontSize, FontStyle.Regular, GraphicsUnit.Pixel, (byte) 1);
SizeF sizeF1 = new SizeF();
Graphics graphics = e.Graphics;
string clsDisplayText = this.clsDisplayText;
Font font2 = font1;
SizeF layoutArea = new SizeF();
StringFormat stringFormat = new StringFormat(StringFormatFlags.DirectionRightToLeft);
int num5 = Strings.Len(this.clsDisplayText);
ref int local1 = ref num5;
int num6 = 1;
ref int local2 = ref num6;
SizeF sizeF2 = graphics.MeasureString(clsDisplayText, font2, layoutArea, stringFormat, out local1, out local2);
path.AddString(this.clsDisplayText, font1.FontFamily, (int) font1.Style, font1.Size, new PointF((float) ((double) rect.Width / 2.0 - (double) sizeF2.Width / 2.0), (float) ((double) rect.Height / 2.0 - (double) sizeF2.Height / 2.0) + (float) this.clsDisplayPosition), StringFormat.GenericDefault);
e.Graphics.FillPath((Brush) linearGradientBrush, path);
break;
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.clsCubesState = CubesCollection.StateOfCubes.Clear;
this.clsCubesPicBox.Refresh();
ProjectData.ClearProjectError();
break;
}
}
Point[] destPoints = new Point[3]
{
new Point(checked ((int) Math.Round(a1)), checked ((int) Math.Round(a2))),
new Point(checked ((int) Math.Round(a3)), checked ((int) Math.Round(a4))),
new Point(checked ((int) Math.Round(a5)), checked ((int) Math.Round(a6)))
};
e.Graphics.DrawImage((Image) bitmap, destPoints);
}
private void ShowSpinCubes()
{
try
{
foreach (Cube cube in (CollectionBase) modGlobal.Cubes)
{
modGlobal.myCube = cube;
modGlobal.myCube.CubeLabel.Visible = false;
modGlobal.myCube.SetRndCubeLetter();
}
}
finally
{
IEnumerator enumerator;
if (enumerator is IDisposable)
((IDisposable) enumerator).Dispose();
}
int num = 1;
while (!this.clsKillThread)
{
Thread.Sleep(1);
this.clsCubesState = CubesCollection.StateOfCubes.ZoomSpinning;
this.clsCubesPicBox.Refresh();
checked { ++num; }
if (num > 130)
{
modGlobal.Cubes.CubesState = CubesCollection.StateOfCubes.Normal;
this.clsCubesPicBox.Refresh();
try
{
foreach (Cube cube in (CollectionBase) modGlobal.Cubes)
{
modGlobal.myCube = cube;
modGlobal.myCube.CubeLabel.Visible = true;
}
}
finally
{
IEnumerator enumerator;
if (enumerator is IDisposable)
((IDisposable) enumerator).Dispose();
}
this.clsCubesAreSpinning = false;
return;
}
}
this.clsCubesAreSpinning = false;
this.clsKillThread = false;
}
public void ShowSpinStartUp()
{
this.SpinCubesThread = new Thread(new ThreadStart(this.ShowSpinCubes));
this.clsCubesAreSpinning = true;
this.clsKillThread = false;
this.SpinCubesThread.Start();
}
public CubesCollection.StateOfCubes CubesState
{
get => this.clsCubesState;
set => this.clsCubesState = value;
}
private void HandleScrambleCubes()
{
long num = 1;
while (!this.clsKillThread)
{
Thread.Sleep(1);
this.clsCubesPicBox.Refresh();
checked { ++num; }
if (num > 100L)
{
this.clsCubesAreScrambling = false;
return;
}
}
this.clsCubesAreScrambling = false;
this.clsKillThread = false;
}
public void ScrambleCubes()
{
this.ScrambleCubesThread = new Thread(new ThreadStart(this.HandleScrambleCubes));
this.clsCubesAreScrambling = true;
this.clsKillThread = false;
this.ScrambleCubesThread.Start();
}
public void KillCubeThreads() => this.clsKillThread = true;
public enum StateOfCubes
{
Clear,
Normal,
Spinning,
ZoomSpinning,
Text,
}
}
}