Loading GarrigueGamesLauncher/Services/GameImporterService.cs +10 −5 Original line number Diff line number Diff line Loading @@ -41,8 +41,7 @@ public class GameImporterService( FileTypeFilter = [ZipFilter] }; public static readonly string TempDirPath = Path.Join(Path.GetTempPath(), "GarrigueGamesImport"); private static readonly string DataFilePath = Path.Join(TempDirPath, "data.json"); private static readonly string TempDirPath = Path.Join(Path.GetTempPath(), "GarrigueGamesImport"); private static readonly Regex ImageRegex = new(@"^image\/(jpeg|png|webp)$", RegexOptions.IgnoreCase); Loading Loading @@ -100,21 +99,26 @@ public class GameImporterService( /// <returns>True if the game was successfully imported; otherwise, false.</returns> private async Task<bool> ImportGameAsync(IStorageFile file) { string zipPath = HttpUtility.UrlDecode(file.Path.AbsolutePath); var result = await Unzip(zipPath, TempDirPath); var zipPath = HttpUtility.UrlDecode(file.Path.AbsolutePath); var targetPath = Path.Join(TempDirPath, Guid.NewGuid().ToString()); var result = await Unzip(zipPath, targetPath); if (result.IsFailure) { _ = EnqueueImportErrorMessage(file, result.Error!); return false; } result = await ProcessImportedZip(TempDirPath); result = await ProcessImportedZip(targetPath); if (result.IsFailure) { _ = EnqueueImportErrorMessage(file, result.Error!); return false; } // Clean up in Temp if (Directory.Exists(targetPath)) Directory.Delete(targetPath, true); return true; } Loading Loading @@ -314,6 +318,7 @@ public class GameImporterService( { if (!ImageRegex.IsMatch(medium.MediaType)) continue; // imgData downloads a JPEG, we can enforce the extension var imgPath = $"img/{medium.AttachmentId}.jpeg"; var imgData = await kafeService.GetImageBytesAsync(medium.AttachmentId, Resolution.Original); if (imgData == null) continue; Loading Loading
GarrigueGamesLauncher/Services/GameImporterService.cs +10 −5 Original line number Diff line number Diff line Loading @@ -41,8 +41,7 @@ public class GameImporterService( FileTypeFilter = [ZipFilter] }; public static readonly string TempDirPath = Path.Join(Path.GetTempPath(), "GarrigueGamesImport"); private static readonly string DataFilePath = Path.Join(TempDirPath, "data.json"); private static readonly string TempDirPath = Path.Join(Path.GetTempPath(), "GarrigueGamesImport"); private static readonly Regex ImageRegex = new(@"^image\/(jpeg|png|webp)$", RegexOptions.IgnoreCase); Loading Loading @@ -100,21 +99,26 @@ public class GameImporterService( /// <returns>True if the game was successfully imported; otherwise, false.</returns> private async Task<bool> ImportGameAsync(IStorageFile file) { string zipPath = HttpUtility.UrlDecode(file.Path.AbsolutePath); var result = await Unzip(zipPath, TempDirPath); var zipPath = HttpUtility.UrlDecode(file.Path.AbsolutePath); var targetPath = Path.Join(TempDirPath, Guid.NewGuid().ToString()); var result = await Unzip(zipPath, targetPath); if (result.IsFailure) { _ = EnqueueImportErrorMessage(file, result.Error!); return false; } result = await ProcessImportedZip(TempDirPath); result = await ProcessImportedZip(targetPath); if (result.IsFailure) { _ = EnqueueImportErrorMessage(file, result.Error!); return false; } // Clean up in Temp if (Directory.Exists(targetPath)) Directory.Delete(targetPath, true); return true; } Loading Loading @@ -314,6 +318,7 @@ public class GameImporterService( { if (!ImageRegex.IsMatch(medium.MediaType)) continue; // imgData downloads a JPEG, we can enforce the extension var imgPath = $"img/{medium.AttachmentId}.jpeg"; var imgData = await kafeService.GetImageBytesAsync(medium.AttachmentId, Resolution.Original); if (imgData == null) continue; Loading