Merge branch 'dev' into 'main'
Version update 1.2.1 See merge request nullmax17/PlombirLauncher!1
@ -8,14 +8,15 @@
|
|||||||
<PublishSingleFile>true</PublishSingleFile>
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
|
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
|
||||||
|
|
||||||
<IsAotCompatible>false</IsAotCompatible>
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CmlLib.Core" Version="4.0.4" />
|
<PackageReference Include="CmlLib.Core" Version="4.0.4" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.39.0" />
|
<PackageReference Include="CmlLib.Core.Auth.Microsoft" Version="3.2.2" />
|
||||||
|
<PackageReference Include="XboxAuthNet.Game.Msal" Version="0.1.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,9 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Security.AccessControl;
|
using System.Security.AccessControl;
|
||||||
using CmlLib.Core;
|
using CmlLib.Core;
|
||||||
using CmlLib.Core.Auth;
|
using CmlLib.Core.Auth;
|
||||||
|
using CmlLib.Core.Auth.Microsoft;
|
||||||
using CmlLib.Core.ProcessBuilder;
|
using CmlLib.Core.ProcessBuilder;
|
||||||
|
using XboxAuthNet.Game.Msal;
|
||||||
|
|
||||||
namespace Plombir;
|
namespace Plombir;
|
||||||
|
|
||||||
@ -15,17 +17,15 @@ namespace Plombir;
|
|||||||
public class Launcher
|
public class Launcher
|
||||||
{
|
{
|
||||||
private readonly string _version;
|
private readonly string _version;
|
||||||
private readonly string _nickname;
|
|
||||||
static private MinecraftPath? _mcPath;
|
static private MinecraftPath? _mcPath;
|
||||||
static private MinecraftLauncher? _mcLauncher;
|
static private MinecraftLauncher? _mcLauncher;
|
||||||
|
|
||||||
public int DownloadProgress;
|
public int DownloadProgress;
|
||||||
public string? DownloadStatus;
|
public string? DownloadStatus;
|
||||||
|
|
||||||
public Launcher(string userName, string version, string? location = null)
|
public Launcher(string version, string? location = null)
|
||||||
{
|
{
|
||||||
_version = version;
|
_version = version;
|
||||||
_nickname = userName;
|
|
||||||
_mcPath = new($"{location}/{version}/minecraft");
|
_mcPath = new($"{location}/{version}/minecraft");
|
||||||
_mcLauncher = new(_mcPath);
|
_mcLauncher = new(_mcPath);
|
||||||
}
|
}
|
||||||
@ -41,7 +41,7 @@ public class Launcher
|
|||||||
DownloadProgress = (int)(args.ProgressedBytes * 100 / args.TotalBytes);
|
DownloadProgress = (int)(args.ProgressedBytes * 100 / args.TotalBytes);
|
||||||
};
|
};
|
||||||
|
|
||||||
DownloadStatus = "Installing minecraft...";
|
DownloadStatus = "Getting the assets from Mojang...";
|
||||||
Console.WriteLine(DownloadStatus);
|
Console.WriteLine(DownloadStatus);
|
||||||
await _mcLauncher.InstallAsync(_version);
|
await _mcLauncher.InstallAsync(_version);
|
||||||
DownloadStatus = "Finished!";
|
DownloadStatus = "Finished!";
|
||||||
@ -49,15 +49,29 @@ public class Launcher
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
async public Task RunLauncher()
|
public MSession CreateOfflineSession(string nickname)
|
||||||
|
{
|
||||||
|
var s = MSession.CreateOfflineSession(nickname);
|
||||||
|
if (s is null) throw new NullReferenceException("Tried creating offline session, but it's resulted in null!");
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MSession CreateLicensedSession(string uuid, string accsessToken, string nickname)
|
||||||
|
{
|
||||||
|
var s = new MSession(nickname, accsessToken, uuid);
|
||||||
|
if (s is null) throw new NullReferenceException("Tried creating licensed session, but it's resulted in null!");
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
async public Task RunLauncher(MSession session)
|
||||||
{
|
{
|
||||||
if (_mcLauncher is null)
|
if (_mcLauncher is null)
|
||||||
throw new NullReferenceException("Failed to run launcher! Launcher is null!");
|
throw new NullReferenceException("Failed to run launcher! Launcher is null!");
|
||||||
|
|
||||||
var process = await _mcLauncher.BuildProcessAsync(_version, new MLaunchOption
|
var process = await _mcLauncher.BuildProcessAsync(_version, new MLaunchOption
|
||||||
{
|
{
|
||||||
|
// Passing session, to support offline and licensed login methods.
|
||||||
Session = MSession.CreateOfflineSession(_nickname),
|
Session = session,
|
||||||
MaximumRamMb = 4096,
|
MaximumRamMb = 4096,
|
||||||
|
|
||||||
}) ?? throw new Exception("Failed to start minecraft process!");
|
}) ?? throw new Exception("Failed to start minecraft process!");
|
||||||
|
@ -2,8 +2,12 @@ namespace Plombir;
|
|||||||
|
|
||||||
sealed class Program
|
sealed class Program
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static async Task Main()
|
||||||
{
|
{
|
||||||
Console.WriteLine("init: launcher");
|
Console.WriteLine("init: launcher");
|
||||||
|
// var ln = new Launcher("test", "1.20.1");
|
||||||
|
// var s = await Utils.GetLicensedSession();
|
||||||
|
|
||||||
|
// Console.WriteLine(s.CheckIsValid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
using System.IO.Compression;
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using SharpCompress.Archives;
|
|
||||||
using SharpCompress.Common;
|
|
||||||
using SharpCompress.Readers;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using CmlLib.Core;
|
using CmlLib.Core;
|
||||||
|
using CmlLib.Core.Auth;
|
||||||
|
using XboxAuthNet.Game.Msal;
|
||||||
|
using CmlLib.Core.Auth.Microsoft;
|
||||||
|
|
||||||
namespace Plombir;
|
namespace Plombir;
|
||||||
|
|
||||||
@ -27,6 +24,34 @@ static public class Utils
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
ID is approved, we are so ready.
|
||||||
|
*/
|
||||||
|
public static async Task<MSession>? GetLicensedSession()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var app = await MsalClientHelper.BuildApplicationWithCache(
|
||||||
|
"d87c436c-aad0-46ea-b392-b53b3ed787b1"
|
||||||
|
);
|
||||||
|
var loginHandler = JELoginHandlerBuilder.BuildDefault();
|
||||||
|
|
||||||
|
var authenticator = loginHandler.CreateAuthenticatorWithNewAccount(default);
|
||||||
|
authenticator.AddMsalOAuth(app, msal => msal.SystemBrowser());
|
||||||
|
// authenticator.AddMsalOAuth(app, msal => msal.DeviceCode(deviceCode =>
|
||||||
|
// {
|
||||||
|
// Console.WriteLine(deviceCode.Message);
|
||||||
|
// return Task.CompletedTask;
|
||||||
|
// }));
|
||||||
|
// Im too lazy to implement this type of auth
|
||||||
|
authenticator.AddMsalOAuth(app, msal => msal.Silent());
|
||||||
|
authenticator.AddXboxAuthForJE(xbox => xbox.Basic());
|
||||||
|
authenticator.AddJEAuthenticator();
|
||||||
|
return await authenticator.ExecuteForLauncherAsync();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new Exception($"Failed to authentificate! {e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
BIN
Launcher-UI/Assets/Sprites/account-logo.png
Normal file
After Width: | Height: | Size: 570 B |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 892 B After Width: | Height: | Size: 892 B |
Before Width: | Height: | Size: 939 B After Width: | Height: | Size: 939 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
Launcher-UI/Assets/Sprites/microsoft-logo.png
Normal file
After Width: | Height: | Size: 543 B |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
BIN
Launcher-UI/Assets/Sprites/toml-paper.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 911 B |
@ -6,25 +6,41 @@ namespace Plombir;
|
|||||||
|
|
||||||
public class ConfigManager
|
public class ConfigManager
|
||||||
{
|
{
|
||||||
|
static private readonly string defaultRuntime = "./runtime";
|
||||||
|
static private readonly string defaultVersion = "1.20.1";
|
||||||
|
static private readonly string defaultNickname = "slugcat";
|
||||||
|
|
||||||
|
static private readonly string currentTweaksVersion = "1.2.1";
|
||||||
|
|
||||||
|
static private readonly string defaultLoginType = "offline";
|
||||||
|
static private readonly string defaultUuid = "offline";
|
||||||
|
static private readonly string defaultAccsessToken = "offline";
|
||||||
|
|
||||||
public static void BuildDefault()
|
public static void BuildDefault()
|
||||||
{
|
{
|
||||||
TomlTable toml = new TomlTable
|
TomlTable toml = new TomlTable
|
||||||
{
|
{
|
||||||
["title"] = "Launcher tweaks file!",
|
["title"] = "Launcher tweaks file!",
|
||||||
|
["tweaks-version"] = currentTweaksVersion,
|
||||||
|
|
||||||
["runtime-path"] = new TomlString
|
["runtime-path"] = new TomlString
|
||||||
{
|
{
|
||||||
Value = "./runtime",
|
Value = defaultRuntime,
|
||||||
Comment = "Path to folder that will hold all minecraft versions"
|
Comment = "Path to folder that will hold all minecraft versions"
|
||||||
},
|
},
|
||||||
|
|
||||||
["last-version-launched"] = new TomlString
|
["last-version-launched"] = new TomlString
|
||||||
{
|
{
|
||||||
Value = "1.20.1",
|
Value = defaultVersion,
|
||||||
Comment = "Saving last launched version to use it after launch"
|
Comment = "Saving last launched version to use it after launch"
|
||||||
},
|
},
|
||||||
|
|
||||||
["nickname"] = "slugcat"
|
["nickname"] = defaultNickname,
|
||||||
|
["login-method"] = defaultLoginType,
|
||||||
|
["uuid"] = defaultUuid,
|
||||||
|
["accsess-token"] = defaultAccsessToken,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using (StreamWriter writer = File.CreateText("tweaks.toml"))
|
using (StreamWriter writer = File.CreateText("tweaks.toml"))
|
||||||
@ -45,10 +61,58 @@ public class ConfigManager
|
|||||||
{
|
{
|
||||||
TomlTable table = TOML.Parse(reader);
|
TomlTable table = TOML.Parse(reader);
|
||||||
|
|
||||||
return table[key];
|
// If config don't contains it means it's oudated or broken.
|
||||||
|
if (!IsValueExists(table, key))
|
||||||
|
{
|
||||||
|
WriteInConfig(key, "NaN");
|
||||||
|
}
|
||||||
|
|
||||||
|
// In case if config is fine return its value
|
||||||
|
if (table[key].ToString() != "NaN")
|
||||||
|
{
|
||||||
|
if ((key == "tweaks-version") & (table[key] != currentTweaksVersion))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Warning! Tweaks version mismatch!");
|
||||||
|
WriteInConfig("tweaks-version", "wrong-version");
|
||||||
|
}
|
||||||
|
return table[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
return RepairConfig(key);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsValueExists(TomlTable table, string key)
|
||||||
|
{
|
||||||
|
if (table.TryGetNode(key, out var _))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string? RepairConfig(string key)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Warning! Can't locate {key} in tweaks! Fallback to defaults!");
|
||||||
|
// Handling out-dated or broken toml files by filling with defaults
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case "runtime-path": { WriteInConfig(key, defaultRuntime); return defaultRuntime; }
|
||||||
|
case "last-version-launched": { WriteInConfig(key, defaultVersion); return defaultVersion; }
|
||||||
|
case "nickname": { WriteInConfig(key, defaultNickname); return defaultNickname; }
|
||||||
|
|
||||||
|
case "accsess-token": { WriteInConfig(key, defaultAccsessToken); return defaultAccsessToken; }
|
||||||
|
case "uuid": { WriteInConfig(key, defaultUuid); return defaultUuid; }
|
||||||
|
case "login-method": { WriteInConfig(key, defaultLoginType); return defaultLoginType; }
|
||||||
|
case "tweaks-version":
|
||||||
|
{
|
||||||
|
WriteInConfig(key, currentTweaksVersion);
|
||||||
|
return "possibly broken";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static void WriteInConfig(string key, dynamic value)
|
public static void WriteInConfig(string key, dynamic value)
|
||||||
{
|
{
|
||||||
if (!File.Exists("tweaks.toml"))
|
if (!File.Exists("tweaks.toml"))
|
||||||
|
@ -10,18 +10,33 @@ public class LauncherUtils
|
|||||||
{
|
{
|
||||||
public async static Task CreateMinecraftInstance(MainWindowViewModel vm, Window windowCaller)
|
public async static Task CreateMinecraftInstance(MainWindowViewModel vm, Window windowCaller)
|
||||||
{
|
{
|
||||||
|
var licenseStatus = ConfigManager.ReadConfig("login-method");
|
||||||
|
|
||||||
if (vm.Usernick is null) throw new NullReferenceException("Failed to create minecraft instance! Nickname is null!");
|
if (vm.Usernick is null) throw new NullReferenceException("Failed to create minecraft instance! Nickname is null!");
|
||||||
if (vm.SelectedVersion is null) throw new NullReferenceException("Failed to create minecraft instance! Selected version is null!");
|
if (vm.SelectedVersion is null) throw new NullReferenceException("Failed to create minecraft instance! Selected version is null!");
|
||||||
|
|
||||||
System.Console.WriteLine($"Creating minecraft instance for {vm.Usernick}, {vm.SelectedVersion} in {vm.RuntimeLocation}");
|
System.Console.WriteLine($"Creating minecraft instance for {vm.Usernick}, {vm.SelectedVersion} in {vm.RuntimeLocation}");
|
||||||
LoadingWindow loading = new(vm.Usernick, vm.SelectedVersion, vm.RuntimeLocation);
|
LoadingWindow loading = new(vm);
|
||||||
ConfigManager.WriteInConfig("last-version-launched", vm.SelectedVersion);
|
|
||||||
ConfigManager.WriteInConfig("nickname", vm.Usernick);
|
SaveCurrentVariablesToConfig(vm);
|
||||||
|
|
||||||
loading.Show();
|
loading.Show();
|
||||||
await loading.InitLoading();
|
await loading.InitLoading();
|
||||||
loading.Close();
|
loading.Close();
|
||||||
await loading.RunMinecraft();
|
|
||||||
|
if (licenseStatus == "microsoft") await loading.RunMinecraft(true);
|
||||||
|
else await loading.RunMinecraft(false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static async Task CreateLicensedMinecraftInstance()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SaveCurrentVariablesToConfig(MainWindowViewModel vm)
|
||||||
|
{
|
||||||
|
ConfigManager.WriteInConfig("last-version-launched", vm.SelectedVersion);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,4 +15,18 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
|
|
||||||
private string? _runtimeLocation = ConfigManager.ReadConfig("runtime-path");
|
private string? _runtimeLocation = ConfigManager.ReadConfig("runtime-path");
|
||||||
public string? RuntimeLocation { get => _runtimeLocation; set { _runtimeLocation = value; OnPropertyChanged(nameof(RuntimeLocation)); } }
|
public string? RuntimeLocation { get => _runtimeLocation; set { _runtimeLocation = value; OnPropertyChanged(nameof(RuntimeLocation)); } }
|
||||||
|
|
||||||
|
// Session information
|
||||||
|
private string? _loginMethod = ConfigManager.ReadConfig("login-method");
|
||||||
|
public string? LoginMethod { get => _loginMethod; set { _loginMethod = value; OnPropertyChanged(nameof(LoginMethod)); } }
|
||||||
|
|
||||||
|
private string? _accsessToken = ConfigManager.ReadConfig("accsess-token");
|
||||||
|
public string? AccsesToken { get => _accsessToken; set { _accsessToken = value; OnPropertyChanged(nameof(AccsesToken)); } }
|
||||||
|
|
||||||
|
private string? _uuid = ConfigManager.ReadConfig("uuid");
|
||||||
|
public string? UUID { get => _uuid; set { _uuid = value; OnPropertyChanged(nameof(UUID)); } }
|
||||||
|
|
||||||
|
// Tweaks managment
|
||||||
|
private string? _tweaksVersion = ConfigManager.ReadConfig("tweaks-version");
|
||||||
|
public string? TweaksVersion { get => _tweaksVersion; set { _tweaksVersion = value; OnPropertyChanged(nameof(TweaksVersion)); } }
|
||||||
}
|
}
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
namespace LauncherGUI.ViewModels;
|
|
||||||
|
|
||||||
public partial class SettingsWindowViewModel : ViewModelBase
|
|
||||||
{
|
|
||||||
// I save launcher data mostly in MainWindowViewModel.
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Plombir;
|
|
||||||
using LauncherGUI.ViewModels;
|
|
||||||
|
|
||||||
namespace LauncherGUI.ViewModels;
|
|
||||||
|
|
||||||
public partial class VersionSelectorWindowViewModel : ViewModelBase
|
|
||||||
{
|
|
||||||
// I save launcher data mostly in MainWindowViewModel.
|
|
||||||
}
|
|
@ -9,7 +9,7 @@
|
|||||||
d:DesignHeight="200"
|
d:DesignHeight="200"
|
||||||
x:Class="LauncherGUI.Views.LoadingWindow"
|
x:Class="LauncherGUI.Views.LoadingWindow"
|
||||||
x:DataType="vm:LoadingWindowViewModel"
|
x:DataType="vm:LoadingWindowViewModel"
|
||||||
Icon="/Assets/icon.png"
|
Icon="/Assets/Sprites/icon.png"
|
||||||
Title="Loading"
|
Title="Loading"
|
||||||
RequestedThemeVariant="Dark"
|
RequestedThemeVariant="Dark"
|
||||||
Width="400"
|
Width="400"
|
||||||
|
@ -13,12 +13,14 @@ public partial class LoadingWindow : Window
|
|||||||
{
|
{
|
||||||
private Launcher ln;
|
private Launcher ln;
|
||||||
private Task? _buildingTask;
|
private Task? _buildingTask;
|
||||||
|
private readonly MainWindowViewModel _mainWindowVM;
|
||||||
|
|
||||||
// Tokens for controlling download task.
|
// Tokens for controlling download task.
|
||||||
CancellationTokenSource tokenSource = new CancellationTokenSource();
|
CancellationTokenSource tokenSource = new CancellationTokenSource();
|
||||||
public LoadingWindow(string nickname, string? version = null, string? location = null)
|
public LoadingWindow(MainWindowViewModel mainWindowVM)
|
||||||
{
|
{
|
||||||
ln = new Launcher(nickname, version ?? "1.20.1", location ?? "./runtime");
|
_mainWindowVM = mainWindowVM;
|
||||||
|
ln = new Launcher(_mainWindowVM.SelectedVersion ?? "1.20.1", _mainWindowVM.RuntimeLocation ?? "./runtime");
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
DataContext = new LoadingWindowViewModel();
|
DataContext = new LoadingWindowViewModel();
|
||||||
}
|
}
|
||||||
@ -52,9 +54,14 @@ public partial class LoadingWindow : Window
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RunMinecraft()
|
public async Task RunMinecraft(bool IsLicensed)
|
||||||
{
|
{
|
||||||
await ln.RunLauncher();
|
var session = ln.CreateOfflineSession(_mainWindowVM.Usernick);
|
||||||
|
if (IsLicensed)
|
||||||
|
{
|
||||||
|
session = ln.CreateLicensedSession(_mainWindowVM.UUID, _mainWindowVM.AccsesToken, _mainWindowVM.Usernick);
|
||||||
|
}
|
||||||
|
await ln.RunLauncher(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onStopDownloadClick(object sender, RoutedEventArgs e)
|
private void onStopDownloadClick(object sender, RoutedEventArgs e)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
mc:Ignorable="d" d:DesignWidth="750" d:DesignHeight="500"
|
mc:Ignorable="d" d:DesignWidth="750" d:DesignHeight="500"
|
||||||
x:Class="LauncherGUI.Views.MainWindow"
|
x:Class="LauncherGUI.Views.MainWindow"
|
||||||
x:DataType="vm:MainWindowViewModel"
|
x:DataType="vm:MainWindowViewModel"
|
||||||
Icon="/Assets/icon.png"
|
Icon="/Assets/Sprites/icon.png"
|
||||||
Title="PlombirLauncher"
|
Title="PlombirLauncher"
|
||||||
RequestedThemeVariant="Dark"
|
RequestedThemeVariant="Dark"
|
||||||
Width="750" Height="500"
|
Width="750" Height="500"
|
||||||
@ -14,15 +14,9 @@
|
|||||||
MaxWidth="750" MaxHeight="500">
|
MaxWidth="750" MaxHeight="500">
|
||||||
|
|
||||||
<Window.Background>
|
<Window.Background>
|
||||||
<ImageBrush Source="/Assets/background.jpg" Stretch="UniformToFill"/>
|
<ImageBrush Source="/Assets/Sprites/background.jpg" Stretch="UniformToFill"/>
|
||||||
</Window.Background>
|
</Window.Background>
|
||||||
|
|
||||||
<Design.DataContext>
|
|
||||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
|
||||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
|
||||||
<vm:MainWindowViewModel/>
|
|
||||||
</Design.DataContext>
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
@ -33,7 +27,7 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- Title area -->
|
||||||
<StackPanel
|
<StackPanel
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Grid.Row="0" Grid.ColumnSpan="3" >
|
Grid.Row="0" Grid.ColumnSpan="3" >
|
||||||
@ -43,13 +37,15 @@
|
|||||||
Padding="10" Margin="3"
|
Padding="10" Margin="3"
|
||||||
CornerRadius="10">
|
CornerRadius="10">
|
||||||
|
|
||||||
<Image Source="/Assets/title.png"
|
<Image Source="/Assets/Sprites/title.png"
|
||||||
Stretch="Uniform"/>
|
Stretch="Uniform"/>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
<TextBlock FontFamily="{StaticResource QuicksandFont}"
|
<TextBlock FontFamily="{StaticResource QuicksandFont}"
|
||||||
HorizontalAlignment="Right" Text="v1.1.0 - nullmax17"/>
|
HorizontalAlignment="Right" Text="v1.2.1 - Plombir Contribuitors"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Settings for launcher -->
|
||||||
<Canvas Grid.Row="0" Grid.Column="1">
|
<Canvas Grid.Row="0" Grid.Column="1">
|
||||||
<Border
|
<Border
|
||||||
Background="#353535"
|
Background="#353535"
|
||||||
@ -59,7 +55,7 @@
|
|||||||
|
|
||||||
<Image
|
<Image
|
||||||
Height="60"
|
Height="60"
|
||||||
Source="/Assets/cog.png"
|
Source="/Assets/Sprites/cog.png"
|
||||||
Stretch="Uniform"
|
Stretch="Uniform"
|
||||||
PointerPressed="OnCogPressed" />
|
PointerPressed="OnCogPressed" />
|
||||||
|
|
||||||
@ -67,54 +63,67 @@
|
|||||||
|
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
|
<!-- Title area end -->
|
||||||
|
|
||||||
|
<!-- Center-left stack panel with minecraft stuff -->
|
||||||
|
|
||||||
<StackPanel
|
<StackPanel
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Grid.Row="1" Grid.Column="0">
|
Grid.Row="1" Grid.Column="0">
|
||||||
|
|
||||||
|
<!-- Session managment -->
|
||||||
<Border
|
<Border
|
||||||
Background="#353535"
|
Background="#353535"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Width="150"
|
|
||||||
CornerRadius="10"
|
CornerRadius="10"
|
||||||
Padding="15">
|
Padding="15">
|
||||||
|
|
||||||
<Button FontFamily="{StaticResource QuicksandFont}" Content="Launch MC" Click="OnLaunchMinecraftClick" HorizontalAlignment="Center"/>
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
</Border>
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
<Border
|
</Grid.RowDefinitions>
|
||||||
Background="#353535"
|
<Grid.ColumnDefinitions>
|
||||||
HorizontalAlignment="Center"
|
<ColumnDefinition Width="*"/>
|
||||||
Width="250"
|
<ColumnDefinition Width="*"/>
|
||||||
CornerRadius="10"
|
</Grid.ColumnDefinitions>
|
||||||
Padding="15" Margin="15">
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Text="Insert username:"
|
|
||||||
FontFamily="{StaticResource QuicksandFont}"/>
|
|
||||||
<TextBox Margin="5" Text="{Binding Usernick, Mode=TwoWay}" Width="200" />
|
|
||||||
|
|
||||||
</StackPanel>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<Border
|
|
||||||
Background="#353535"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Width="150"
|
|
||||||
CornerRadius="10"
|
|
||||||
Padding="10">
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
|
Content="Launch MC"
|
||||||
|
Click="OnLaunchMinecraftClick"
|
||||||
|
HorizontalAlignment="Center"/>
|
||||||
|
|
||||||
|
<!-- Selecting version -->
|
||||||
|
<Button
|
||||||
|
Grid.Column="1"
|
||||||
|
Grid.Row="1"
|
||||||
FontFamily="{StaticResource QuicksandFont}"
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
Content="Choose version"
|
Content="Choose version"
|
||||||
Click="OnChooseVersionClick"
|
Click="OnChooseVersionClick"
|
||||||
HorizontalAlignment="Center"/>
|
HorizontalAlignment="Center"/>
|
||||||
|
|
||||||
|
<!-- Account managment -->
|
||||||
|
<Image
|
||||||
|
Height="60"
|
||||||
|
Width="60"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.Row="1"
|
||||||
|
Source="/Assets/Sprites/account-logo.png"
|
||||||
|
Stretch="Uniform"
|
||||||
|
PointerPressed="OnAccountSettingsPressed" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Minecraft area end -->
|
||||||
|
|
||||||
|
<!-- Instruction panel in center-right -->
|
||||||
<StackPanel Height="300" Grid.Row="1" Grid.Column="2">
|
<StackPanel Height="300" Grid.Row="1" Grid.Column="2">
|
||||||
<Border
|
<Border
|
||||||
Background="#353535"
|
Background="#353535"
|
||||||
@ -136,7 +145,7 @@
|
|||||||
<Canvas>
|
<Canvas>
|
||||||
<Image
|
<Image
|
||||||
Height="60"
|
Height="60"
|
||||||
Source="/Assets/gitlab-logo.png"
|
Source="/Assets/Sprites/gitlab-logo.png"
|
||||||
Stretch="Uniform"
|
Stretch="Uniform"
|
||||||
PointerPressed="OnGitlabPressed"
|
PointerPressed="OnGitlabPressed"
|
||||||
Canvas.Left="290"
|
Canvas.Left="290"
|
||||||
@ -144,6 +153,8 @@
|
|||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<!-- Instruction panel end -->
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.VisualTree;
|
using Avalonia.VisualTree;
|
||||||
using Plombir;
|
using Plombir;
|
||||||
using CmlLib.Core.VersionMetadata;
|
|
||||||
using LauncherGUI.ViewModels;
|
using LauncherGUI.ViewModels;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@ -32,7 +29,6 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
var vm = DataContext as MainWindowViewModel;
|
var vm = DataContext as MainWindowViewModel;
|
||||||
await LauncherUtils.CreateMinecraftInstance(vm, root);
|
await LauncherUtils.CreateMinecraftInstance(vm, root);
|
||||||
button.Content = "Minecraft launched";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,4 +82,14 @@ public partial class MainWindow : Window
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnAccountSettingsPressed(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is not Image img) return;
|
||||||
|
|
||||||
|
if (img.GetVisualRoot() is not MainWindow root) return;
|
||||||
|
|
||||||
|
SessionManagmentWindow sessionManager = new(DataContext as MainWindowViewModel);
|
||||||
|
sessionManager.Show(root);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
152
Launcher-UI/Views/SessionManagmentWindow.axaml
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
<Window
|
||||||
|
xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignWidth="500"
|
||||||
|
d:DesignHeight="400"
|
||||||
|
x:Class="LauncherGUI.Views.SessionManagmentWindow"
|
||||||
|
Icon="/Assets/Sprites/icon.png"
|
||||||
|
Title="Account manager"
|
||||||
|
RequestedThemeVariant="Dark"
|
||||||
|
Width="500"
|
||||||
|
Height="400"
|
||||||
|
MinWidth="500"
|
||||||
|
MinHeight="400"
|
||||||
|
MaxWidth="500"
|
||||||
|
MaxHeight="400"
|
||||||
|
Background="#542434"
|
||||||
|
>
|
||||||
|
|
||||||
|
<StackPanel>
|
||||||
|
<Border
|
||||||
|
Width="500"
|
||||||
|
Background="#94a285"
|
||||||
|
Padding="10"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
>
|
||||||
|
<StackPanel>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Text="Current session info"
|
||||||
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock
|
||||||
|
Text="Session nickname: "
|
||||||
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
|
/>
|
||||||
|
<TextBlock x:Name="currentNickname" Foreground="#d9ccfb"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock
|
||||||
|
Text="Session login method: "
|
||||||
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
|
/>
|
||||||
|
<TextBlock x:Name="loginMethod" Foreground="#d9ccfb" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock
|
||||||
|
Text="Session uuid: "
|
||||||
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
|
/>
|
||||||
|
<TextBlock x:Name="currentUuid" Foreground="#d9ccfb" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- This is quite junky, but It should look simillar. -->
|
||||||
|
<Border
|
||||||
|
Width="500"
|
||||||
|
Background="#504254"
|
||||||
|
Padding="10"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
>
|
||||||
|
<TextBlock
|
||||||
|
Text="OFFLINE METHOD"
|
||||||
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border
|
||||||
|
Width="500"
|
||||||
|
Background="#504254"
|
||||||
|
Padding="10"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
>
|
||||||
|
<StackPanel HorizontalAlignment="Center">
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Text="Insert username:"
|
||||||
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
|
/>
|
||||||
|
<TextBox
|
||||||
|
x:Name="inputNickname"
|
||||||
|
Width="200"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
|
Content="Save"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Click="OnSaveButtonClick"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border
|
||||||
|
Width="500"
|
||||||
|
Background="#542434"
|
||||||
|
Padding="10"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Text="LICENSED METHOD"
|
||||||
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border
|
||||||
|
Width="500"
|
||||||
|
Background="#542434"
|
||||||
|
Padding="10"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
>
|
||||||
|
|
||||||
|
<StackPanel
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
>
|
||||||
|
<Image
|
||||||
|
Height="30"
|
||||||
|
Width="30"
|
||||||
|
Source="/Assets/Sprites/microsoft-logo.png"
|
||||||
|
Stretch="Uniform"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
Content="Login with Microsoft"
|
||||||
|
Click="OnMicrosoftLoginClick"
|
||||||
|
/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Window>
|
61
Launcher-UI/Views/SessionManagmentWindow.axaml.cs
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using LauncherGUI.ViewModels;
|
||||||
|
|
||||||
|
namespace LauncherGUI.Views;
|
||||||
|
using Plombir;
|
||||||
|
|
||||||
|
public partial class SessionManagmentWindow : Window
|
||||||
|
{
|
||||||
|
private MainWindowViewModel _mainWindowVM;
|
||||||
|
public SessionManagmentWindow(MainWindowViewModel mainWindowVM)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_mainWindowVM = mainWindowVM;
|
||||||
|
PopulateInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PopulateInfo()
|
||||||
|
{
|
||||||
|
inputNickname.Text = _mainWindowVM.Usernick; // setting default nickname.
|
||||||
|
currentNickname.Text = _mainWindowVM.Usernick;
|
||||||
|
loginMethod.Text = _mainWindowVM.LoginMethod;
|
||||||
|
currentUuid.Text = _mainWindowVM.UUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSaveButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is not Button button) return;
|
||||||
|
|
||||||
|
_mainWindowVM.Usernick = inputNickname.Text;
|
||||||
|
_mainWindowVM.LoginMethod = "offline"; // Swapping to offline method
|
||||||
|
_mainWindowVM.UUID = "offline"; // Just to be sure
|
||||||
|
_mainWindowVM.AccsesToken = "offline";
|
||||||
|
|
||||||
|
Console.WriteLine($"Changing nickname to {inputNickname.Text}");
|
||||||
|
|
||||||
|
button.Content = "Saved!";
|
||||||
|
SaveSessionInfo();
|
||||||
|
PopulateInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
async private void OnMicrosoftLoginClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var session = await Utils.GetLicensedSession();
|
||||||
|
_mainWindowVM.LoginMethod = "microsoft";
|
||||||
|
_mainWindowVM.Usernick = session.Username;
|
||||||
|
_mainWindowVM.UUID = session.UUID;
|
||||||
|
_mainWindowVM.AccsesToken = session.AccessToken;
|
||||||
|
SaveSessionInfo();
|
||||||
|
PopulateInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveSessionInfo()
|
||||||
|
{
|
||||||
|
ConfigManager.WriteInConfig("nickname", _mainWindowVM.Usernick);
|
||||||
|
ConfigManager.WriteInConfig("login-method", _mainWindowVM.LoginMethod);
|
||||||
|
ConfigManager.WriteInConfig("uuid", _mainWindowVM.UUID);
|
||||||
|
ConfigManager.WriteInConfig("accsess-token", _mainWindowVM.AccsesToken);
|
||||||
|
}
|
||||||
|
}
|
@ -1,54 +1,69 @@
|
|||||||
<Window
|
<Window
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:vm="using:LauncherGUI.ViewModels"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignWidth="500"
|
d:DesignWidth="500"
|
||||||
d:DesignHeight="400"
|
d:DesignHeight="400"
|
||||||
x:Class="LauncherGUI.Views.SettingsWindow"
|
x:Class="LauncherGUI.Views.SettingsWindow"
|
||||||
x:DataType="vm:SettingsWindowViewModel"
|
Icon="/Assets/Sprites/icon.png"
|
||||||
Icon="/Assets/icon.png"
|
|
||||||
Title="Launcher tweaks"
|
Title="Launcher tweaks"
|
||||||
RequestedThemeVariant="Dark"
|
RequestedThemeVariant="Dark"
|
||||||
Width="500"
|
Width="500"
|
||||||
Height="400"
|
Height="400"
|
||||||
MinWidth="500"
|
MinWidth="500"
|
||||||
MinHeight="400"
|
MinHeight="400"
|
||||||
|
MaxWidth="500"
|
||||||
|
MaxHeight="400"
|
||||||
Background="#353535"
|
Background="#353535"
|
||||||
>
|
>
|
||||||
|
|
||||||
<Grid>
|
<Window.Background>
|
||||||
<Grid.RowDefinitions>
|
<ImageBrush Source="/Assets/Sprites/toml-paper.png" Stretch="UniformToFill"/>
|
||||||
<RowDefinition Height="*"/>
|
</Window.Background>
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
<StackPanel Margin="5">
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
<StackPanel HorizontalAlignment="Center">
|
||||||
<ColumnDefinition Width="*"/>
|
<TextBlock
|
||||||
<ColumnDefinition Width="Auto"/>
|
Text="All tweaks can be found in TOML near executable."
|
||||||
</Grid.ColumnDefinitions>
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
|
/>
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="0" Grid.ColumnSpan="2"
|
x:Name="tweaksVersion"
|
||||||
HorizontalAlignment="Center"
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
Text="All tweaks can be found in TOML near executable."
|
/>
|
||||||
FontFamily="{StaticResource QuicksandFont}" />
|
|
||||||
<StackPanel
|
|
||||||
Grid.Row="1" Grid.Column="0">
|
|
||||||
|
|
||||||
<Button Margin="5" Content="Select minecraft folder" Click="OnFilePickerClick" />
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Margin="20">
|
||||||
|
|
||||||
|
<StackPanel>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
x:Name="currentDir"
|
||||||
|
FontFamily="{StaticResource QuicksandFont}"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
Margin="5"
|
||||||
|
Content="Select minecraft folder"
|
||||||
|
Click="OnFilePickerClick"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
/>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Grid.Row="2" Grid.Column="1">
|
</StackPanel>
|
||||||
<Image Source="/Assets/toml-paper.png"
|
|
||||||
Stretch="Uniform"/>
|
<!-- <StackPanel Grid.Row="2" Grid.Column="1">
|
||||||
|
<Image Source="/Assets/Sprites/toml-paper.png" Stretch="Uniform" />
|
||||||
|
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel> -->
|
||||||
|
|
||||||
</Grid>
|
</StackPanel>
|
||||||
|
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -14,6 +14,8 @@ public partial class SettingsWindow : Window
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_mainWindowVM = mainWindowVM;
|
_mainWindowVM = mainWindowVM;
|
||||||
|
tweaksVersion.Text = $"Current tweaks version: {_mainWindowVM.TweaksVersion}";
|
||||||
|
currentDir.Text = $"Current saving directory: {_mainWindowVM.RuntimeLocation}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnFilePickerClick(object sender, RoutedEventArgs args)
|
private async void OnFilePickerClick(object sender, RoutedEventArgs args)
|
||||||
@ -35,6 +37,7 @@ public partial class SettingsWindow : Window
|
|||||||
if (location is null) throw new NullReferenceException("Invalid location selected!");
|
if (location is null) throw new NullReferenceException("Invalid location selected!");
|
||||||
_mainWindowVM.RuntimeLocation = location;
|
_mainWindowVM.RuntimeLocation = location;
|
||||||
System.Console.WriteLine($"Selected {_mainWindowVM.RuntimeLocation}.");
|
System.Console.WriteLine($"Selected {_mainWindowVM.RuntimeLocation}.");
|
||||||
|
currentDir.Text = $"Current saving directory: {_mainWindowVM.RuntimeLocation}";
|
||||||
ConfigManager.WriteInConfig("runtime-path", location);
|
ConfigManager.WriteInConfig("runtime-path", location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<Window xmlns="https://github.com/avaloniaui"
|
<Window xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:vm="using:LauncherGUI.ViewModels"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="200"
|
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="200"
|
||||||
x:Class="LauncherGUI.Views.VersionSelectorWindow"
|
x:Class="LauncherGUI.Views.VersionSelectorWindow"
|
||||||
x:DataType="vm:VersionSelectorWindowViewModel"
|
|
||||||
Icon="/Assets/icon.png"
|
Icon="/Assets/Sprites/icon.png"
|
||||||
Title="Select version"
|
Title="Select version"
|
||||||
RequestedThemeVariant="Dark"
|
RequestedThemeVariant="Dark"
|
||||||
Width="600" Height="500"
|
Width="600" Height="500"
|
||||||
|
@ -21,3 +21,4 @@ Licensed in MIT!
|
|||||||
- [Minecraft](https://www.minecraft.net)
|
- [Minecraft](https://www.minecraft.net)
|
||||||
- [Cmllib](https://github.com/CmlLib/CmlLib.Core.git) - MIT license
|
- [Cmllib](https://github.com/CmlLib/CmlLib.Core.git) - MIT license
|
||||||
- [Avalonia UI](https://github.com/AvaloniaUI/Avalonia) - MIT license
|
- [Avalonia UI](https://github.com/AvaloniaUI/Avalonia) - MIT license
|
||||||
|
- [Tommy](https://github.com/dezhidki/Tommy) - MIT license
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
cd ../Launcher-UI
|
cd ../Launcher-UI
|
||||||
|
|
||||||
out_dir=../package/out/build
|
out_dir=../package/out/build
|
||||||
archieve_name=PlombirLinux-v1-1-0.tar.gz
|
archieve_name=PlombirLinux-v1-2-1.tar.gz
|
||||||
|
|
||||||
rm -r $out_dir
|
rm -r $out_dir
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
cd ../Launcher-UI
|
cd ../Launcher-UI
|
||||||
|
|
||||||
out_dir=../package/out/build
|
out_dir=../package/out/build
|
||||||
archieve_name=PlombirOSX-v1-1-0.tar.gz
|
archieve_name=PlombirOSX-v1-2-1.tar.gz
|
||||||
|
|
||||||
rm -r $out_dir
|
rm -r $out_dir
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
cd ../Launcher-UI
|
cd ../Launcher-UI
|
||||||
|
|
||||||
out_dir=../package/out/build
|
out_dir=../package/out/build
|
||||||
archieve_name=PlombirWindows-v1-1-0.tar.gz
|
archieve_name=PlombirWindows-v1-2-1.tar.gz
|
||||||
|
|
||||||
rm -r $out_dir
|
rm -r $out_dir
|
||||||
|
|
||||||
|