diff --git a/FloatTool/App.xaml.cs b/FloatTool/App.xaml.cs
index bd1d346..e57d634 100644
--- a/FloatTool/App.xaml.cs
+++ b/FloatTool/App.xaml.cs
@@ -16,6 +16,7 @@
*/
using DiscordRPC;
+using FloatTool.Common;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -31,7 +32,7 @@
namespace FloatTool
{
- public partial class App : Application
+ public partial class App : Application
{
public static ResourceDictionary ThemeDictionary { get; set; }
diff --git a/FloatTool/AppHelpers.cs b/FloatTool/AppHelpers.cs
index 60a927a..1050353 100644
--- a/FloatTool/AppHelpers.cs
+++ b/FloatTool/AppHelpers.cs
@@ -16,12 +16,13 @@
*/
using DiscordRPC;
+using FloatTool.Common;
using System.Collections.Generic;
using System.IO;
namespace FloatTool
{
- internal static class AppHelpers
+ internal static class AppHelpers
{
public static FileSystemWatcher Watcher;
public static DiscordRpcClient DiscordClient;
diff --git a/FloatTool/Common/Calculations.cs b/FloatTool/Common/Calculations.cs
index 1296ca0..ceb5486 100644
--- a/FloatTool/Common/Calculations.cs
+++ b/FloatTool/Common/Calculations.cs
@@ -15,56 +15,81 @@
- along with this program. If not, see .
*/
-using System.Collections.Generic;
using System.Numerics;
-namespace FloatTool
+namespace FloatTool.Common
{
- static public class Calculations
- {
- public static double Craft(InputSkin[] ingridients, double minFloat, double floatRange)
- {
- return floatRange * (ingridients[0].WearValue
- + ingridients[1].WearValue
- + ingridients[2].WearValue
- + ingridients[3].WearValue
- + ingridients[4].WearValue
- + ingridients[5].WearValue
- + ingridients[6].WearValue
- + ingridients[7].WearValue
- + ingridients[8].WearValue
- + ingridients[9].WearValue) + minFloat;
- }
+ static public class Calculations
+ {
+ public static double Craft(InputSkin[] ingridients, double minFloat, double floatRange)
+ {
+ return floatRange * (ingridients[0].WearValue
+ + ingridients[1].WearValue
+ + ingridients[2].WearValue
+ + ingridients[3].WearValue
+ + ingridients[4].WearValue
+ + ingridients[5].WearValue
+ + ingridients[6].WearValue
+ + ingridients[7].WearValue
+ + ingridients[8].WearValue
+ + ingridients[9].WearValue) + minFloat;
+ }
- public static bool NextCombination(int[] num, int n)
- {
- bool finished = false;
- for (int i = 9; !finished; --i)
- {
- if (num[i] < n + i)
- {
- ++num[i];
- if (i < 9)
- for (int j = i + 1; j < 10; ++j)
- num[j] = num[j - 1] + 1;
- return true;
- }
- finished = i == 0;
- }
- return false;
- }
-
- public static long GetCombinationsCount(int poolSize)
- {
- BigInteger fact1 = poolSize;
- for (int i = poolSize - 1; i > 10; i--)
- fact1 *= i;
+ public static bool NextCombination(int[] num, int n)
+ {
+ bool finished = false;
+ for (int i = 9; !finished; --i)
+ {
+ if (num[i] < n + i)
+ {
+ ++num[i];
+ if (i < 9)
+ for (int j = i + 1; j < 10; ++j)
+ num[j] = num[j - 1] + 1;
+ return true;
+ }
+ finished = i == 0;
+ }
+ return false;
+ }
- BigInteger fact2 = poolSize - 10;
- for (int i = poolSize - 11; i > 1; i--)
- fact2 *= i;
+ public static bool NextCombination(int[] arr, int n, int step)
+ {
+ arr[9] += step;
+ if (arr[9] < n + 10) return true;
+ else
+ {
+ fix_loop:
+ int overflow = arr[9] - (n + 10);
+ for (int i = 9; i >= 0; --i)
+ {
+ if (arr[i] < n + i)
+ {
+ ++arr[i];
+ for (int j = i + 1; j < 10; ++j)
+ arr[j] = arr[j - 1] + 1;
- return (long)(fact1 / fact2);
- }
- }
+ arr[9] += overflow;
+
+ if (arr[9] < n + 10) return true;
+ else goto fix_loop;
+ }
+ }
+ return false;
+ }
+ }
+
+ public static long GetCombinationsCount(int poolSize)
+ {
+ BigInteger fact1 = poolSize;
+ for (int i = poolSize - 1; i > 10; i--)
+ fact1 *= i;
+
+ BigInteger fact2 = poolSize - 10;
+ for (int i = poolSize - 11; i > 1; i--)
+ fact2 *= i;
+
+ return (long)(fact1 / fact2);
+ }
+ }
}
diff --git a/FloatTool/Common/Logger.cs b/FloatTool/Common/Logger.cs
index 358bb45..edb57fd 100644
--- a/FloatTool/Common/Logger.cs
+++ b/FloatTool/Common/Logger.cs
@@ -22,47 +22,47 @@
using log4net.Repository.Hierarchy;
using System.Reflection;
-namespace FloatTool
+namespace FloatTool.Common
{
- public sealed class Logger
- {
- public static ILog Log { get; } = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ public sealed class Logger
+ {
+ public static ILog Log { get; } = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- public static void Initialize()
- {
- Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
+ public static void Initialize()
+ {
+ Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
- PatternLayout patternLayout = new()
- {
- ConversionPattern = "%date [%thread] %-5level - %message%newline"
- };
- patternLayout.ActivateOptions();
+ PatternLayout patternLayout = new()
+ {
+ ConversionPattern = "%date [%thread] %-5level - %message%newline"
+ };
+ patternLayout.ActivateOptions();
- RollingFileAppender roller = new()
- {
- AppendToFile = false,
- File = @"logs/log.txt",
- Layout = patternLayout,
- MaxSizeRollBackups = 5,
- MaximumFileSize = "250KB",
- RollingStyle = RollingFileAppender.RollingMode.Size,
- StaticLogFileName = true
- };
- roller.ActivateOptions();
- hierarchy.Root.AddAppender(roller);
+ RollingFileAppender roller = new()
+ {
+ AppendToFile = false,
+ File = @"logs/log.txt",
+ Layout = patternLayout,
+ MaxSizeRollBackups = 5,
+ MaximumFileSize = "250KB",
+ RollingStyle = RollingFileAppender.RollingMode.Size,
+ StaticLogFileName = true
+ };
+ roller.ActivateOptions();
+ hierarchy.Root.AddAppender(roller);
- MemoryAppender memory = new();
- memory.ActivateOptions();
- hierarchy.Root.AddAppender(memory);
+ MemoryAppender memory = new();
+ memory.ActivateOptions();
+ hierarchy.Root.AddAppender(memory);
- hierarchy.Root.Level = Level.Info;
- hierarchy.Configured = true;
- }
+ hierarchy.Root.Level = Level.Info;
+ hierarchy.Configured = true;
+ }
- public static void Debug(object message) => Log.Debug(message);
- public static void Info(object message) => Log.Info(message);
- public static void Warn(object message) => Log.Warn(message);
- public static void Error(object message) => Log.Error(message);
- public static void Fatal(object message) => Log.Fatal(message);
- }
+ public static void Debug(object message) => Log.Debug(message);
+ public static void Info(object message) => Log.Info(message);
+ public static void Warn(object message) => Log.Warn(message);
+ public static void Error(object message) => Log.Error(message);
+ public static void Fatal(object message) => Log.Fatal(message);
+ }
}
diff --git a/FloatTool/Common/RelayCommand.cs b/FloatTool/Common/RelayCommand.cs
index d63e42d..00a5740 100644
--- a/FloatTool/Common/RelayCommand.cs
+++ b/FloatTool/Common/RelayCommand.cs
@@ -18,38 +18,38 @@
using System;
using System.Windows.Input;
-namespace FloatTool
+namespace FloatTool.Common
{
- public sealed class RelayCommand : ICommand
- {
- readonly Action