Update Module

- 백신 회피를 위한 런처 수정
This commit is contained in:
2023-02-10 17:20:25 +09:00
parent 3a35e53ec0
commit db5a1cff63
4 changed files with 55 additions and 25 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using CommonLibrary;
namespace Mitria_Minecraft_Launcher.Updater
@@ -22,6 +23,9 @@ namespace Mitria_Minecraft_Launcher.Updater
CommonLibrary.Log.INFO("Launcher Version : " + thisVersion);
CommonLibrary.Log.INFO("Remote Launcher Version : " + remoteVersion);
int result = remoteVersion.CompareTo(thisVersion);
#if DEBUG
result =1;
#endif
if (result <= 0)
{
CommonLibrary.Log.INFO("Version Same");
@@ -37,13 +41,24 @@ namespace Mitria_Minecraft_Launcher.Updater
}
string downloadUrl = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, launcherPatchInformation.LauncherUrl, launcherPatchInformation.LauncherFileName);
string newLauncherFile = CommonLibrary.Extensions.PathCombineW(tempDirectory, launcherPatchInformation.LauncherFileName);
downloader.DownloadFile(downloadUrl, newLauncherFile);
string launcherFile = System.Reflection.Assembly.GetExecutingAssembly().Location;
string oldLauncherFile = CommonLibrary.Extensions.PathCombineW(tempDirectory, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + "_old");
string launcherPackFile = CommonLibrary.Extensions.PathCombineW(tempDirectory, launcherPatchInformation.LauncherFileName);
downloader.DownloadFile(downloadUrl, launcherPackFile);
string launcherFile = System.Reflection.Assembly.GetExecutingAssembly().Location;
string launcherPath = System.IO.Path.GetDirectoryName(launcherFile);
// 기존 파일 파일명 변경후 temp 디렉토리로 이전
string oldLauncherFile = CommonLibrary.Extensions.PathCombineW(tempDirectory, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + "_old");
System.IO.File.Move(launcherFile, oldLauncherFile);
System.IO.File.Move(newLauncherFile, launcherFile);
// 언패킹 과정
var progressPacker = new ProgressPacker();
Log.INFO("[Launcher] Unpack Start");
progressPacker.UnPack(launcherPackFile, launcherPath, null);
Log.INFO("[Launcher] Unpack Done");
//System.IO.File.Move(newLauncherFile, launcherFile);
return LauncherUpdateStatus.Update;
}
}