forge support

This commit is contained in:
2024-12-27 22:12:20 +05:00
parent cb85b132c3
commit 631f5c9126
8 changed files with 76 additions and 31 deletions

View File

@@ -15,6 +15,12 @@ public class LauncherApp : Application
Config = Config.LoadFromFile();
Logger.DebugLogEnabled = Config.debug;
AvaloniaXamlLoader.Load(this);
// some file required by forge installer
if (!File.Exists("launcher_profiles.json"))
{
File.WriteAllText("launcher_profiles.json", "{}");
}
}
public override void OnFrameworkInitializationCompleted()

View File

@@ -90,6 +90,9 @@
<CheckBox IsChecked="{Binding #window.EnableJavaDownload}">
Скачивать джаву
</CheckBox>
<CheckBox IsChecked="{Binding #window.RedirectGameOutput}">
Выводить лог игры в лаунчер
</CheckBox>
</StackPanel>
</ScrollViewer>
<Button Name="LaunchButton" Grid.Row="1"

View File

@@ -51,6 +51,15 @@ public partial class MainWindow : Window
set => SetValue(EnableJavaDownloadProperty, value);
}
public static readonly StyledProperty<bool> RedirectGameOutputProperty =
AvaloniaProperty.Register<MainWindow, bool>(nameof(RedirectGameOutput),
defaultBindingMode: BindingMode.TwoWay, defaultValue: false);
public bool RedirectGameOutput
{
get => GetValue(RedirectGameOutputProperty);
set => SetValue(RedirectGameOutputProperty, value);
}
public MainWindow()
{
InitializeComponent();
@@ -65,6 +74,7 @@ public partial class MainWindow : Window
PlayerName = LauncherApp.Config.player_name;
MemoryLimit = LauncherApp.Config.max_memory;
EnableJavaDownload = LauncherApp.Config.download_java;
RedirectGameOutput = LauncherApp.Config.redirect_game_output;
InstalledVersionComboBox.SelectedIndex = 0;
InstalledVersionComboBox.IsEnabled = false;
@@ -119,6 +129,7 @@ public partial class MainWindow : Window
LauncherApp.Config.player_name = PlayerName;
LauncherApp.Config.max_memory = MemoryLimit;
LauncherApp.Config.download_java = EnableJavaDownload;
LauncherApp.Config.redirect_game_output = RedirectGameOutput;
LauncherApp.Config.SaveToFile();
if (selectedVersion == null)
return;