Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9bcdfd88e6 | |||
| 2dc472c85a | |||
| 2087c14285 | |||
| ef36fb5584 | |||
| d6bd7b9ef0 | |||
| 23195bd7c7 | |||
| 5e439ee8d5 |
@@ -27,9 +27,9 @@ public record Config
|
|||||||
new() { name = "Mojang", url = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json" },
|
new() { name = "Mojang", url = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json" },
|
||||||
];
|
];
|
||||||
|
|
||||||
public UpdateHelper.GiteaConfig gitea { get; set; } = new UpdateHelper.GiteaConfig
|
public UpdateHelper.GiteaConfig gitea { get; set; } = new()
|
||||||
{
|
{
|
||||||
serverUrl = "https://timerix.ddns.net:3322",
|
serverUrl = "https://timerix.ddns.net/git/",
|
||||||
user = "Timerix",
|
user = "Timerix",
|
||||||
repo = "mlaumcherb",
|
repo = "mlaumcherb",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ public class GameVersion
|
|||||||
_gameArgs = new GameArguments(_descriptor);
|
_gameArgs = new GameArguments(_descriptor);
|
||||||
_libraries = new Libraries(_descriptor);
|
_libraries = new Libraries(_descriptor);
|
||||||
WorkingDirectory = GetVersionDir(_descriptor.id);
|
WorkingDirectory = GetVersionDir(_descriptor.id);
|
||||||
JavaExecutableFilePath = GetJavaExecutablePath(_descriptor.javaVersion.component, LauncherApp.Config.debug);
|
JavaExecutableFilePath = GetJavaExecutablePath(
|
||||||
|
_descriptor.javaVersion.component, LauncherApp.Config.redirect_game_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Download(bool update, Action<NetworkTask> networkTaskCreatedCallback)
|
public async Task Download(bool update, Action<NetworkTask> networkTaskCreatedCallback)
|
||||||
@@ -108,6 +109,7 @@ public class GameVersion
|
|||||||
if (string.IsNullOrWhiteSpace(LauncherApp.Config.player_name))
|
if (string.IsNullOrWhiteSpace(LauncherApp.Config.player_name))
|
||||||
throw new Exception("invalid player name");
|
throw new Exception("invalid player name");
|
||||||
|
|
||||||
|
string classSeparator = PlatformHelper.GetOs() == "windows" ? ";" : ":";
|
||||||
Directory.Create(WorkingDirectory);
|
Directory.Create(WorkingDirectory);
|
||||||
string uuid = GetPlayerUUID(LauncherApp.Config.player_name);
|
string uuid = GetPlayerUUID(LauncherApp.Config.player_name);
|
||||||
Dictionary<string, string> placeholder_values = new() {
|
Dictionary<string, string> placeholder_values = new() {
|
||||||
@@ -127,14 +129,14 @@ public class GameVersion
|
|||||||
{ "launcher_version", "1.6.84-j" },
|
{ "launcher_version", "1.6.84-j" },
|
||||||
{ "classpath", _libraries.Libs.Select(l => l.jarFilePath)
|
{ "classpath", _libraries.Libs.Select(l => l.jarFilePath)
|
||||||
.Append(GetVersionJarFilePath(_descriptor.id))
|
.Append(GetVersionJarFilePath(_descriptor.id))
|
||||||
.MergeToString(';') },
|
.MergeToString(classSeparator) },
|
||||||
{ "assets_index_name", _descriptor.assets },
|
{ "assets_index_name", _descriptor.assets },
|
||||||
{ "assets_root", GetAssetsDir().ToString() },
|
{ "assets_root", GetAssetsDir().ToString() },
|
||||||
{ "game_assets", GetAssetsDir().ToString() },
|
{ "game_assets", GetAssetsDir().ToString() },
|
||||||
{ "game_directory", WorkingDirectory.ToString() },
|
{ "game_directory", WorkingDirectory.ToString() },
|
||||||
{ "natives_directory", GetNativeLibrariesDir(_descriptor.id).ToString() },
|
{ "natives_directory", GetNativeLibrariesDir(_descriptor.id).ToString() },
|
||||||
{ "library_directory", GetLibrariesDir().ToString() },
|
{ "library_directory", GetLibrariesDir().ToString() },
|
||||||
{ "classpath_separator", ";"},
|
{ "classpath_separator", classSeparator},
|
||||||
{ "path", GetLog4jConfigFilePath().ToString() },
|
{ "path", GetLog4jConfigFilePath().ToString() },
|
||||||
{ "version_name", _descriptor.id },
|
{ "version_name", _descriptor.id },
|
||||||
{ "version_type", _descriptor.type },
|
{ "version_type", _descriptor.type },
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ public class LauncherLogger : ILogger
|
|||||||
private CompositeLogger _compositeLogger;
|
private CompositeLogger _compositeLogger;
|
||||||
private FileLogger _fileLogger;
|
private FileLogger _fileLogger;
|
||||||
public static readonly IOPath LogsDirectory = "launcher_logs";
|
public static readonly IOPath LogsDirectory = "launcher_logs";
|
||||||
public IOPath LogfileName => _fileLogger.LogfileName;
|
public IOPath LogFilePath => _fileLogger.LogfileName;
|
||||||
|
|
||||||
public LauncherLogger()
|
public LauncherLogger()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.1.0</Version>
|
<Version>1.1.1</Version>
|
||||||
<OutputType Condition="'$(Configuration)' == 'Debug'">Exe</OutputType>
|
<OutputType Condition="'$(Configuration)' == 'Debug'">Exe</OutputType>
|
||||||
<OutputType Condition="'$(Configuration)' != 'Debug'">WinExe</OutputType>
|
<OutputType Condition="'$(Configuration)' != 'Debug'">WinExe</OutputType>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
|||||||
@@ -183,7 +183,11 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Launcher.LaunchDirectoryInfoAsync(new DirectoryInfo(Directory.GetCurrent().ToString()))
|
|
||||||
|
string workingDir = Directory.GetCurrent().ToString();
|
||||||
|
LauncherApp.Logger.LogDebug(nameof(MainWindow),
|
||||||
|
$"opening working directory: {workingDir}");
|
||||||
|
Launcher.LaunchDirectoryInfoAsync(new DirectoryInfo(workingDir))
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -196,7 +200,10 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Launcher.LaunchFileInfoAsync(new FileInfo(LauncherApp.Logger.LogfileName.ToString()))
|
string logFilePath = LauncherApp.Logger.LogFilePath.ToString();
|
||||||
|
LauncherApp.Logger.LogDebug(nameof(MainWindow),
|
||||||
|
$"opening log file: {logFilePath}");
|
||||||
|
Launcher.LaunchFileInfoAsync(new FileInfo(logFilePath))
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -209,7 +216,10 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Launcher.LaunchUriAsync(new Uri("https://timerix.ddns.net:3322/Timerix/mlaumcherb"))
|
var sourcesUri = new Uri(LauncherApp.Config.gitea.GetRepoUrl());
|
||||||
|
LauncherApp.Logger.LogDebug(nameof(MainWindow),
|
||||||
|
$"opening in web browser: {sourcesUri}");
|
||||||
|
Launcher.LaunchUriAsync(sourcesUri)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ namespace Mlaumcherb.Client.Avalonia.классы;
|
|||||||
|
|
||||||
public class JavaVersionCatalog
|
public class JavaVersionCatalog
|
||||||
{
|
{
|
||||||
[JsonProperty("linux")]
|
|
||||||
public Dictionary<string, JavaVersionProps[]>? linux_x86 { get; set; }
|
|
||||||
[JsonProperty("linux-i386")]
|
[JsonProperty("linux-i386")]
|
||||||
|
public Dictionary<string, JavaVersionProps[]>? linux_x86 { get; set; }
|
||||||
|
[JsonProperty("linux")]
|
||||||
public Dictionary<string, JavaVersionProps[]>? linux_x64 { get; set; }
|
public Dictionary<string, JavaVersionProps[]>? linux_x64 { get; set; }
|
||||||
[JsonProperty("mac-os")]
|
[JsonProperty("mac-os")]
|
||||||
public Dictionary<string, JavaVersionProps[]>? osx_x64 { get; set; }
|
public Dictionary<string, JavaVersionProps[]>? osx_x64 { get; set; }
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class GiteaClient(string ServerUrl)
|
|||||||
{
|
{
|
||||||
public async Task<Release> GetLatestRelease(string user, string repo)
|
public async Task<Release> GetLatestRelease(string user, string repo)
|
||||||
{
|
{
|
||||||
string url = $"{ServerUrl}//api/v1/repos/{user}/{repo}/releases/latest";
|
string url = $"{ServerUrl}/api/v1/repos/{user}/{repo}/releases/latest";
|
||||||
return await NetworkHelper.DownloadStringAndDeserialize<Release>(url);
|
return await NetworkHelper.DownloadStringAndDeserialize<Release>(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,15 +10,17 @@ public class UpdateHelper
|
|||||||
private readonly IOPath executablePathOld;
|
private readonly IOPath executablePathOld;
|
||||||
private readonly IOPath executablePathNew;
|
private readonly IOPath executablePathNew;
|
||||||
|
|
||||||
|
private readonly GiteaConfig _giteaConfig;
|
||||||
|
|
||||||
public class GiteaConfig
|
public class GiteaConfig
|
||||||
{
|
{
|
||||||
[JsonRequired] public required string serverUrl { get; set; }
|
[JsonRequired] public required string serverUrl { get; set; }
|
||||||
[JsonRequired] public required string user { get; set; }
|
[JsonRequired] public required string user { get; set; }
|
||||||
[JsonRequired] public required string repo { get; set; }
|
[JsonRequired] public required string repo { get; set; }
|
||||||
|
|
||||||
|
public string GetRepoUrl() => $"{serverUrl}/{user}/{repo}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private GiteaConfig _giteaConfig;
|
|
||||||
|
|
||||||
public UpdateHelper(GiteaConfig giteaConfig)
|
public UpdateHelper(GiteaConfig giteaConfig)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,14 +40,17 @@ public static class PathHelper
|
|||||||
|
|
||||||
public static IOPath GetJavaBinDir(string id) =>
|
public static IOPath GetJavaBinDir(string id) =>
|
||||||
Path.Concat(GetJavaRuntimeDir(id), "bin");
|
Path.Concat(GetJavaRuntimeDir(id), "bin");
|
||||||
public static IOPath GetJavaExecutablePath(string id, bool debug)
|
public static IOPath GetJavaExecutablePath(string id, bool redirectOutput)
|
||||||
{
|
{
|
||||||
string executable_name = "java";
|
string executable_name = "java";
|
||||||
if (debug)
|
if (!redirectOutput)
|
||||||
executable_name += "w";
|
executable_name = "javaw";
|
||||||
if(OperatingSystem.IsWindows())
|
if(OperatingSystem.IsWindows())
|
||||||
executable_name += ".exe";
|
executable_name += ".exe";
|
||||||
return Path.Concat(GetJavaBinDir(id), executable_name);
|
var path = Path.Concat(GetJavaBinDir(id), executable_name);
|
||||||
|
if(!redirectOutput && !File.Exists(path))
|
||||||
|
return GetJavaExecutablePath(id, true);
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetLog4jConfigFileName() => "log4j.xml";
|
public static string GetLog4jConfigFileName() => "log4j.xml";
|
||||||
|
|||||||
14
README.md
Normal file
14
README.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Mlaumcherb - a minecraft laumcherb
|
||||||
|
|
||||||
|
<img src="./images/cheems.png" alt="silly-dog-picture" style="width:200px;"/>
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Downloads minecraft from mojang server or any other
|
||||||
|
- Downloads java or uses whatever you specified in config
|
||||||
|
- Downloads modpacks of my custom format
|
||||||
|
- Automatic launcher updates from git releases
|
||||||
|
|
||||||
|
## How to build
|
||||||
|
```sh
|
||||||
|
./build.sh selfcontained
|
||||||
|
```
|
||||||
@@ -29,11 +29,12 @@ case "$mode" in
|
|||||||
args="$args_selfcontained"
|
args="$args_selfcontained"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "ПОЛЬЗОВАНИЕ: ./собрать.sh [способ]"
|
echo "ПОЛЬЗОВАНИЕ: ./build.sh [способ]"
|
||||||
echo " СПОСОБЫ:"
|
echo " СПОСОБЫ:"
|
||||||
echo " бинарное - компилирует промежуточный (управляемый) код в машинный вместе с рантаймом"
|
echo " aot, native, бинарное - компилирует промежуточный (управляемый) код в машинный вместе с рантаймом"
|
||||||
echo " небинарное - приделывает промежуточный (управляемый) код к рантайму"
|
echo " self-contained, selfcontained, небинарное - приделывает промежуточный (управляемый) код к рантайму"
|
||||||
echo " Оба способа собирают программу в один файл, который не является 80-мегабайтовым умственно отсталым кубом. Он 20-мегабайтовый >w<"
|
echo " Оба способа собирают программу в один файл, который не является 80-мегабайтовым умственно отсталым кубом.\
|
||||||
|
Он 20-мегабайтовый >w<"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -44,4 +45,4 @@ echo "$command"
|
|||||||
$command
|
$command
|
||||||
|
|
||||||
find "$outdir" -name '*.pdb' -delete -printf "deleted '%p'\n"
|
find "$outdir" -name '*.pdb' -delete -printf "deleted '%p'\n"
|
||||||
ls -shk "$outdir" | sort -h
|
tree -sh "$outdir"
|
||||||
BIN
images/cheems.png
Normal file
BIN
images/cheems.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -5,6 +5,8 @@ EndProject
|
|||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFolder", "SolutionFolder", "{A3217C18-CC0D-4CE8-9C48-1BDEC1E1B333}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFolder", "SolutionFolder", "{A3217C18-CC0D-4CE8-9C48-1BDEC1E1B333}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
.gitignore = .gitignore
|
.gitignore = .gitignore
|
||||||
|
README.md = README.md
|
||||||
|
build.sh = build.sh
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
|
|||||||
Reference in New Issue
Block a user