86 lines
3.8 KiB
C#
86 lines
3.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Mitria_Minecraft_Launcher
|
|
{
|
|
public static class Settings
|
|
{
|
|
#pragma warning disable S1104 // Fields should not have public accessibility
|
|
#pragma warning disable S2223 // Non-constant static fields should not be visible
|
|
public static LauncherConfig UserLauncherConfig;
|
|
public static ClientVersion UserClientVersion;
|
|
|
|
|
|
public static readonly string UserLauncherConfigPath = "config.xml";
|
|
public static readonly string UserClientVersionPath = "version.xml"; // 위치 // 게임 디렉토리 +
|
|
public static readonly string CustomDataDirectory = "CustomData";
|
|
public static readonly string RuntimeLocation = "runtime";
|
|
#pragma warning disable S1075 // URIs should not be hardcoded
|
|
public static readonly string ServerBaseUrl = "http://mitria.kr/Patchdata";
|
|
#pragma warning restore S1075 // URIs should not be hardcoded
|
|
public static readonly string ServerLauncherPatchInformationFile = "/Launcher.xml";
|
|
public static readonly string ServerDataPatchInformationFile = "/Data.xml";
|
|
public static readonly string BaseArgument = @"-XX:+UseG1GC -Xmx8G -Xms8G -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M";
|
|
|
|
public static void LoadUserLauncherConfig()
|
|
{
|
|
string path = System.IO.Path.GetFullPath(UserLauncherConfigPath);
|
|
if (System.IO.File.Exists(path))
|
|
{
|
|
UserLauncherConfig = CommonLibrary.XMLSystem.LoadFromPath<LauncherConfig>(path);
|
|
}
|
|
else
|
|
{
|
|
UserLauncherConfig = new LauncherConfig();
|
|
UserLauncherConfig.MinecraftPlayerName = string.Empty;
|
|
UserLauncherConfig.Argument = Settings.BaseArgument;
|
|
UserLauncherConfig.GameDirectory = @"C:\Games\Mitria";
|
|
UserLauncherConfig.ShellView = false;
|
|
UserLauncherConfig.RuntimeVersion = "0.0.0.0";
|
|
UserLauncherConfig.CustomData = new List<string>();
|
|
}
|
|
}
|
|
|
|
public static void SaveUserLauncherConfig()
|
|
{
|
|
string path = System.IO.Path.GetFullPath(UserLauncherConfigPath);
|
|
string pathDirectory = System.IO.Path.GetDirectoryName(path);
|
|
if (!System.IO.Directory.Exists(pathDirectory))
|
|
{
|
|
System.IO.Directory.CreateDirectory(pathDirectory);
|
|
}
|
|
CommonLibrary.XMLSystem.Save(path, UserLauncherConfig);
|
|
}
|
|
|
|
public static void LoadUserClientVersion()
|
|
{
|
|
string path = CommonLibrary.Extensions.PathCombineW(UserLauncherConfig.GameDirectory, UserClientVersionPath);
|
|
if (System.IO.File.Exists(path))
|
|
{
|
|
UserClientVersion = CommonLibrary.XMLSystem.LoadFromPath<ClientVersion>(path);
|
|
}
|
|
else
|
|
{
|
|
UserClientVersion = new ClientVersion();
|
|
|
|
UserClientVersion.PackageVersion = "0.0.0.0";
|
|
UserClientVersion.PackageDirectorys = new List<string>();
|
|
UserClientVersion.ComponentVersion = "0.0.0.0";
|
|
UserClientVersion.ComponentDirectorys = new List<string>();
|
|
}
|
|
}
|
|
|
|
public static void SaveUserClientVersion()
|
|
{
|
|
string path = CommonLibrary.Extensions.PathCombineW(UserLauncherConfig.GameDirectory, UserClientVersionPath);
|
|
string pathDirectory = System.IO.Path.GetDirectoryName(path);
|
|
if (!System.IO.Directory.Exists(pathDirectory))
|
|
{
|
|
System.IO.Directory.CreateDirectory(pathDirectory);
|
|
}
|
|
CommonLibrary.XMLSystem.Save(path, UserClientVersion);
|
|
}
|
|
}
|
|
|
|
|
|
} |