diff --git a/SCTools/SCTool_Redesigned/Properties/AssemblyInfo.cs b/SCTools/SCTool_Redesigned/Properties/AssemblyInfo.cs index 2f0adf8..619aff6 100644 --- a/SCTools/SCTool_Redesigned/Properties/AssemblyInfo.cs +++ b/SCTools/SCTool_Redesigned/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 // 기본값으로 할 수 있습니다. // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.4.0")] -[assembly: AssemblyFileVersion("1.3.4.0")] +[assembly: AssemblyVersion("1.3.4.1")] +[assembly: AssemblyFileVersion("1.3.4.1")] diff --git a/SCTools/SCTool_Redesigned/Update/CustomApplicationUpdater.cs b/SCTools/SCTool_Redesigned/Update/CustomApplicationUpdater.cs index 5663c35..6031aac 100644 --- a/SCTools/SCTool_Redesigned/Update/CustomApplicationUpdater.cs +++ b/SCTools/SCTool_Redesigned/Update/CustomApplicationUpdater.cs @@ -69,10 +69,10 @@ public CustomApplicationUpdater(IUpdateRepository updateRepository, string execu _updateScriptPath = Path.Combine(_executableDir, "update.bat"); _updatesStoragePath = Path.Combine(_executableDir, "updates"); _schedInstallArchivePath = Path.Combine(_updatesStoragePath, "latest.zip"); - _schedInstallExecutablePath = Path.Combine(_updatesStoragePath, "shatagon.exe"); + _schedInstallExecutablePath = Path.Combine(_updatesStoragePath, "Shatagon.exe"); _schedInstallJsonPath = Path.Combine(_updatesStoragePath, "latest.json"); _installUnpackedDir = Path.Combine(_updatesStoragePath, "latest"); - _installUnpackedExecutablePath = Path.Combine(_updatesStoragePath, "latest", "shatagon.exe"); + _installUnpackedExecutablePath = Path.Combine(_updatesStoragePath, "latest", "Shatagon.exe"); _currentVersion = _updateRepository.CurrentVersion; } @@ -147,11 +147,11 @@ public bool ScheduleInstallUpdate(UpdateInfo updateInfo, string filePath) { Directory.CreateDirectory(_updatesStoragePath); } - if (File.Exists(_schedInstallArchivePath)) + if (File.Exists(_schedInstallExecutablePath)) { - File.Delete(_schedInstallArchivePath); + File.Delete(_schedInstallExecutablePath); } - File.Move(filePath, _schedInstallArchivePath); + File.Move(filePath, _schedInstallExecutablePath); if (JsonHelper.WriteFile(_schedInstallJsonPath, updateInfo)) { _updateRepository.SetCurrentVersion(updateInfo.GetVersion()); @@ -176,8 +176,8 @@ public bool CancelScheduleInstallUpdate() _updateRepository.SetCurrentVersion(_currentVersion); if (File.Exists(_schedInstallJsonPath)) FileUtils.DeleteFileNoThrow(_schedInstallJsonPath); - return File.Exists(_schedInstallArchivePath) && - FileUtils.DeleteFileNoThrow(_schedInstallArchivePath); + return File.Exists(_schedInstallExecutablePath) && + FileUtils.DeleteFileNoThrow(_schedInstallExecutablePath); } public void RemoveUpdateScript() @@ -205,7 +205,7 @@ private bool ExtractUpdateScript() private bool ExtractReadyInstallUpdate() { var installUnpackedDir = new DirectoryInfo(_installUnpackedDir); - var extractTempDir = new DirectoryInfo(Path.Combine(_updatesStoragePath, "temp_" + Path.GetRandomFileName())); + //var extractTempDir = new DirectoryInfo(Path.Combine(_updatesStoragePath, "temp_" + Path.GetRandomFileName())); try { if (installUnpackedDir.Exists && !FileUtils.DeleteDirectoryNoThrow(installUnpackedDir, true)) @@ -214,14 +214,27 @@ private bool ExtractReadyInstallUpdate() return false; } + //updates/latest.zip + //updates/temp_random + //updates/lastest + // + + //using var archive = ZipFile.OpenRead(_schedInstallArchivePath); + + //extractTempDir.Create(); + //archive.ExtractToDirectory(extractTempDir.FullName); + //if (!_packageVerifier.VerifyPackage(extractTempDir.FullName)) + // throw new NotSupportedException("Not supported upgrade package"); + //Directory.Move(extractTempDir.FullName, _installUnpackedDir); + Directory.CreateDirectory(_installUnpackedDir); - File.Move(_schedInstallExecutablePath, _installUnpackedExecutablePath); + File.Copy(_schedInstallExecutablePath, _installUnpackedExecutablePath); } catch (Exception e) { _logger.Error(e, $"Failed extract update package to: {_installUnpackedDir}"); - if (extractTempDir.Exists) - FileUtils.DeleteDirectoryNoThrow(extractTempDir, true); + //if (extractTempDir.Exists) + // FileUtils.DeleteDirectoryNoThrow(extractTempDir, true); if (installUnpackedDir.Exists) FileUtils.DeleteDirectoryNoThrow(installUnpackedDir, true); return false; diff --git a/SCTools/SCTool_Redesigned/Update/CustomPackageVerifier.cs b/SCTools/SCTool_Redesigned/Update/CustomPackageVerifier.cs index bf12c92..1ae4442 100644 --- a/SCTools/SCTool_Redesigned/Update/CustomPackageVerifier.cs +++ b/SCTools/SCTool_Redesigned/Update/CustomPackageVerifier.cs @@ -10,8 +10,7 @@ internal class CustomPackageVerifier : CustomApplicationUpdater.IPackageVerifier public bool VerifyPackage(string path) { - if (!File.Exists(Path.Combine(path, $"{ExecutorName}.exe")) || - !File.Exists(Path.Combine(path, $"{ExecutorName}.exe.config"))) + if (!File.Exists(Path.Combine(path, $"{ExecutorName}.exe"))) { return false; }