diff --git a/Mlaumcherb.Client.Avalonia/Config.cs b/Mlaumcherb.Client.Avalonia/Config.cs index 058dadd..9ac5748 100644 --- a/Mlaumcherb.Client.Avalonia/Config.cs +++ b/Mlaumcherb.Client.Avalonia/Config.cs @@ -1,10 +1,12 @@ using Mlaumcherb.Client.Avalonia.зримое; +using Mlaumcherb.Client.Avalonia.классы; using Mlaumcherb.Client.Avalonia.холопы; namespace Mlaumcherb.Client.Avalonia; public record Config { + [JsonRequired] public string config_version { get; set; } = "1.0.0"; public bool debug { get; set; } = #if DEBUG true; @@ -17,6 +19,12 @@ public record Config public bool download_java { get; set; } = true; public string? last_launched_version { get; set; } public int max_parallel_downloads { get; set; } = 16; + + + public VersionCatalogProps[] version_catalogs { get; set; } = + [ + new() { Name = "Mojang", Url = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json" } + ]; [JsonIgnore] static IOPath _filePath = "config.json"; diff --git a/Mlaumcherb.Client.Avalonia/GameVersion.cs b/Mlaumcherb.Client.Avalonia/GameVersion.cs index b257354..f1faacb 100644 --- a/Mlaumcherb.Client.Avalonia/GameVersion.cs +++ b/Mlaumcherb.Client.Avalonia/GameVersion.cs @@ -26,9 +26,9 @@ public class GameVersion private CancellationTokenSource? _gameCts; private CommandTask? _commandTask; - public static async Task> GetAllVersionsAsync() + public static Task> GetAllVersionsAsync() { - var propsSet = new HashSet(); + var propsList = new List(); // local descriptors Directory.Create(GetVersionsDir()); @@ -38,19 +38,12 @@ public class GameVersion var d = new GameVersionProps(name, null); if(!File.Exists(d.LocalDescriptorPath)) throw new Exception("Can't find version descriptor file in directory '{subdir}'. Rename it as directory name."); - propsSet.Add(d); - } - - // remote non-duplicating versions - foreach (var removeVersion in await Сеть.GetDownloadableVersions()) - { - propsSet.Add(removeVersion); + propsList.Add(d); } // reverse sort - var propsList = propsSet.ToList(); propsList.Sort((a, b) => b.CompareTo(a)); - return propsList; + return Task.FromResult(propsList); } public static async Task CreateFromPropsAsync(GameVersionProps props) @@ -60,7 +53,7 @@ public class GameVersion if (props.RemoteDescriptorUrl is null) throw new NullReferenceException("can't download game version descriptor '" + props.Name + "', because RemoteDescriptorUrl is null"); - await Сеть.DownloadFile(props.RemoteDescriptorUrl, props.LocalDescriptorPath); + await NetworkHelper.DownloadFile(props.RemoteDescriptorUrl, props.LocalDescriptorPath); } return new GameVersion(props); diff --git a/Mlaumcherb.Client.Avalonia/LauncherLogger.cs b/Mlaumcherb.Client.Avalonia/LauncherLogger.cs index e1028f1..fcd8c83 100644 --- a/Mlaumcherb.Client.Avalonia/LauncherLogger.cs +++ b/Mlaumcherb.Client.Avalonia/LauncherLogger.cs @@ -1,6 +1,4 @@ -using Mlaumcherb.Client.Avalonia.зримое; - -namespace Mlaumcherb.Client.Avalonia; +namespace Mlaumcherb.Client.Avalonia; public class LauncherLogger : ILogger { diff --git a/Mlaumcherb.Client.Avalonia/зримое/MainWindow.axaml b/Mlaumcherb.Client.Avalonia/зримое/MainWindow.axaml index 4cf3144..6d28e4c 100644 --- a/Mlaumcherb.Client.Avalonia/зримое/MainWindow.axaml +++ b/Mlaumcherb.Client.Avalonia/зримое/MainWindow.axaml @@ -7,53 +7,93 @@ Title="млаумчерб" Icon="avares://млаумчерб/капитал/кубе.ico" FontFamily="{StaticResource MonospaceFont}" FontSize="18" - MinWidth="1200" MinHeight="700" - Width="800" Height="500" + MinWidth="800" MinHeight="400" + Width="800" Height="600" WindowStartupLocation="CenterScreen"> - - * 30 + - * 300 * + + + + + + + + + + - + * 60 - - Версия: - - - Ник: - - - - Выделенная память: - - - Мб - - - - - - Проверять файлы игры - - - Скачивать джаву - - + + + Версия: + + + + + + Источник: + + + релиз + снапшот + старое + другое + + + Доступные версии: + + + + + + Ник: + + + + Выделенная память: + + + Мб + + + + + + Проверять файлы игры + + + Скачивать джаву + + +