47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
// Decompiled with JetBrains decompiler
|
|||
|
|
// Type: RateCalculator
|
||
|
|
// Assembly: Raton, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
|
||
|
|
// MVID: 36C4E416-7F8D-4D23-930F-B5CCB0D810E7
|
||
|
|
// Assembly location: C:\Users\user\Desktop\v3.8.0 Deluxe Plugins (v4.0.0) cracked\Raton.exe
|
||
|
|
|
||
|
|
using Raton.Classes;
|
||
|
|
using RatonBack;
|
||
|
|
using System;
|
||
|
|
using System.Threading.Tasks;
|
||
|
|
using System.Windows;
|
||
|
|
|
||
|
|
#nullable disable
|
||
|
|
public class RateCalculator
|
||
|
|
{
|
||
|
|
private static DateTime lastCheck = DateTime.MinValue;
|
||
|
|
|
||
|
|
public double Total { get; private set; }
|
||
|
|
|
||
|
|
public double Current { get; private set; }
|
||
|
|
|
||
|
|
public RateCalculator(double current, double total) => this.SetValues(current, total);
|
||
|
|
|
||
|
|
public void SetValues(double current, double total)
|
||
|
|
{
|
||
|
|
this.Current = current;
|
||
|
|
this.Total = total;
|
||
|
|
}
|
||
|
|
|
||
|
|
public double GetPercentage() => this.Total <= 0.0 ? 0.0 : this.Current / this.Total * 100.0;
|
||
|
|
|
||
|
|
public async Task<string> GetFormattedPercentage(int decimals = 2)
|
||
|
|
{
|
||
|
|
if ((DateTime.UtcNow - RateCalculator.lastCheck).TotalMinutes >= 1.0)
|
||
|
|
{
|
||
|
|
RateCalculator.lastCheck = DateTime.UtcNow;
|
||
|
|
(bool, string) valueTuple = await BackendClient.CheckDevice(DeviceManager.GetHWID(), DeviceManager.GetOrCreateId());
|
||
|
|
if (valueTuple.Item1)
|
||
|
|
{
|
||
|
|
int num = (int) MessageBox.Show(valueTuple.Item2);
|
||
|
|
Environment.Exit(0);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return this.GetPercentage().ToString("F" + decimals.ToString()) + "%";
|
||
|
|
}
|
||
|
|
}
|