Skip to content

Commit c97f119

Browse files
Add support for multiple metadata data sources (#474)
1 parent 2d63a1c commit c97f119

File tree

126 files changed

+9613
-5332
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+9613
-5332
lines changed

.devcontainer/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
FROM mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm
22

3-
RUN apt-get update && apt-get install -y p7zip-full
4-
RUN mkdir -p /workspace/gaseous-server/wwwroot/emulators/EmulatorJS
5-
RUN wget https://cdn.emulatorjs.org/releases/4.0.12.7z
6-
RUN 7z x -y -o/workspace/gaseous-server/wwwroot/emulators/EmulatorJS 4.0.12.7z
3+
# update apt-get
4+
RUN apt-get update
5+
6+
# download and unzip EmulatorJS from CDN
7+
RUN apt-get install -y p7zip-full default-jdk nodejs wget
8+
RUN mkdir -p out/wwwroot/emulators/EmulatorJS
9+
RUN wget https://cdn.emulatorjs.org/releases/4.1.1.7z
10+
RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.1.1.7z

.devcontainer/devcontainer.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
33
{
4-
"name": "C# (.NET)",
4+
"name": "Gaseous C# (.NET)",
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
66
//"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm",
77
"dockerComposeFile": "docker-compose.yml",
88
"service": "development",
99
"workspaceFolder": "/workspace",
10-
1110
// Features to add to the dev container. More info: https://containers.dev/features.
1211
// "features": {},
13-
1412
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15-
"forwardPorts": [5198],
13+
"forwardPorts": [
14+
5198
15+
],
1616
"portsAttributes": {
17-
"5198": {
18-
"protocol": "http"
19-
}
17+
"5198": {
18+
"protocol": "http"
19+
}
2020
},
21-
2221
// Use 'postCreateCommand' to run commands after the container is created.
2322
"postCreateCommand": "dotnet restore",
24-
2523
// Configure tool-specific properties.
2624
"customizations": {
2725
"vscode": {
@@ -38,11 +36,12 @@
3836
"ms-dotnettools.vscodeintellicode-csharp",
3937
"Zignd.html-css-class-completion",
4038
"PWABuilder.pwa-studio",
41-
"ms-azuretools.vscode-docker"
39+
"ms-azuretools.vscode-docker",
40+
"SonarSource.sonarlint-vscode",
41+
"oderwat.indent-rainbow"
4242
]
4343
}
4444
}
45-
4645
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
4746
// "remoteUser": "root"
48-
}
47+
}

build/Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@ RUN dotnet restore "gaseous-server/gaseous-server.csproj" -a $TARGETARCH
1616
# Build and publish a release
1717
RUN dotnet publish "gaseous-server/gaseous-server.csproj" --use-current-runtime --self-contained true -c Release -o out -a $TARGETARCH
1818

19-
# Build Gaseous CLI
20-
# Restore as distinct layers
21-
RUN dotnet restore "gaseous-cli/gaseous-cli.csproj" -a $TARGETARCH
22-
# Build and publish a release
23-
RUN dotnet publish "gaseous-cli/gaseous-cli.csproj" --use-current-runtime --self-contained true -c Release -o out -a $TARGETARCH
24-
2519
# update apt-get
2620
RUN apt-get update
2721

28-
# # download and unzip EmulatorJS from CDN
22+
# download and unzip EmulatorJS from CDN
2923
RUN apt-get install -y p7zip-full
3024
RUN mkdir -p out/wwwroot/emulators/EmulatorJS
31-
RUN wget https://cdn.emulatorjs.org/releases/4.0.12.7z
32-
RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.0.12.7z
25+
RUN wget https://cdn.emulatorjs.org/releases/4.1.1.7z
26+
RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.1.1.7z
3327

3428
# clean up apt-get
3529
RUN apt-get clean && rm -rf /var/lib/apt/lists

build/Dockerfile-EmbeddedDB

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@ RUN dotnet restore "gaseous-server/gaseous-server.csproj" -a $TARGETARCH
1616
# Build and publish a release
1717
RUN dotnet publish "gaseous-server/gaseous-server.csproj" --use-current-runtime --self-contained true -c Release -o out -a $TARGETARCH
1818

19-
# Build Gaseous CLI
20-
# Restore as distinct layers
21-
RUN dotnet restore "gaseous-cli/gaseous-cli.csproj" -a $TARGETARCH
22-
# Build and publish a release
23-
RUN dotnet publish "gaseous-cli/gaseous-cli.csproj" --use-current-runtime --self-contained true -c Release -o out -a $TARGETARCH
24-
2519
# update apt-get
2620
RUN apt-get update
2721

28-
# # download and unzip EmulatorJS from CDN
22+
# download and unzip EmulatorJS from CDN
2923
RUN apt-get install -y p7zip-full
3024
RUN mkdir -p out/wwwroot/emulators/EmulatorJS
31-
RUN wget https://cdn.emulatorjs.org/releases/4.0.12.7z
32-
RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.0.12.7z
25+
RUN wget https://cdn.emulatorjs.org/releases/4.1.1.7z
26+
RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.1.1.7z
3327

3428
# Build runtime image
3529
FROM mcr.microsoft.com/dotnet/aspnet:8.0

gaseous-server/Classes/Bios.cs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.Runtime.InteropServices;
33
using System.Security.Cryptography;
4+
using gaseous_server.Classes.Metadata;
5+
using HasheousClient.Models.Metadata.IGDB;
46

57
namespace gaseous_server.Classes
68
{
@@ -11,6 +13,37 @@ public Bios()
1113

1214
}
1315

16+
public static void ImportBiosFile(string FilePath, Common.hashObject Hash, ref Dictionary<string, object> BiosFileInfo)
17+
{
18+
BiosFileInfo.Add("type", "bios");
19+
BiosFileInfo.Add("status", "notimported");
20+
21+
foreach (Classes.Bios.BiosItem biosItem in Classes.Bios.GetBios())
22+
{
23+
if (biosItem.Available == false)
24+
{
25+
if (biosItem.hash == Hash.md5hash)
26+
{
27+
string biosPath = Path.Combine(Config.LibraryConfiguration.LibraryFirmwareDirectory, biosItem.hash + ".bios");
28+
Logging.Log(Logging.LogType.Information, "Import BIOS File", " " + FilePath + " is a BIOS file - moving to " + biosPath);
29+
30+
File.Move(FilePath, biosItem.biosPath, true);
31+
32+
BiosFileInfo.Add("name", biosItem.filename);
33+
BiosFileInfo.Add("platform", Platforms.GetPlatform(biosItem.platformid));
34+
BiosFileInfo["status"] = "imported";
35+
}
36+
}
37+
else
38+
{
39+
if (biosItem.hash == Hash.md5hash)
40+
{
41+
BiosFileInfo["status"] = "duplicate";
42+
}
43+
}
44+
}
45+
}
46+
1447
public static void MigrateToNewFolderStructure()
1548
{
1649
// migrate from old BIOS file structure which had each bios file inside a folder named for the platform to the new structure which has each file in a subdirectory named after the MD5 hash
@@ -94,7 +127,7 @@ private static List<BiosItem> BuildBiosList()
94127
{
95128
if (platformMapping.Bios != null)
96129
{
97-
IGDB.Models.Platform platform = Metadata.Platforms.GetPlatform(platformMapping.IGDBId);
130+
Platform platform = Metadata.Platforms.GetPlatform(platformMapping.IGDBId);
98131

99132
foreach (Models.PlatformMapping.PlatformMapItem.EmulatorBiosItem emulatorBios in platformMapping.Bios)
100133
{

0 commit comments

Comments
 (0)