PathCombine 통합 작업

This commit is contained in:
2025-09-05 20:43:59 +09:00
parent 513d841f80
commit 1d19e21bb2
8 changed files with 56 additions and 85 deletions

View File

@@ -5,55 +5,27 @@ namespace CommonLibrary
{ {
public static class Extensions public static class Extensions
{ {
//TODO: 제거후 PathCombine 에 통합 /// <summary>경로를 일관된 포맷으로 변경</summary>
public static string PathCombineL(params string[] paths) /// <param name="paths">경로 리스트들</param>
/// <returns>폴더 구분자가 / 로 일관되게 변경된 경로</returns>
public static string PathCombine(params string[] paths)
{ {
var directorySeparatorChar = System.IO.Path.AltDirectorySeparatorChar.ToString(); if (paths == null || paths.Length == 0)
return PathCombine(directorySeparatorChar, paths).Replace("\\", "/"); return string.Empty;
}
//TODO: 제거예정 var sb = new StringBuilder();
public static string PathCombineW(params string[] paths) for (int i = 0; i < paths.Length; i++)
{ {
var directorySeparatorChar = System.IO.Path.DirectorySeparatorChar.ToString(); if (string.IsNullOrEmpty(paths[i]))
return PathCombine(directorySeparatorChar, paths).Replace("/", "\\"); continue;
}
static string PathCombine(string directorySeparator, params string[] paths) var part = paths[i].Replace("\\", "/").Trim('/');
{ if (sb.Length > 0)
if (paths.Length == 0) return string.Empty; sb.Append('/');
var path = new StringBuilder(); sb.Append(part);
path.Append(paths[0]);
for (int i = 1; i < paths.Length; i++)
{
if (path.ToString().Substring(path.Length - 1, 1) == directorySeparator)
{
if (paths[i].Substring(0, 1) == directorySeparator)
{
path.Append(paths[i].Substring(1, paths[i].Length - 1));
} }
else return sb.ToString();
{
path.Append(paths[i]);
}
}
else
{
if (paths[i].Substring(0, 1) == directorySeparator)
{
path.Append(paths[i]);
}
else
{
path.Append(directorySeparator);
path.Append(paths[i]);
}
}
}
return path.ToString();
} }
public static bool IsDefault<T>(ref this T data) where T : struct public static bool IsDefault<T>(ref this T data) where T : struct

View File

@@ -31,7 +31,7 @@ namespace Mitria_Minecraft_Launcher
List<DirectoryInfo> directoryInfos = new List<DirectoryInfo>(); List<DirectoryInfo> directoryInfos = new List<DirectoryInfo>();
foreach (string directory in directorys) foreach (string directory in directorys)
{ {
System.IO.DirectoryInfo directoryInfo = new DirectoryInfo(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory,Settings.NowProfile.ServerName, directory)); System.IO.DirectoryInfo directoryInfo = new DirectoryInfo(CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory,Settings.NowProfile.ServerName, directory));
directoryInfos.Add(directoryInfo); directoryInfos.Add(directoryInfo);
} }
return GetLocalFileList(directoryInfos); return GetLocalFileList(directoryInfos);
@@ -53,7 +53,7 @@ namespace Mitria_Minecraft_Launcher
foreach (var file in files) foreach (var file in files)
{ {
FileDetail fileDetail = new FileDetail(); FileDetail fileDetail = new FileDetail();
fileDetail.Directory = file.DirectoryName.Replace(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName) + "\\", "").Replace("\\", "/"); fileDetail.Directory = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName);
fileDetail.FileName = file.Name; fileDetail.FileName = file.Name;
fileDetail.FileSize = file.Length; fileDetail.FileSize = file.Length;
fileDetail.HashCode = GetFileHash(file); fileDetail.HashCode = GetFileHash(file);

View File

@@ -169,7 +169,7 @@ namespace Mitria_Minecraft_Launcher
Settings.SaveUserLauncherConfig(); Settings.SaveUserLauncherConfig();
Settings.SaveUserClientVersion(); Settings.SaveUserClientVersion();
string runtime = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.RuntimeLocation , Settings.NowProfile.ServerName, "\\bin\\javaw.exe")); string runtime = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombine(Settings.RuntimeLocation , Settings.NowProfile.ServerName, "/bin/javaw.exe"));
if (!System.IO.File.Exists(runtime)) if (!System.IO.File.Exists(runtime))
{ {
CommonLibrary.Log.FATAL("not found java"); CommonLibrary.Log.FATAL("not found java");
@@ -178,11 +178,11 @@ namespace Mitria_Minecraft_Launcher
Settings.NowProfile.RuntimeVersion = "0.0.0.0"; // 버전초기화 Settings.NowProfile.RuntimeVersion = "0.0.0.0"; // 버전초기화
return; return;
} }
string excuteArgumentXml = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, @"\Mitria\ExcuteArgument.xml"); string excuteArgumentXml = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, @"/Mitria/ExcuteArgument.xml");
ExcuteArgument excuteArgument = CommonLibrary.XmlSystem.LoadFromPath<ExcuteArgument>(excuteArgumentXml); ExcuteArgument excuteArgument = CommonLibrary.XmlSystem.LoadFromPath<ExcuteArgument>(excuteArgumentXml);
List<Parameter> launcherParameters = new List<Parameter>(); List<Parameter> launcherParameters = new List<Parameter>();
launcherParameters.Add(new Parameter("GameDirectory", "\"" + CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName) + "\"")); launcherParameters.Add(new Parameter("GameDirectory", CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName) ));
launcherParameters.Add(new Parameter("argument", Settings.NowProfile.Argument)); launcherParameters.Add(new Parameter("argument", Settings.NowProfile.Argument));
launcherParameters.Add(new Parameter("userName", Settings.UserLauncherConfig.MinecraftPlayerName)); launcherParameters.Add(new Parameter("userName", Settings.UserLauncherConfig.MinecraftPlayerName));
launcherParameters.Add(new Parameter("uuid", "uuid")); launcherParameters.Add(new Parameter("uuid", "uuid"));
@@ -199,7 +199,7 @@ namespace Mitria_Minecraft_Launcher
CreateNoWindow = true, CreateNoWindow = true,
Arguments = argumentsCommand, Arguments = argumentsCommand,
UseShellExecute = Settings.UserLauncherConfig.ShellView, UseShellExecute = Settings.UserLauncherConfig.ShellView,
WorkingDirectory = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory , Settings.NowProfile.ServerName), WorkingDirectory = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory , Settings.NowProfile.ServerName),
}; };
process.StartInfo = processStartInfo; process.StartInfo = processStartInfo;
@@ -239,7 +239,7 @@ namespace Mitria_Minecraft_Launcher
private string ReportCheck(DateTime criteriaDateTime) private string ReportCheck(DateTime criteriaDateTime)
{ {
string crashDirectory = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfigPath, "crash-reports"); string crashDirectory = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfigPath, "crash-reports");
string lastFileName = string.Empty; string lastFileName = string.Empty;
if (System.IO.Directory.Exists(crashDirectory)) if (System.IO.Directory.Exists(crashDirectory))
{ {

View File

@@ -24,7 +24,7 @@ namespace Mitria_Minecraft_Launcher
DialogResult result = folderBrowserDialog.ShowDialog(); DialogResult result = folderBrowserDialog.ShowDialog();
if(result == DialogResult.OK) if(result == DialogResult.OK)
{ {
textBox_GameDirectory.Text = CommonLibrary.Extensions.PathCombineW(folderBrowserDialog.SelectedPath,"Mitria"); textBox_GameDirectory.Text = CommonLibrary.Extensions.PathCombine(folderBrowserDialog.SelectedPath,"Mitria");
} }
} }

View File

@@ -88,12 +88,12 @@ namespace Mitria_Minecraft_Launcher
if (!existence) if (!existence)
{ {
newList.Remove(Settings.UserLauncherConfig.Profiles[i]); newList.Remove(Settings.UserLauncherConfig.Profiles[i]);
string path = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.UserLauncherConfig.Profiles[i].ServerName); string path = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.UserLauncherConfig.Profiles[i].ServerName);
if (File.Exists(path)) if (File.Exists(path))
{ {
Directory.Delete(path, true); Directory.Delete(path, true);
} }
path = CommonLibrary.Extensions.PathCombineW(Settings.CustomDataDirectory, Settings.UserLauncherConfig.Profiles[i].ServerName); path = CommonLibrary.Extensions.PathCombine(Settings.CustomDataDirectory, Settings.UserLauncherConfig.Profiles[i].ServerName);
if (System.IO.Directory.Exists(path)) if (System.IO.Directory.Exists(path))
{ {
System.IO.Directory.Delete(path, true); System.IO.Directory.Delete(path, true);

View File

@@ -116,7 +116,7 @@ namespace Mitria_Minecraft_Launcher
} }
public static void LoadUserClientVersion() public static void LoadUserClientVersion()
{ {
string path = CommonLibrary.Extensions.PathCombineW(UserLauncherConfig.GameDirectory, NowProfile.ServerName, UserClientVersionPath); string path = CommonLibrary.Extensions.PathCombine(UserLauncherConfig.GameDirectory, NowProfile.ServerName, UserClientVersionPath);
if (System.IO.File.Exists(path)) if (System.IO.File.Exists(path))
{ {
UserClientVersion = CommonLibrary.XmlSystem.LoadFromPath<ClientVersion>(path); UserClientVersion = CommonLibrary.XmlSystem.LoadFromPath<ClientVersion>(path);
@@ -134,7 +134,7 @@ namespace Mitria_Minecraft_Launcher
public static void SaveUserClientVersion() public static void SaveUserClientVersion()
{ {
string path = CommonLibrary.Extensions.PathCombineW(UserLauncherConfig.GameDirectory, NowProfile.ServerName, UserClientVersionPath); string path = CommonLibrary.Extensions.PathCombine(UserLauncherConfig.GameDirectory, NowProfile.ServerName, UserClientVersionPath);
string pathDirectory = System.IO.Path.GetDirectoryName(path); string pathDirectory = System.IO.Path.GetDirectoryName(path);
if (!System.IO.Directory.Exists(pathDirectory)) if (!System.IO.Directory.Exists(pathDirectory))
{ {

View File

@@ -27,7 +27,7 @@ namespace Mitria_Minecraft_Launcher.Updater
// Version File Download // Version File Download
CommonLibrary.Log.INFO("download version file."); CommonLibrary.Log.INFO("download version file.");
var verionData = downloader.DownloadString(CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, "Servers", Settings.NowProfile.ServerName, Settings.ServerDataPatchInformationFile)); var verionData = downloader.DownloadString(CommonLibrary.Extensions.PathCombine(Settings.ServerBaseUrl, "Servers", Settings.NowProfile.ServerName, Settings.ServerDataPatchInformationFile));
// Versoin File 받기에 실패하였을때 업데이트 전체 실패처리 // Versoin File 받기에 실패하였을때 업데이트 전체 실패처리
if (verionData == string.Empty) if (verionData == string.Empty)
@@ -74,7 +74,7 @@ namespace Mitria_Minecraft_Launcher.Updater
CommonLibrary.Log.INFO("Runtime delete it for update."); CommonLibrary.Log.INFO("Runtime delete it for update.");
// 런타임 폴더 경로 가져오기 // 런타임 폴더 경로 가져오기
var rootDirectoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.RuntimeLocation, Settings.NowProfile.ServerName))); var rootDirectoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombine(Settings.RuntimeLocation, Settings.NowProfile.ServerName)));
// 런타임 폴더 삭제후 새로만들기 // 런타임 폴더 삭제후 새로만들기
if (!rootDirectoryInfo.Exists) if (!rootDirectoryInfo.Exists)
@@ -93,7 +93,7 @@ namespace Mitria_Minecraft_Launcher.Updater
// 런타임 다운로드 시작 // 런타임 다운로드 시작
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 2, 9, "[2/9] Runtime Download")); GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 2, 9, "[2/9] Runtime Download"));
Log.INFO("[Runtime] Data Download Start"); Log.INFO("[Runtime] Data Download Start");
var downloadUrl = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, "Servers", Settings.NowProfile.ServerName, dataPatchInformation.RuntimeUrl, dataPatchInformation.RuntimeFileName); var downloadUrl = CommonLibrary.Extensions.PathCombine(Settings.ServerBaseUrl, "Servers", Settings.NowProfile.ServerName, dataPatchInformation.RuntimeUrl, dataPatchInformation.RuntimeFileName);
var targetPath = System.IO.Path.Combine(tempDirectory, dataPatchInformation.RuntimeFileName); // 임시폴더에 다운로드 var targetPath = System.IO.Path.Combine(tempDirectory, dataPatchInformation.RuntimeFileName); // 임시폴더에 다운로드
downloader.DownloadFile(downloadUrl, targetPath); downloader.DownloadFile(downloadUrl, targetPath);
Log.INFO("[Runtime] Data Download End"); Log.INFO("[Runtime] Data Download End");
@@ -150,14 +150,14 @@ namespace Mitria_Minecraft_Launcher.Updater
CommonLibrary.Log.INFO("[Package] update."); CommonLibrary.Log.INFO("[Package] update.");
} }
// 패키지 다운로드 // 패키지 다운로드
var downloadUrl = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, "Servers", Settings.NowProfile.ServerName, dataPatchInformation.PackageUrl, dataPatchInformation.PackageFileName); var downloadUrl = CommonLibrary.Extensions.PathCombine(Settings.ServerBaseUrl, "Servers", Settings.NowProfile.ServerName, dataPatchInformation.PackageUrl, dataPatchInformation.PackageFileName);
var targetPath = System.IO.Path.Combine(tempDirectory, dataPatchInformation.PackageFileName); var targetPath = System.IO.Path.Combine(tempDirectory, dataPatchInformation.PackageFileName);
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 5, 9, "[5/9] Package Download")); GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 5, 9, "[5/9] Package Download"));
Log.INFO("[Package] Download Start"); Log.INFO("[Package] Download Start");
downloader.DownloadFile(downloadUrl, targetPath); downloader.DownloadFile(downloadUrl, targetPath);
Log.INFO("[Package] Download End"); Log.INFO("[Package] Download End");
var rootDirectoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName))); var rootDirectoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName)));
if (!rootDirectoryInfo.Exists) if (!rootDirectoryInfo.Exists)
{ {
@@ -168,7 +168,7 @@ namespace Mitria_Minecraft_Launcher.Updater
{ {
Log.INFO("[Package] Empty GameDirectory Start"); Log.INFO("[Package] Empty GameDirectory Start");
// 비우기 전에 스크린샷폴더 보존 /screenshots // 비우기 전에 스크린샷폴더 보존 /screenshots
string oldScreenshotsDirectory = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, "screenshots"); string oldScreenshotsDirectory = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, "screenshots");
string newScreenshotsDirectory = System.IO.Path.GetFullPath("screenshots_" + DateTime.Now.ToString("yyyyMMddHHmmss")); string newScreenshotsDirectory = System.IO.Path.GetFullPath("screenshots_" + DateTime.Now.ToString("yyyyMMddHHmmss"));
if (System.IO.Directory.Exists(oldScreenshotsDirectory) && System.IO.Directory.GetFiles(oldScreenshotsDirectory, "*", System.IO.SearchOption.AllDirectories).Length > 0) if (System.IO.Directory.Exists(oldScreenshotsDirectory) && System.IO.Directory.GetFiles(oldScreenshotsDirectory, "*", System.IO.SearchOption.AllDirectories).Length > 0)
{ {
@@ -189,7 +189,7 @@ namespace Mitria_Minecraft_Launcher.Updater
// 리스트에 있는 디렉토리와 파일 삭제 // 리스트에 있는 디렉토리와 파일 삭제
foreach (var item in list) foreach (var item in list)
{ {
string target = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, item.Name); string target = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, item.Name);
if (item.IsDirectory) if (item.IsDirectory)
{ {
Extensions.DeleteDirectory(target); Extensions.DeleteDirectory(target);
@@ -250,7 +250,7 @@ namespace Mitria_Minecraft_Launcher.Updater
} }
foreach (var directory in resultDirectorys) foreach (var directory in resultDirectorys)
{ {
var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, directory)); var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombine (Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, directory));
if (System.IO.Directory.Exists(directoryPath)) if (System.IO.Directory.Exists(directoryPath))
{ {
@@ -261,17 +261,16 @@ namespace Mitria_Minecraft_Launcher.Updater
var reverseDirectorys = dataPatchInformation.ComponentDirectorys; var reverseDirectorys = dataPatchInformation.ComponentDirectorys;
reverseDirectorys.Reverse(); reverseDirectorys.Reverse();
string gameDirectory = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName) + "\\"; string gameDirectory = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName);
foreach (var directory in reverseDirectorys) foreach (var directory in reverseDirectorys)
{ {
var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, directory)); var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, directory));
if (System.IO.Directory.Exists(directoryPath)) if (System.IO.Directory.Exists(directoryPath))
{ {
var lowDirectorys = System.IO.Directory.GetDirectories(directoryPath); var lowDirectorys = System.IO.Directory.GetDirectories(directoryPath);
foreach (var lowDirectory in lowDirectorys) foreach (var lowDirectory in lowDirectorys)
{ {
var directoryName = lowDirectory.Replace(gameDirectory, string.Empty); var directoryName = lowDirectory.Replace(gameDirectory, string.Empty);
directoryName = directoryName.Replace("\\", "/");
if (!dataPatchInformation.ComponentDirectorys.Contains(directoryName)) if (!dataPatchInformation.ComponentDirectorys.Contains(directoryName))
{ {
System.IO.Directory.Delete(lowDirectory, true); System.IO.Directory.Delete(lowDirectory, true);
@@ -283,7 +282,7 @@ namespace Mitria_Minecraft_Launcher.Updater
foreach (var directory in dataPatchInformation.ComponentDirectorys) foreach (var directory in dataPatchInformation.ComponentDirectorys)
{ {
var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, directory)); var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, directory));
if (!System.IO.Directory.Exists(directoryPath)) if (!System.IO.Directory.Exists(directoryPath))
{ {
@@ -301,7 +300,7 @@ namespace Mitria_Minecraft_Launcher.Updater
foreach (var fileDetail in removeFiles) foreach (var fileDetail in removeFiles)
{ {
var filePath = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, fileDetail.Directory, fileDetail.FileName); var filePath = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, fileDetail.Directory, fileDetail.FileName);
FileInfo fileInfo = new FileInfo(filePath); FileInfo fileInfo = new FileInfo(filePath);
fileInfo.IsReadOnly = false; fileInfo.IsReadOnly = false;
if (fileInfo.Exists) if (fileInfo.Exists)
@@ -315,8 +314,8 @@ namespace Mitria_Minecraft_Launcher.Updater
Log.INFO("[Component] Download Start"); Log.INFO("[Component] Download Start");
for (int i = 0; i < needFiles.Count; i++) for (int i = 0; i < needFiles.Count; i++)
{ {
var url = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, "Servers", Settings.NowProfile.ServerName, dataPatchInformation.ComponentUrl, needFiles[i].Directory, needFiles[i].FileName); var url = CommonLibrary.Extensions.PathCombine(Settings.ServerBaseUrl, "Servers", Settings.NowProfile.ServerName, dataPatchInformation.ComponentUrl, needFiles[i].Directory, needFiles[i].FileName);
var path = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, needFiles[i].Directory, needFiles[i].FileName); var path = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, needFiles[i].Directory, needFiles[i].FileName);
downloader.DownloadFile(url, path); downloader.DownloadFile(url, path);
Log.INFO("[Component] +[F] " + path); Log.INFO("[Component] +[F] " + path);
} }
@@ -332,27 +331,27 @@ namespace Mitria_Minecraft_Launcher.Updater
// 삭제된 파일 찾기 // 삭제된 파일 찾기
string rootCustomPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.CustomDataDirectory, Settings.NowProfile.ServerName)); string rootCustomPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombine(Settings.CustomDataDirectory, Settings.NowProfile.ServerName));
if (!System.IO.Directory.Exists(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "config"))) if (!System.IO.Directory.Exists(CommonLibrary.Extensions.PathCombine(rootCustomPath, "config")))
{ {
System.IO.Directory.CreateDirectory(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "config")); System.IO.Directory.CreateDirectory(CommonLibrary.Extensions.PathCombine(rootCustomPath, "config"));
} }
if (!System.IO.Directory.Exists(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "mods"))) if (!System.IO.Directory.Exists(CommonLibrary.Extensions.PathCombine(rootCustomPath, "mods")))
{ {
System.IO.Directory.CreateDirectory(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "mods")); System.IO.Directory.CreateDirectory(CommonLibrary.Extensions.PathCombine(rootCustomPath, "mods"));
} }
List<string> files = new List<string>(); List<string> files = new List<string>();
files.AddRange(System.IO.Directory.GetFiles(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "config"))); files.AddRange(System.IO.Directory.GetFiles(CommonLibrary.Extensions.PathCombine(rootCustomPath, "config")));
files.AddRange(System.IO.Directory.GetFiles(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "mods"))); files.AddRange(System.IO.Directory.GetFiles(CommonLibrary.Extensions.PathCombine(rootCustomPath, "mods")));
for (int i = 0; i < files.Count; i++) for (int i = 0; i < files.Count; i++)
{ {
files[i] = files[i].Replace(rootCustomPath + '\\', string.Empty); files[i] = files[i].Replace(rootCustomPath + '/', string.Empty);
} }
foreach (var file in files) foreach (var file in files)
{ {
string sourcePath = CommonLibrary.Extensions.PathCombineW(rootCustomPath, file); string sourcePath = CommonLibrary.Extensions.PathCombine(rootCustomPath, file);
string targetPath = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, file); string targetPath = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, file);
if (System.IO.File.Exists(targetPath)) if (System.IO.File.Exists(targetPath))
{ {

View File

@@ -37,15 +37,15 @@ namespace Mitria_Minecraft_Launcher.Updater
System.IO.Directory.CreateDirectory("temp"); System.IO.Directory.CreateDirectory("temp");
} }
string downloadUrl = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, launcherPatchInformation.LauncherUrl, launcherPatchInformation.LauncherFileName); string downloadUrl = CommonLibrary.Extensions.PathCombine(Settings.ServerBaseUrl, launcherPatchInformation.LauncherUrl, launcherPatchInformation.LauncherFileName);
string launcherPackFile = CommonLibrary.Extensions.PathCombineW(tempDirectory, launcherPatchInformation.LauncherFileName); string launcherPackFile = CommonLibrary.Extensions.PathCombine(tempDirectory, launcherPatchInformation.LauncherFileName);
downloader.DownloadFile(downloadUrl, launcherPackFile); downloader.DownloadFile(downloadUrl, launcherPackFile);
string launcherFile = System.Reflection.Assembly.GetExecutingAssembly().Location; string launcherFile = System.Reflection.Assembly.GetExecutingAssembly().Location;
string launcherPath = System.IO.Path.GetDirectoryName(launcherFile); string launcherPath = System.IO.Path.GetDirectoryName(launcherFile);
// 기존 파일 파일명 변경후 temp 디렉토리로 이전 // 기존 파일 파일명 변경후 temp 디렉토리로 이전
string oldLauncherFile = CommonLibrary.Extensions.PathCombineW(tempDirectory, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + "_old"); string oldLauncherFile = CommonLibrary.Extensions.PathCombine(tempDirectory, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + "_old");
System.IO.File.Move(launcherFile, oldLauncherFile); System.IO.File.Move(launcherFile, oldLauncherFile);
// 언패킹 과정 // 언패킹 과정