PathCombine 통합 작업
This commit is contained in:
@@ -27,7 +27,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
|
||||
// Version File Download
|
||||
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 받기에 실패하였을때 업데이트 전체 실패처리
|
||||
if (verionData == string.Empty)
|
||||
@@ -74,7 +74,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
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)
|
||||
@@ -93,7 +93,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
// 런타임 다운로드 시작
|
||||
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 2, 9, "[2/9] Runtime Download"));
|
||||
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); // 임시폴더에 다운로드
|
||||
downloader.DownloadFile(downloadUrl, targetPath);
|
||||
Log.INFO("[Runtime] Data Download End");
|
||||
@@ -150,14 +150,14 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
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);
|
||||
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 5, 9, "[5/9] Package Download"));
|
||||
Log.INFO("[Package] Download Start");
|
||||
downloader.DownloadFile(downloadUrl, targetPath);
|
||||
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)
|
||||
{
|
||||
@@ -168,7 +168,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
{
|
||||
Log.INFO("[Package] Empty GameDirectory Start");
|
||||
// 비우기 전에 스크린샷폴더 보존 /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"));
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
Extensions.DeleteDirectory(target);
|
||||
@@ -250,7 +250,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
}
|
||||
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))
|
||||
{
|
||||
@@ -261,17 +261,16 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
|
||||
var reverseDirectorys = dataPatchInformation.ComponentDirectorys;
|
||||
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)
|
||||
{
|
||||
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))
|
||||
{
|
||||
var lowDirectorys = System.IO.Directory.GetDirectories(directoryPath);
|
||||
foreach (var lowDirectory in lowDirectorys)
|
||||
{
|
||||
var directoryName = lowDirectory.Replace(gameDirectory, string.Empty);
|
||||
directoryName = directoryName.Replace("\\", "/");
|
||||
if (!dataPatchInformation.ComponentDirectorys.Contains(directoryName))
|
||||
{
|
||||
System.IO.Directory.Delete(lowDirectory, true);
|
||||
@@ -283,7 +282,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
|
||||
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))
|
||||
{
|
||||
@@ -301,7 +300,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
|
||||
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.IsReadOnly = false;
|
||||
if (fileInfo.Exists)
|
||||
@@ -315,8 +314,8 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
Log.INFO("[Component] Download Start");
|
||||
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 path = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, 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.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, needFiles[i].Directory, needFiles[i].FileName);
|
||||
downloader.DownloadFile(url, 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));
|
||||
if (!System.IO.Directory.Exists(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "config")))
|
||||
string rootCustomPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombine(Settings.CustomDataDirectory, Settings.NowProfile.ServerName));
|
||||
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>();
|
||||
files.AddRange(System.IO.Directory.GetFiles(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "config")));
|
||||
files.AddRange(System.IO.Directory.GetFiles(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "mods")));
|
||||
files.AddRange(System.IO.Directory.GetFiles(CommonLibrary.Extensions.PathCombine(rootCustomPath, "config")));
|
||||
files.AddRange(System.IO.Directory.GetFiles(CommonLibrary.Extensions.PathCombine(rootCustomPath, "mods")));
|
||||
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)
|
||||
{
|
||||
string sourcePath = CommonLibrary.Extensions.PathCombineW(rootCustomPath, file);
|
||||
string targetPath = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, file);
|
||||
string sourcePath = CommonLibrary.Extensions.PathCombine(rootCustomPath, file);
|
||||
string targetPath = CommonLibrary.Extensions.PathCombine(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, file);
|
||||
|
||||
if (System.IO.File.Exists(targetPath))
|
||||
{
|
||||
|
Reference in New Issue
Block a user