Package 버전에 따라 무삭제 기능 추가 시작점

This commit is contained in:
2025-05-21 14:47:39 +09:00
parent ff52d49800
commit a00beb4efc

View File

@@ -124,6 +124,7 @@ namespace Mitria_Minecraft_Launcher.Updater
CommonLibrary.Log.INFO("[Package] LocalVersion : " + thisVersion);
CommonLibrary.Log.INFO("[Package] RemoteVersion : " + remoteVersion);
result = remoteVersion.CompareTo(thisVersion);
//TODO: 만약 Major 버전이 바뀌면 전부삭제, 아니면 있는 폴더면 선별후 삭제
// 1 : 리모트가 큼, 0 : 같음, -1 리모트가 적음
if (result == 0)
@@ -134,8 +135,19 @@ namespace Mitria_Minecraft_Launcher.Updater
{
CommonLibrary.Log
.INFO(string.Format("{0}", result == 1 ? "remote is the upper version" : "remote is the lower version"));
CommonLibrary.Log.INFO("[Package] delete it for update.");
bool packageInitialization = true;
if (thisVersion.Major < remoteVersion.Major ||
(thisVersion.Major == remoteVersion.Major && thisVersion.Minor < remoteVersion.Minor))
{
packageInitialization = false;
CommonLibrary.Log.INFO("[Package] update.");
}
else
{
CommonLibrary.Log.INFO("[Package] delete it for update.");
}
var rootDirectoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName)));
if (!rootDirectoryInfo.Exists)
@@ -270,7 +282,6 @@ namespace Mitria_Minecraft_Launcher.Updater
}
}
}
}
foreach (var directory in dataPatchInformation.ComponentDirectorys)
@@ -284,7 +295,6 @@ namespace Mitria_Minecraft_Launcher.Updater
}
}
var auditFile = new AuditFile();
var localFiles = auditFile.GetLocalFileList(dataPatchInformation.ComponentDirectorys);
var removeFiles = auditFile.GetRemoveFiles(localFiles, dataPatchInformation.ComponentList);
@@ -322,6 +332,7 @@ namespace Mitria_Minecraft_Launcher.Updater
// 커스텀 폴더, Config
#region CustomData
// 삭제된 파일 찾기
string rootCustomPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.CustomDataDirectory, Settings.NowProfile.ServerName));
@@ -339,7 +350,6 @@ namespace Mitria_Minecraft_Launcher.Updater
for (int i = 0; i < files.Count; i++)
{
files[i] = files[i].Replace(rootCustomPath + '\\', string.Empty);
}
foreach (var file in files)
@@ -347,7 +357,6 @@ namespace Mitria_Minecraft_Launcher.Updater
string sourcePath = CommonLibrary.Extensions.PathCombineW(rootCustomPath, file);
string targetPath = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, file);
if (System.IO.File.Exists(targetPath))
{
System.IO.FileInfo sourceFile = new System.IO.FileInfo(sourcePath);
@@ -356,7 +365,6 @@ namespace Mitria_Minecraft_Launcher.Updater
{
System.IO.File.Copy(sourcePath, targetPath, true);
Log.INFO("[CustomData] +[F] " + targetPath);
}
}
else
@@ -387,8 +395,10 @@ namespace Mitria_Minecraft_Launcher.Updater
GameUpdateManagerMessage?.Invoke(this, e);
}
}
}
public enum GameUpdateStatus
{
Success,
Fail