Browse Source

code cleaning

Veloe 2 years ago
parent
commit
ccc4d92180
24 changed files with 2290 additions and 2282 deletions
  1. 3 3
      VeloeLauncherUpdater/LatestLauncherVersion.cs
  2. 3 3
      VeloeLauncherUpdater/Program.cs
  3. 488 420
      VeloeMinecraftLauncher/MinecraftLauncher/Downloader.cs
  4. 25 31
      VeloeMinecraftLauncher/MinecraftLauncher/EventSink.cs
  5. 101 108
      VeloeMinecraftLauncher/MinecraftLauncher/Settings.cs
  6. 264 265
      VeloeMinecraftLauncher/MinecraftLauncher/StartCommandBuilder.cs
  7. 13 18
      VeloeMinecraftLauncher/Models/Entity/Assets/Asset.cs
  8. 4 4
      VeloeMinecraftLauncher/Models/Entity/Changelog.cs
  9. 11 0
      VeloeMinecraftLauncher/Models/Entity/DownloadedVersion.cs
  10. 8 0
      VeloeMinecraftLauncher/Models/Entity/LatestLauncherVersion.cs
  11. 17 21
      VeloeMinecraftLauncher/Models/Entity/LauncherProfiles.cs
  12. 15 20
      VeloeMinecraftLauncher/Models/Entity/McStatus/McStatus.cs
  13. 9 9
      VeloeMinecraftLauncher/Models/Entity/Modpack.cs
  14. 181 188
      VeloeMinecraftLauncher/Models/Entity/Version/Version.cs
  15. 4 11
      VeloeMinecraftLauncher/Models/Entity/VesrionManifest/Latest.cs
  16. 13 18
      VeloeMinecraftLauncher/Models/Entity/VesrionManifest/Version.cs
  17. 6 11
      VeloeMinecraftLauncher/Models/Entity/VesrionManifest/VersionManifest.cs
  18. 36 0
      VeloeMinecraftLauncher/Models/ServerPanelModel.cs
  19. 18 19
      VeloeMinecraftLauncher/ViewModels/ErrorWindowViewModel.cs
  20. 595 650
      VeloeMinecraftLauncher/ViewModels/MainWindowViewModel.cs
  21. 151 152
      VeloeMinecraftLauncher/ViewModels/SettingsWindowViewModel.cs
  22. 304 305
      VeloeMinecraftLauncher/ViewModels/VersionsDownloaderViewModel.cs
  23. 17 18
      VeloeMinecraftLauncher/ViewModels/ViewModelBase.cs
  24. 4 8
      VeloeMinecraftLauncher/Views/MainWindow.axaml

+ 3 - 3
VeloeLauncherUpdater/LatestLauncherVersion.cs

@@ -8,8 +8,8 @@ namespace VeloeLauncherUpdater
 {
     public class LatestLauncherVersion
     {
-        public string latest { get; set; }
-        public string updater { get; set; }
-        public string url { get; set; }
+        public string Latest { get; set; }
+        public string Updater { get; set; }
+        public string Url { get; set; }
     }
 }

+ 3 - 3
VeloeLauncherUpdater/Program.cs

@@ -37,7 +37,7 @@ try
 
             latestLauncherVersion = string.IsNullOrEmpty(jsonData)
                         ? new LatestLauncherVersion()
-                        : JsonSerializer.Deserialize<LatestLauncherVersion>(jsonData);
+                        : JsonSerializer.Deserialize<LatestLauncherVersion>(jsonData, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
         }
 
         if (OperatingSystem.IsLinux())
@@ -48,10 +48,10 @@ try
 
         if (latestLauncherVersion != null)
         {
-            logger.Information("Latest launcher version on server: {0}", latestLauncherVersion.latest);
+            logger.Information("Latest launcher version on server: {0}", latestLauncherVersion.Latest);
             logger.Information("Launcher version: {0}", fileVersionInfo.FileVersion);
 
-            if (!(new Version(latestLauncherVersion.latest) > new Version(fileVersionInfo.FileVersion)))
+            if (!(new Version(latestLauncherVersion.Latest) > new Version(fileVersionInfo.FileVersion)))
             {
                 logger.Information("No update required.");
                 return;

File diff suppressed because it is too large
+ 488 - 420
VeloeMinecraftLauncher/MinecraftLauncher/Downloader.cs


+ 25 - 31
VeloeMinecraftLauncher/MinecraftLauncher/EventSink.cs

@@ -1,46 +1,40 @@
 using Serilog.Events;
 using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
-namespace VeloeMinecraftLauncher.MinecraftLauncher    
+namespace VeloeMinecraftLauncher.MinecraftLauncher;
+
+public class EventSink : Serilog.Core.ILogEventSink
 {
-    public class EventSink : Serilog.Core.ILogEventSink
+    private readonly IFormatProvider _formatProvider = null;
+    public event EventHandler DataReceived;
+
+    public EventSink(IFormatProvider formatProvider)
     {
-        private readonly IFormatProvider _formatProvider = null;
-        public event EventHandler DataReceived;
+        _formatProvider = formatProvider;
+    }
 
-        public EventSink(IFormatProvider formatProvider)
+    public void Emit(LogEvent logEvent)
+    {
+        var message = "";
+        if (_formatProvider is not null)
+            message = logEvent.RenderMessage(_formatProvider);
+        else
         {
-            _formatProvider = formatProvider;
+            message = $"[{logEvent.Timestamp.ToString("HH:mm:ss")} {logEvent.Level.ToString()}] {logEvent.RenderMessage()}{logEvent.Exception}\n";
         }
-
-        public void Emit(LogEvent logEvent)
+        if (DataReceived != null)
         {
-            var message = "";
-            if (_formatProvider is not null)
-                message = logEvent.RenderMessage(_formatProvider);
-            else
-            {
-                message = $"[{logEvent.Timestamp.ToString("HH:mm:ss")} {logEvent.Level.ToString()}] {logEvent.RenderMessage()}{logEvent.Exception}\n";
-            }
-            if (DataReceived != null)
-            {
-                var data = EventArgs.Empty;
-                DataReceived?.Invoke(this, new MyEventArgs(message));
-            }
+            var data = EventArgs.Empty;
+            DataReceived?.Invoke(this, new MyEventArgs(message));
         }
     }
+}
 
-    public class MyEventArgs : EventArgs
+public class MyEventArgs : EventArgs
+{
+    public string Data;
+    public MyEventArgs(string _myData)
     {
-        public string Data;
-        public MyEventArgs(string _myData)
-        {
-            Data = _myData;
-        }
+        Data = _myData;
     }
 }

+ 101 - 108
VeloeMinecraftLauncher/MinecraftLauncher/Settings.cs

@@ -1,138 +1,131 @@
-using Avalonia.Media;
-using Microsoft.Extensions.Logging;
-using Serilog;
-using Serilog.Events;
+using Serilog.Events;
 using System;
-using System.Collections.Generic;
 using System.IO;
 using System.Linq;
-using System.Text;
 using System.Text.Json;
-using System.Threading.Tasks;
 
-namespace VeloeMinecraftLauncher.MinecraftLauncher
+namespace VeloeMinecraftLauncher.MinecraftLauncher;
+
+internal static class Settings
 {
-    internal static class Settings
+    //public static readonly string JavaPath = "C:\\Program Files\\Microsoft\\jdk-11.0.12.7-hotspot\\bin\\java.exe";
+    public static string JavaPath = "";
+    public static string MinecraftForlderPath = Directory.GetCurrentDirectory() + '/';
+    public static UInt32 MaxRam = 2048;
+    public static bool useCustomJava = false;
+    public static bool setMaxRam = false;
+    public static bool setPath = true;
+    public static bool checkGameAssets = false;
+    public static bool gameLogToLauncher = false;
+    public static string Username;
+    public static string lastChosenVersion;
+    public static Serilog.ILogger logger;
+    public static Serilog.ILogger avaloniaLogger;
+    public static bool setMaxLog = false;
+    public static UInt32 MaxLog = 1024;
+    public static LogEventLevel consoleLogEventLevel = LogEventLevel.Debug;
+    public static LogEventLevel fileLogEventLevel = LogEventLevel.Debug;
+
+    public static void UpdateSettings(SettingsSerializable settings)
     {
-        //public static readonly string JavaPath = "C:\\Program Files\\Microsoft\\jdk-11.0.12.7-hotspot\\bin\\java.exe";
-        public static string JavaPath = "";
-        public static string MinecraftForlderPath = Directory.GetCurrentDirectory() + '/';
-        public static UInt32 MaxRam = 2048;
-        public static bool useCustomJava = false;
-        public static bool setMaxRam = false;
-        public static bool setPath = true;
-        public static bool checkGameAssets = false;
-        public static bool gameLogToLauncher = false;
-        public static string Username;
-        public static string lastChosenVersion;
-        public static Serilog.ILogger logger;
-        public static Serilog.ILogger avaloniaLogger;
-        public static bool setMaxLog = false;
-        public static UInt32 MaxLog = 1024;
-        public static LogEventLevel consoleLogEventLevel = LogEventLevel.Debug;
-        public static LogEventLevel fileLogEventLevel = LogEventLevel.Debug;
-
-        public static void UpdateSettings(SettingsSerializable settings)
-        {
-            if (settings is null)
-                return;
-            JavaPath = settings.JavaPath;
-            MinecraftForlderPath = settings.MinecraftForlderPath;
-            MaxRam = settings.MaxRam;
-            useCustomJava = settings.useCustomJava;
-            setMaxRam = settings.setMaxRam;
-            setPath = settings.setPath;
-            checkGameAssets = settings.checkGameAssets;
-            gameLogToLauncher = settings.gameLogToLauncher;
-            lastChosenVersion = settings.lastChosenVersion;
-            Username = settings.Username;
-            setMaxLog = settings.setMaxLog;
-            MaxLog = settings.MaxLog;
-            consoleLogEventLevel = settings.consoleLogEventLevel;
-            fileLogEventLevel = settings.fileLogEventLevel;
+        if (settings is null)
+            return;
+        JavaPath = settings.JavaPath;
+        MinecraftForlderPath = settings.MinecraftForlderPath;
+        MaxRam = settings.MaxRam;
+        useCustomJava = settings.useCustomJava;
+        setMaxRam = settings.setMaxRam;
+        setPath = settings.setPath;
+        checkGameAssets = settings.checkGameAssets;
+        gameLogToLauncher = settings.gameLogToLauncher;
+        lastChosenVersion = settings.lastChosenVersion;
+        Username = settings.Username;
+        setMaxLog = settings.setMaxLog;
+        MaxLog = settings.MaxLog;
+        consoleLogEventLevel = settings.consoleLogEventLevel;
+        fileLogEventLevel = settings.fileLogEventLevel;
 
+    }
+
+    public static void LoadSettings()
+    {
+        if (!File.Exists($"settings.json"))
+        {
+            var file = File.Create($"settings.json");
+            file.Close();
+            file.Dispose();
         }
 
-        public static void LoadSettings()
+        var settings = File.ReadAllText($"settings.json");
+
+        if (settings != String.Empty)
         {
-            if (!File.Exists($"settings.json"))
+            try
             {
-                var file = File.Create($"settings.json");
-                file.Close();
-                file.Dispose();
-            }
+                var settingsSerializable = JsonSerializer.Deserialize<SettingsSerializable>(settings, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
 
-            var settings = File.ReadAllText($"settings.json");
-
-            if (settings != String.Empty)
+                Settings.UpdateSettings(settingsSerializable);
+            }
+            catch (JsonException ex)
             {
-                try
-                {
-                    var settingsSerializable = JsonSerializer.Deserialize<SettingsSerializable>(settings);
-
-                    Settings.UpdateSettings(settingsSerializable);
-                }
-                catch (JsonException ex)
-                {
-                    //TODO log
-                }
+                //TODO log
             }
         }
+    }
 
-        public static void SaveSettings()
-        {
-            if(MinecraftForlderPath == string.Empty)
-                MinecraftForlderPath = Directory.GetCurrentDirectory();
+    public static void SaveSettings()
+    {
+        if(MinecraftForlderPath == string.Empty)
+            MinecraftForlderPath = Directory.GetCurrentDirectory();
 
-            if(MinecraftForlderPath.Last() is not ('/' or '\\'))
-                MinecraftForlderPath = MinecraftForlderPath + "/";
+        if(MinecraftForlderPath.Last() is not ('/' or '\\'))
+            MinecraftForlderPath = MinecraftForlderPath + "/";
 
-            if (!Directory.Exists(MinecraftForlderPath))
-                Directory.CreateDirectory(MinecraftForlderPath);
+        if (!Directory.Exists(MinecraftForlderPath))
+            Directory.CreateDirectory(MinecraftForlderPath);
 
-            var settings = JsonSerializer.Serialize(new SettingsSerializable());
+        var settings = JsonSerializer.Serialize(new SettingsSerializable());
 
-            File.WriteAllText($"settings.json", settings);
-        }
+        File.WriteAllText($"settings.json", settings);
     }
+}
 
-    public class SettingsSerializable
-    {
-        public string JavaPath {get; set;}
-        public string MinecraftForlderPath { get; set;}
-        public UInt32 MaxRam { get; set; }
-        public bool useCustomJava { get; set; }
-        public bool setMaxRam { get; set; }
-        public bool setPath { get; set; }
-        public bool checkGameAssets { get; set; }
+public class SettingsSerializable
+{
+    public string JavaPath {get; set;}
+    public string MinecraftForlderPath { get; set;}
+    public UInt32 MaxRam { get; set; }
+    public bool useCustomJava { get; set; }
+    public bool setMaxRam { get; set; }
+    public bool setPath { get; set; }
+    public bool checkGameAssets { get; set; }
 
-        public bool gameLogToLauncher { get; set; }
+    public bool gameLogToLauncher { get; set; }
 
-        public string Username { get; set; }
+    public string Username { get; set; }
 
-        public string lastChosenVersion { get; set; }
+    public string lastChosenVersion { get; set; }
 
-        public bool setMaxLog { get; set; }
-        public UInt32 MaxLog { get; set; }
-        public LogEventLevel consoleLogEventLevel { get; set; }
-        public LogEventLevel fileLogEventLevel { get; set; }
+    public bool setMaxLog { get; set; }
+    public UInt32 MaxLog { get; set; }
+    public LogEventLevel consoleLogEventLevel { get; set; }
+    public LogEventLevel fileLogEventLevel { get; set; }
 
-        public SettingsSerializable()
-        {
-            JavaPath = Settings.JavaPath;
-            MinecraftForlderPath= Settings.MinecraftForlderPath;
-            MaxRam= Settings.MaxRam;
-            useCustomJava= Settings.useCustomJava;
-            setMaxRam= Settings.setMaxRam;
-            setPath = Settings.setPath;
-            checkGameAssets= Settings.checkGameAssets;
-            gameLogToLauncher= Settings.gameLogToLauncher;
-            Username = Settings.Username;
-            lastChosenVersion= Settings.lastChosenVersion;
-            setMaxLog= Settings.setMaxLog;
-            MaxLog = Settings.MaxLog;
-            consoleLogEventLevel= Settings.consoleLogEventLevel;
-            fileLogEventLevel= Settings.fileLogEventLevel;
-        }
+    public SettingsSerializable()
+    {
+        JavaPath = Settings.JavaPath;
+        MinecraftForlderPath= Settings.MinecraftForlderPath;
+        MaxRam= Settings.MaxRam;
+        useCustomJava= Settings.useCustomJava;
+        setMaxRam= Settings.setMaxRam;
+        setPath = Settings.setPath;
+        checkGameAssets= Settings.checkGameAssets;
+        gameLogToLauncher= Settings.gameLogToLauncher;
+        Username = Settings.Username;
+        lastChosenVersion= Settings.lastChosenVersion;
+        setMaxLog= Settings.setMaxLog;
+        MaxLog = Settings.MaxLog;
+        consoleLogEventLevel= Settings.consoleLogEventLevel;
+        fileLogEventLevel= Settings.fileLogEventLevel;
     }
 }

+ 264 - 265
VeloeMinecraftLauncher/MinecraftLauncher/StartCommandBuilder.cs

@@ -6,57 +6,123 @@ using System.Text;
 using System.Text.Json;
 using System.Threading.Tasks;
 
-namespace VeloeMinecraftLauncher.MinecraftLauncher
+namespace VeloeMinecraftLauncher.MinecraftLauncher;
+
+internal static class StartCommandBuilder
 {
-    internal static class StartCommandBuilder
+    public static string Build(Entity.Version.Version version, string username)
     {
-        public static string Build(Entity.Version.Version version, string username)
+        var returnString = new StringBuilder();
+
+        char separator = ':';
+
+        if (OperatingSystem.IsWindows())
+            separator = ';';
+
+        if (version is null)
+            return returnString.ToString();
+
+        // setting natives folder
+        if (version.InheritsFrom is null)
+            returnString.Append($"-Djava.library.path={Settings.MinecraftForlderPath + "versions/" + version.Id + "/natives/"}");
+        else
+            returnString.Append($"-Djava.library.path={Settings.MinecraftForlderPath + "versions/" + version.InheritsFrom + "/natives/"}"); //for forge, vanilla optifine, fabric
+
+        returnString.Append(" -cp ");
+
+        // add libraries
+        foreach(var library in version.Libraries)
         {
-            var returnString = new StringBuilder();
+            bool rulesVaild = true;
+            //check if native
+            if (library.Natives is not null)
+                continue;
 
-            char separator = ':';
+            //rules check
+            if (library.Rules is not null)
+            {
+                rulesVaild = false;
+                foreach (var rule in library.Rules)
+                {
+                    bool isRuleOsExist = rule.Os is not null;
 
-            if (OperatingSystem.IsWindows())
-                separator = ';';
 
-            if (version is null)
-                return returnString.ToString();
+                    if (rule.Action == "allow" && rule.Os is null)
+                    {
+                        rulesVaild = true;
+                        continue;
+                    }
 
-            // setting natives folder
-            if (version.inheritsFrom is null)
-                returnString.Append($"-Djava.library.path={Settings.MinecraftForlderPath + "versions/" + version.id + "/natives/"}");
-            else
-                returnString.Append($"-Djava.library.path={Settings.MinecraftForlderPath + "versions/" + version.inheritsFrom + "/natives/"}"); //for forge, vanilla optifine, fabric
+                    if (rule.Os is not null)
+                        if (rule.Action == "allow" &&
+                                (rule.Os.Name == "linux" && OperatingSystem.IsLinux() ||
+                                rule.Os.Name == "windows" && OperatingSystem.IsWindows())
+                            )
+                        {
+                            rulesVaild = true;
+                            continue;
+                        }
+                }
+            }
+
+            //if no path
+            if (library.Downloads is null) //for optifine
+            {
+
+                string name = library.Name;
+                var dirs = name.Split(':');
+                dirs[0] = dirs[0].Replace('.','/');
+                var libPath = String.Empty;
+                foreach (var dir in dirs)
+                {
+                    libPath += dir+"/";
+                }
+                if (rulesVaild)
+                    returnString.Append(Settings.MinecraftForlderPath + "libraries/" + libPath + dirs[dirs.Length-2]+"-"+dirs[dirs.Length-1]+".jar;");
+
+                continue;
+            }
 
-            returnString.Append(" -cp ");
+            if (rulesVaild)
+                returnString.Append(Settings.MinecraftForlderPath + "libraries/" + library.Downloads.Artifact.Path + separator);
 
-            // add libraries
-            foreach(var library in version.libraries)
+        }
+        
+        Entity.Version.Version inheritsFrom = new();
+        if (version.InheritsFrom is null)
+            returnString.Append(Settings.MinecraftForlderPath + "versions/" + version.Id + "/" + version.Id + ".jar"); //main jar file
+        else
+        {
+            //for forge, vanilla optifine, fabric
+            //add libraries from inherited version
+            var inheritsJsonString = File.ReadAllText(Settings.MinecraftForlderPath + "versions/" + version.InheritsFrom + "/" + version.InheritsFrom + ".json");
+            
+            inheritsFrom = JsonSerializer.Deserialize<Entity.Version.Version>(inheritsJsonString, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
+
+            foreach (var library in inheritsFrom.Libraries)
             {
                 bool rulesVaild = true;
-                //check if native
-                if (library.natives is not null)
+                if (library.Natives is not null)
                     continue;
 
-                //rules check
-                if (library.rules is not null)
+                if (library.Rules is not null)
                 {
                     rulesVaild = false;
-                    foreach (var rule in library.rules)
+                    foreach (var rule in library.Rules)
                     {
-                        bool isRuleOsExist = rule.os is not null;
+                        bool isRuleOsExist = rule.Os is not null;
 
 
-                        if (rule.action == "allow" && rule.os is null)
+                        if (rule.Action == "allow" && rule.Os is null)
                         {
                             rulesVaild = true;
                             continue;
                         }
 
-                        if (rule.os is not null)
-                            if (rule.action == "allow" &&
-                                    (rule.os.name == "linux" && OperatingSystem.IsLinux() ||
-                                    rule.os.name == "windows" && OperatingSystem.IsWindows())
+                        if (rule.Os is not null)
+                            if (rule.Action == "allow" &&
+                                    (rule.Os.Name == "linux" && OperatingSystem.IsLinux() ||
+                                    rule.Os.Name == "windows" && OperatingSystem.IsWindows())
                                 )
                             {
                                 rulesVaild = true;
@@ -65,139 +131,136 @@ namespace VeloeMinecraftLauncher.MinecraftLauncher
                     }
                 }
 
-                //if no path
-                if (library.downloads is null) //for optifine
-                {
-
-                    string name = library.name;
-                    var dirs = name.Split(':');
-                    dirs[0] = dirs[0].Replace('.','/');
-                    var libPath = String.Empty;
-                    foreach (var dir in dirs)
-                    {
-                        libPath += dir+"/";
-                    }
-                    if (rulesVaild)
-                        returnString.Append(Settings.MinecraftForlderPath + "libraries/" + libPath + dirs[dirs.Length-2]+"-"+dirs[dirs.Length-1]+".jar;");
-
-                    continue;
-                }
-
-                if (rulesVaild)
-                    returnString.Append(Settings.MinecraftForlderPath + "libraries/" + library.downloads.artifact.path + separator);
+                if(rulesVaild)
+                    returnString.Append(Settings.MinecraftForlderPath + "libraries/" + library.Downloads.Artifact.Path + separator);
 
             }
-            
-            Entity.Version.Version inheritsFrom = new();
-            if (version.inheritsFrom is null)
-                returnString.Append(Settings.MinecraftForlderPath + "versions/" + version.id + "/" + version.id + ".jar"); //main jar file
+            //main jar file
+            //check here if there is jar file not inherited
+            //check if it is not 0kb size (fabric)
+            var fileInfo = new FileInfo($"{Settings.MinecraftForlderPath}versions/{version.Id}/{version.Id}.jar");
+
+            if (fileInfo.Exists && fileInfo.Length > 0)
+                returnString.Append(Settings.MinecraftForlderPath + "versions/" + version.Id + "/" + version.Id + ".jar");//for optifine
             else
-            {
-                //for forge, vanilla optifine, fabric
-                //add libraries from inherited version
-                var inheritsJsonString = File.ReadAllText(Settings.MinecraftForlderPath + "versions/" + version.inheritsFrom + "/" + version.inheritsFrom + ".json");
-                
-                inheritsFrom = JsonSerializer.Deserialize<Entity.Version.Version>(inheritsJsonString);
+                returnString.Append(Settings.MinecraftForlderPath + "versions/" + version.InheritsFrom + "/" + version.InheritsFrom + ".jar");//for forge
+        }
+
+       //check for jvm fabric options
 
-                foreach (var library in inheritsFrom.libraries)
+        if (version.Arguments is not null && version.InheritsFrom is not null)
+        {
+            if (version.Arguments.Jvm is not null)
+                foreach (var argument in version.Arguments.Jvm)
                 {
-                    bool rulesVaild = true;
-                    if (library.natives is not null)
+                    if (argument is null)
                         continue;
 
-                    if (library.rules is not null)
-                    {
-                        rulesVaild = false;
-                        foreach (var rule in library.rules)
-                        {
-                            bool isRuleOsExist = rule.os is not null;
+                    var type = argument.GetType();
 
+                    if (!(argument is JsonElement))
+                        continue;
 
-                            if (rule.action == "allow" && rule.os is null)
-                            {
-                                rulesVaild = true;
-                                continue;
-                            }
+                    if (!(((JsonElement)argument).ValueKind == JsonValueKind.String))
+                        continue;
 
-                            if (rule.os is not null)
-                                if (rule.action == "allow" &&
-                                        (rule.os.name == "linux" && OperatingSystem.IsLinux() ||
-                                        rule.os.name == "windows" && OperatingSystem.IsWindows())
-                                    )
-                                {
-                                    rulesVaild = true;
-                                    continue;
-                                }
-                        }
+                    var value = ((JsonElement)argument).Deserialize(typeof(string)) as string;
+
+                    //for new forge versions (1.18, 1.19)
+                    if (value.Contains("${version_name}"))
+                    {
+                        value = value.Replace("${version_name}", version.InheritsFrom);
+                    }
+                    if (value.Contains("${library_directory}"))
+                    {
+                        value = value.Replace("${library_directory}", Settings.MinecraftForlderPath + "libraries/");
+                    }
+                    if (value.Contains("${classpath_separator}"))
+                    {
+                        value = value.Replace("${classpath_separator}", ";");
                     }
 
-                    if(rulesVaild)
-                        returnString.Append(Settings.MinecraftForlderPath + "libraries/" + library.downloads.artifact.path + separator);
-    
+                    returnString.Append(" ");
+                    returnString.Append(value.Replace(" ", ""));
                 }
-                //main jar file
-                //check here if there is jar file not inherited
-                //check if it is not 0kb size (fabric)
-                var fileInfo = new FileInfo($"{Settings.MinecraftForlderPath}versions/{version.id}/{version.id}.jar");
+        }
 
-                if (fileInfo.Exists && fileInfo.Length > 0)
-                    returnString.Append(Settings.MinecraftForlderPath + "versions/" + version.id + "/" + version.id + ".jar");//for optifine
-                else
-                    returnString.Append(Settings.MinecraftForlderPath + "versions/" + version.inheritsFrom + "/" + version.inheritsFrom + ".jar");//for forge
-            }
+        //max ram
+        if (Settings.setMaxRam)
+            returnString.Append($" -Xmx{Settings.MaxRam}M ");
 
-           //check for jvm fabric options
-   
-            if (version.arguments is not null && version.inheritsFrom is not null)
+
+        returnString.Append(" " + version.MainClass);
+
+        List<string> args = new List<string>();
+        List<string> argsValues = new List<string>();
+       
+        if (version.Arguments is not null)
+        {
+            foreach (var argument in version.Arguments.Game)
             {
-                if (version.arguments.jvm is not null)
-                    foreach (var argument in version.arguments.jvm)
-                    {
-                        if (argument is null)
-                            continue;
+                if (argument is null)
+                    continue;
 
-                        var type = argument.GetType();
+                var type = argument.GetType();
 
-                        if (!(argument is JsonElement))
-                            continue;
+                if (!(argument is JsonElement))
+                    continue;
 
-                        if (!(((JsonElement)argument).ValueKind == JsonValueKind.String))
-                            continue;
+                if (!(((JsonElement)argument).ValueKind == JsonValueKind.String))
+                    continue;
 
-                        var value = ((JsonElement)argument).Deserialize(typeof(string)) as string;
+                var value = ((JsonElement)argument).Deserialize(typeof(string));
 
-                        //for new forge versions (1.18, 1.19)
-                        if (value.Contains("${version_name}"))
-                        {
-                            value = value.Replace("${version_name}", version.inheritsFrom);
-                        }
-                        if (value.Contains("${library_directory}"))
-                        {
-                            value = value.Replace("${library_directory}", Settings.MinecraftForlderPath + "libraries/");
-                        }
-                        if (value.Contains("${classpath_separator}"))
-                        {
-                            value = value.Replace("${classpath_separator}", ";");
-                        }
+                //if ()
 
-                        returnString.Append(" ");
-                        returnString.Append(value.Replace(" ", ""));
-                    }
-            }
+                if (!(value as string).Contains("--"))
+                {
+                    argsValues.Add(value as string);
+                    continue;
+                }
 
-            //max ram
-            if (Settings.setMaxRam)
-                returnString.Append($" -Xmx{Settings.MaxRam}M ");
+                args.Add(value as string);
+            }
+        }
+        if (version.MinecraftArguments is not null)
+        {
+            var minecraftArguments = version.MinecraftArguments.Split(' ');
+            //args = version.minecraftArguments.Split(' ').Where(x=> x.Contains("--")).ToList();
+            for (int i = 0; i < minecraftArguments.Count(); i++)
+            {
+                if (minecraftArguments[i].Contains("--"))
+                    args.Add(minecraftArguments[i]);
+                else
+                    argsValues.Add(minecraftArguments[i]);
+            }
+        }
 
 
-            returnString.Append(" " + version.mainClass);
+        Dictionary<string, bool> argsProvided = new Dictionary<string, bool>()
+        {
+            { "--username", false },
+            { "--version", false },
+            { "--gameDir", false},
+            { "--assetsDir", false },
+            { "--assetIndex", false },
+            { "--uuid", false },
+            { "--accessToken", false},
+            { "--userType", false},               
+            { "--tweakClass", false }
+        };
+
+        //check if all required arguments provided. Use inheritFrom if needed
+        foreach (var arg in args)
+        {
+            argsProvided[arg] = true;
+        }
 
-            List<string> args = new List<string>();
-            List<string> argsValues = new List<string>();
-           
-            if (version.arguments is not null)
+        if (argsProvided.ContainsValue(false))
+        {
+            if (inheritsFrom.Arguments is not null)
             {
-                foreach (var argument in version.arguments.game)
+                foreach (var argument in inheritsFrom.Arguments.Game)
                 {
                     if (argument is null)
                         continue;
@@ -219,155 +282,91 @@ namespace VeloeMinecraftLauncher.MinecraftLauncher
                         argsValues.Add(value as string);
                         continue;
                     }
-
-                    args.Add(value as string);
+                    if (!argsProvided.GetValueOrDefault(value as string, false))
+                    {
+                        args.Add(value as string);
+                        argsProvided[value as string] = true;
+                    }
                 }
             }
-            if (version.minecraftArguments is not null)
+            if (inheritsFrom.MinecraftArguments is not null)
             {
-                var minecraftArguments = version.minecraftArguments.Split(' ');
+                var minecraftArguments = inheritsFrom.MinecraftArguments.Split(' ');
                 //args = version.minecraftArguments.Split(' ').Where(x=> x.Contains("--")).ToList();
                 for (int i = 0; i < minecraftArguments.Count(); i++)
                 {
                     if (minecraftArguments[i].Contains("--"))
+                    {
                         args.Add(minecraftArguments[i]);
+                        argsProvided[minecraftArguments[i]] = true;
+                    }
                     else
                         argsValues.Add(minecraftArguments[i]);
                 }
             }
+        }
 
-
-            Dictionary<string, bool> argsProvided = new Dictionary<string, bool>()
-            {
-                { "--username", false },
-                { "--version", false },
-                { "--gameDir", false},
-                { "--assetsDir", false },
-                { "--assetIndex", false },
-                { "--uuid", false },
-                { "--accessToken", false},
-                { "--userType", false},               
-                { "--tweakClass", false }
-            };
-
-            //check if all required arguments provided. Use inheritFrom if needed
-            foreach (var arg in args)
-            {
-                argsProvided[arg] = true;
-            }
-
-            if (argsProvided.ContainsValue(false))
+        for (int i = 0; i < args.Count; i++)
+        {
+            switch (args[i])
             {
-                if (inheritsFrom.arguments is not null)
-                {
-                    foreach (var argument in inheritsFrom.arguments.game)
-                    {
-                        if (argument is null)
-                            continue;
-
-                        var type = argument.GetType();
-
-                        if (!(argument is JsonElement))
-                            continue;
-
-                        if (!(((JsonElement)argument).ValueKind == JsonValueKind.String))
-                            continue;
-
-                        var value = ((JsonElement)argument).Deserialize(typeof(string));
-
-                        //if ()
-
-                        if (!(value as string).Contains("--"))
-                        {
-                            argsValues.Add(value as string);
-                            continue;
-                        }
-                        if (!argsProvided.GetValueOrDefault(value as string, false))
-                        {
-                            args.Add(value as string);
-                            argsProvided[value as string] = true;
-                        }
-                    }
-                }
-                if (inheritsFrom.minecraftArguments is not null)
-                {
-                    var minecraftArguments = inheritsFrom.minecraftArguments.Split(' ');
-                    //args = version.minecraftArguments.Split(' ').Where(x=> x.Contains("--")).ToList();
-                    for (int i = 0; i < minecraftArguments.Count(); i++)
+                case "--username":
+                    returnString.Append(" --username " + username);
+                    break;
+                case "--version":
+                    returnString.Append(" --version " + version.Id /*"\"Copy of VeloeLauncher\""*/);
+                    break;
+                case "--gameDir":
+                    //for forge
+                    if (!(argsValues.Where(x => x.Contains("forge")).Count() > 0 || version.Id.ToLower().Contains("fabric")))
+                        returnString.Append(" --gameDir " + Settings.MinecraftForlderPath);
+                    else
+                        returnString.Append(" --gameDir " + Settings.MinecraftForlderPath + "versions/" + version.Id);
+                    break;
+                case "--assetsDir":
+                    //for forge
+                    if (version.InheritsFrom is null)
+                        returnString.Append(" --assetsDir " + Settings.MinecraftForlderPath + "assets/" + version.Assets + "/");
+                    else
+                        returnString.Append(" --assetsDir " + Settings.MinecraftForlderPath + "assets/" + inheritsFrom.Assets + "/");
+                    break;
+                case "--assetIndex":
+                    //for forge
+                    if (version.InheritsFrom is null)
+                        returnString.Append(" --assetIndex " + version.Assets);
+                    else
+                        returnString.Append(" --assetIndex " + inheritsFrom.Assets);
+                    break;
+                case "--uuid":
+                    returnString.Append(" --uuid sample_token");
+                    break;
+                case "--accessToken":
+                    returnString.Append(" --accessToken sample_token");
+                    break;
+                case "--userType":
+                    returnString.Append(" --userType offline");
+                    break;
+                case "--userProperties":
+                    returnString.Append(" --userProperties  " + "{\"veloelauncher\":[\"wtfisthis\"]}");
+                    break;
+                case "--versionType":
+                    returnString.Append(" --versionType " + version.Type);
+                    break;
+                case "--tweakClass":
+                    returnString.Append(" --tweakClass");
+                    if (argsValues[i] is not null)
+                        returnString.Append(" " + argsValues[i]);
+                    break;
+                //for new forge
+                default:
+                    if (argsValues[i] is not null && !argsValues[i].Contains("${"))
                     {
-                        if (minecraftArguments[i].Contains("--"))
-                        {
-                            args.Add(minecraftArguments[i]);
-                            argsProvided[minecraftArguments[i]] = true;
-                        }
-                        else
-                            argsValues.Add(minecraftArguments[i]);
+                        returnString.Append($" {args[i]} {argsValues[i]}");
                     }
-                }
-            }
+                    break;
 
-            for (int i = 0; i < args.Count; i++)
-            {
-                switch (args[i])
-                {
-                    case "--username":
-                        returnString.Append(" --username " + username);
-                        break;
-                    case "--version":
-                        returnString.Append(" --version " + version.id /*"\"Copy of VeloeLauncher\""*/);
-                        break;
-                    case "--gameDir":
-                        //for forge
-                        if (!(argsValues.Where(x => x.Contains("forge")).Count() > 0 || version.id.ToLower().Contains("fabric")))
-                            returnString.Append(" --gameDir " + Settings.MinecraftForlderPath);
-                        else
-                            returnString.Append(" --gameDir " + Settings.MinecraftForlderPath + "versions/" + version.id);
-                        break;
-                    case "--assetsDir":
-                        //for forge
-                        if (version.inheritsFrom is null)
-                            returnString.Append(" --assetsDir " + Settings.MinecraftForlderPath + "assets/" + version.assets + "/");
-                        else
-                            returnString.Append(" --assetsDir " + Settings.MinecraftForlderPath + "assets/" + inheritsFrom.assets + "/");
-                        break;
-                    case "--assetIndex":
-                        //for forge
-                        if (version.inheritsFrom is null)
-                            returnString.Append(" --assetIndex " + version.assets);
-                        else
-                            returnString.Append(" --assetIndex " + inheritsFrom.assets);
-                        break;
-                    case "--uuid":
-                        returnString.Append(" --uuid sample_token");
-                        break;
-                    case "--accessToken":
-                        returnString.Append(" --accessToken sample_token");
-                        break;
-                    case "--userType":
-                        returnString.Append(" --userType offline");
-                        break;
-                    case "--userProperties":
-                        returnString.Append(" --userProperties  " + "{\"veloelauncher\":[\"wtfisthis\"]}");
-                        break;
-                    case "--versionType":
-                        returnString.Append(" --versionType " + version.type);
-                        break;
-                    case "--tweakClass":
-                        returnString.Append(" --tweakClass");
-                        if (argsValues[i] is not null)
-                            returnString.Append(" " + argsValues[i]);
-                        break;
-                    //for new forge
-                    default:
-                        if (argsValues[i] is not null && !argsValues[i].Contains("${"))
-                        {
-                            returnString.Append($" {args[i]} {argsValues[i]}");
-                        }
-                        break;
-
-                }
             }
-            return returnString.ToString();
         }
+        return returnString.ToString();
     }
 }

+ 13 - 18
VeloeMinecraftLauncher/Models/Entity/Assets/Asset.cs

@@ -1,24 +1,19 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using System.Collections.Generic;
 using System.Text.Json.Serialization;
-using System.Threading.Tasks;
 
-namespace VeloeMinecraftLauncher.Entity.Assets
+namespace VeloeMinecraftLauncher.Entity.Assets;
+
+internal class Asset
 {
-    internal class Asset
-    {
-        public string hash { get; set; }
-        public int size { get; set; }
-    }
+    public string Hash { get; set; }
+    public int Size { get; set; }
+}
 
-    internal class AssetsManifest
-    {
-        [JsonPropertyName("virtual")]
-        public bool IsVirtual { get; set; }
+internal class AssetsManifest
+{
+    [JsonPropertyName("virtual")]
+    public bool IsVirtual { get; set; }
 
-        [JsonPropertyName("objects")]
-        public Dictionary<string, Asset> Objects { get; set; }
-    }
+    [JsonPropertyName("objects")]
+    public Dictionary<string, Asset> Objects { get; set; }
 }

+ 4 - 4
VeloeMinecraftLauncher/Models/Entity/Changelog.cs

@@ -1,9 +1,9 @@
 namespace VeloeMinecraftLauncher.Models.Entity;
 public class Changelog
 {
-    public string title { get; set; }
-    public string text { get; set; }
-    public string version { get; set; }
-    public string date { get; set; }
+    public string Title { get; set; }
+    public string Text { get; set; }
+    public string Version { get; set; }
+    public string Date { get; set; }
 }
 

+ 11 - 0
VeloeMinecraftLauncher/Models/Entity/DownloadedVersion.cs

@@ -0,0 +1,11 @@
+namespace VeloeMinecraftLauncher.Models.Entity;
+public class DownloadedVersion
+{
+    public string path;
+    public string version;
+
+    public override string ToString()
+    {
+        return version;
+    }
+}

+ 8 - 0
VeloeMinecraftLauncher/Models/Entity/LatestLauncherVersion.cs

@@ -0,0 +1,8 @@
+namespace VeloeMinecraftLauncher.Models.Entity;
+
+public class LatestLauncherVersion
+{
+    public string? Latest { get; set; }
+    public string? Updater { get; set; }
+    public string? Url { get; set; }
+}

+ 17 - 21
VeloeMinecraftLauncher/Models/Entity/LauncherProfiles.cs

@@ -1,29 +1,25 @@
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
-namespace VeloeMinecraftLauncher.Entity.LauncherProfiles
-{
-    [Serializable]
-    public class LauncherProfiles
-    {
-        public string selectedProfile { get; set; }
-        public Dictionary<string, Profile> profiles { get; set; }
+namespace VeloeMinecraftLauncher.Entity.LauncherProfiles;
 
-        public LauncherProfiles()
-        {
-            profiles = new Dictionary<string, Profile>();
-        }
-    }
+[Serializable]
+public class LauncherProfiles
+{
+    public string SelectedProfile { get; set; }
+    public Dictionary<string, Profile> Profiles { get; set; }
 
-    [Serializable]
-    public class Profile
+    public LauncherProfiles()
     {
-        public string name { get; set; }
-        public string lastVersionId { get; set; }
-        public string[] allowedReleaseTypes { get; set; }
-        public string launcherVisibilityOnGameClose { get; set; }
+        Profiles = new Dictionary<string, Profile>();
     }
 }
+
+[Serializable]
+public class Profile
+{
+    public string Name { get; set; }
+    public string LastVersionId { get; set; }
+    public string[] AllowedReleaseTypes { get; set; }
+    public string LauncherVisibilityOnGameClose { get; set; }
+}

+ 15 - 20
VeloeMinecraftLauncher/Models/Entity/McStatus/McStatus.cs

@@ -1,23 +1,18 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
 
-namespace VeloeMinecraftLauncher.Entity.McStatus
+namespace VeloeMinecraftLauncher.Entity.McStatus;
+
+public class McStatus
 {
-    public class McStatus
-    {
-        public string MessageOfTheDay { get; set; }
-        public string Gametype { get; set; }
-        public string GameId { get; set; }
-        public string Version { get; set; }
-        public string Plugins { get; set; }
-        public string Map { get; set; }
-        public string NumPlayers { get; set; }
-        public string MaxPlayers { get; set; }
-        public string HostPort { get; set; }
-        public string HostIp { get; set; }
-        public List<string> Players { get; set; }
-    }
+    public string MessageOfTheDay { get; set; }
+    public string Gametype { get; set; }
+    public string GameId { get; set; }
+    public string Version { get; set; }
+    public string Plugins { get; set; }
+    public string Map { get; set; }
+    public string NumPlayers { get; set; }
+    public string MaxPlayers { get; set; }
+    public string HostPort { get; set; }
+    public string HostIp { get; set; }
+    public List<string> Players { get; set; }
 }

+ 9 - 9
VeloeMinecraftLauncher/Models/Entity/Modpack.cs

@@ -1,18 +1,18 @@
 namespace VeloeMinecraftLauncher.Models.Entity;
 public class Modpack
 {
-    public string name { get; set; }
-    public string version { get; set; }
-    public bool forge { get; set; } = false;
-    public bool forgeoptifine { get; set; } = false;
-    public bool optifine { get; set; } = false;
-    public bool fabric { get; set; } = false;
-    public string url { get; set; }
-    public int revision { get; set; }
+    public string Name { get; set; }
+    public string Version { get; set; }
+    public bool Forge { get; set; } = false;
+    public bool ForgeOptifine { get; set; } = false;
+    public bool Optifine { get; set; } = false;
+    public bool Fabric { get; set; } = false;
+    public string Url { get; set; }
+    public int Revision { get; set; }
 
     public override string ToString()
     {
-        return name;
+        return Name;
     }
 }
 

+ 181 - 188
VeloeMinecraftLauncher/Models/Entity/Version/Version.cs

@@ -1,191 +1,184 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using System.Collections.Generic;
 using System.Text.Json.Serialization;
-using System.Threading.Tasks;
-
-namespace VeloeMinecraftLauncher.Entity.Version
-{
-
-    public class Arguments
-    {      
-        public List<object> game { get; set; }
-        public List<object> jvm { get; set; }
-    }
-    public class Artifact
-    {
-        public string path { get; set; }
-        public string sha1 { get; set; }
-        public int size { get; set; }
-        public string url { get; set; }
-    }
-
-    public class AssetIndex
-    {
-        public string id { get; set; }
-        public string sha1 { get; set; }
-        public int size { get; set; }
-        public int totalSize { get; set; }
-        public string url { get; set; }
-    }
-
-    public class Classifiers
-    {
-        [JsonPropertyName("natives-linux")]
-        public NativesLinux NativesLinux { get; set; }
-
-        [JsonPropertyName("natives-osx")]
-        public NativesOsx NativesOsx { get; set; }
-
-        [JsonPropertyName("natives-windows")]
-        public NativesWindows NativesWindows { get; set; }
-
-        [JsonPropertyName("natives-windows-32")]
-        public NativesWindows NativesWindows32 { get; set; }
-
-        [JsonPropertyName("natives-windows-64")]
-        public NativesWindows NativesWindows64 { get; set; }
-
-        public Sources sources { get; set; }
-        public Javadoc javadoc { get; set; }
-    }
-
-    public class Client
-    {
-        public string sha1 { get; set; }
-        public int size { get; set; }
-        public string url { get; set; }
-        public string argument { get; set; }
-        public File file { get; set; }
-        public string type { get; set; }
-    }
-
-    public class Downloads
-    {
-        public Client client { get; set; }
-        public Server server { get; set; }
-        public Artifact artifact { get; set; }
-        public Classifiers classifiers { get; set; }
-    }
-
-    public class Extract
-    {
-        public List<string> exclude { get; set; }
-    }
-
-    public class File
-    {
-        public string id { get; set; }
-        public string sha1 { get; set; }
-        public int size { get; set; }
-        public string url { get; set; }
-    }
-
-    public class Javadoc
-    {
-        public string path { get; set; }
-        public string sha1 { get; set; }
-        public int size { get; set; }
-        public string url { get; set; }
-    }
-
-    public class JavaVersion
-    {
-        public string component { get; set; }
-        public int majorVersion { get; set; }
-    }
-
-    public class Library
-    {
-        public Downloads downloads { get; set; }
-        public string name { get; set; }
-        public List<Rule> rules { get; set; }
-        public Extract extract { get; set; }
-        public Natives natives { get; set; }
-    }
-
-    public class Logging
-    {
-        public Client client { get; set; }
-    }
-
-    public class Natives
-    {
-        public string linux { get; set; }
-        public string osx { get; set; }
-        public string windows { get; set; }
-    }
-
-    public class NativesLinux
-    {
-        public string path { get; set; }
-        public string sha1 { get; set; }
-        public int size { get; set; }
-        public string url { get; set; }
-    }
-
-    public class NativesOsx
-    {
-        public string path { get; set; }
-        public string sha1 { get; set; }
-        public int size { get; set; }
-        public string url { get; set; }
-    }
-
-    public class NativesWindows
-    {
-        public string path { get; set; }
-        public string sha1 { get; set; }
-        public int size { get; set; }
-        public string url { get; set; }
-    }
-
-    public class Os
-    {
-        public string name { get; set; }
-    }
-
-    public class Version
-    {
-        public Arguments arguments { get; set; }
-        public AssetIndex assetIndex { get; set; }
-        public string assets { get; set; }
-        public int complianceLevel { get; set; }
-        public Downloads downloads { get; set; }
-        public string id { get; set; }
-        public JavaVersion javaVersion { get; set; }
-        public List<Library> libraries { get; set; }
-        public Logging logging { get; set; }
-        public string mainClass { get; set; }
-        public string minecraftArguments { get; set; }
-        public int minimumLauncherVersion { get; set; }
-        public string releaseTime { get; set; }
-        public string time { get; set; }
-        public string type { get; set; }
-
-        public string inheritsFrom { get; set; }
-    }
-
-    public class Rule
-    {
-        public string action { get; set; }
-        public Os os { get; set; }
-    }
-
-    public class Server
-    {
-        public string sha1 { get; set; }
-        public int size { get; set; }
-        public string url { get; set; }
-    }
-
-    public class Sources
-    {
-        public string path { get; set; }
-        public string sha1 { get; set; }
-        public int size { get; set; }
-        public string url { get; set; }
-    }
 
+namespace VeloeMinecraftLauncher.Entity.Version;
+
+public class Arguments
+{      
+    public List<object> Game { get; set; }
+    public List<object> Jvm { get; set; }
+}
+public class Artifact
+{
+    public string Path { get; set; }
+    public string Sha1 { get; set; }
+    public int Size { get; set; }
+    public string Url { get; set; }
+}
+
+public class AssetIndex
+{
+    public string Id { get; set; }
+    public string Sha1 { get; set; }
+    public int Size { get; set; }
+    public int TotalSize { get; set; }
+    public string Url { get; set; }
+}
+
+public class Classifiers
+{
+    [JsonPropertyName("natives-linux")]
+    public NativesLinux NativesLinux { get; set; }
+
+    [JsonPropertyName("natives-osx")]
+    public NativesOsx NativesOsx { get; set; }
+
+    [JsonPropertyName("natives-windows")]
+    public NativesWindows NativesWindows { get; set; }
+
+    [JsonPropertyName("natives-windows-32")]
+    public NativesWindows NativesWindows32 { get; set; }
+
+    [JsonPropertyName("natives-windows-64")]
+    public NativesWindows NativesWindows64 { get; set; }
+
+    public Sources Sources { get; set; }
+    public Javadoc Javadoc { get; set; }
+}
+
+public class Client
+{
+    public string Sha1 { get; set; }
+    public int Size { get; set; }
+    public string Url { get; set; }
+    public string Argument { get; set; }
+    public File File { get; set; }
+    public string Type { get; set; }
+}
+
+public class Downloads
+{
+    public Client Client { get; set; }
+    public Server Server { get; set; }
+    public Artifact Artifact { get; set; }
+    public Classifiers Classifiers { get; set; }
+}
+
+public class Extract
+{
+    public List<string> Exclude { get; set; }
+}
+
+public class File
+{
+    public string Id { get; set; }
+    public string Sha1 { get; set; }
+    public int Size { get; set; }
+    public string Url { get; set; }
+}
+
+public class Javadoc
+{
+    public string Path { get; set; }
+    public string Sha1 { get; set; }
+    public int Size { get; set; }
+    public string Url { get; set; }
+}
+
+public class JavaVersion
+{
+    public string Component { get; set; }
+    public int MajorVersion { get; set; }
+}
+
+public class Library
+{
+    public Downloads Downloads { get; set; }
+    public string Name { get; set; }
+    public List<Rule> Rules { get; set; }
+    public Extract Extract { get; set; }
+    public Natives Natives { get; set; }
+}
+
+public class Logging
+{
+    public Client Client { get; set; }
+}
+
+public class Natives
+{
+    public string Linux { get; set; }
+    public string Osx { get; set; }
+    public string Windows { get; set; }
+}
+
+public class NativesLinux
+{
+    public string Path { get; set; }
+    public string Sha1 { get; set; }
+    public int Size { get; set; }
+    public string Url { get; set; }
+}
+
+public class NativesOsx
+{
+    public string Path { get; set; }
+    public string Sha1 { get; set; }
+    public int Size { get; set; }
+    public string Url { get; set; }
+}
+
+public class NativesWindows
+{
+    public string Path { get; set; }
+    public string Sha1 { get; set; }
+    public int Size { get; set; }
+    public string Url { get; set; }
+}
+
+public class Os
+{
+    public string Name { get; set; }
+}
+
+public class Version
+{
+    public Arguments Arguments { get; set; }
+    public AssetIndex AssetIndex { get; set; }
+    public string Assets { get; set; }
+    public int ComplianceLevel { get; set; }
+    public Downloads Downloads { get; set; }
+    public string Id { get; set; }
+    public JavaVersion JavaVersion { get; set; }
+    public List<Library> Libraries { get; set; }
+    public Logging Logging { get; set; }
+    public string MainClass { get; set; }
+    public string MinecraftArguments { get; set; }
+    public int MinimumLauncherVersion { get; set; }
+    public string ReleaseTime { get; set; }
+    public string Time { get; set; }
+    public string Type { get; set; }
+
+    public string InheritsFrom { get; set; }
+}
+
+public class Rule
+{
+    public string Action { get; set; }
+    public Os Os { get; set; }
+}
+
+public class Server
+{
+    public string Sha1 { get; set; }
+    public int Size { get; set; }
+    public string Url { get; set; }
+}
+
+public class Sources
+{
+    public string Path { get; set; }
+    public string Sha1 { get; set; }
+    public int Size { get; set; }
+    public string Url { get; set; }
 }

+ 4 - 11
VeloeMinecraftLauncher/Models/Entity/VesrionManifest/Latest.cs

@@ -1,14 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+namespace VeloeMinecraftLauncher.Entity.VersionManifest;
 
-namespace VeloeMinecraftLauncher.Entity.VersionManifest
+public class Latest
 {
-    public class Latest
-    {
-        public string release { get; set; }
-        public string snapshot { get; set; }
-    }
+    public string Release { get; set; }
+    public string Snapshot { get; set; }
 }

+ 13 - 18
VeloeMinecraftLauncher/Models/Entity/VesrionManifest/Version.cs

@@ -1,24 +1,19 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
-namespace VeloeMinecraftLauncher.Entity.VersionManifest
+namespace VeloeMinecraftLauncher.Entity.VersionManifest;
+
+public class Version
 { 
-    public class Version
-    { 
-        public string id { get; set; }
-        public string type { get; set; }
-        public string url { get; set; }
-        public DateTime time { get; set; }
-        public DateTime releaseTime { get; set; }
-        public string sha1 { get; set; }
-        public int complianceLevel { get; set; }
+    public string Id { get; set; }
+    public string Type { get; set; }
+    public string Url { get; set; }
+    public DateTime Time { get; set; }
+    public DateTime ReleaseTime { get; set; }
+    public string Sha1 { get; set; }
+    public int ComplianceLevel { get; set; }
 
-        public override string ToString()
-        {
-            return id;
-        }
+    public override string ToString()
+    {
+        return Id;
     }
 }

+ 6 - 11
VeloeMinecraftLauncher/Models/Entity/VesrionManifest/VersionManifest.cs

@@ -1,14 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
 
-namespace VeloeMinecraftLauncher.Entity.VersionManifest
+namespace VeloeMinecraftLauncher.Entity.VersionManifest;
+
+public class VersionManifest
 {
-    public class VersionManifest
-    {
-        public Latest latest { get; set; }
-        public List<Version> versions { get; set; }
-    }
+    public Latest Latest { get; set; }
+    public List<Version> Versions { get; set; }
 }

+ 36 - 0
VeloeMinecraftLauncher/Models/ServerPanelModel.cs

@@ -0,0 +1,36 @@
+using ReactiveUI;
+using ReactiveUI.Validation.Helpers;
+
+namespace VeloeMinecraftLauncher.Models;
+public class ServerPanelModel : ReactiveValidationObject
+{
+    private string _name;
+    private string _status;
+    private string _tip;
+    private string _players;
+
+    public string Name
+    {
+        get => _name;
+        set => this.RaiseAndSetIfChanged(ref _name, value);
+    }
+
+    public string Status
+    {
+        get => _status;
+        set => this.RaiseAndSetIfChanged(ref _status, value);
+    }
+
+    public string Tip
+    {
+        get => _tip;
+        set => this.RaiseAndSetIfChanged(ref _tip, value);
+    }
+
+    public string Players
+    {
+        get => _players;
+        set => this.RaiseAndSetIfChanged(ref _players, value);
+    }
+}
+

+ 18 - 19
VeloeMinecraftLauncher/ViewModels/ErrorWindowViewModel.cs

@@ -1,28 +1,27 @@
 using ReactiveUI;
 
-namespace VeloeMinecraftLauncher.ViewModels
+namespace VeloeMinecraftLauncher.ViewModels;
+
+public class ErrorWindowViewModel : ViewModelBase
 {
-    public class ErrorWindowViewModel : ViewModelBase
+    public ErrorWindowViewModel(string errorMessage, string errorTrace)
     {
-        public ErrorWindowViewModel(string errorMessage, string errorTrace)
-        {
-            ErrorMessage = errorMessage;
-            ErrorTrace = errorTrace;
-        }
+        ErrorMessage = errorMessage;
+        ErrorTrace = errorTrace;
+    }
 
-        private string errorMessage;
-        private string errorTrace;
+    private string _errorMessage;
+    private string _errorTrace;
 
-        public string ErrorTrace
-        {
-            get => errorTrace;
-            set => this.RaiseAndSetIfChanged(ref errorTrace, value);
-        }
+    public string ErrorTrace
+    {
+        get => _errorTrace;
+        set => this.RaiseAndSetIfChanged(ref _errorTrace, value);
+    }
 
-        public string ErrorMessage
-        {
-            get => errorMessage;
-            set => this.RaiseAndSetIfChanged(ref errorMessage, value);
-        }
+    public string ErrorMessage
+    {
+        get => _errorMessage;
+        set => this.RaiseAndSetIfChanged(ref _errorMessage, value);
     }
 }

+ 595 - 650
VeloeMinecraftLauncher/ViewModels/MainWindowViewModel.cs

@@ -22,866 +22,811 @@ using System.IO.Compression;
 using ReactiveUI.Validation.Extensions;
 using Avalonia.Media;
 using Avalonia.Data;
-using ReactiveUI.Validation.Helpers;
 using System.Collections.Generic;
 using VeloeMinecraftLauncher.Models.Entity;
+using VeloeMinecraftLauncher.Models;
 
-namespace VeloeMinecraftLauncher.ViewModels
+namespace VeloeMinecraftLauncher.ViewModels;
+
+public class MainWindowViewModel : ViewModelBase
 {
-    public class MainWindowViewModel : ViewModelBase
-    {
-        public MainWindowViewModel()
-        {           
-            Task.Run(() =>
+    public MainWindowViewModel()
+    {           
+        Task.Run(() =>
+        {
+            try
             {
-                try
-                {
-                    //creating logger
-                    EventSink eventSink = new(null);
-                    eventSink.DataReceived += LogHandler;
-
-                    logger = new LoggerConfiguration()
-                        .MinimumLevel.Debug()
-                        .WriteTo.Sink(eventSink , Settings.consoleLogEventLevel)
-                        .WriteTo.File("launcher.log", Settings.fileLogEventLevel, fileSizeLimitBytes: Settings.MaxLog * 1024, rollOnFileSizeLimit: true)// restricted... is Optional
-                        .CreateLogger();
-                    Settings.logger = logger;
-
-                    //loading settings
-                    logger.Debug("Loading settings.");
-                    Settings.LoadSettings();
-                    username = Settings.Username;
-
-                    //loading local verions
-                    logger.Debug("Loading local versions.");
-                    updateAvailable();
-                }
-                catch (Exception ex)
-                {
-                    OpenErrorWindow(ex);
-                }
+                //creating logger
+                EventSink eventSink = new(null);
+                eventSink.DataReceived += LogHandler;
+
+                _logger = new LoggerConfiguration()
+                    .MinimumLevel.Debug()
+                    .WriteTo.Sink(eventSink , Settings.consoleLogEventLevel)
+                    .WriteTo.File("launcher.log", Settings.fileLogEventLevel, fileSizeLimitBytes: Settings.MaxLog * 1024, rollOnFileSizeLimit: true)// restricted... is Optional
+                    .CreateLogger();
+                Settings.logger = _logger;
+
+                //loading settings
+                _logger.Debug("Loading settings.");
+                Settings.LoadSettings();
+                _username = Settings.Username;
+
+                //loading local verions
+                _logger.Debug("Loading local versions.");
+                updateAvailable();
+            }
+            catch (Exception ex)
+            {
+                OpenErrorWindow(ex);
+            }
 
-                this.ValidationRule(
+            this.ValidationRule(
                 viewModel => viewModel.Username,
                 value => { return !string.IsNullOrEmpty(value); },
                 "Empty username.");
 
-                UpdateUpdater();
+            UpdateUpdater();
 
-                try
+            try
+            {
+                //check launcher update
+                _logger.Information("Checking launcher versions updates.");
+                _latestLauncherInfo = Downloader.DownloadAndDeserializeJsonData<LatestLauncherVersion>("https://files.veloe.link/launcher/update/versions.json");
+                if (_latestLauncherInfo is not null)
                 {
-                    //check launcher update
-                    logger.Information("Checking launcher versions updates.");
-                    latestLauncherInfo = Downloader.DownloadAndDeserializeJsonData<LatestLauncherVersion>("https://files.veloe.link/launcher/update/versions.json");
-                    if (latestLauncherInfo is not null)
-                    {
-                        logger.Information("Launcher version on server: {0}", latestLauncherInfo.latest);
-                        logger.Information("Launcher version: {0}", Assembly.GetExecutingAssembly().GetName().Version);
-
-                        if (new Version(latestLauncherInfo.latest) > Assembly.GetExecutingAssembly().GetName().Version)
-                        {
-                            logger.Debug("Update available!");
-                            IsUpdateAvailable = true;
-                        }
+                    _logger.Information("Launcher version on server: {0}", _latestLauncherInfo.Latest);
+                    _logger.Information("Launcher version: {0}", Assembly.GetExecutingAssembly().GetName().Version);
 
+                    if (new Version(_latestLauncherInfo.Latest) > Assembly.GetExecutingAssembly().GetName().Version)
+                    {
+                        _logger.Debug("Update available!");
+                        IsUpdateAvailable = true;
                     }
+
                 }
-                catch (Exception ex)
-                {
-                    OpenErrorWindow(ex);
-                }
-                try
-                {
-                    var changelog = Downloader.DownloadAndDeserializeJsonData<List<Changelog>>("https://files.veloe.link/launcher/changelog.json");
+            }
+            catch (Exception ex)
+            {
+                OpenErrorWindow(ex);
+            }
+            try
+            {
+                var changelog = Downloader.DownloadAndDeserializeJsonData<List<Changelog>>("https://files.veloe.link/launcher/changelog.json");
 
-                    if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+                if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+                {
+                    Dispatcher.UIThread.InvokeAsync(() =>
                     {
-                        Dispatcher.UIThread.InvokeAsync(() =>
+                        var stackpanel = desktop.MainWindow.GetControl<StackPanel>("ChangeLogStackPanel");
+                        foreach (var version in changelog)
                         {
-                            var stackpanel = desktop.MainWindow.GetControl<StackPanel>("ChangeLogStackPanel");
-                            foreach (var version in changelog)
+                            if (version.Title is not null)
                             {
-                                if (version.title is not null)
-                                {
-                                    stackpanel.Children.Add(new TextBlock()
-                                    {
-                                        Text = version.title,
-                                        VerticalAlignment = Avalonia.Layout.VerticalAlignment.Stretch,
-                                        TextWrapping = TextWrapping.Wrap,
-                                        FontSize = 16
-                                    });
-                                }
                                 stackpanel.Children.Add(new TextBlock()
                                 {
-                                    Text = version.text,
+                                    Text = version.Title,
                                     VerticalAlignment = Avalonia.Layout.VerticalAlignment.Stretch,
-                                    TextWrapping = TextWrapping.Wrap
+                                    TextWrapping = TextWrapping.Wrap,
+                                    FontSize = 16
                                 });
                             }
-                        });
+                            stackpanel.Children.Add(new TextBlock()
+                            {
+                                Text = version.Text,
+                                VerticalAlignment = Avalonia.Layout.VerticalAlignment.Stretch,
+                                TextWrapping = TextWrapping.Wrap
+                            });
+                        }
+                    });
 
-                    }
                 }
-                catch (Exception ex)
+            }
+            catch (Exception ex)
+            {
+                OpenErrorWindow(ex);
+            }
+            try
+            {
+              
+                _logger.Debug("Connecting to WebSoket");
+                    //conection to my servers 
+
+                var serverNames = Downloader.DownloadAndDeserializeJsonData<List<string>>("https://files.veloe.link/launcher/servers.json");
+
+                _connection = new HubConnectionBuilder()
+                    .WithUrl("https://monitor.veloe.link/hubs/data")
+                    .WithAutomaticReconnect()
+                    .Build();
+            
+                Func<Exception, Task> reconnecting = ex => Task.Run(() =>
                 {
-                    OpenErrorWindow(ex);
-                }
-                try
+                    _logger.Warning("Reconnecting to WebCoket...");
+                });
+                Func<string, Task> reconnected = str => Task.Run(() =>
                 {
-                  
-                    logger.Debug("Connecting to WebSoket");
-                        //conection to my servers 
+                    _logger.Warning("Reconnected to WebCoket.");
+                    foreach (var server in serverNames)
+                    {
+                        _connection.InvokeAsync("ConnectToGroup", server);
+                    }
+                });
 
-                    var serverNames = Downloader.DownloadAndDeserializeJsonData<List<string>>("https://files.veloe.link/launcher/servers.json");
+                _connection.Reconnecting += reconnecting;
+                _connection.Reconnected += reconnected;
 
-                    connection = new HubConnectionBuilder()
-                        .WithUrl("https://monitor.veloe.link/hubs/data")
-                        .WithAutomaticReconnect()
-                        .Build();
-                
-                    Func<Exception, Task> reconnecting = ex => Task.Run(() =>
-                    {
-                        logger.Warning("Reconnecting to WebCoket...");
-                    });
-                    Func<string, Task> reconnected = str => Task.Run(() =>
+                if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+                {
+                    Dispatcher.UIThread.InvokeAsync(() =>
                     {
-                        logger.Warning("Reconnected to WebCoket.");
+                        var stackpanel = desktop.MainWindow.GetControl<StackPanel>("ServersStackPanel");
                         foreach (var server in serverNames)
-                        {
-                            connection.InvokeAsync("ConnectToGroup", server);
-                        }
+                            stackpanel.Children.Add(CreateServerPanel(server));
                     });
 
-                    connection.Reconnecting += reconnecting;
-                    connection.Reconnected += reconnected;
-
-                    if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
-                    {
-                        Dispatcher.UIThread.InvokeAsync(() =>
-                        {
-                            var stackpanel = desktop.MainWindow.GetControl<StackPanel>("ServersStackPanel");
-                            foreach (var server in serverNames)
-                                stackpanel.Children.Add(CreateServerPanel(server));
-                        });
-
-                    }
-
-                    connection.StartAsync();
+                }
 
-                    foreach (var server in serverNames)
-                    {
-                        connection.InvokeAsync("ConnectToGroup", server);
-                    }
-                    logger.Debug("Connected to WebSoket");
+                _connection.StartAsync();
 
-                    consoleOutputTimer.Elapsed += UpdateConsoleOutput;
-                    consoleOutputTimer.AutoReset = false;
-                }
-                catch (Exception ex)
+                foreach (var server in serverNames)
                 {
-                    OpenErrorWindow(ex);
+                    _connection.InvokeAsync("ConnectToGroup", server);
                 }
-            });
+                _logger.Debug("Connected to WebSoket");
 
-        }
+                _consoleOutputTimer.Elapsed += UpdateConsoleOutput;
+                _consoleOutputTimer.AutoReset = false;
+            }
+            catch (Exception ex)
+            {
+                OpenErrorWindow(ex);
+            }
+        });
 
-        System.Timers.Timer consoleOutputTimer = new(250);
+    }
 
-        private HubConnection connection;
-        private string downloadButton = "Download versions";
-        private string startButton = "Start Minecraft";
-        private string username = "";
-        private StringBuilder consoleText = new StringBuilder();
-        private int downloadedIndex;
-        private string argumentsBox;
-        private bool isNoGameRunning = true;
-        private bool isUpdateAvailable = false;
-        private string settingsButton = "Settings";
-        private string startButtonOutput;
+    System.Timers.Timer _consoleOutputTimer = new(250);
 
-        ILogger logger;
+    private HubConnection _connection;
+    private string _downloadButton = "Download versions";
+    private string _startButton = "Start Minecraft";
+    private string _username = "";
+    private StringBuilder _consoleText = new StringBuilder();
+    private int _downloadedIndex;
+    private string _argumentsBox;
+    private bool _isNoGameRunning = true;
+    private bool _isUpdateAvailable = false;
+    private string _settingsButton = "Settings";
+    private string _startButtonOutput;
 
-        LatestLauncherVersion latestLauncherInfo;
-        DownloadedVerion downloadedVersion;
+    ILogger _logger;
 
-        ObservableCollection<DownloadedVerion> downloadedVersions;
+    LatestLauncherVersion _latestLauncherInfo;
+    DownloadedVersion _downloadedVersion;
 
-        public ObservableCollection<DownloadedVerion> DownloadedVersions { 
-            get => downloadedVersions; 
-            set
-            {
-                this.RaiseAndSetIfChanged(ref downloadedVersions, value);
-            }
-        }
+    ObservableCollection<DownloadedVersion> _downloadedVersions;
 
-        public DownloadedVerion DownloadedVerion
+    public ObservableCollection<DownloadedVersion> DownloadedVersions { 
+        get => _downloadedVersions; 
+        set
         {
-            get => downloadedVersion;
-            set
-            {
-                this.RaiseAndSetIfChanged(ref downloadedVersion, value);
-                //Settings.lastChosenVersion = value.version;
-                //logger.Debug("Version choosen: {0}",value.version);
-                //logger.Debug("Version json: {0}", value.path);
-            }
+            this.RaiseAndSetIfChanged(ref _downloadedVersions, value);
         }
+    }
 
-        public int DownloadedIndex
+    public DownloadedVersion DownloadedVerion
+    {
+        get => _downloadedVersion;
+        set
         {
-            get => downloadedIndex;
-            set
-            {
-                this.RaiseAndSetIfChanged(ref downloadedIndex, value);
-                if (value >= 0 && value < DownloadedVersions.Count)
-                    DownloadedVerion = DownloadedVersions[value];
-            }
-        }
-        public string Greeting => "Welcome to Cringe Launcher!";
-        public string DownloadButton {
-            get => downloadButton;
-            set => this.RaiseAndSetIfChanged(ref downloadButton, value);
+            this.RaiseAndSetIfChanged(ref _downloadedVersion, value);
+            //Settings.lastChosenVersion = value.version;
+            //logger.Debug("Version choosen: {0}",value.version);
+            //logger.Debug("Version json: {0}", value.path);
         }
+    }
 
-        public string StartButton
+    public int DownloadedIndex
+    {
+        get => _downloadedIndex;
+        set
         {
-            get => startButton;
-            set => this.RaiseAndSetIfChanged(ref startButton, value);
+            this.RaiseAndSetIfChanged(ref _downloadedIndex, value);
+            if (value >= 0 && value < DownloadedVersions.Count)
+                DownloadedVerion = DownloadedVersions[value];
         }
+    }
+    public string Greeting => "Welcome to Cringe Launcher!";
+    public string DownloadButton {
+        get => _downloadButton;
+        set => this.RaiseAndSetIfChanged(ref _downloadButton, value);
+    }
 
-        public string Username 
-        { 
-            get => username;
-            set
-            {
-                this.RaiseAndSetIfChanged(ref username, value);
-                this.RaisePropertyChanged(nameof(IsStartButtonEnabled));
-            }
-        }
+    public string StartButton
+    {
+        get => _startButton;
+        set => this.RaiseAndSetIfChanged(ref _startButton, value);
+    }
 
-        public string ConsoleText
+    public string Username 
+    { 
+        get => _username;
+        set
         {
-            get 
-            {
-                if (consoleText.Length < UInt16.MaxValue)
-                    return consoleText.ToString();
-                else
-                    return consoleText.ToString(consoleText.Length - UInt16.MaxValue, UInt16.MaxValue);
-            }
-            set
-            {
-                consoleText.Clear();
-                consoleText.Append(value);
-                this.RaisePropertyChanged(nameof(ConsoleText));
-                ConsoleTextCaretIndex = int.MaxValue;
-            }
+            this.RaiseAndSetIfChanged(ref _username, value);
+            this.RaisePropertyChanged(nameof(IsStartButtonEnabled));
         }
+    }
 
-        public string StartButtonOutput
+    public string ConsoleText
+    {
+        get 
         {
-            get => startButtonOutput;
-            set => this.RaiseAndSetIfChanged(ref startButtonOutput, value);
+            if (_consoleText.Length < UInt16.MaxValue)
+                return _consoleText.ToString();
+            else
+                return _consoleText.ToString(_consoleText.Length - UInt16.MaxValue, UInt16.MaxValue);
         }
-
-        public string ArgumentsBox
+        set
         {
-            get => argumentsBox;
-            set => this.RaiseAndSetIfChanged(ref argumentsBox, value);
+            _consoleText.Clear();
+            _consoleText.Append(value);
+            this.RaisePropertyChanged(nameof(ConsoleText));
+            ConsoleTextCaretIndex = int.MaxValue;
         }
+    }
 
-        public string SettingsButton
-        {
-            get => settingsButton;
-            set => this.RaiseAndSetIfChanged(ref settingsButton, value);
-        }
+    public string StartButtonOutput
+    {
+        get => _startButtonOutput;
+        set => this.RaiseAndSetIfChanged(ref _startButtonOutput, value);
+    }
 
-        public bool IsNoGameRunning
-        {
-            get => isNoGameRunning;
-            set
-            {
-                this.RaiseAndSetIfChanged(ref isNoGameRunning, value);
-                this.RaisePropertyChanged(nameof(IsStartButtonEnabled));
-            }
-        }
+    public string ArgumentsBox
+    {
+        get => _argumentsBox;
+        set => this.RaiseAndSetIfChanged(ref _argumentsBox, value);
+    }
 
-        public bool IsStartButtonEnabled
-        {
-            get => IsNoGameRunning && !string.IsNullOrEmpty(Username);
-        }
+    public string SettingsButton
+    {
+        get => _settingsButton;
+        set => this.RaiseAndSetIfChanged(ref _settingsButton, value);
+    }
 
-        public bool IsUpdateAvailable
+    public bool IsNoGameRunning
+    {
+        get => _isNoGameRunning;
+        set
         {
-            get => isUpdateAvailable;
-            set => this.RaiseAndSetIfChanged(ref isUpdateAvailable, value);
+            this.RaiseAndSetIfChanged(ref _isNoGameRunning, value);
+            this.RaisePropertyChanged(nameof(IsStartButtonEnabled));
         }
+    }
 
-        public int ConsoleTextCaretIndex
-        {
-            get => int.MaxValue;
-            set => this.RaisePropertyChanged(nameof(ConsoleTextCaretIndex));
-        }
+    public bool IsStartButtonEnabled
+    {
+        get => IsNoGameRunning && !string.IsNullOrEmpty(Username);
+    }
 
-        public void OnClickCommand()
+    public bool IsUpdateAvailable
+    {
+        get => _isUpdateAvailable;
+        set => this.RaiseAndSetIfChanged(ref _isUpdateAvailable, value);
+    }
+
+    public int ConsoleTextCaretIndex
+    {
+        get => int.MaxValue;
+        set => this.RaisePropertyChanged(nameof(ConsoleTextCaretIndex));
+    }
+
+    public void OnClickCommand()
+    {
+        var versionsDownloader = new VersionsDownloader 
+        { 
+            DataContext = new VersionsDownloaderViewModel() 
+        };
+       
+        if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
         {
-            var versionsDownloader = new VersionsDownloader 
-            { 
-                DataContext = new VersionsDownloaderViewModel() 
-            };
-           
-            if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
-            {
-                //var versionsDownloaderTask =
-                versionsDownloader.Closed += updateAvailable;
-                versionsDownloader.ShowDialog(desktop.MainWindow);
-                //versionsDownloaderTask.Wait();              
-            }
+            versionsDownloader.Closed += updateAvailable;
+            versionsDownloader.ShowDialog(desktop.MainWindow);            
         }
+    }
 
-        public async void StartMinecraft()
+    public async void StartMinecraft()
+    {
+        Task.Run(async() =>
         {
-            Task.Run(async() =>
+            try
             {
-                try
+                _logger.Debug("Starting minecraft.");
+                if (DownloadedVerion is null)
                 {
-                    logger.Debug("Starting minecraft.");
-                    if (DownloadedVerion is null)
-                    {
-                        IsNoGameRunning = true;
-                        return;
-                    }
+                    IsNoGameRunning = true;
+                    return;
+                }
 
 
-                    int version = 0;
+                int version = 0;
 
-                    //var verionJsonFileStream = File.OpenRead(DownloadedVerion.path);
-                    using (StreamReader reader = new StreamReader(DownloadedVerion.path))
-                    {
-                        string json = reader.ReadToEnd();
+                using (StreamReader reader = new StreamReader(DownloadedVerion.path))
+                {
+                    string json = reader.ReadToEnd();
 
-                        var versionJson = JsonSerializer.Deserialize<Entity.Version.Version>(json);
+                    var versionJson = JsonSerializer.Deserialize<Entity.Version.Version>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
 
-                        if (Settings.checkGameAssets)
-                        {
-                            TaskStatus result;
+                    if (Settings.checkGameAssets)
+                    {
+                        TaskStatus result;
 
-                            if (versionJson.inheritsFrom is null)
-                                result = Downloader.StartDownload(value => StartButtonOutput = value, value => IsNoGameRunning = value, value => { }, value => { }, versionJson).Result;
-                            else
+                        if (versionJson.InheritsFrom is null)
+                            result = Downloader.StartDownload(value => StartButtonOutput = value, value => IsNoGameRunning = value, value => { }, value => { }, versionJson).Result;
+                        else
+                        {
+                            using (StreamReader inheritsFromReader = new StreamReader(Settings.MinecraftForlderPath + "versions/" + versionJson.InheritsFrom + "/" + versionJson.InheritsFrom + ".json"))
                             {
-                                using (StreamReader inheritsFromReader = new StreamReader(Settings.MinecraftForlderPath + "versions/" + versionJson.inheritsFrom + "/" + versionJson.inheritsFrom + ".json"))
-                                {
-                                    string jsonInheritsFrom = inheritsFromReader.ReadToEnd();
-                                    var inheritsFromJson = JsonSerializer.Deserialize<Entity.Version.Version>(jsonInheritsFrom);
+                                string jsonInheritsFrom = inheritsFromReader.ReadToEnd();
+                                var inheritsFromJson = JsonSerializer.Deserialize<Entity.Version.Version>(jsonInheritsFrom, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
 
-                                    result = Downloader.StartDownload(value => StartButtonOutput = value, value => IsNoGameRunning = value, value => { }, value => { }, inheritsFromJson).Result;
-                                }
+                                result = Downloader.StartDownload(value => StartButtonOutput = value, value => IsNoGameRunning = value, value => { }, value => { }, inheritsFromJson).Result;
                             }
+                        }
 
-                            if (result != TaskStatus.RanToCompletion)
-                            {
-                                IsNoGameRunning = true;
-                                return;
-                            }
+                        if (result != TaskStatus.RanToCompletion)
+                        {
+                            IsNoGameRunning = true;
+                            return;
                         }
+                    }
 
-                        string arguments = StartCommandBuilder.Build(versionJson, Username);
+                    string arguments = StartCommandBuilder.Build(versionJson, Username);
 
-                        if (!Settings.useCustomJava)
+                    if (!Settings.useCustomJava)
+                    {
+                        if (versionJson.JavaVersion != null)
                         {
-                            if (versionJson.javaVersion != null)
-                            {
-                                logger.Debug("Java version required: {0}", versionJson.javaVersion.majorVersion);
-                                version = versionJson.javaVersion.majorVersion;
-                            }
-                            else
+                            _logger.Debug("Java version required: {0}", versionJson.JavaVersion.MajorVersion);
+                            version = versionJson.JavaVersion.MajorVersion;
+                        }
+                        else
+                        {
+                            if (versionJson.InheritsFrom != null)
                             {
-                                if (versionJson.inheritsFrom != null)
+                                using (StreamReader inheritsFromReader = new StreamReader(Settings.MinecraftForlderPath + "versions/" + versionJson.InheritsFrom + "/" + versionJson.InheritsFrom + ".json"))
                                 {
-                                    using (StreamReader inheritsFromReader = new StreamReader(Settings.MinecraftForlderPath + "versions/" + versionJson.inheritsFrom + "/" + versionJson.inheritsFrom + ".json"))
+                                    string jsonInheritsFrom = inheritsFromReader.ReadToEnd();
+                                    var inheritsFromJson = JsonSerializer.Deserialize<Entity.Version.Version>(jsonInheritsFrom, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
+                                    if (inheritsFromJson.JavaVersion != null)
                                     {
-                                        string jsonInheritsFrom = inheritsFromReader.ReadToEnd();
-                                        var inheritsFromJson = JsonSerializer.Deserialize<Entity.Version.Version>(jsonInheritsFrom);
-                                        if (inheritsFromJson.javaVersion != null)
-                                        {
-                                            logger.Debug("Java version required: {0}", inheritsFromJson.javaVersion.majorVersion);
-                                            version = inheritsFromJson.javaVersion.majorVersion;
-                                        }
+                                        _logger.Debug("Java version required: {0}", inheritsFromJson.JavaVersion.MajorVersion);
+                                        version = inheritsFromJson.JavaVersion.MajorVersion;
                                     }
                                 }
                             }
                         }
-
-                        ConsoleText += arguments;
-                        ArgumentsBox = arguments;
                     }
 
-                    if (DownloadedVerion is null)
-                        return;
+                    ConsoleText += arguments;
+                    ArgumentsBox = arguments;
+                }
 
-                    string javaPath = Settings.JavaPath;
+                if (DownloadedVerion is null)
+                    return;
 
-                    if (!Settings.useCustomJava)
-                    {
-                        javaPath = Settings.MinecraftForlderPath + "javaruntime/" + version + "/bin/java";
-                        if (OperatingSystem.IsWindows())
-                            javaPath += ".exe";
-                    }
+                string javaPath = Settings.JavaPath;
 
-                    logger.Debug("Java version path: {0}", javaPath);
-                    logger.Debug("Minecraft arguments: {0}", ArgumentsBox);
+                if (!Settings.useCustomJava)
+                {
+                    javaPath = Settings.MinecraftForlderPath + "javaruntime/" + version + "/bin/java";
+                    if (OperatingSystem.IsWindows())
+                        javaPath += ".exe";
+                }
 
-                    ProcessStartInfo proc;
-                    proc = new ProcessStartInfo
-                    {
-                        UseShellExecute = false,
-                        RedirectStandardOutput = true,
-                        RedirectStandardError = true,
-                        WindowStyle = ProcessWindowStyle.Hidden,
-                        CreateNoWindow = true,
-                        FileName = System.IO.Path.Combine(Settings.MinecraftForlderPath, javaPath),
-                        StandardErrorEncoding = Encoding.UTF8,
-                        WorkingDirectory = Settings.MinecraftForlderPath,
-                        Arguments = ArgumentsBox
-                    };
+                _logger.Debug("Java version path: {0}", javaPath);
+                _logger.Debug("Minecraft arguments: {0}", ArgumentsBox);
 
+                ProcessStartInfo proc;
+                proc = new ProcessStartInfo
+                {
+                    UseShellExecute = false,
+                    RedirectStandardOutput = true,
+                    RedirectStandardError = true,
+                    WindowStyle = ProcessWindowStyle.Hidden,
+                    CreateNoWindow = true,
+                    FileName = System.IO.Path.Combine(Settings.MinecraftForlderPath, javaPath),
+                    StandardErrorEncoding = Encoding.UTF8,
+                    WorkingDirectory = Settings.MinecraftForlderPath,
+                    Arguments = ArgumentsBox
+                };
 
-                    Process minecraft = new Process();
 
-                    minecraft.StartInfo = proc;
+                Process minecraft = new Process();
 
-                    Task.Run(() =>
-                    {
-                        try
-                        {
-                            logger.Debug("Starting java process.");
+                minecraft.StartInfo = proc;
 
-                            minecraft.OutputDataReceived += OutputHandler;
-                            minecraft.ErrorDataReceived += OutputHandler;
+                Task.Run(() =>
+                {
+                    try
+                    {
+                        _logger.Debug("Starting java process.");
 
-                            //* Start process and handlers            
-                            //minecraft.WaitForExit();
+                        minecraft.OutputDataReceived += OutputHandler;
+                        minecraft.ErrorDataReceived += OutputHandler;
 
-                            minecraft.EnableRaisingEvents = true;
+                        //* Start process and handlers            
+                        //minecraft.WaitForExit();
 
-                            IsNoGameRunning = false;
-                            minecraft.Start();
+                        minecraft.EnableRaisingEvents = true;
 
-                            minecraft.Exited += ProcessExited;
+                        IsNoGameRunning = false;
+                        minecraft.Start();
 
-                            minecraft.BeginOutputReadLine();
-                            minecraft.BeginErrorReadLine();
+                        minecraft.Exited += ProcessExited;
 
-                            if (!Settings.gameLogToLauncher)
-                            {
-                                minecraft.OutputDataReceived -= OutputHandler;
-                                minecraft.CancelOutputRead();
-                            }
+                        minecraft.BeginOutputReadLine();
+                        minecraft.BeginErrorReadLine();
 
-                            return Task.CompletedTask;
-                        }
-                        catch (Exception ex)
+                        if (!Settings.gameLogToLauncher)
                         {
-                            OpenErrorWindow(ex);
-                            return Task.CompletedTask;
+                            minecraft.OutputDataReceived -= OutputHandler;
+                            minecraft.CancelOutputRead();
                         }
-                    });
-                    logger.Debug("Updating Settings");
-                    Settings.Username = username;
-                    Settings.lastChosenVersion = DownloadedVerion.version;
-                    Settings.SaveSettings();
 
-                }
-                catch (Exception ex)
-                {
-                    OpenErrorWindow(ex);
-                }
-            });
-            
-        }
+                        return Task.CompletedTask;
+                    }
+                    catch (Exception ex)
+                    {
+                        OpenErrorWindow(ex);
+                        return Task.CompletedTask;
+                    }
+                });
+                _logger.Debug("Updating Settings");
+                Settings.Username = _username;
+                Settings.lastChosenVersion = DownloadedVerion.version;
+                Settings.SaveSettings();
 
-        void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
-        {
-            //Todo create multiple TextBlocks if char limit
-            if (!consoleOutputTimer.Enabled)
+            }
+            catch (Exception ex)
             {
-                consoleOutputTimer.Stop();
-                consoleOutputTimer.Start();
+                OpenErrorWindow(ex);
             }
-            consoleText.Append(outLine.Data + "\n");          
-        }
+        });
+        
+    }
 
-        void LogHandler(object sendingProcess, EventArgs args)
+    void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
+    {
+        //Todo create multiple TextBlocks if char limit
+        if (!_consoleOutputTimer.Enabled)
         {
-            if (!consoleOutputTimer.Enabled)
-            {
-                consoleOutputTimer.Stop();
-                consoleOutputTimer.Start();
-            }
-            consoleText.Append(((MyEventArgs)args).Data);
+            _consoleOutputTimer.Stop();
+            _consoleOutputTimer.Start();
         }
+        _consoleText.Append(outLine.Data + "\n");          
+    }
 
-        void UpdateConsoleOutput(Object source, ElapsedEventArgs e)
+    void LogHandler(object sendingProcess, EventArgs args)
+    {
+        if (!_consoleOutputTimer.Enabled)
         {
-            this.RaisePropertyChanged(nameof(ConsoleText));
-
-            ScrollToEnd("ConsoleScroll");
+            _consoleOutputTimer.Stop();
+            _consoleOutputTimer.Start();
         }
+        _consoleText.Append(((MyEventArgs)args).Data);
+    }
+
+    void UpdateConsoleOutput(Object source, ElapsedEventArgs e)
+    {
+        this.RaisePropertyChanged(nameof(ConsoleText));
+
+        ScrollToEnd("ConsoleScroll");
+    }
 
-        void ScrollToEnd(string ScrollName)
+    void ScrollToEnd(string ScrollName)
+    {
+        if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
         {
-            if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+            Dispatcher.UIThread.InvokeAsync(() =>
             {
-                Dispatcher.UIThread.InvokeAsync(() =>
-                {
-                    var scroll = desktop.MainWindow.GetControl<ScrollViewer>("ConsoleScroll");
-                    scroll.ScrollToEnd();
-                });
+                var scroll = desktop.MainWindow.GetControl<ScrollViewer>("ConsoleScroll");
+                scroll.ScrollToEnd();
+            });
 
-            }
         }
+    }
 
-        void ProcessExited(object sendingProcess, EventArgs e)
-        {
-            ((Process)sendingProcess).Exited -= ProcessExited;
+    void ProcessExited(object sendingProcess, EventArgs e)
+    {
+        ((Process)sendingProcess).Exited -= ProcessExited;
 
-            logger.Debug("Exit code: {0}", ((Process)sendingProcess).ExitCode);
+        _logger.Debug("Exit code: {0}", ((Process)sendingProcess).ExitCode);
 
-            StartButtonOutput = "";
-            IsNoGameRunning = true;
-            if (((Process)sendingProcess).ExitCode != 0)
-                OpenErrorWindow(new Exception("Minecraft process exited with an error.\nCheck log in game folder or in launcher console."));
+        StartButtonOutput = "";
+        IsNoGameRunning = true;
+        if (((Process)sendingProcess).ExitCode != 0)
+            OpenErrorWindow(new Exception("Minecraft process exited with an error.\nCheck log in game folder or in launcher console."));
+
+        ((Process)sendingProcess).Dispose();         
+    }
 
-            ((Process)sendingProcess).Dispose();         
-        }
 
 
+    public void updateAvailable()
+    {
+        if (DownloadedVersions is null)
+            DownloadedVersions = new();
 
-        public void updateAvailable()
+        DownloadedVersions.Clear();
+        DirectoryInfo versions = new( Settings.MinecraftForlderPath + "versions");
+        try
         {
-            if (DownloadedVersions is null)
-                DownloadedVersions = new();
+            var dirs = versions.GetDirectories("*", SearchOption.TopDirectoryOnly);
+            LauncherProfiles profiles = new LauncherProfiles();
+            profiles.SelectedProfile = "NotImplemented";
 
-            DownloadedVersions.Clear();
-            DirectoryInfo versions = new( Settings.MinecraftForlderPath + "versions");
-            try
+            foreach (var dir in dirs)
             {
-                var dirs = versions.GetDirectories("*", SearchOption.TopDirectoryOnly);
-                LauncherProfiles profiles = new LauncherProfiles();
-                profiles.selectedProfile = "NotImplemented";
-
-                foreach (var dir in dirs)
+                _logger.Debug("Checking folder {0}", dir.Name);
+                string checkedPath;
+                if (File.Exists(checkedPath = dir.FullName + "/" + dir.Name + ".json"))
                 {
-                    logger.Debug("Checking folder {0}", dir.Name);
-                    string checkedPath;
-                    if (File.Exists(checkedPath = dir.FullName + "/" + dir.Name + ".json"))
-                    {
-                        logger.Debug("Found version {0}",dir.Name);
-                        DownloadedVersions.Add(new DownloadedVerion() { path = checkedPath, version = dir.Name });
-                        profiles.profiles.Add($"Version {dir.Name}", new Profile() { name = dir.Name, lastVersionId = dir.Name, launcherVisibilityOnGameClose = "keep the launcher open" });
-                    }
-
+                    _logger.Debug("Found version {0}",dir.Name);
+                    DownloadedVersions.Add(new DownloadedVersion() { path = checkedPath, version = dir.Name });
+                    profiles.Profiles.Add($"Version {dir.Name}", new Profile() { Name = dir.Name, LastVersionId = dir.Name, LauncherVisibilityOnGameClose = "keep the launcher open" });
                 }
 
-                if (Settings.lastChosenVersion != null)
+            }
+
+            if (Settings.lastChosenVersion != null)
+            {
+                DownloadedIndex = 0;
+                for (int i = 0; i < DownloadedVersions.Count; i++)
                 {
-                    DownloadedIndex = 0;
-                    for (int i = 0; i < DownloadedVersions.Count; i++)
+                    if (DownloadedVersions[i].version == Settings.lastChosenVersion)
                     {
-                        if (DownloadedVersions[i].version == Settings.lastChosenVersion)
-                        {
-                            DownloadedIndex = i;
-                            break;
-                        }
+                        DownloadedIndex = i;
+                        break;
                     }
-                    
                 }
-                if (!File.Exists(Settings.MinecraftForlderPath + "launcher_profiles.json"))
-                {
-                    var file = File.Create(Settings.MinecraftForlderPath + "launcher_profiles.json");
-                    file.Close();
-                    file.Dispose();
-                }
-                var lpString = JsonSerializer.Serialize(profiles);
-                File.WriteAllText(Settings.MinecraftForlderPath + "launcher_profiles.json", lpString);
+                
             }
-            catch (DirectoryNotFoundException ex)
+            if (!File.Exists(Settings.MinecraftForlderPath + "launcher_profiles.json"))
             {
-                Directory.CreateDirectory(Settings.MinecraftForlderPath + "versions");
-                return;
+                var file = File.Create(Settings.MinecraftForlderPath + "launcher_profiles.json");
+                file.Close();
+                file.Dispose();
             }
-            
+            var lpString = JsonSerializer.Serialize(profiles, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
+            File.WriteAllText(Settings.MinecraftForlderPath + "launcher_profiles.json", lpString);
+        }
+        catch (DirectoryNotFoundException ex)
+        {
+            Directory.CreateDirectory(Settings.MinecraftForlderPath + "versions");
+            return;
         }
+        
+    }
 
-        public void updateAvailable(object sendingObject, EventArgs e)
+    public void updateAvailable(object sendingObject, EventArgs e)
+    {
+        try
         {
-            try
-            {
-                updateAvailable();
-            }
-            catch (Exception ex)
-            {
-                OpenErrorWindow(ex);                
-            }
+            updateAvailable();
+        }
+        catch (Exception ex)
+        {
+            OpenErrorWindow(ex);                
+        }
 
-            switch (sendingObject)
-            {
-                case VersionsDownloader:
-                    ((VersionsDownloader)sendingObject).Closed -= updateAvailable;
-                    break;
+        switch (sendingObject)
+        {
+            case VersionsDownloader:
+                ((VersionsDownloader)sendingObject).Closed -= updateAvailable;
+                break;
 
-                case SettingsWindow:
-                    ((SettingsWindow)sendingObject).Closed -= updateAvailable;
-                    break;
-            }
-    
+            case SettingsWindow:
+                ((SettingsWindow)sendingObject).Closed -= updateAvailable;
+                break;
+        }
+
+    }
+
+    public void OpenSettings()
+    {
+        var settingsWindow = new SettingsWindow { DataContext = new SettingsWindowViewModel() };
+
+        if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+        {
+            settingsWindow.Closed += updateAvailable;
+            settingsWindow.ShowDialog(desktop.MainWindow);
         }
+    }
+
+    public void DownloadUpdate()
+    {
+        _logger.Debug("Started updater.exe");
+        Process updater = new Process();
+        updater.StartInfo.FileName = "Updater";
+        if (OperatingSystem.IsWindows())
+            updater.StartInfo.FileName += ".exe";
 
-        public void OpenSettings()
+        if (!File.Exists(updater.StartInfo.FileName))
+            UpdateUpdater();
+
+        if (!File.Exists(updater.StartInfo.FileName))
         {
-            var settingsWindow = new SettingsWindow { DataContext = new SettingsWindowViewModel() };
+            updater.Start();
 
             if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
             {
-                settingsWindow.Closed += updateAvailable;
-                settingsWindow.ShowDialog(desktop.MainWindow);
+                desktop.MainWindow.Close();
             }
         }
+        else
+            OpenErrorWindow(new FileNotFoundException($"File {updater.StartInfo.FileName} not found!"));
+    }
 
-        public void DownloadUpdate()
+    private void UpdateUpdater()
+    {
+        try
         {
-            logger.Debug("Started updater.exe");
-            Process updater = new Process();
-            updater.StartInfo.FileName = "Updater";
+            string fileName = "Updater";
             if (OperatingSystem.IsWindows())
-                updater.StartInfo.FileName += ".exe";
-
-            if (!File.Exists(updater.StartInfo.FileName))
-                UpdateUpdater();
-
-            if (!File.Exists(updater.StartInfo.FileName))
+                fileName += ".exe";
+            if (File.Exists(fileName))
             {
-                updater.Start();
+                FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(fileName);
+                LatestLauncherVersion latestLauncherVersion = Downloader.DownloadAndDeserializeJsonData<LatestLauncherVersion>("https://files.veloe.link/launcher/update/versions.json");
 
-                if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+                if (OperatingSystem.IsLinux())
                 {
-                    desktop.MainWindow.Close();
+                    _logger.Information("Manual updates only.");
+                    return;
                 }
-            }
-            else
-                OpenErrorWindow(new FileNotFoundException($"File {updater.StartInfo.FileName} not found!"));
-        }
 
-        private void UpdateUpdater()
-        {
-            try
-            {
-                string fileName = "Updater";
-                if (OperatingSystem.IsWindows())
-                    fileName += ".exe";
-                if (File.Exists(fileName))
+                if (latestLauncherVersion != null)
                 {
-                    FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(fileName);
-                    LatestLauncherVersion latestLauncherVersion = Downloader.DownloadAndDeserializeJsonData<LatestLauncherVersion>("https://files.veloe.link/launcher/update/versions.json");
+                    _logger.Information("Latest updater version on server: {0}", latestLauncherVersion.Updater);
+                    _logger.Information("Updater version: {0}", fileVersionInfo.FileVersion);
 
-                    if (OperatingSystem.IsLinux())
+                    if (!(new Version(latestLauncherVersion.Updater) > new Version(fileVersionInfo.FileVersion)))
                     {
-                        logger.Information("Manual updates only.");
+                        _logger.Information($"No update for \"{fileName}\" required.");
                         return;
                     }
-
-                    if (latestLauncherVersion != null)
-                    {
-                        logger.Information("Latest updater version on server: {0}", latestLauncherVersion.updater);
-                        logger.Information("Updater version: {0}", fileVersionInfo.FileVersion);
-
-                        if (!(new Version(latestLauncherVersion.updater) > new Version(fileVersionInfo.FileVersion)))
-                        {
-                            logger.Information($"No update for \"{fileName}\" required.");
-                            return;
-                        }
-                    }
                 }
-                               
-                WebClient webClient = new WebClient();
-                try
-                {
-                    logger.Information("Downloading updater.zip");
-                    string url = String.Empty;
-
-                    if (OperatingSystem.IsWindows())
-                        url = "https://files.veloe.link/launcher/update/updater.zip";
+            }
+                           
+            WebClient webClient = new WebClient();
+            try
+            {
+                _logger.Information("Downloading updater.zip");
+                string url = String.Empty;
 
-                    if (OperatingSystem.IsLinux())
-                        url = "https://files.veloe.link/launcher/update/updater_linux-x64.zip";
+                if (OperatingSystem.IsWindows())
+                    url = "https://files.veloe.link/launcher/update/updater.zip";
 
-                    if (url == String.Empty)
-                        return;
+                if (OperatingSystem.IsLinux())
+                    url = "https://files.veloe.link/launcher/update/updater_linux-x64.zip";
 
-                    webClient.DownloadFile(new System.Uri(url), "updater.zip");
-                }
-                catch (Exception ex)
-                {
-                    logger.Error("Error occured on getting updater.zip from the server.");
-                    throw;
-                }
-                webClient.Dispose();
-                logger.Information("Unpacking updater.zip");
-                ZipFile.ExtractToDirectory($"updater.zip", Directory.GetCurrentDirectory(), true);
+                if (url == String.Empty)
+                    return;
 
-                logger.Information("Deleting updater.zip");
-                File.Delete($"updater.zip");
-                
+                webClient.DownloadFile(new System.Uri(url), "updater.zip");
             }
             catch (Exception ex)
             {
-                OpenErrorWindow(ex);
+                _logger.Error("Error occured on getting updater.zip from the server.");
+                throw;
             }
+            webClient.Dispose();
+            _logger.Information("Unpacking updater.zip");
+            ZipFile.ExtractToDirectory($"updater.zip", Directory.GetCurrentDirectory(), true);
 
+            _logger.Information("Deleting updater.zip");
+            File.Delete($"updater.zip");
+            
         }
-
-        private Panel CreateServerPanel(string name)
+        catch (Exception ex)
         {
-            ServerPanelModel serverPanelModel = new() { Name = name , Status = "Wait for update...", Tip = "No players.", Players = string.Empty};
-
-            Panel panel = new Panel() 
-            { 
-                VerticalAlignment = Avalonia.Layout.VerticalAlignment.Top, 
-                HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Stretch, 
-                Height = 75, 
-                Width = 150, 
-                Margin = Avalonia.Thickness.Parse("0 0 10 10")
-            };
-
-            panel.Children.Add(new Border() 
-            { 
-                Background = Brushes.Black, 
-                Opacity = 0.2, 
-                CornerRadius = Avalonia.CornerRadius.Parse("15") 
-            });
+            OpenErrorWindow(ex);
+        }
 
-            var tip = new ToolTip()
-            {
-                Content = new TextBlock() {TextWrapping = TextWrapping.Wrap, [!TextBlock.TextProperty] = new Binding { Source = serverPanelModel,Path = nameof(serverPanelModel.Tip) } }
-            };
+    }
 
-            ToolTip.SetTip(panel, tip);
+    private Panel CreateServerPanel(string name)
+    {
+        ServerPanelModel serverPanelModel = new() { Name = name , Status = "Wait for update...", Tip = "No players.", Players = string.Empty};
 
-            StackPanel textPanel = new() { VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center };
+        Panel panel = new Panel() 
+        { 
+            VerticalAlignment = Avalonia.Layout.VerticalAlignment.Top, 
+            HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Stretch, 
+            Height = 75, 
+            Width = 150, 
+            Margin = Avalonia.Thickness.Parse("0 0 10 10")
+        };
+
+        panel.Children.Add(new Border() 
+        { 
+            Background = Brushes.Black, 
+            Opacity = 0.2, 
+            CornerRadius = Avalonia.CornerRadius.Parse("15") 
+        });
 
-            textPanel.Children.Add(new TextBlock() { VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center, [!TextBlock.TextProperty] = new Binding { Source = serverPanelModel, Path = nameof(serverPanelModel.Status) } });
-            textPanel.Children.Add(new TextBlock() { FontSize = 20, VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center, [!TextBlock.TextProperty] = new Binding { Source = serverPanelModel, Path = nameof(serverPanelModel.Players) } });
-            
-            panel.Children.Add(textPanel);
+        var tip = new ToolTip()
+        {
+            Content = new TextBlock() {TextWrapping = TextWrapping.Wrap, [!TextBlock.TextProperty] = new Binding { Source = serverPanelModel,Path = nameof(serverPanelModel.Tip) } }
+        };
 
-            System.Timers.Timer timeoutTimer = new System.Timers.Timer(30000);
+        ToolTip.SetTip(panel, tip);
 
-            timeoutTimer.Elapsed += (Object source, ElapsedEventArgs e) => 
-            { 
-                serverPanelModel.Status = $"{serverPanelModel.Name}: Offline"; 
-                serverPanelModel.Players = string.Empty; 
-            };
-            timeoutTimer.Start();
+        StackPanel textPanel = new() { VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center };
 
-            connection.On<string>($"Update{serverPanelModel.Name}", (message) =>
-            {
-                McStatus status = JsonSerializer.Deserialize<McStatus>(message);
-                serverPanelModel.Status = $"{serverPanelModel.Name}: Online";
-                serverPanelModel.Players = $"{status.NumPlayers}/{status.MaxPlayers}";
-                serverPanelModel.Tip = String.Empty;
-                if (UInt16.Parse(status.NumPlayers) > 0)
-                    foreach (var player in status.Players)
-                    {
-                        serverPanelModel.Tip += player;
-                        serverPanelModel.Tip += "\n";
-                    }
-                else
-                    serverPanelModel.Tip = "No players.";
-                timeoutTimer.Stop();
-                timeoutTimer.Start();
-            });
+        textPanel.Children.Add(new TextBlock() { VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center, [!TextBlock.TextProperty] = new Binding { Source = serverPanelModel, Path = nameof(serverPanelModel.Status) } });
+        textPanel.Children.Add(new TextBlock() { FontSize = 20, VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center, [!TextBlock.TextProperty] = new Binding { Source = serverPanelModel, Path = nameof(serverPanelModel.Players) } });
+        
+        panel.Children.Add(textPanel);
 
-            return panel;
-        }
+        System.Timers.Timer timeoutTimer = new System.Timers.Timer(30000);
 
-        private void OpenErrorWindow(Exception ex)
-        {
-            var message = ex.Message;
-            var stackTrace = ex.StackTrace;
-            Settings.logger.Error(ex.Message);
-            Settings.logger.Error(ex.StackTrace);
-            Exception innerException = ex.InnerException;
-            while (innerException is not null)
-            {
-                message += "\n" + innerException.Message;
-                stackTrace += "\n" + innerException.StackTrace;
-                Settings.logger.Error(innerException.Message);
-                Settings.logger.Error(innerException.StackTrace);
-                innerException = innerException.InnerException;
-            }
+        timeoutTimer.Elapsed += (Object source, ElapsedEventArgs e) => 
+        { 
+            serverPanelModel.Status = $"{serverPanelModel.Name}: Offline"; 
+            serverPanelModel.Players = string.Empty; 
+        };
+        timeoutTimer.Start();
 
-            Dispatcher.UIThread.InvokeAsync(() =>
-            {
-                if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+        _connection.On<string>($"Update{serverPanelModel.Name}", (message) =>
+        {
+            McStatus status = JsonSerializer.Deserialize<McStatus>(message, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
+            serverPanelModel.Status = $"{serverPanelModel.Name}: Online";
+            serverPanelModel.Players = $"{status.NumPlayers}/{status.MaxPlayers}";
+            serverPanelModel.Tip = String.Empty;
+            if (UInt16.Parse(status.NumPlayers) > 0)
+                foreach (var player in status.Players)
                 {
-                    var ErrorMessageViewModel = new ErrorWindowViewModel(message, stackTrace);
-                    var ErrorMessage = new ErrorWindow()
-                    {
-                        DataContext = ErrorMessageViewModel
-                    };
-                    ErrorMessage.ShowDialog(desktop.MainWindow);
+                    serverPanelModel.Tip += player;
+                    serverPanelModel.Tip += "\n";
                 }
-            });
-        }
-    }
-
-    public class LatestLauncherVersion
-    {
-        public string latest { get; set; }
-        public string updater { get; set; }
-        public string url { get; set; }
-    }
-
-    public class DownloadedVerion
-    {
-        public string path;
-        public string version;
+            else
+                serverPanelModel.Tip = "No players.";
+            timeoutTimer.Stop();
+            timeoutTimer.Start();
+        });
 
-        public override string ToString()
-        {
-            return version;
-        }
+        return panel;
     }
 
-    public class ServerPanelModel: ReactiveValidationObject
+    private void OpenErrorWindow(Exception ex)
     {
-        private string _name;
-        private string _status;
-        private string _tip;
-        private string _players;
-
-        public string Name
-        { 
-            get => _name;
-            set => this.RaiseAndSetIfChanged(ref _name, value);            
-        }
-
-        public string Status
-        {
-            get => _status;
-            set => this.RaiseAndSetIfChanged(ref _status, value);
-        }
-
-        public string Tip
+        var message = ex.Message;
+        var stackTrace = ex.StackTrace;
+        Settings.logger.Error(ex.Message);
+        Settings.logger.Error(ex.StackTrace);
+        Exception innerException = ex.InnerException;
+        while (innerException is not null)
         {
-            get => _tip;
-            set => this.RaiseAndSetIfChanged(ref _tip, value);
+            message += "\n" + innerException.Message;
+            stackTrace += "\n" + innerException.StackTrace;
+            Settings.logger.Error(innerException.Message);
+            Settings.logger.Error(innerException.StackTrace);
+            innerException = innerException.InnerException;
         }
 
-        public string Players
+        Dispatcher.UIThread.InvokeAsync(() =>
         {
-            get => _players;
-            set => this.RaiseAndSetIfChanged(ref _players, value);
-        }
+            if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+            {
+                var ErrorMessageViewModel = new ErrorWindowViewModel(message, stackTrace);
+                var ErrorMessage = new ErrorWindow()
+                {
+                    DataContext = ErrorMessageViewModel
+                };
+                ErrorMessage.ShowDialog(desktop.MainWindow);
+            }
+        });
     }
-   
 }

+ 151 - 152
VeloeMinecraftLauncher/ViewModels/SettingsWindowViewModel.cs

@@ -9,189 +9,188 @@ using System.Threading.Tasks;
 using System.Collections.ObjectModel;
 using Serilog.Events;
 
-namespace VeloeMinecraftLauncher.ViewModels
+namespace VeloeMinecraftLauncher.ViewModels;
+
+public class SettingsWindowViewModel : ViewModelBase
 {
-    public class SettingsWindowViewModel : ViewModelBase
+    public SettingsWindowViewModel()
     {
-        public SettingsWindowViewModel()
-        {
-            LauncherVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
-
-            var logger = Settings.logger;
-
-            this.ValidationRule(
-            viewModel => viewModel.MaxRam,
-            value => { UInt32 result; bool resultb = UInt32.TryParse(value, out result); /*logger.Debug("Validator result: {0} {1}", value, resultb);*/ IsValid = resultb; return resultb; },
-            "Not a number.");
-
-            this.ValidationRule(
-            viewModel => viewModel.MaxLog,
-            value => { UInt32 result; bool resultb = UInt32.TryParse(value, out result); /*logger.Debug("Validator result: {0} {1}", value, resultb);*/ IsValid = resultb; return resultb; },
-            "Not a number.");
-       
-    }
-
-        private string launcherVersion;
-        private string minecraftFolderPath = Settings.MinecraftForlderPath;
-        private string javaPath = Settings.JavaPath;
-        private string maxRam = Settings.MaxRam.ToString();
-        private bool isValid;
-        private LogEventLevel fileLogEventLevel = Settings.fileLogEventLevel;
-        private LogEventLevel consoleLogEventLevel = Settings.consoleLogEventLevel;
-        private string maxLog = Settings.MaxLog.ToString();
-        
-        private ObservableCollection<LogEventLevel> logEventLevels = new() {LogEventLevel.Debug, LogEventLevel.Information, LogEventLevel.Warning, LogEventLevel.Error };
-
-        public bool UseCustomJava
-        {
-            get => Settings.useCustomJava;
-            set => this.RaiseAndSetIfChanged(ref Settings.useCustomJava, value);
-        }
+        LauncherVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
 
-        public bool SetMaxRam
-        {
-            get => Settings.setMaxRam;
-            set => this.RaiseAndSetIfChanged(ref Settings.setMaxRam, value);
-        }
+        var _logger = Settings.logger;
 
-        public bool SetMinecraftFolder
-        {
-            get => Settings.setPath;
-            set => this.RaiseAndSetIfChanged(ref Settings.setPath, value);
-        }
+        this.ValidationRule(
+        viewModel => viewModel.MaxRam,
+        value => { UInt32 result; bool resultb = UInt32.TryParse(value, out result); /*logger.Debug("Validator result: {0} {1}", value, resultb);*/ IsValid = resultb; return resultb; },
+        "Not a number.");
 
-        public bool CheckAssets
-        {
-            get => Settings.checkGameAssets;
-            set => this.RaiseAndSetIfChanged(ref Settings.checkGameAssets, value);
-        }
+        this.ValidationRule(
+        viewModel => viewModel.MaxLog,
+        value => { UInt32 result; bool resultb = UInt32.TryParse(value, out result); /*logger.Debug("Validator result: {0} {1}", value, resultb);*/ IsValid = resultb; return resultb; },
+        "Not a number.");
+   
+}
 
-        public string JavaPath
-        {
-            get => javaPath;
-            set => this.RaiseAndSetIfChanged(ref javaPath, value);
-        }
+    private string _launcherVersion;
+    private string _minecraftFolderPath = Settings.MinecraftForlderPath;
+    private string _javaPath = Settings.JavaPath;
+    private string _maxRam = Settings.MaxRam.ToString();
+    private bool _isValid;
+    private LogEventLevel _fileLogEventLevel = Settings.fileLogEventLevel;
+    private LogEventLevel _consoleLogEventLevel = Settings.consoleLogEventLevel;
+    private string _maxLog = Settings.MaxLog.ToString();
+    
+    private ObservableCollection<LogEventLevel> _logEventLevels = new() {LogEventLevel.Debug, LogEventLevel.Information, LogEventLevel.Warning, LogEventLevel.Error };
+
+    public bool UseCustomJava
+    {
+        get => Settings.useCustomJava;
+        set => this.RaiseAndSetIfChanged(ref Settings.useCustomJava, value);
+    }
 
-        public string MaxRam
-        {
-            get => maxRam.ToString();
-            set => this.RaiseAndSetIfChanged(ref maxRam, value);
-        }
+    public bool SetMaxRam
+    {
+        get => Settings.setMaxRam;
+        set => this.RaiseAndSetIfChanged(ref Settings.setMaxRam, value);
+    }
 
-        public bool IsValid
-        {
-            get => isValid;
-            set => this.RaiseAndSetIfChanged(ref isValid, value);
-        }
+    public bool SetMinecraftFolder
+    {
+        get => Settings.setPath;
+        set => this.RaiseAndSetIfChanged(ref Settings.setPath, value);
+    }
 
-        public string MinecraftFolderPath
-        {
-            get => minecraftFolderPath;
-            set => this.RaiseAndSetIfChanged(ref minecraftFolderPath, value);
-        }
+    public bool CheckAssets
+    {
+        get => Settings.checkGameAssets;
+        set => this.RaiseAndSetIfChanged(ref Settings.checkGameAssets, value);
+    }
 
-        public string LauncherVersion
-        {
-            get => launcherVersion;
-            set => this.RaiseAndSetIfChanged(ref launcherVersion, value);
-        }
+    public string JavaPath
+    {
+        get => _javaPath;
+        set => this.RaiseAndSetIfChanged(ref _javaPath, value);
+    }
 
-        public bool GameLogToLauncher
-        {
-            get => Settings.gameLogToLauncher;
-            set => this.RaiseAndSetIfChanged(ref Settings.gameLogToLauncher, value);
-        }
+    public string MaxRam
+    {
+        get => _maxRam;
+        set => this.RaiseAndSetIfChanged(ref _maxRam, value);
+    }
 
-        public ObservableCollection<LogEventLevel> LogEventLevels
-        {
-            get => logEventLevels;
-            set => this.RaiseAndSetIfChanged(ref logEventLevels, value);
-        }
+    public bool IsValid
+    {
+        get => _isValid;
+        set => this.RaiseAndSetIfChanged(ref _isValid, value);
+    }
 
-        public LogEventLevel FileLogEventLevel
-        {
-            get =>fileLogEventLevel;
-            set => this.RaiseAndSetIfChanged(ref fileLogEventLevel, value);
-        }
+    public string MinecraftFolderPath
+    {
+        get => _minecraftFolderPath;
+        set => this.RaiseAndSetIfChanged(ref _minecraftFolderPath, value);
+    }
 
-        public LogEventLevel ConsoleLogEventLevel
-        {
-            get => consoleLogEventLevel;
-            set => this.RaiseAndSetIfChanged(ref consoleLogEventLevel, value);
-        }
+    public string LauncherVersion
+    {
+        get => _launcherVersion;
+        set => this.RaiseAndSetIfChanged(ref _launcherVersion, value);
+    }
 
-        public bool SetMaxLog
-        {
-            get => Settings.setMaxLog;
-            set => this.RaiseAndSetIfChanged(ref Settings.setMaxLog, value);
-        }
+    public bool GameLogToLauncher
+    {
+        get => Settings.gameLogToLauncher;
+        set => this.RaiseAndSetIfChanged(ref Settings.gameLogToLauncher, value);
+    }
 
-        public string MaxLog
-        {
-            get => maxLog;
-            set => this.RaiseAndSetIfChanged(ref maxLog, value);
-        }
+    public ObservableCollection<LogEventLevel> LogEventLevels
+    {
+        get => _logEventLevels;
+        set => this.RaiseAndSetIfChanged(ref _logEventLevels, value);
+    }
 
-        public void SaveSettings()
-        {
-            Settings.JavaPath = javaPath;
-            Settings.MinecraftForlderPath = minecraftFolderPath;
-            Settings.MaxRam = UInt32.Parse(maxRam);
-            Settings.MaxLog = UInt32.Parse(maxLog);
-            Settings.consoleLogEventLevel = consoleLogEventLevel;
-            Settings.fileLogEventLevel = fileLogEventLevel;
-            Settings.SaveSettings();
-        }
-
-        public void OpenMinecraftPathDialog(Window window)
+    public LogEventLevel FileLogEventLevel
+    {
+        get =>_fileLogEventLevel;
+        set => this.RaiseAndSetIfChanged(ref _fileLogEventLevel, value);
+    }
+
+    public LogEventLevel ConsoleLogEventLevel
+    {
+        get => _consoleLogEventLevel;
+        set => this.RaiseAndSetIfChanged(ref _consoleLogEventLevel, value);
+    }
+
+    public bool SetMaxLog
+    {
+        get => Settings.setMaxLog;
+        set => this.RaiseAndSetIfChanged(ref Settings.setMaxLog, value);
+    }
+
+    public string MaxLog
+    {
+        get => _maxLog;
+        set => this.RaiseAndSetIfChanged(ref _maxLog, value);
+    }
+
+    public void SaveSettings()
+    {
+        Settings.JavaPath = _javaPath;
+        Settings.MinecraftForlderPath = _minecraftFolderPath;
+        Settings.MaxRam = UInt32.Parse(_maxRam);
+        Settings.MaxLog = UInt32.Parse(_maxLog);
+        Settings.consoleLogEventLevel = _consoleLogEventLevel;
+        Settings.fileLogEventLevel = _fileLogEventLevel;
+        Settings.SaveSettings();
+    }
+
+    public void OpenMinecraftPathDialog(Window window)
+    {
+        Task.Run(() =>
         {
-            Task.Run(() =>
-            {
-                OpenFolderDialog dialog = new OpenFolderDialog();
+            OpenFolderDialog dialog = new OpenFolderDialog();
 
-                var initPath = String.Empty;
+            var initPath = String.Empty;
 
-                if (Settings.MinecraftForlderPath is not null)
-                    if (Settings.MinecraftForlderPath != String.Empty)
-                        initPath = Path.GetFullPath(Settings.MinecraftForlderPath);
+            if (Settings.MinecraftForlderPath is not null)
+                if (Settings.MinecraftForlderPath != String.Empty)
+                    initPath = Path.GetFullPath(Settings.MinecraftForlderPath);
 
-                dialog.Directory = initPath;
+            dialog.Directory = initPath;
 
-                var result = dialog.ShowAsync(window).Result;
-                if (result is null)
-                    return;
+            var result = dialog.ShowAsync(window).Result;
+            if (result is null)
+                return;
 
-                if (result == String.Empty)
-                    return;
+            if (result == String.Empty)
+                return;
 
-                MinecraftFolderPath = result;
-            });
-        }
+            MinecraftFolderPath = result;
+        });
+    }
 
-        public void OpenJavaPathDialog(Window window)
+    public void OpenJavaPathDialog(Window window)
+    {
+        Task.Run(() =>
         {
-            Task.Run(() =>
-            {
-                OpenFileDialog dialog = new OpenFileDialog();
+            OpenFileDialog dialog = new OpenFileDialog();
 
-                var initPath = String.Empty;
+            var initPath = String.Empty;
 
-                if (Settings.JavaPath is not null)
-                    if (Settings.JavaPath != String.Empty)
-                        initPath = Path.GetFullPath(Settings.JavaPath);
+            if (Settings.JavaPath is not null)
+                if (Settings.JavaPath != String.Empty)
+                    initPath = Path.GetFullPath(Settings.JavaPath);
 
-                dialog.AllowMultiple = false;
-                dialog.Directory = initPath;
+            dialog.AllowMultiple = false;
+            dialog.Directory = initPath;
 
-                var result = dialog.ShowAsync(window).Result;
-                if (result is null)
-                    return;
+            var result = dialog.ShowAsync(window).Result;
+            if (result is null)
+                return;
 
-                if (result[0] == String.Empty)
-                    return;
+            if (result[0] == String.Empty)
+                return;
 
-                JavaPath = result[0];
-            });
-        }
+            JavaPath = result[0];
+        });
     }
 }

+ 304 - 305
VeloeMinecraftLauncher/ViewModels/VersionsDownloaderViewModel.cs

@@ -14,73 +14,151 @@ using VeloeMinecraftLauncher.MinecraftLauncher;
 using VeloeMinecraftLauncher.Models.Entity;
 using VeloeMinecraftLauncher.Views;
 
-namespace VeloeMinecraftLauncher.ViewModels
+namespace VeloeMinecraftLauncher.ViewModels;
+
+public class VersionsDownloaderViewModel : ViewModelBase
 {
-    public class VersionsDownloaderViewModel : ViewModelBase
+    private string _startButton = "Download";
+    private bool _showOld = false;
+    private bool _showSnaps = false;
+    private bool _installFabric = false;
+    private bool _installForge = false;
+    private bool _installOptifine = false;
+    private bool _installForgeOptifine = false;
+    private bool _installFabricVisible = false;
+    private bool _installForgeVisible = false;
+    private bool _installOptifineVisible = false;
+    private bool _installForgeOptifineVisible = false;
+    private bool _downloadJava = false;
+    private bool _isControlsEnabled = true;
+    private int _progress = 0;
+    private string _downloadingFileName;
+
+    Serilog.ILogger _logger;
+
+    ObservableCollection<Entity.VersionManifest.Version> _filteredVersions;
+    ObservableCollection<Modpack> _modpackVersions;
+    Entity.VersionManifest.Version _filteredVersion;
+    Modpack _selectedModpack;
+    VersionManifest _versionManifest;
+
+    public VersionsDownloaderViewModel()
     {
-        private string startButton = "Download";
-        private bool showOld = false;
-        private bool showSnaps = false;
-        private bool installFabric = false;
-        private bool installForge = false;
-        private bool installOptifine = false;
-        private bool installForgeOptifine = false;
-        private bool installFabricVisible = false;
-        private bool installForgeVisible = false;
-        private bool installOptifineVisible = false;
-        private bool installForgeOptifineVisible = false;
-        private bool downloadJava = false;
-        private bool isControlsEnabled = true;
-        private int progress = 0;
-        private string downloadingFileName;
-
-        Serilog.ILogger logger;
-
-        ObservableCollection<Entity.VersionManifest.Version> filteredVersions;
-        ObservableCollection<Modpack> modpackVersions;
-        Entity.VersionManifest.Version filteredVersion;
-        Modpack selectedModpack;
-        VersionManifest versionManifest;
-
-        public VersionsDownloaderViewModel()
+        try
         {
+            Task.Run(() =>
+            {
+                _logger = Settings.logger;
+                if (FilteredVersions is null)
+                {
+                    FilteredVersions = new();
+                }
+                if (ModpackVersions is null)
+                {
+                    ModpackVersions = new();
+                }
+                _logger.Debug("Getting versionManifest.json");
+                _versionManifest = Downloader.DownloadAndDeserializeJsonData<VersionManifest>("https://launchermeta.mojang.com/mc/game/version_manifest_v2.json");
+                ModpackVersions.AddRange(Downloader.DownloadAndDeserializeJsonData<List<Modpack>>("https://files.veloe.link/launcher/modpacks.json"));
+                _logger.Debug("Updating available versions to download.");
+                updateList();
+            });
+        }
+        catch (Exception ex)
+        {
+            var message = ex.Message;
+            var stackTrace = ex.StackTrace;
+            Settings.logger.Error(ex.Message);
+            Settings.logger.Error(ex.StackTrace);
+            Exception innerException = ex.InnerException;
+            while (innerException is not null)
+            {
+                message += "\n" + innerException.Message;
+                stackTrace += "\n" + innerException.StackTrace;
+                Settings.logger.Error(innerException.Message);
+                Settings.logger.Error(innerException.StackTrace);
+                innerException = innerException.InnerException;
+            }
+
+
+            if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+            {
+                var ErrorMessageViewModel = new ErrorWindowViewModel(message, stackTrace);
+                var ErrorMessage = new ErrorWindow()
+                {
+                    DataContext = ErrorMessageViewModel
+                };
+                //var versionsDownloaderTask =
+                ErrorMessage.ShowDialog(desktop.MainWindow);
+                //versionsDownloaderTask.Wait();              
+            }
+        }
+    }
+
+    public Entity.VersionManifest.Version FilteredVersion
+    {
+        get { return _filteredVersion; }
+        set { 
+            this.RaiseAndSetIfChanged(ref _filteredVersion, value);
+
+            InstallFabric = false;
+            InstallForge = false;
+            InstallOptifine = false;
+            InstallForgeOptifine = false;
             try
             {
-                Task.Run(() =>
+                using (var httpClient = new HttpClient())
                 {
-                    logger = Settings.logger;
-                    if (FilteredVersions is null)
+
+                    var response = httpClient.GetAsync(@$"https://files.veloe.link/launcher/forge/Forge{value.Id}/Forge{value.Id}.json").Result;
+
+                    if (response.IsSuccessStatusCode)
                     {
-                        FilteredVersions = new();
+                        InstallForgeVisible = true;
+                        response = httpClient.GetAsync(@$"https://files.veloe.link/launcher/forge/Forge{value.Id}/Optifine{value.Id}.jar").Result;
+                        if (response.IsSuccessStatusCode)
+                            InstallForgeOptifineVisible = true;
                     }
-                    if (ModpackVersions is null)
+                    else
                     {
-                        ModpackVersions = new();
+                        InstallForgeVisible = false;
+                        InstallForgeOptifineVisible = false;
                     }
-                    logger.Debug("Getting versionManifest.json");
-                    versionManifest = Downloader.DownloadAndDeserializeJsonData<VersionManifest>("https://launchermeta.mojang.com/mc/game/version_manifest_v2.json");
-                    ModpackVersions.AddRange(Downloader.DownloadAndDeserializeJsonData<List<Modpack>>("https://files.veloe.link/launcher/modpacks.json"));
-                    logger.Debug("Updating available versions to download.");
-                    updateList();
-                });
+
+                        response = httpClient.GetAsync(@$"https://files.veloe.link/launcher/fabric/Fabric{value.Id}/Fabric{value.Id}.json").Result;
+
+                    if (response.IsSuccessStatusCode)
+                        InstallFabricVisible = true;
+                    else
+                        _installFabricVisible = false;
+
+                    response = httpClient.GetAsync(@$"https://files.veloe.link/launcher/optifine/Optifine{value.Id}/Optifine{value.Id}.json").Result;
+
+                    if (response.IsSuccessStatusCode)
+                        InstallOptifineVisible = true;
+                    else
+                        InstallOptifineVisible = false;
+                
+
+                }
             }
             catch (Exception ex)
             {
                 var message = ex.Message;
                 var stackTrace = ex.StackTrace;
-                Settings.logger.Error(ex.Message);
-                Settings.logger.Error(ex.StackTrace);
+                _logger.Error(ex.Message);
+                _logger.Error(ex.StackTrace);
                 Exception innerException = ex.InnerException;
                 while (innerException is not null)
                 {
                     message += "\n" + innerException.Message;
                     stackTrace += "\n" + innerException.StackTrace;
-                    Settings.logger.Error(innerException.Message);
-                    Settings.logger.Error(innerException.StackTrace);
+                    _logger.Error(innerException.Message);
+                    _logger.Error(innerException.StackTrace);
                     innerException = innerException.InnerException;
                 }
 
-
+                Dispatcher.UIThread.InvokeAsync(async () => { 
                 if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
                 {
                     var ErrorMessageViewModel = new ErrorWindowViewModel(message, stackTrace);
@@ -88,311 +166,232 @@ namespace VeloeMinecraftLauncher.ViewModels
                     {
                         DataContext = ErrorMessageViewModel
                     };
-                    //var versionsDownloaderTask =
                     ErrorMessage.ShowDialog(desktop.MainWindow);
-                    //versionsDownloaderTask.Wait();              
                 }
+                });
             }
         }
+    }
 
-        public Entity.VersionManifest.Version FilteredVersion
-        {
-            get { return filteredVersion; }
-            set { 
-                this.RaiseAndSetIfChanged(ref filteredVersion, value);
-
-                InstallFabric = false;
-                InstallForge = false;
-                InstallOptifine = false;
-                InstallForgeOptifine = false;
-                try
-                {
-                    using (var httpClient = new HttpClient())
-                    {
-
-                        var response = httpClient.GetAsync(@$"https://files.veloe.link/launcher/forge/Forge{value.id}/Forge{value.id}.json").Result;
-
-                        if (response.IsSuccessStatusCode)
-                        {
-                            InstallForgeVisible = true;
-                            response = httpClient.GetAsync(@$"https://files.veloe.link/launcher/forge/Forge{value.id}/Optifine{value.id}.jar").Result;
-                            if (response.IsSuccessStatusCode)
-                                InstallForgeOptifineVisible = true;
-                        }
-                        else
-                        {
-                            InstallForgeVisible = false;
-                            InstallForgeOptifineVisible = false;
-                        }
-
-                            response = httpClient.GetAsync(@$"https://files.veloe.link/launcher/fabric/Fabric{value.id}/Fabric{value.id}.json").Result;
-
-                        if (response.IsSuccessStatusCode)
-                            InstallFabricVisible = true;
-                        else
-                            installFabricVisible = false;
-
-                        response = httpClient.GetAsync(@$"https://files.veloe.link/launcher/optifine/Optifine{value.id}/Optifine{value.id}.json").Result;
+    public Modpack SelectedModpack
+    {
+        get => _selectedModpack;
+        set => this.RaiseAndSetIfChanged(ref _selectedModpack, value);
+    }
 
-                        if (response.IsSuccessStatusCode)
-                            InstallOptifineVisible = true;
-                        else
-                            InstallOptifineVisible = false;
-                    
+    public ObservableCollection<Entity.VersionManifest.Version> FilteredVersions
+    {
+        get => _filteredVersions; 
+        set => this.RaiseAndSetIfChanged(ref _filteredVersions, value);
+    }
 
-                    }
-                }
-                catch (Exception ex)
-                {
-                    var message = ex.Message;
-                    var stackTrace = ex.StackTrace;
-                    logger.Error(ex.Message);
-                    logger.Error(ex.StackTrace);
-                    Exception innerException = ex.InnerException;
-                    while (innerException is not null)
-                    {
-                        message += "\n" + innerException.Message;
-                        stackTrace += "\n" + innerException.StackTrace;
-                        logger.Error(innerException.Message);
-                        logger.Error(innerException.StackTrace);
-                        innerException = innerException.InnerException;
-                    }
+    public ObservableCollection<Models.Entity.Modpack> ModpackVersions
+    {
+        get => _modpackVersions;
+        set => this.RaiseAndSetIfChanged(ref _modpackVersions, value);
+    }
 
-                    Dispatcher.UIThread.InvokeAsync(async () => { 
-                    if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
-                    {
-                        var ErrorMessageViewModel = new ErrorWindowViewModel(message, stackTrace);
-                        var ErrorMessage = new ErrorWindow()
-                        {
-                            DataContext = ErrorMessageViewModel
-                        };
-                        ErrorMessage.ShowDialog(desktop.MainWindow);
-                    }
-                    });
-                }
-            }
-        }
+    public string StartButton
+    {
+        get => _startButton; 
+        set => this.RaiseAndSetIfChanged(ref _startButton, value);
+    }
 
-        public Modpack SelectedModpack
-        {
-            get => selectedModpack;
-            set => this.RaiseAndSetIfChanged(ref selectedModpack, value);
+    public bool ShowOld
+    {
+        get => _showOld;
+        set { 
+            this.RaiseAndSetIfChanged(ref _showOld, value);
+            updateList();
         }
+    }
 
-        public ObservableCollection<Entity.VersionManifest.Version> FilteredVersions
-        {
-            get => filteredVersions; 
-            set => this.RaiseAndSetIfChanged(ref filteredVersions, value);
+    public bool ShowSnaps
+    {
+        get => _showSnaps;
+        set { 
+            this.RaiseAndSetIfChanged(ref _showSnaps, value);
+            updateList();
         }
+    }
 
-        public ObservableCollection<Models.Entity.Modpack> ModpackVersions
-        {
-            get => modpackVersions;
-            set => this.RaiseAndSetIfChanged(ref modpackVersions, value);
-        }
+    public int Progress
+    {
+        get => _progress;
+        set => this.RaiseAndSetIfChanged(ref _progress, value);
+    }
 
-        public string StartButton
-        {
-            get => startButton; 
-            set => this.RaiseAndSetIfChanged(ref startButton, value);
-        }
+    public string DownloadingFileName
+    {
+        get => _downloadingFileName;
+        set => this.RaiseAndSetIfChanged(ref _downloadingFileName, value);
+    }
 
-        public bool ShowOld
+    public bool InstallForge
+    {
+        get => _installForge;
+        set
         {
-            get => showOld;
-            set { 
-                this.RaiseAndSetIfChanged(ref showOld, value);
-                updateList();
-            }
-        }
+            this.RaiseAndSetIfChanged(ref _installForge, value);
 
-        public bool ShowSnaps
-        {
-            get => showSnaps;
-            set { 
-                this.RaiseAndSetIfChanged(ref showSnaps, value);
-                updateList();
-            }
+            if (InstallFabric)
+                InstallFabric = false;
         }
+    }
 
-        public int Progress
+    public bool InstallFabric
+    {
+        get => _installFabric;
+        set
         {
-            get => progress;
-            set => this.RaiseAndSetIfChanged(ref progress, value);
+            this.RaiseAndSetIfChanged(ref _installFabric, value);
+            if (InstallForge)
+                InstallForge = false;
         }
+    }
 
-        public string DownloadingFileName
-        {
-            get => downloadingFileName;
-            set => this.RaiseAndSetIfChanged(ref downloadingFileName, value);
-        }
+    public bool InstallOptifine
+    {
+        get => _installOptifine;
+        set => this.RaiseAndSetIfChanged(ref _installOptifine, value);
+    }
 
-        public bool InstallForge
+    public bool InstallForgeOptifine
+    {
+        get { return _installForgeOptifine; }
+        set
         {
-            get => installForge;
-            set
-            {
-                this.RaiseAndSetIfChanged(ref installForge, value);
-
-                if (InstallFabric)
-                    InstallFabric = false;
-            }
+            this.RaiseAndSetIfChanged(ref _installForgeOptifine, value);
+            if (value)
+                InstallForge = true;
         }
+    }
 
-        public bool InstallFabric
-        {
-            get => installFabric;
-            set
-            {
-                this.RaiseAndSetIfChanged(ref installFabric, value);
-                if (InstallForge)
-                    InstallForge = false;
-            }
-        }
+    public bool InstallForgeVisible
+    {
+        get => _installForgeVisible;
+        set => this.RaiseAndSetIfChanged(ref _installForgeVisible, value);
+    }
 
-        public bool InstallOptifine
-        {
-            get => installOptifine;
-            set => this.RaiseAndSetIfChanged(ref installOptifine, value);
-        }
+    public bool InstallFabricVisible
+    {
+        get => _installFabricVisible;
+        set => this.RaiseAndSetIfChanged(ref _installFabricVisible, value);
+    }
 
-        public bool InstallForgeOptifine
-        {
-            get { return installForgeOptifine; }
-            set
-            {
-                this.RaiseAndSetIfChanged(ref installForgeOptifine, value);
-                if (value)
-                    InstallForge = true;
-            }
-        }
+    public bool InstallOptifineVisible
+    {
+        get => _installOptifineVisible;
+        set => this.RaiseAndSetIfChanged(ref _installOptifineVisible, value);
+    }
 
-        public bool InstallForgeVisible
-        {
-            get => installForgeVisible;
-            set => this.RaiseAndSetIfChanged(ref installForgeVisible, value);
-        }
+    public bool InstallForgeOptifineVisible
+    {
+        get => _installForgeOptifineVisible;
+        set => this.RaiseAndSetIfChanged(ref _installForgeOptifineVisible, value);
+    }
 
-        public bool InstallFabricVisible
-        {
-            get => installFabricVisible;
-            set => this.RaiseAndSetIfChanged(ref installFabricVisible, value);
-        }
+    public bool DownloadJava
+    {
+        get => _downloadJava;
+        set => this.RaiseAndSetIfChanged(ref _downloadJava, value);
+    }
 
-        public bool InstallOptifineVisible
-        {
-            get => installOptifineVisible;
-            set => this.RaiseAndSetIfChanged(ref installOptifineVisible, value);
-        }
+    public bool IsControlsEnabled
+    {
+        get => _isControlsEnabled;
+        set => this.RaiseAndSetIfChanged(ref _isControlsEnabled, value);
+    }
 
-        public bool InstallForgeOptifineVisible
-        {
-            get => installForgeOptifineVisible;
-            set => this.RaiseAndSetIfChanged(ref installForgeOptifineVisible, value);
-        }
+    public async Task OnStartBunttonClick()
+    {
+        Task.Run(() => {
+
+            if (FilteredVersion is null)
+                return TaskStatus.Faulted;
+
+            _logger.Debug("Downloading {0}.json", FilteredVersion.Id);
+            DownloadingFileName = $"{FilteredVersion.Id}.json";
+            var versionJson = Downloader.DownloadAndDeserializeJsonData<Entity.Version.Version>(FilteredVersion.Url, Settings.MinecraftForlderPath + "versions/" + FilteredVersion.Id + "/", FilteredVersion.Id + ".json");
+
+            if (versionJson is not null)
+                Downloader.StartDownload(
+                  value => DownloadingFileName = value,
+                  value => IsControlsEnabled = value,
+                  value => value.DownloadProgressChanged += WebClient_DownloadProgressChanged,
+                  value => value.DownloadProgressChanged -= WebClient_DownloadProgressChanged,
+                  versionJson,
+                  DownloadJava,
+                  InstallForge,
+                  InstallOptifine,
+                  InstallForgeOptifine,
+                  InstallFabric);
+        return TaskStatus.RanToCompletion; });
+    }
+  
+    public async void OnStartModpackBunttonClick()
+    {
+        FilteredVersion = FilteredVersions.Where(x => x.Id == SelectedModpack.Version).FirstOrDefault();
+
+        Task.Run(() => Downloader.StartDownloadModpack(
+            value => DownloadingFileName = value,
+            value => IsControlsEnabled = value,
+            value => value.DownloadProgressChanged += WebClient_DownloadProgressChanged,
+            value => value.DownloadProgressChanged -= WebClient_DownloadProgressChanged,
+            FilteredVersions,
+            SelectedModpack,
+            DownloadJava,
+            InstallFabric = SelectedModpack.Fabric,
+            InstallForge = SelectedModpack.Forge,
+            InstallOptifine = SelectedModpack.Optifine,
+            InstallForgeOptifine = SelectedModpack.ForgeOptifine));
+    }
 
-        public bool DownloadJava
-        {
-            get => downloadJava;
-            set => this.RaiseAndSetIfChanged(ref downloadJava, value);
-        }
+    private void WebClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
+    {
+        Progress = e.ProgressPercentage;
+    }
 
-        public bool IsControlsEnabled
+    public void updateList()
+    {
+        try
         {
-            get => isControlsEnabled;
-            set => this.RaiseAndSetIfChanged(ref isControlsEnabled, value);
-        }
+            FilteredVersions.Clear();
 
-        public async Task OnStartBunttonClick()
-        {
-            Task.Run(() => {
-
-                if (FilteredVersion is null)
-                    return TaskStatus.Faulted;
-
-                logger.Debug("Downloading {0}.json", FilteredVersion.id);
-                DownloadingFileName = $"{FilteredVersion.id}.json";
-                var versionJson = Downloader.DownloadAndDeserializeJsonData<Entity.Version.Version>(FilteredVersion.url, Settings.MinecraftForlderPath + "versions/" + FilteredVersion.id + "/", FilteredVersion.id + ".json");
-
-                if (versionJson is not null)
-                    Downloader.StartDownload(
-                      value => DownloadingFileName = value,
-                      value => IsControlsEnabled = value,
-                      value => value.DownloadProgressChanged += WebClient_DownloadProgressChanged,
-                      value => value.DownloadProgressChanged -= WebClient_DownloadProgressChanged,
-                      versionJson,
-                      DownloadJava,
-                      InstallForge,
-                      InstallOptifine,
-                      InstallForgeOptifine,
-                      InstallFabric);
-            return TaskStatus.RanToCompletion; });
-        }
-      
-        public async void OnStartModpackBunttonClick()
-        {
-            FilteredVersion = FilteredVersions.Where(x => x.id == SelectedModpack.version).FirstOrDefault();
-
-            Task.Run(() => Downloader.StartDownloadModpack(
-                value => DownloadingFileName = value,
-                value => IsControlsEnabled = value,
-                value => value.DownloadProgressChanged += WebClient_DownloadProgressChanged,
-                value => value.DownloadProgressChanged -= WebClient_DownloadProgressChanged,
-                FilteredVersions,
-                SelectedModpack,
-                DownloadJava,
-                InstallFabric = SelectedModpack.fabric,
-                InstallForge = SelectedModpack.forge,
-                InstallOptifine = SelectedModpack.optifine,
-                InstallForgeOptifine = SelectedModpack.forgeoptifine));
-        }
+            if (_versionManifest.Versions is null)
+                return;
 
-        private void WebClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
-        {
-            Progress = e.ProgressPercentage;
+            foreach (var version in _versionManifest.Versions)
+            {
+                if (ShowSnaps && version.Type == "snapshot" || ShowOld && version.Type is ("old_alpha" or "old_beta") || version.Type == "release")
+                    FilteredVersions.Add(version);
+            }
         }
-
-        public void updateList()
+        catch (Exception ex)
         {
-            try
+            var message = ex.Message;
+            var stackTrace = ex.StackTrace;
+            _logger.Error(ex.Message);
+            _logger.Error(ex.StackTrace);
+            Exception innerException = ex.InnerException;
+            while (innerException is not null)
             {
-                FilteredVersions.Clear();
-
-                if (versionManifest.versions is null)
-                    return;
-
-                foreach (var version in versionManifest.versions)
-                {
-                    if (ShowSnaps && version.type == "snapshot" || ShowOld && version.type is ("old_alpha" or "old_beta") || version.type == "release")
-                        FilteredVersions.Add(version);
-                }
+                message += "\n" + innerException.Message;
+                stackTrace += "\n" + innerException.StackTrace;
+                _logger.Error(innerException.Message);
+                _logger.Error(innerException.StackTrace);
+                innerException = innerException.InnerException;
             }
-            catch (Exception ex)
-            {
-                var message = ex.Message;
-                var stackTrace = ex.StackTrace;
-                logger.Error(ex.Message);
-                logger.Error(ex.StackTrace);
-                Exception innerException = ex.InnerException;
-                while (innerException is not null)
-                {
-                    message += "\n" + innerException.Message;
-                    stackTrace += "\n" + innerException.StackTrace;
-                    logger.Error(innerException.Message);
-                    logger.Error(innerException.StackTrace);
-                    innerException = innerException.InnerException;
-                }
 
 
-                if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+            if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+            {
+                var ErrorMessageViewModel = new ErrorWindowViewModel(message, stackTrace);
+                var ErrorMessage = new ErrorWindow()
                 {
-                    var ErrorMessageViewModel = new ErrorWindowViewModel(message, stackTrace);
-                    var ErrorMessage = new ErrorWindow()
-                    {
-                        DataContext = ErrorMessageViewModel
-                    };
-                    ErrorMessage.ShowDialog(desktop.MainWindow);            
-                }
+                    DataContext = ErrorMessageViewModel
+                };
+                ErrorMessage.ShowDialog(desktop.MainWindow);            
             }
         }
     }

+ 17 - 18
VeloeMinecraftLauncher/ViewModels/ViewModelBase.cs

@@ -4,27 +4,26 @@ using ReactiveUI;
 using ReactiveUI.Validation.Helpers;
 using VeloeMinecraftLauncher.MinecraftLauncher;
 
-namespace VeloeMinecraftLauncher.ViewModels
+namespace VeloeMinecraftLauncher.ViewModels;
+
+public class ViewModelBase : ReactiveValidationObject
 {
-    public class ViewModelBase : ReactiveValidationObject
+    public ViewModelBase()
     {
-        public ViewModelBase()
-        {
-            this.RaisePropertyChanged(nameof(InterfaceColor));
-            this.RaisePropertyChanged(nameof(MaterialOpacity));
+        this.RaisePropertyChanged(nameof(InterfaceColor));
+        this.RaisePropertyChanged(nameof(MaterialOpacity));
 
-        }
-        public Color InterfaceColor
-        {
-            get => Color.Parse("Black");
-            set => this.RaisePropertyChanged(nameof(InterfaceColor));
-        }
+    }
+    public Color InterfaceColor
+    {
+        get => Color.Parse("Black");
+        set => this.RaisePropertyChanged(nameof(InterfaceColor));
+    }
 
-        public float MaterialOpacity
-        {
-            get => 0.5F;
-            set => this.RaisePropertyChanged(nameof(MaterialOpacity));
-        }
+    public float MaterialOpacity
+    {
+        get => 0.5F;
+        set => this.RaisePropertyChanged(nameof(MaterialOpacity));
     }
-   
 }
+

+ 4 - 8
VeloeMinecraftLauncher/Views/MainWindow.axaml

@@ -87,11 +87,10 @@
 							<TextBlock VerticalAlignment="Center">Console</TextBlock>
 						</TabItem.Header>
 						<Panel
-								VerticalAlignment="Stretch"
-								HorizontalAlignment="Stretch"								
-								Margin="0 0 0 5">
+							VerticalAlignment="Stretch"
+							HorizontalAlignment="Stretch"								
+							Margin="0 0 0 5">
 							<Border Background="Black" Opacity="0.2" CornerRadius="5" />
-
 							<ScrollViewer
 								Name="ConsoleScroll"
 								HorizontalScrollBarVisibility="Auto"
@@ -108,7 +107,6 @@
 								</TextBlock>
 							</ScrollViewer>
 						</Panel>
-
 					</TabItem>
 					<TabItem>
 						<TabItem.Header>
@@ -126,8 +124,7 @@
 								<StackPanel
 									Name="ChangeLogStackPanel"
 									Width="760"
-									Margin="5,5,5,5">
-									
+									Margin="5,5,5,5">								
 								</StackPanel>
 							</ScrollViewer>
 						</Panel>
@@ -137,7 +134,6 @@
 					Grid.Row="2"
 					Orientation="Horizontal"
 					HorizontalAlignment="Center">
-
 					<Button
 						Content="{Binding DownloadButton}"
 						Command="{Binding OnClickCommand}">

Some files were not shown because too many files changed in this diff