updated to be platform-agnostic

This commit is contained in:
2024-01-05 23:24:32 +06:00
parent 46dce9d6c7
commit 96d87bdd97
8 changed files with 41 additions and 55 deletions

View File

@@ -1,6 +1,4 @@
using System.Diagnostics;
namespace launcher_client;
namespace launcher_client;
internal static partial class Launcher
{

View File

@@ -20,7 +20,7 @@ namespace launcher_client;
internal static partial class Launcher
{
private static FileLogger _fileLogger = new("launcher-logs", "launcher_client");
private static FileLogger _fileLogger = new("launcher-logs", "launcher-client");
private static ILogger logger = new CompositeLogger(
_fileLogger,
new ConsoleLogger());
@@ -50,7 +50,6 @@ internal static partial class Launcher
? LauncherConfig.CreateDefault()
: LauncherConfig.LoadFromFile();
DTLibInternalLogging.SetLogger(logger);
logger.DebugLogEnabled = debug;
logger.LogInfo("Main", "launcher is starting");
@@ -133,9 +132,9 @@ internal static partial class Launcher
FSP.DownloadByManifest("download_if_not_exist", Directory.GetCurrent());
FSP.DownloadByManifest("sync_always", Directory.GetCurrent(), true);
foreach (string dir in new DtsodV23(FSP
.DownloadFileToMemory("sync_and_remove\\dirlist.dtsod")
.DownloadFileToMemory(Path.Concat("sync_and_remove","dirlist.dtsod"))
.BytesToString())["dirs"])
FSP.DownloadByManifest("sync_and_remove\\" + dir,
FSP.DownloadByManifest(Path.Concat("sync_and_remove", dir),
Directory.GetCurrent() + '\\' + dir, true, true);
logger.LogInfo("Main", "client updated");
}
@@ -149,7 +148,7 @@ internal static partial class Launcher
config.GameWindowHeight,
Directory.GetCurrent());
logger.LogDebug("LaunchGame", gameOptions);
var gameProcess = Process.Start($"{config.JavaPath}\\java.exe", gameOptions);
var gameProcess = Process.Start(config.JavaPath.Str, gameOptions);
gameProcess.WaitForExit();
logger.LogInfo("Main", "minecraft closed");
}
@@ -202,7 +201,6 @@ internal static partial class Launcher
mainSocket.Close();
mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
FSP = new FSP(mainSocket);
FSP.debug = debug;
}
while (true)

View File

@@ -5,12 +5,12 @@ namespace launcher_client;
public class LauncherConfig
{
public static string ConfigFilePath = "launcher.dtsod";
public static IOPath ConfigFilePath = "minecraft-launcher.dtsod";
public int GameMemory = 3000;
public int GameWindowHeight = 500;
public int GameWindowWidth = 900;
public string JavaPath = "jre\\bin";
public IOPath JavaPath = "jre/bin/java.exe";
public string ServerAddress = "127.0.0.1";
public int ServerPort = 25000;
public string Username = "";
@@ -36,7 +36,7 @@ public class LauncherConfig
{ "gameMemory", GameMemory },
{ "gameWindowHeight", GameWindowHeight },
{ "gameWindowWidth", GameWindowWidth },
{ "javaPath", JavaPath },
{ "javaPath", JavaPath.Str },
{ "serverAddress", ServerAddress },
{ "serverPort", ServerPort },
{ "username", Username },

View File

@@ -13,8 +13,8 @@
<EmbeddedResource Include="gui\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DTLib.Dtsod" Version="1.3.0" />
<PackageReference Include="DTLib.Logging" Version="1.3.0" />
<PackageReference Include="DTLib.Network" Version="1.3.0" />
<PackageReference Include="DTLib.Dtsod" Version="1.3.1" />
<PackageReference Include="DTLib.Logging" Version="1.3.1" />
<PackageReference Include="DTLib.Network" Version="1.3.1" />
</ItemGroup>
</Project>

View File

@@ -1,8 +0,0 @@
gameMemory: "3000";
gameWindowWidth: "1600";
gameWindowHeight: "1000";
javaPath: "java\bin";
serverAddress: "127.0.0.1";
serverPort: 25000;
username: "";
uuid: "";