feat: updated EmulatorJS to v4.0.5 (#36)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -25,6 +26,39 @@ namespace gaseous_server.Controllers
|
||||
return Classes.Bios.GetBios(PlatformId, AvailableOnly);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpHead]
|
||||
[Route("zip/{PlatformId}")]
|
||||
[ProducesResponseType(typeof(FileStreamResult), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult GetBiosCompressed(long PlatformId)
|
||||
{
|
||||
try
|
||||
{
|
||||
IGDB.Models.Platform platform = Classes.Metadata.Platforms.GetPlatform(PlatformId);
|
||||
|
||||
string biosPath = Path.Combine(gaseous_tools.Config.LibraryConfiguration.LibraryBIOSDirectory, platform.Slug);
|
||||
|
||||
string tempFile = Path.GetTempFileName();
|
||||
|
||||
using (FileStream zipFile = System.IO.File.Create(tempFile))
|
||||
using (var zipArchive = new ZipArchive(zipFile, ZipArchiveMode.Create))
|
||||
{
|
||||
foreach (string file in Directory.GetFiles(biosPath))
|
||||
{
|
||||
zipArchive.CreateEntryFromFile(file, Path.GetFileName(file));
|
||||
}
|
||||
}
|
||||
|
||||
var stream = new FileStream(tempFile, FileMode.Open);
|
||||
return File(stream, "application/zip", platform.Slug + ".zip");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpHead]
|
||||
[Route("{PlatformId}/{BiosName}")]
|
||||
|
Reference in New Issue
Block a user