Skip to content

Commit

Permalink
v.0.7.0
Browse files Browse the repository at this point in the history
Optimizations, custom themes and bug fixes
  • Loading branch information
Prevter committed May 9, 2021
1 parent 7f512c7 commit 7524a84
Show file tree
Hide file tree
Showing 17 changed files with 2,498 additions and 2,258 deletions.
15 changes: 7 additions & 8 deletions FloatToolGUI/Benchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@ public void parseCraft(List<InputSkin> inputs, List<Skin> outputs, string want)
{
decimal wantFloat = 1;
if (CurrentSearchMode != SearchMode.Equal)
decimal.TryParse(want, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out wantFloat);
decimal.TryParse(want, NumberStyles.Any, CultureInfo.InvariantCulture, out wantFloat);

foreach (var item in outputs)
for (int i = 0; i < outputs.Count; i++)
{
decimal flotOrigin = Math.Round(craft(inputs, item.MinFloat, item.MaxFloat), 14);
string flot = craftF(inputs, item.MinFloat, item.MaxFloat);
decimal flotOrigin = Math.Round(craft(inputs, outputs[i].MinFloat, outputs[i].MaxFloat), 14);

if (
((flotOrigin.ToString(CultureInfo.InvariantCulture).StartsWith(want)) && CurrentSearchMode == SearchMode.Equal) ||
((flotOrigin < wantFloat) && CurrentSearchMode == SearchMode.Less) ||
((flotOrigin > wantFloat) && CurrentSearchMode == SearchMode.Greater)
(flotOrigin.ToString(CultureInfo.InvariantCulture).StartsWith(want, StringComparison.Ordinal) && CurrentSearchMode == SearchMode.Equal) ||
(CurrentSearchMode == SearchMode.Less && (flotOrigin < wantFloat)) ||
(CurrentSearchMode == SearchMode.Greater && (flotOrigin > wantFloat))
)
{
return;
Expand Down Expand Up @@ -254,7 +253,7 @@ private void submitScoreBtn_Click(object sender, EventArgs e)
try
{
submitScoreBtn.Enabled = false;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create($"{uri}addBenchmark.php?cpu={cpuNameLabel.Text} ({benchmarkThreadsNumericUpdown.Value.ToString()})&speed={speedLabel.Text.Split(' ')[0]}");
HttpWebRequest req = (HttpWebRequest)WebRequest.Create($"{uri}addBenchmark.php?cpu={cpuNameLabel.Text} ({benchmarkThreadsNumericUpdown.Value} Threads)&speed={speedLabel.Text.Split(' ')[0]}");
req.UserAgent = $"FloatTool/{versionLabel2.Text}";
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
res.Close();
Expand Down
2 changes: 1 addition & 1 deletion FloatToolGUI/Calculation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static public decimal craft(List<InputSkin> ingridients, float minFloat, float m
decimal avgFloat = 0;
foreach (InputSkin f in ingridients)
{
avgFloat += (decimal)f.WearValue;
avgFloat += f.WearValue;
}
avgFloat /= 10;
return ((decimal)(maxFloat - minFloat) * avgFloat) + (decimal)minFloat;
Expand Down
2 changes: 2 additions & 0 deletions FloatToolGUI/FloatToolGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@
<ItemGroup>
<Content Include="floattool.ico" />
<Content Include="FodyWeavers.xml" />
<None Include="Resources\LightThemePreview.png" />
<None Include="Resources\DarkThemePreview.png" />
<None Include="Resources\loading.gif" />
<EmbeddedResource Include="itemData.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
16 changes: 14 additions & 2 deletions FloatToolGUI/InputSkin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,32 @@ namespace FloatToolGUI
public class InputSkin
{
public Skin SkinReference { get; set; }
public double WearValue { get; set; }
public decimal WearValue { get; set; }
public float Price { get; set; }
public Currency SkinCurrency { get; set; }


public InputSkin(double wear, float price, Currency currency) {
public InputSkin(decimal wear, float price, Currency currency) {
WearValue = wear;
Price = price;
SkinCurrency = currency;
}

public InputSkin(double wear, float price, Currency currency)
{
WearValue = (decimal)wear;
Price = price;
SkinCurrency = currency;
}

internal int CompareTo(InputSkin b)
{
return WearValue > b.WearValue ? 1 : (WearValue < b.WearValue ? -1 : 0);
}

public override string ToString()
{
return WearValue.ToString();
}
}
}
4 changes: 3 additions & 1 deletion FloatToolGUI/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace FloatToolGUI
{
static class Logger
{
static string LaunchTime = DateTime.Now.ToString().Replace(' ', '_').Replace(':', '-');

static public void Log(object data)
{
using (StreamWriter w = File.AppendText("debug.log"))
Expand All @@ -20,7 +22,7 @@ static public void Log(object data)
static public void SaveCrashReport()
{
Directory.CreateDirectory("crashreports");
File.Copy("debug.log", @$"crashreports{Path.DirectorySeparatorChar}{DateTime.Now.ToString().Replace(' ', '_').Replace(':', '-')}.log");
File.Copy("debug.log", @$"crashreports{Path.DirectorySeparatorChar}{LaunchTime}.log", true);
}

static public void ClearLogs()
Expand Down
Loading

0 comments on commit 7524a84

Please sign in to comment.