mirror of
https://github.com/gaseous-project/gaseous-server
synced 2026-04-21 13:27:16 +00:00
Move background processes out of process (#693)
Introduce the gaseous library and process host projects, enabling out-of-process execution and enhancing task management. Implemented versioning support for AgeGroupMap downloads and improved status reporting for background tasks. Refactored various components for better integration and error handling. Updated configurations for inter-process communication and task initialization.
This commit is contained in:
parent
1f854cc080
commit
9aa6be0494
318 changed files with 2947 additions and 2065 deletions
2
.github/scripts/generate_glossary_table.sh
vendored
2
.github/scripts/generate_glossary_table.sh
vendored
|
|
@ -7,7 +7,7 @@ set -euo pipefail
|
|||
# Falls back to hard-coded mapping if specific concept not represented as a direct key.
|
||||
|
||||
GLOSSARY_FILE="docs/Localisation-Glossary.md"
|
||||
LOCALE_DIR="gaseous-server/Support/Localisation"
|
||||
LOCALE_DIR="gaseous-lib/Support/Localisation"
|
||||
START_MARKER="<!-- GLOSSARY_TABLE_START -->"
|
||||
END_MARKER="<!-- GLOSSARY_TABLE_END -->"
|
||||
|
||||
|
|
|
|||
2
.github/scripts/generate_locale_table.sh
vendored
2
.github/scripts/generate_locale_table.sh
vendored
|
|
@ -6,7 +6,7 @@ set -euo pipefail
|
|||
# Requires: jq
|
||||
|
||||
DOC_FILE="docs/Localisation.md"
|
||||
LOCALE_DIR="gaseous-server/Support/Localisation"
|
||||
LOCALE_DIR="gaseous-lib/Support/Localisation"
|
||||
START_MARKER="<!-- LOCALE_TABLE_START -->"
|
||||
END_MARKER="<!-- LOCALE_TABLE_END -->"
|
||||
|
||||
|
|
|
|||
4
.github/workflows/language-coverage.yml
vendored
4
.github/workflows/language-coverage.yml
vendored
|
|
@ -7,7 +7,7 @@ permissions:
|
|||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'gaseous-server/Support/Localisation/*.json'
|
||||
- 'gaseous-lib/Support/Localisation/*.json'
|
||||
- '.github/workflows/language-coverage.yml'
|
||||
|
||||
jobs:
|
||||
|
|
@ -29,7 +29,7 @@ jobs:
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const locDir = path.join(process.env.GITHUB_WORKSPACE, 'gaseous-server/Support/Localisation');
|
||||
const locDir = path.join(process.env.GITHUB_WORKSPACE, 'gaseous-lib/Support/Localisation');
|
||||
const enPath = path.join(locDir, 'en.json');
|
||||
const en = JSON.parse(fs.readFileSync(enPath, 'utf8'));
|
||||
const enStrings = Object.keys(en.strings || {});
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ on:
|
|||
branches-ignore:
|
||||
- main
|
||||
paths:
|
||||
- 'gaseous-server/Support/Localisation/*.json'
|
||||
- 'gaseous-lib/Support/Localisation/*.json'
|
||||
- 'docs/Localisation.md'
|
||||
- 'docs/Localisation-Glossary.md'
|
||||
- '.github/scripts/generate_locale_table.sh'
|
||||
|
|
|
|||
17
.vscode/launch.json
vendored
17
.vscode/launch.json
vendored
|
|
@ -70,6 +70,23 @@
|
|||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
},
|
||||
{
|
||||
"name": "Process Host",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "full-rebuild",
|
||||
"program": "${workspaceFolder}/gaseous-processhost/bin/Debug/net10.0/gaseous-processhost.dll",
|
||||
"args": [
|
||||
"--service",
|
||||
"SignatureIngestor",
|
||||
"--reportingserver",
|
||||
"https://localhost:5197",
|
||||
"--correlationid",
|
||||
"00000000-0000-0000-0000-000000000000"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/gaseous-processhost",
|
||||
"stopAtEntry": false
|
||||
}
|
||||
]
|
||||
}
|
||||
5
.vscode/tasks.json
vendored
5
.vscode/tasks.json
vendored
|
|
@ -17,7 +17,7 @@
|
|||
"type": "process",
|
||||
"args": [
|
||||
"clean",
|
||||
"${workspaceFolder}/gaseous-server/gaseous-server.csproj",
|
||||
"${workspaceFolder}/Gaseous.sln",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
|
|
@ -49,7 +49,8 @@
|
|||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/gaseous-server/gaseous-server.csproj",
|
||||
"${workspaceFolder}/Gaseous.sln",
|
||||
"/t:Rebuild",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
|
|
|
|||
64
Gaseous.sln
64
Gaseous.sln
|
|
@ -27,28 +27,92 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "gaseous-configurator", "gas
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gaseous-server.Tests", "gaseous-server.Tests\gaseous-server.Tests.csproj", "{A476D629-DC6F-4C78-9084-8F910429AFB3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gaseous-processhost", "gaseous-processhost\gaseous-processhost.csproj", "{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gaseous-lib", "gaseous-lib\gaseous-lib.csproj", "{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Release|x64.Build.0 = Release|Any CPU
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}.Release|x86.Build.0 = Release|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Release|x64.Build.0 = Release|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{419CC4E4-8932-4E4A-B027-5521AA0CBA85}.Release|x86.Build.0 = Release|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Release|x64.Build.0 = Release|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{C6A3A0D2-76AA-4C14-9A7B-7A8E6D7C9A11}.Release|x86.Build.0 = Release|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A476D629-DC6F-4C78-9084-8F910429AFB3}.Release|x86.Build.0 = Release|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Release|x64.Build.0 = Release|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CFCDA316-2CBA-497D-87AC-EFB86E2705AE}.Release|x86.Build.0 = Release|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E6B7DDA6-BD74-436D-BAC5-8E42D1AC6E2F}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
2
docs
2
docs
|
|
@ -1 +1 @@
|
|||
Subproject commit f7962c29b6e0cfc12e915e01eb57bca8728be900
|
||||
Subproject commit 82d1a8b9394c8fd68ea0d7c7567aa340be34926d
|
||||
|
|
@ -24,6 +24,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\gaseous-server\gaseous-server.csproj" />
|
||||
<ProjectReference Include="../gaseous-lib/gaseous-lib.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@
|
|||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\gaseous-server\gaseous-server.csproj" />
|
||||
<ProjectReference Include="../gaseous-lib/gaseous-lib.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
982
gaseous-lib/Classes/Collections.cs
Normal file
982
gaseous-lib/Classes/Collections.cs
Normal file
|
|
@ -0,0 +1,982 @@
|
|||
// using System;
|
||||
// using System.Data;
|
||||
// using System.IO.Compression;
|
||||
// using System.Reflection;
|
||||
// using System.Runtime.InteropServices;
|
||||
// using System.Security.Cryptography;
|
||||
// using Authentication;
|
||||
// using gaseous_server.Classes.Metadata;
|
||||
// using gaseous_server.Controllers;
|
||||
// using gaseous_server.Controllers.v1_1;
|
||||
// using gaseous_server.Models;
|
||||
// using gaseous_server.Classes.Plugins.MetadataProviders.MetadataTypes;
|
||||
// using Microsoft.AspNetCore.Identity;
|
||||
// using Microsoft.AspNetCore.Mvc.Filters;
|
||||
// using Newtonsoft.Json;
|
||||
// using SharpCompress.Common;
|
||||
// using static gaseous_server.Classes.Metadata.Games;
|
||||
|
||||
// namespace gaseous_server.Classes
|
||||
// {
|
||||
// public class Collections
|
||||
// {
|
||||
// public static List<CollectionItem> GetCollections(string userid)
|
||||
// {
|
||||
// Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||
// string sql = "SELECT * FROM RomCollections WHERE OwnedBy=@ownedby ORDER BY `Name`";
|
||||
// Dictionary<string, object> dbDict = new Dictionary<string, object>{
|
||||
// { "ownedby", userid }
|
||||
// };
|
||||
// DataTable data = db.ExecuteCMD(sql, dbDict);
|
||||
|
||||
// List<CollectionItem> collectionItems = new List<CollectionItem>();
|
||||
|
||||
// foreach (DataRow row in data.Rows)
|
||||
// {
|
||||
// collectionItems.Add(BuildCollectionItem(row));
|
||||
// }
|
||||
|
||||
// return collectionItems;
|
||||
// }
|
||||
|
||||
// public static CollectionItem GetCollection(long Id, string userid)
|
||||
// {
|
||||
// Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||
// string sql;
|
||||
// if (userid == "")
|
||||
// {
|
||||
// // reserved for internal operations
|
||||
// sql = "SELECT * FROM RomCollections WHERE Id = @id ORDER BY `Name`";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // instigated by a user
|
||||
// sql = "SELECT * FROM RomCollections WHERE Id = @id AND OwnedBy = @ownedby ORDER BY `Name`";
|
||||
// }
|
||||
// Dictionary<string, object> dbDict = new Dictionary<string, object>
|
||||
// {
|
||||
// { "id", Id },
|
||||
// { "ownedby", userid }
|
||||
// };
|
||||
// DataTable romDT = db.ExecuteCMD(sql, dbDict);
|
||||
|
||||
// if (romDT.Rows.Count > 0)
|
||||
// {
|
||||
// DataRow row = romDT.Rows[0];
|
||||
// CollectionItem collectionItem = BuildCollectionItem(row);
|
||||
|
||||
// return collectionItem;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// throw new Exception("Unknown Collection Id");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static CollectionItem NewCollection(CollectionItem item, string userid)
|
||||
// {
|
||||
// Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||
// string sql = "INSERT INTO RomCollections (`Name`, Description, Platforms, Genres, Players, PlayerPerspectives, Themes, MinimumRating, MaximumRating, MaximumRomsPerPlatform, MaximumBytesPerPlatform, MaximumCollectionSizeInBytes, FolderStructure, IncludeBIOSFiles, ArchiveType, AlwaysInclude, BuiltStatus, OwnedBy) VALUES (@name, @description, @platforms, @genres, @players, @playerperspectives, @themes, @minimumrating, @maximumrating, @maximumromsperplatform, @maximumbytesperplatform, @maximumcollectionsizeinbytes, @folderstructure, @includebiosfiles, @archivetype, @alwaysinclude, @builtstatus, @ownedby); SELECT CAST(LAST_INSERT_ID() AS SIGNED);";
|
||||
// Dictionary<string, object> dbDict = new Dictionary<string, object>
|
||||
// {
|
||||
// { "name", item.Name },
|
||||
// { "description", item.Description },
|
||||
// { "platforms", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.Platforms, new List<long>())) },
|
||||
// { "genres", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.Genres, new List<long>())) },
|
||||
// { "players", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.Players, new List<long>())) },
|
||||
// { "playerperspectives", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.PlayerPerspectives, new List<long>())) },
|
||||
// { "themes", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.Themes, new List<long>())) },
|
||||
// { "minimumrating", Common.ReturnValueIfNull(item.MinimumRating, -1) },
|
||||
// { "maximumrating", Common.ReturnValueIfNull(item.MaximumRating, -1) },
|
||||
// { "maximumromsperplatform", Common.ReturnValueIfNull(item.MaximumRomsPerPlatform, -1) },
|
||||
// { "maximumbytesperplatform", Common.ReturnValueIfNull(item.MaximumBytesPerPlatform, -1) },
|
||||
// { "maximumcollectionsizeinbytes", Common.ReturnValueIfNull(item.MaximumCollectionSizeInBytes, -1) },
|
||||
// { "folderstructure", Common.ReturnValueIfNull(item.FolderStructure, CollectionItem.FolderStructures.Gaseous) },
|
||||
// { "includebiosfiles", Common.ReturnValueIfNull(item.IncludeBIOSFiles, 0) },
|
||||
// { "archivetype", Common.ReturnValueIfNull(item.ArchiveType, CollectionItem.ArchiveTypes.Zip) },
|
||||
// { "alwaysinclude", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.AlwaysInclude, new List<CollectionItem.AlwaysIncludeItem>())) },
|
||||
// { "builtstatus", CollectionItem.CollectionBuildStatus.WaitingForBuild },
|
||||
// { "ownedby", userid }
|
||||
// };
|
||||
// DataTable romDT = db.ExecuteCMD(sql, dbDict);
|
||||
// long CollectionId = (long)romDT.Rows[0][0];
|
||||
|
||||
// CollectionItem collectionItem = GetCollection(CollectionId, userid);
|
||||
|
||||
// StartCollectionItemBuild(CollectionId, userid);
|
||||
|
||||
// return collectionItem;
|
||||
// }
|
||||
|
||||
// public static CollectionItem EditCollection(long Id, CollectionItem item, string userid, bool ForceRebuild = true)
|
||||
// {
|
||||
// Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||
// string sql = "UPDATE RomCollections SET `Name`=@name, Description=@description, Platforms=@platforms, Genres=@genres, Players=@players, PlayerPerspectives=@playerperspectives, Themes=@themes, MinimumRating=@minimumrating, MaximumRating=@maximumrating, MaximumRomsPerPlatform=@maximumromsperplatform, MaximumBytesPerPlatform=@maximumbytesperplatform, MaximumCollectionSizeInBytes=@maximumcollectionsizeinbytes, FolderStructure=@folderstructure, IncludeBIOSFiles=@includebiosfiles, ArchiveType=@archivetype, AlwaysInclude=@alwaysinclude, BuiltStatus=@builtstatus WHERE Id=@id AND OwnedBy=@ownedby";
|
||||
// Dictionary<string, object> dbDict = new Dictionary<string, object>
|
||||
// {
|
||||
// { "id", Id },
|
||||
// { "name", item.Name },
|
||||
// { "description", item.Description },
|
||||
// { "platforms", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.Platforms, new List<long>())) },
|
||||
// { "genres", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.Genres, new List<long>())) },
|
||||
// { "players", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.Players, new List<long>())) },
|
||||
// { "playerperspectives", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.PlayerPerspectives, new List<long>())) },
|
||||
// { "themes", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.Themes, new List<long>())) },
|
||||
// { "minimumrating", Common.ReturnValueIfNull(item.MinimumRating, -1) },
|
||||
// { "maximumrating", Common.ReturnValueIfNull(item.MaximumRating, -1) },
|
||||
// { "maximumromsperplatform", Common.ReturnValueIfNull(item.MaximumRomsPerPlatform, -1) },
|
||||
// { "maximumbytesperplatform", Common.ReturnValueIfNull(item.MaximumBytesPerPlatform, -1) },
|
||||
// { "maximumcollectionsizeinbytes", Common.ReturnValueIfNull(item.MaximumCollectionSizeInBytes, -1) },
|
||||
// { "folderstructure", Common.ReturnValueIfNull(item.FolderStructure, CollectionItem.FolderStructures.Gaseous) },
|
||||
// { "includebiosfiles", Common.ReturnValueIfNull(item.IncludeBIOSFiles, 0) },
|
||||
// { "alwaysinclude", Newtonsoft.Json.JsonConvert.SerializeObject(Common.ReturnValueIfNull(item.AlwaysInclude, new List<CollectionItem.AlwaysIncludeItem>())) },
|
||||
// { "archivetype", Common.ReturnValueIfNull(item.ArchiveType, CollectionItem.ArchiveTypes.Zip) },
|
||||
// { "ownedby", userid }
|
||||
// };
|
||||
|
||||
// string CollectionZipFile = Path.Combine(Config.LibraryConfiguration.LibraryCollectionsDirectory, Id + item.ArchiveExtension);
|
||||
// if (ForceRebuild == true)
|
||||
// {
|
||||
// dbDict.Add("builtstatus", CollectionItem.CollectionBuildStatus.WaitingForBuild);
|
||||
// if (File.Exists(CollectionZipFile))
|
||||
// {
|
||||
// Logging.LogKey(Logging.LogType.Warning, "process.collections", "collections.deleting_existing_build", null, new string[] { item.Name });
|
||||
// File.Delete(CollectionZipFile);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (File.Exists(CollectionZipFile))
|
||||
// {
|
||||
// dbDict.Add("builtstatus", CollectionItem.CollectionBuildStatus.Completed);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// dbDict.Add("builtstatus", CollectionItem.CollectionBuildStatus.NoStatus);
|
||||
// }
|
||||
// }
|
||||
// db.ExecuteCMD(sql, dbDict);
|
||||
|
||||
// CollectionItem collectionItem = GetCollection(Id, userid);
|
||||
|
||||
// if (collectionItem.BuildStatus == CollectionItem.CollectionBuildStatus.WaitingForBuild)
|
||||
// {
|
||||
// StartCollectionItemBuild(Id, userid);
|
||||
// }
|
||||
|
||||
// return collectionItem;
|
||||
// }
|
||||
|
||||
// public static void DeleteCollection(long Id, string userid)
|
||||
// {
|
||||
// Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||
// string sql = "DELETE FROM RomCollections WHERE Id=@id AND OwnedBy=@ownedby";
|
||||
// Dictionary<string, object> dbDict = new Dictionary<string, object>
|
||||
// {
|
||||
// { "id", Id },
|
||||
// { "ownedby", userid }
|
||||
// };
|
||||
// db.ExecuteCMD(sql, dbDict);
|
||||
|
||||
// string CollectionZipFile = Path.Combine(Config.LibraryConfiguration.LibraryCollectionsDirectory, Id + ".zip");
|
||||
// if (File.Exists(CollectionZipFile))
|
||||
// {
|
||||
// File.Delete(CollectionZipFile);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static void StartCollectionItemBuild(long Id, string userid)
|
||||
// {
|
||||
// // send blank user id to getcollection as this is not a user initiated process
|
||||
// CollectionItem collectionItem = GetCollection(Id, userid);
|
||||
|
||||
// if (collectionItem.BuildStatus != CollectionItem.CollectionBuildStatus.Building)
|
||||
// {
|
||||
// // set collection item to waitingforbuild
|
||||
// Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||
// string sql = "UPDATE RomCollections SET BuiltStatus=@bs WHERE Id=@id";
|
||||
// Dictionary<string, object> dbDict = new Dictionary<string, object>();
|
||||
// dbDict.Add("id", Id);
|
||||
// dbDict.Add("bs", CollectionItem.CollectionBuildStatus.WaitingForBuild);
|
||||
// db.ExecuteCMD(sql, dbDict);
|
||||
|
||||
// // start background task
|
||||
// ProcessQueue.QueueProcessor.QueueItem queueItem = new ProcessQueue.QueueProcessor.QueueItem(ProcessQueue.QueueItemType.CollectionCompiler, 1, false, true);
|
||||
// queueItem.Options = new Dictionary<string, object>{
|
||||
// { "Id", Id },
|
||||
// { "UserId", userid }
|
||||
// };
|
||||
// queueItem.ForceExecute();
|
||||
// ProcessQueue.QueueProcessor.QueueItems.Add(queueItem);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static CollectionContents GetCollectionContent(CollectionItem collectionItem, string userid)
|
||||
// {
|
||||
// Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||
|
||||
// // get age ratings for specified user
|
||||
// List<AgeGroups.AgeRestrictionGroupings> UserAgeGroupings = new List<AgeGroups.AgeRestrictionGroupings>();
|
||||
// bool UserAgeGroupIncludeUnrated = true;
|
||||
// ApplicationUser? user = null;
|
||||
// if (userid != "")
|
||||
// {
|
||||
// Authentication.UserTable<Authentication.ApplicationUser> userTable = new UserTable<ApplicationUser>(db);
|
||||
// user = userTable.GetUserById(userid);
|
||||
|
||||
// if (user.SecurityProfile.AgeRestrictionPolicy.IncludeUnrated == false)
|
||||
// {
|
||||
// UserAgeGroupIncludeUnrated = false;
|
||||
// }
|
||||
|
||||
// foreach (AgeGroups.AgeRestrictionGroupings ageGrouping in Enum.GetValues(typeof(AgeGroups.AgeRestrictionGroupings)))
|
||||
// {
|
||||
// if (ageGrouping <= user.SecurityProfile.AgeRestrictionPolicy.MaximumAgeRestriction && ageGrouping != AgeGroups.AgeRestrictionGroupings.Unclassified)
|
||||
// {
|
||||
// UserAgeGroupings.Add(ageGrouping);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// List<CollectionContents.CollectionPlatformItem> collectionPlatformItems = new List<CollectionContents.CollectionPlatformItem>();
|
||||
|
||||
// // get platforms
|
||||
// List<long> platformids = new List<long>();
|
||||
// platformids.AddRange(collectionItem.Platforms);
|
||||
|
||||
// List<long>? DynamicPlatforms = new List<long>();
|
||||
// DynamicPlatforms.AddRange(collectionItem.Platforms);
|
||||
|
||||
// List<Platform> platforms = new List<Platform>();
|
||||
|
||||
// // add platforms with an inclusion status
|
||||
// foreach (CollectionItem.AlwaysIncludeItem alwaysIncludeItem in collectionItem.AlwaysInclude)
|
||||
// {
|
||||
// if (
|
||||
// alwaysIncludeItem.InclusionState == CollectionItem.AlwaysIncludeStatus.AlwaysInclude ||
|
||||
// alwaysIncludeItem.InclusionState == CollectionItem.AlwaysIncludeStatus.AlwaysExclude
|
||||
// )
|
||||
// {
|
||||
// if (!platformids.Contains(alwaysIncludeItem.PlatformId))
|
||||
// {
|
||||
// platformids.Add(alwaysIncludeItem.PlatformId);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // add dynamic platforms
|
||||
// if (DynamicPlatforms.Count > 0)
|
||||
// {
|
||||
// foreach (long PlatformId in platformids)
|
||||
// {
|
||||
// platforms.Add(Platforms.GetPlatform(PlatformId).Result);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // get all platforms to pull from
|
||||
// Dictionary<string, List<Filters.FilterItem>> FilterDict = Filters.Filter(AgeGroups.AgeRestrictionGroupings.Adult, true).Result;
|
||||
// List<Classes.Filters.FilterItem> filteredPlatforms = (List<Classes.Filters.FilterItem>)FilterDict["platforms"];
|
||||
// foreach (Filters.FilterItem filterItem in filteredPlatforms)
|
||||
// {
|
||||
// platforms.Add(Platforms.GetPlatform((long)filterItem.Id).Result);
|
||||
// }
|
||||
// }
|
||||
|
||||
// // age ratings
|
||||
// AgeGroups.AgeRestrictionGroupings AgeGrouping = AgeGroups.AgeRestrictionGroupings.Unclassified;
|
||||
// bool ContainsUnclassifiedAgeGroup = false;
|
||||
|
||||
// // build collection
|
||||
// List<CollectionContents.CollectionPlatformItem> platformItems = new List<CollectionContents.CollectionPlatformItem>();
|
||||
|
||||
// foreach (Platform platform in platforms)
|
||||
// {
|
||||
// long TotalRomSize = 0;
|
||||
// long TotalGameCount = 0;
|
||||
|
||||
// bool isDynamic = false;
|
||||
// if (DynamicPlatforms.Contains((long)platform.Id))
|
||||
// {
|
||||
// isDynamic = true;
|
||||
// }
|
||||
// else if (DynamicPlatforms.Count == 0)
|
||||
// {
|
||||
// isDynamic = true;
|
||||
// }
|
||||
|
||||
// Controllers.v1_1.GamesController.GameReturnPackage games = new Controllers.v1_1.GamesController.GameReturnPackage();
|
||||
// if (isDynamic == true)
|
||||
// {
|
||||
// Controllers.v1_1.GamesController.GameSearchModel searchModel = new Controllers.v1_1.GamesController.GameSearchModel
|
||||
// {
|
||||
// Name = "",
|
||||
// Platform = new List<string>{
|
||||
// platform.Id.ToString()
|
||||
// },
|
||||
// Genre = collectionItem.Genres.ConvertAll(s => s.ToString()),
|
||||
// GameMode = collectionItem.Players.ConvertAll(s => s.ToString()),
|
||||
// PlayerPerspective = collectionItem.PlayerPerspectives.ConvertAll(s => s.ToString()),
|
||||
// Theme = collectionItem.Themes.ConvertAll(s => s.ToString()),
|
||||
// GameRating = new Controllers.v1_1.GamesController.GameSearchModel.GameRatingItem
|
||||
// {
|
||||
// MinimumRating = collectionItem.MinimumRating,
|
||||
// MaximumRating = collectionItem.MaximumRating
|
||||
// },
|
||||
// GameAgeRating = new Controllers.v1_1.GamesController.GameSearchModel.GameAgeRatingItem
|
||||
// {
|
||||
// AgeGroupings = UserAgeGroupings,
|
||||
// IncludeUnrated = UserAgeGroupIncludeUnrated
|
||||
// }
|
||||
// };
|
||||
// games = Controllers.v1_1.GamesController.GetGames(searchModel, user).Result;
|
||||
|
||||
// }
|
||||
|
||||
// CollectionContents.CollectionPlatformItem collectionPlatformItem = new CollectionContents.CollectionPlatformItem(platform);
|
||||
// collectionPlatformItem.Games = new List<CollectionContents.CollectionPlatformItem.CollectionGameItem>();
|
||||
|
||||
// // add titles with an inclusion status
|
||||
// foreach (CollectionItem.AlwaysIncludeItem alwaysIncludeItem in collectionItem.AlwaysInclude)
|
||||
// {
|
||||
// if (
|
||||
// (
|
||||
// alwaysIncludeItem.InclusionState == CollectionItem.AlwaysIncludeStatus.AlwaysInclude ||
|
||||
// alwaysIncludeItem.InclusionState == CollectionItem.AlwaysIncludeStatus.AlwaysExclude
|
||||
// ) && alwaysIncludeItem.PlatformId == platform.Id
|
||||
// )
|
||||
// {
|
||||
// MinimalGameItem AlwaysIncludeGame = new MinimalGameItem(Games.GetGame(FileSignature.MetadataSources.IGDB, alwaysIncludeItem.GameId).Result);
|
||||
// CollectionContents.CollectionPlatformItem.CollectionGameItem gameItem = new CollectionContents.CollectionPlatformItem.CollectionGameItem(AlwaysIncludeGame);
|
||||
// gameItem.InclusionStatus = new CollectionItem.AlwaysIncludeItem();
|
||||
// gameItem.InclusionStatus.PlatformId = alwaysIncludeItem.PlatformId;
|
||||
// gameItem.InclusionStatus.GameId = alwaysIncludeItem.GameId;
|
||||
// gameItem.InclusionStatus.InclusionState = alwaysIncludeItem.InclusionState;
|
||||
|
||||
// // execute Roms.GetRomsAsync and wait for it to finish
|
||||
// // this is a blocking call
|
||||
// gameItem.Roms = Task.Run(async () =>
|
||||
// {
|
||||
// var result = await Roms.GetRomsAsync((long)gameItem.Id, (long)platform.Id);
|
||||
// return result.GameRomItems;
|
||||
// }).Result;
|
||||
|
||||
// collectionPlatformItem.Games.Add(gameItem);
|
||||
// }
|
||||
// }
|
||||
|
||||
// foreach (MinimalGameItem game in games.Games)
|
||||
// {
|
||||
// bool gameAlreadyInList = false;
|
||||
// foreach (CollectionContents.CollectionPlatformItem.CollectionGameItem existingGame in collectionPlatformItem.Games)
|
||||
// {
|
||||
// if (existingGame.Id == game.Id)
|
||||
// {
|
||||
// gameAlreadyInList = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (gameAlreadyInList == false)
|
||||
// {
|
||||
// CollectionContents.CollectionPlatformItem.CollectionGameItem collectionGameItem = new CollectionContents.CollectionPlatformItem.CollectionGameItem(game);
|
||||
|
||||
// // Retrieve ROMs for the game synchronously
|
||||
// List<Roms.GameRomItem> gameRoms = Task.Run(async () =>
|
||||
// {
|
||||
// var result = await Roms.GetRomsAsync((long)game.Id, (long)platform.Id);
|
||||
// return result.GameRomItems;
|
||||
// }).Result;
|
||||
|
||||
// // Calculate total ROM size for the game
|
||||
// long GameRomSize = gameRoms.Sum(r => (long)r.Size);
|
||||
|
||||
// bool AddGame = false;
|
||||
// if (collectionItem.MaximumBytesPerPlatform > 0)
|
||||
// {
|
||||
// if ((TotalRomSize + GameRomSize) < collectionItem.MaximumBytesPerPlatform)
|
||||
// {
|
||||
// AddGame = true;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// AddGame = true;
|
||||
// }
|
||||
|
||||
// if (AddGame == true)
|
||||
// {
|
||||
// TotalRomSize += GameRomSize;
|
||||
|
||||
// bool AddRoms = false;
|
||||
|
||||
// if (collectionItem.MaximumRomsPerPlatform > 0)
|
||||
// {
|
||||
// if (TotalGameCount < collectionItem.MaximumRomsPerPlatform)
|
||||
// {
|
||||
// AddRoms = true;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// AddRoms = true;
|
||||
// }
|
||||
|
||||
// if (AddRoms == true)
|
||||
// {
|
||||
// TotalGameCount += 1;
|
||||
// collectionGameItem.Roms = gameRoms;
|
||||
// collectionPlatformItem.Games.Add(collectionGameItem);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // handle age grouping
|
||||
// List<AgeRating> gameAgeRatings = game.AgeRatings.Select(s => (AgeRating)s).ToList();
|
||||
// AgeGroups.AgeRestrictionGroupings CurrentAgeGroup = AgeGroups.GetAgeGroupFromAgeRatings(gameAgeRatings);
|
||||
// if (CurrentAgeGroup > AgeGrouping)
|
||||
// {
|
||||
// AgeGrouping = CurrentAgeGroup;
|
||||
// }
|
||||
// if (CurrentAgeGroup == AgeGroups.AgeRestrictionGroupings.Unclassified)
|
||||
// {
|
||||
// ContainsUnclassifiedAgeGroup = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// collectionPlatformItem.Games.Sort((x, y) => x.Name.CompareTo(y.Name));
|
||||
|
||||
// if (collectionPlatformItem.Games.Count > 0)
|
||||
// {
|
||||
// bool AddPlatform = false;
|
||||
// if (collectionItem.MaximumCollectionSizeInBytes > 0)
|
||||
// {
|
||||
// if (TotalRomSize < collectionItem.MaximumCollectionSizeInBytes)
|
||||
// {
|
||||
// AddPlatform = true;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// AddPlatform = true;
|
||||
// }
|
||||
|
||||
// if (AddPlatform == true)
|
||||
// {
|
||||
// collectionPlatformItems.Add(collectionPlatformItem);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// collectionPlatformItems.Sort((x, y) => x.Name.CompareTo(y.Name));
|
||||
|
||||
// CollectionContents collectionContents = new CollectionContents
|
||||
// {
|
||||
// Collection = collectionPlatformItems,
|
||||
// AgeGroup = AgeGrouping,
|
||||
// ContainsUnclassifiedAgeGroup = ContainsUnclassifiedAgeGroup
|
||||
// };
|
||||
|
||||
// return collectionContents;
|
||||
// }
|
||||
|
||||
// public static void CompileCollections(long CollectionId, string userid)
|
||||
// {
|
||||
// Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||
|
||||
// CollectionItem collectionItem = GetCollection(CollectionId, userid);
|
||||
// if (collectionItem.BuildStatus == CollectionItem.CollectionBuildStatus.WaitingForBuild)
|
||||
// {
|
||||
// Logging.LogKey(Logging.LogType.Information, "process.collections", "collections.beginning_build", null, new string[] { collectionItem.Name });
|
||||
|
||||
// CollectionContents collectionContents = GetCollectionContent(collectionItem, userid);
|
||||
|
||||
// // set starting
|
||||
// string sql = "UPDATE RomCollections SET BuiltStatus=@bs, AgeGroup=@ag, AgeGroupUnclassified=@agu WHERE Id=@id";
|
||||
// Dictionary<string, object> dbDict = new Dictionary<string, object>
|
||||
// {
|
||||
// { "id", collectionItem.Id },
|
||||
// { "bs", CollectionItem.CollectionBuildStatus.Building },
|
||||
// { "ag", collectionContents.AgeGroup },
|
||||
// { "agu", collectionContents.ContainsUnclassifiedAgeGroup }
|
||||
// };
|
||||
// db.ExecuteCMD(sql, dbDict);
|
||||
|
||||
// List<CollectionContents.CollectionPlatformItem> collectionPlatformItems = collectionContents.Collection;
|
||||
// string ZipFilePath = Path.Combine(Config.LibraryConfiguration.LibraryCollectionsDirectory, collectionItem.Id + collectionItem.ArchiveExtension);
|
||||
// string ZipFileTempPath = Path.Combine(Config.LibraryConfiguration.LibraryTempDirectory, collectionItem.Id.ToString());
|
||||
|
||||
// try
|
||||
// {
|
||||
|
||||
// // clean up if needed
|
||||
// if (File.Exists(ZipFilePath))
|
||||
// {
|
||||
// Logging.LogKey(Logging.LogType.Warning, "process.collections", "collections.deleting_existing_build", null, new string[] { collectionItem.Name });
|
||||
// File.Delete(ZipFilePath);
|
||||
// }
|
||||
|
||||
// if (Directory.Exists(ZipFileTempPath))
|
||||
// {
|
||||
// Directory.Delete(ZipFileTempPath, true);
|
||||
// }
|
||||
|
||||
// // gather collection files
|
||||
// Directory.CreateDirectory(ZipFileTempPath);
|
||||
// string ZipBiosPath = Path.Combine(ZipFileTempPath, "BIOS");
|
||||
|
||||
// // get the games
|
||||
// foreach (CollectionContents.CollectionPlatformItem collectionPlatformItem in collectionPlatformItems)
|
||||
// {
|
||||
// // get platform bios files if present
|
||||
// if (collectionItem.IncludeBIOSFiles == true)
|
||||
// {
|
||||
// List<Bios.BiosItem> bios = Bios.GetBios(collectionPlatformItem.Id, true).Result;
|
||||
// if (!Directory.Exists(ZipBiosPath))
|
||||
// {
|
||||
// Directory.CreateDirectory(ZipBiosPath);
|
||||
// }
|
||||
|
||||
// foreach (Bios.BiosItem biosItem in bios)
|
||||
// {
|
||||
// if (File.Exists(biosItem.biosPath))
|
||||
// {
|
||||
// Logging.LogKey(Logging.LogType.Information, "process.collections", "collections.copying_bios_file", null, new string[] { biosItem.filename });
|
||||
// File.Copy(biosItem.biosPath, Path.Combine(ZipBiosPath, biosItem.filename), true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // create platform directory
|
||||
// string ZipPlatformPath = "";
|
||||
// switch (collectionItem.FolderStructure)
|
||||
// {
|
||||
// case CollectionItem.FolderStructures.Gaseous:
|
||||
// ZipPlatformPath = Path.Combine(ZipFileTempPath, collectionPlatformItem.Slug);
|
||||
// break;
|
||||
|
||||
// case CollectionItem.FolderStructures.RetroPie:
|
||||
// try
|
||||
// {
|
||||
// PlatformMapping.PlatformMapItem platformMapItem = PlatformMapping.GetPlatformMap(collectionPlatformItem.Id).Result;
|
||||
// ZipPlatformPath = Path.Combine(ZipFileTempPath, "roms", platformMapItem.RetroPieDirectoryName);
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// ZipPlatformPath = Path.Combine(ZipFileTempPath, collectionPlatformItem.Slug);
|
||||
// }
|
||||
|
||||
// break;
|
||||
|
||||
// }
|
||||
// if (!Directory.Exists(ZipPlatformPath))
|
||||
// {
|
||||
// Directory.CreateDirectory(ZipPlatformPath);
|
||||
// }
|
||||
|
||||
// foreach (CollectionContents.CollectionPlatformItem.CollectionGameItem collectionGameItem in collectionPlatformItem.Games)
|
||||
// {
|
||||
// bool includeGame = false;
|
||||
// if (collectionGameItem.InclusionStatus == null)
|
||||
// {
|
||||
// includeGame = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (collectionGameItem.InclusionStatus.InclusionState == CollectionItem.AlwaysIncludeStatus.AlwaysInclude)
|
||||
// {
|
||||
// includeGame = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (includeGame == true)
|
||||
// {
|
||||
// string ZipGamePath = "";
|
||||
// switch (collectionItem.FolderStructure)
|
||||
// {
|
||||
// case CollectionItem.FolderStructures.Gaseous:
|
||||
// // create game directory
|
||||
// ZipGamePath = Path.Combine(ZipPlatformPath, collectionGameItem.Slug);
|
||||
// if (!Directory.Exists(ZipGamePath))
|
||||
// {
|
||||
// Directory.CreateDirectory(ZipGamePath);
|
||||
// }
|
||||
// break;
|
||||
|
||||
// case CollectionItem.FolderStructures.RetroPie:
|
||||
// ZipGamePath = ZipPlatformPath;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// // copy in roms
|
||||
// foreach (Roms.GameRomItem gameRomItem in collectionGameItem.Roms)
|
||||
// {
|
||||
// if (File.Exists(gameRomItem.Path))
|
||||
// {
|
||||
// Logging.LogKey(Logging.LogType.Information, "process.collections", "collections.copying_rom", null, new string[] { gameRomItem.Name });
|
||||
// File.Copy(gameRomItem.Path, Path.Combine(ZipGamePath, gameRomItem.Name), true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // compress to zip
|
||||
// Logging.LogKey(Logging.LogType.Information, "process.collections", "collections.compressing_collection");
|
||||
// switch (collectionItem.ArchiveType)
|
||||
// {
|
||||
// case CollectionItem.ArchiveTypes.Zip:
|
||||
// ZipFile.CreateFromDirectory(ZipFileTempPath, ZipFilePath, CompressionLevel.SmallestSize, false);
|
||||
// break;
|
||||
|
||||
// case CollectionItem.ArchiveTypes.RAR:
|
||||
|
||||
// break;
|
||||
|
||||
// case CollectionItem.ArchiveTypes.SevenZip:
|
||||
|
||||
// break;
|
||||
// }
|
||||
|
||||
|
||||
// // clean up
|
||||
// if (Directory.Exists(ZipFileTempPath))
|
||||
// {
|
||||
// Logging.LogKey(Logging.LogType.Information, "process.collections", "collections.cleaning_up");
|
||||
// Directory.Delete(ZipFileTempPath, true);
|
||||
// }
|
||||
|
||||
// // set completed
|
||||
// dbDict["bs"] = CollectionItem.CollectionBuildStatus.Completed;
|
||||
// db.ExecuteCMD(sql, dbDict);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// // clean up
|
||||
// if (Directory.Exists(ZipFileTempPath))
|
||||
// {
|
||||
// Directory.Delete(ZipFileTempPath, true);
|
||||
// }
|
||||
|
||||
// if (File.Exists(ZipFilePath))
|
||||
// {
|
||||
// File.Delete(ZipFilePath);
|
||||
// }
|
||||
|
||||
// // set failed
|
||||
// dbDict["bs"] = CollectionItem.CollectionBuildStatus.Failed;
|
||||
// db.ExecuteCMD(sql, dbDict);
|
||||
|
||||
// Logging.LogKey(Logging.LogType.Critical, "process.collection_builder", "collections.build_failed", null, null, ex);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private static CollectionItem BuildCollectionItem(DataRow row)
|
||||
// {
|
||||
// string strPlatforms = (string)Common.ReturnValueIfNull(row["Platforms"], "[ ]");
|
||||
// string strGenres = (string)Common.ReturnValueIfNull(row["Genres"], "[ ]");
|
||||
// string strPlayers = (string)Common.ReturnValueIfNull(row["Players"], "[ ]");
|
||||
// string strPlayerPerspectives = (string)Common.ReturnValueIfNull(row["PlayerPerspectives"], "[ ]");
|
||||
// string strThemes = (string)Common.ReturnValueIfNull(row["Themes"], "[ ]");
|
||||
// string strAlwaysInclude = (string)Common.ReturnValueIfNull(row["AlwaysInclude"], "[ ]");
|
||||
|
||||
// CollectionItem item = new CollectionItem();
|
||||
// item.Id = (long)row["Id"];
|
||||
// item.Name = (string)row["Name"];
|
||||
// item.Description = (string)row["Description"];
|
||||
// item.Platforms = Newtonsoft.Json.JsonConvert.DeserializeObject<List<long>>(strPlatforms);
|
||||
// item.Genres = Newtonsoft.Json.JsonConvert.DeserializeObject<List<long>>(strGenres);
|
||||
// item.Players = Newtonsoft.Json.JsonConvert.DeserializeObject<List<long>>(strPlayers);
|
||||
// item.PlayerPerspectives = Newtonsoft.Json.JsonConvert.DeserializeObject<List<long>>(strPlayerPerspectives);
|
||||
// item.Themes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<long>>(strThemes);
|
||||
// item.MinimumRating = (int)Common.ReturnValueIfNull(row["MinimumRating"], -1);
|
||||
// item.MaximumRating = (int)Common.ReturnValueIfNull(row["MaximumRating"], -1);
|
||||
// item.MaximumRomsPerPlatform = (int)Common.ReturnValueIfNull(row["MaximumRomsPerPlatform"], (int)-1);
|
||||
// item.MaximumBytesPerPlatform = (long)Common.ReturnValueIfNull(row["MaximumBytesPerPlatform"], (long)-1);
|
||||
// item.MaximumCollectionSizeInBytes = (long)Common.ReturnValueIfNull(row["MaximumCollectionSizeInBytes"], (long)-1);
|
||||
// item.FolderStructure = (CollectionItem.FolderStructures)(int)Common.ReturnValueIfNull(row["FolderStructure"], 0);
|
||||
// item.IncludeBIOSFiles = (bool)row["IncludeBIOSFiles"];
|
||||
// item.ArchiveType = (CollectionItem.ArchiveTypes)(int)Common.ReturnValueIfNull(row["ArchiveType"], 0);
|
||||
// item.AlwaysInclude = Newtonsoft.Json.JsonConvert.DeserializeObject<List<CollectionItem.AlwaysIncludeItem>>(strAlwaysInclude);
|
||||
// item.BuildStatus = (CollectionItem.CollectionBuildStatus)(int)Common.ReturnValueIfNull(row["BuiltStatus"], 0);
|
||||
|
||||
// return item;
|
||||
// }
|
||||
|
||||
// public class CollectionItem
|
||||
// {
|
||||
// public CollectionItem()
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// public long Id { get; set; }
|
||||
// public string Name { get; set; }
|
||||
// public string Description { get; set; }
|
||||
// public List<long>? Platforms { get; set; }
|
||||
// public List<long>? Genres { get; set; }
|
||||
// public List<long>? Players { get; set; }
|
||||
// public List<long>? PlayerPerspectives { get; set; }
|
||||
// public List<long>? Themes { get; set; }
|
||||
// public int MinimumRating { get; set; }
|
||||
// public int MaximumRating { get; set; }
|
||||
// public int? MaximumRomsPerPlatform { get; set; }
|
||||
// public long? MaximumBytesPerPlatform { get; set; }
|
||||
// public long? MaximumCollectionSizeInBytes { get; set; }
|
||||
// public FolderStructures FolderStructure { get; set; } = FolderStructures.Gaseous;
|
||||
// public bool IncludeBIOSFiles { get; set; } = true;
|
||||
// public ArchiveTypes ArchiveType { get; set; } = CollectionItem.ArchiveTypes.Zip;
|
||||
// public string ArchiveExtension
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// if (ArchiveType != null)
|
||||
// {
|
||||
// switch (ArchiveType)
|
||||
// {
|
||||
// case ArchiveTypes.Zip:
|
||||
// default:
|
||||
// return ".zip";
|
||||
|
||||
// case ArchiveTypes.RAR:
|
||||
// return ".rar";
|
||||
|
||||
// case ArchiveTypes.SevenZip:
|
||||
// return ".7z";
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return ".zip";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// public List<AlwaysIncludeItem> AlwaysInclude { get; set; }
|
||||
|
||||
// [JsonIgnore]
|
||||
// public CollectionBuildStatus BuildStatus
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// if (_BuildStatus == CollectionBuildStatus.Completed)
|
||||
// {
|
||||
// if (File.Exists(Path.Combine(Config.LibraryConfiguration.LibraryCollectionsDirectory, Id + ArchiveExtension)))
|
||||
// {
|
||||
// return CollectionBuildStatus.Completed;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return CollectionBuildStatus.NoStatus;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return _BuildStatus;
|
||||
// }
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// _BuildStatus = value;
|
||||
// }
|
||||
// }
|
||||
// private CollectionBuildStatus _BuildStatus { get; set; }
|
||||
|
||||
// [JsonIgnore]
|
||||
// public long CollectionBuiltSizeBytes
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// if (BuildStatus == CollectionBuildStatus.Completed)
|
||||
// {
|
||||
// string ZipFilePath = Path.Combine(Config.LibraryConfiguration.LibraryCollectionsDirectory, Id + ArchiveExtension);
|
||||
// if (File.Exists(ZipFilePath))
|
||||
// {
|
||||
// FileInfo fi = new FileInfo(ZipFilePath);
|
||||
// return fi.Length;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// public enum CollectionBuildStatus
|
||||
// {
|
||||
// NoStatus = 0,
|
||||
// WaitingForBuild = 1,
|
||||
// Building = 2,
|
||||
// Completed = 3,
|
||||
// Failed = 4
|
||||
// }
|
||||
|
||||
// public enum FolderStructures
|
||||
// {
|
||||
// Gaseous = 0,
|
||||
// RetroPie = 1
|
||||
// }
|
||||
|
||||
// public enum ArchiveTypes
|
||||
// {
|
||||
// Zip = 0,
|
||||
// RAR = 1,
|
||||
// SevenZip = 2
|
||||
// }
|
||||
|
||||
// public class AlwaysIncludeItem
|
||||
// {
|
||||
// public long PlatformId { get; set; }
|
||||
// public long GameId { get; set; }
|
||||
// public AlwaysIncludeStatus InclusionState { get; set; }
|
||||
// }
|
||||
|
||||
// public enum AlwaysIncludeStatus
|
||||
// {
|
||||
// None = 0,
|
||||
// AlwaysInclude = 1,
|
||||
// AlwaysExclude = 2
|
||||
// }
|
||||
// }
|
||||
|
||||
// public class CollectionContents
|
||||
// {
|
||||
// [JsonIgnore]
|
||||
// public List<CollectionPlatformItem> Collection { get; set; }
|
||||
|
||||
// [JsonIgnore]
|
||||
// public long CollectionProjectedSizeBytes
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// long CollectionSize = 0;
|
||||
|
||||
// List<CollectionPlatformItem> collectionPlatformItems = new List<CollectionPlatformItem>();
|
||||
|
||||
// if (Collection != null)
|
||||
// {
|
||||
// collectionPlatformItems = Collection;
|
||||
// }
|
||||
|
||||
// foreach (CollectionPlatformItem platformItem in collectionPlatformItems)
|
||||
// {
|
||||
// CollectionSize += platformItem.RomSize;
|
||||
// }
|
||||
|
||||
// return CollectionSize;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public AgeGroups.AgeRestrictionGroupings AgeGroup { get; set; }
|
||||
// public bool ContainsUnclassifiedAgeGroup { get; set; }
|
||||
|
||||
// public class CollectionPlatformItem
|
||||
// {
|
||||
// public CollectionPlatformItem(Platform platform)
|
||||
// {
|
||||
// string[] PropertyWhitelist = new string[] { "Id", "Name", "Slug" };
|
||||
|
||||
// PropertyInfo[] srcProperties = typeof(Platform).GetProperties();
|
||||
// PropertyInfo[] dstProperties = typeof(CollectionPlatformItem).GetProperties();
|
||||
// foreach (PropertyInfo srcProperty in srcProperties)
|
||||
// {
|
||||
// if (PropertyWhitelist.Contains<string>(srcProperty.Name))
|
||||
// {
|
||||
// foreach (PropertyInfo dstProperty in dstProperties)
|
||||
// {
|
||||
// if (srcProperty.Name == dstProperty.Name)
|
||||
// {
|
||||
// dstProperty.SetValue(this, srcProperty.GetValue(platform));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// public long Id { get; set; }
|
||||
// public string Name { get; set; }
|
||||
// public string Slug { get; set; }
|
||||
|
||||
// public List<CollectionGameItem> Games { get; set; }
|
||||
|
||||
// public int RomCount
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// int Counter = 0;
|
||||
// foreach (CollectionGameItem Game in Games)
|
||||
// {
|
||||
// Counter += 1;
|
||||
// }
|
||||
|
||||
// return Counter;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public long RomSize
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// long Size = 0;
|
||||
// foreach (CollectionGameItem Game in Games)
|
||||
// {
|
||||
// foreach (Roms.GameRomItem Rom in Game.Roms)
|
||||
// {
|
||||
// Size += (long)Rom.Size;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return Size;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public class CollectionGameItem : MinimalGameItem
|
||||
// {
|
||||
// public CollectionGameItem(MinimalGameItem gameObject)
|
||||
// {
|
||||
// this.Id = gameObject.Id;
|
||||
// this.Name = gameObject.Name;
|
||||
// this.Slug = gameObject.Slug;
|
||||
// this.TotalRating = gameObject.TotalRating;
|
||||
// this.TotalRatingCount = gameObject.TotalRatingCount;
|
||||
// this.Cover = gameObject.Cover;
|
||||
// this.Artworks = gameObject.Artworks;
|
||||
// this.FirstReleaseDate = gameObject.FirstReleaseDate;
|
||||
// this.AgeRatings = gameObject.AgeRatings;
|
||||
// }
|
||||
|
||||
// public AgeGroups.AgeRestrictionGroupings AgeGrouping
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// List<AgeRating> gameAgeRatings = this.AgeRatings.Select(s => (AgeRating)s).ToList();
|
||||
// return AgeGroups.GetAgeGroupFromAgeRatings(gameAgeRatings);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public CollectionItem.AlwaysIncludeItem InclusionStatus { get; set; }
|
||||
|
||||
// public List<Roms.GameRomItem> Roms { get; set; }
|
||||
|
||||
// public long RomSize
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// long Size = 0;
|
||||
// foreach (Roms.GameRomItem Rom in Roms)
|
||||
// {
|
||||
// Size += (long)Rom.Size;
|
||||
// }
|
||||
|
||||
// return Size;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
@ -40,6 +40,15 @@ namespace gaseous_server.Classes
|
|||
set { _config.ServerPort = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The port used for local communication between the main server process and the out-of-process task host. This is used for sending commands and receiving status updates from the out-of-process task host when executing long-running tasks. The default value is 5197, but it can be overridden with the "localcommsport" environment variable or by changing the value in the config file. When running in a container, the environment variable will take precedence over the config file value to allow for easy configuration without needing to modify the config file.
|
||||
/// </summary>
|
||||
public static int LocalCommsPort
|
||||
{
|
||||
get { return _config.LocalCommsPort; }
|
||||
set { _config.LocalCommsPort = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The default language/locale the server uses for responses and localisation. This is in the format of a standard locale string, e.g. "en-US" or "fr-FR". The default is "en-US". Can be overridden by setting the "serverlanguage" environment variable or by changing the value in the config file. When running in a container, the environment variable will take precedence over the config file value to allow for easy configuration without needing to modify the config file.
|
||||
/// </summary>
|
||||
|
|
@ -229,6 +238,13 @@ namespace gaseous_server.Classes
|
|||
return "2";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the background task processing system is enabled. This can be used to disable background task processing if needed (e.g. for troubleshooting or if the feature is not desired). When disabled, the timer that processes the queue will not execute any tasks.
|
||||
/// This is a runtime option to prevent running processes until the server is fully up and running.
|
||||
/// </summary>
|
||||
public static bool BackgroundTasksEnabled { get; set; } = false;
|
||||
|
||||
#endregion Configuration Accessors
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -439,42 +455,22 @@ namespace gaseous_server.Classes
|
|||
{
|
||||
Logging.LogKey(Logging.LogType.Debug, "process.database", "database.reading_setting", null, new string[] { SettingName });
|
||||
|
||||
if (Database.schema_version >= 1016)
|
||||
{
|
||||
sql = "SELECT Value, ValueDate FROM Settings WHERE Setting = @SettingName";
|
||||
sql = "SELECT Value, ValueDate FROM Settings WHERE Setting = @SettingName";
|
||||
|
||||
dbResponse = db.ExecuteCMD(sql, dbDict);
|
||||
Type type = typeof(T);
|
||||
if (dbResponse.Rows.Count == 0)
|
||||
{
|
||||
// no value with that name stored - respond with the default value
|
||||
SetSetting<T>(SettingName, DefaultValue);
|
||||
return DefaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type.ToString() == "System.DateTime")
|
||||
{
|
||||
AppSettings.Add(SettingName, (T)dbResponse.Rows[0]["ValueDate"]);
|
||||
return (T)dbResponse.Rows[0]["ValueDate"];
|
||||
}
|
||||
else
|
||||
{
|
||||
AppSettings.Add(SettingName, (T)dbResponse.Rows[0]["Value"]);
|
||||
return (T)dbResponse.Rows[0]["Value"];
|
||||
}
|
||||
}
|
||||
dbResponse = db.ExecuteCMD(sql, dbDict);
|
||||
Type type = typeof(T);
|
||||
if (dbResponse.Rows.Count == 0)
|
||||
{
|
||||
// no value with that name stored - respond with the default value
|
||||
SetSetting<T>(SettingName, DefaultValue);
|
||||
return DefaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "SELECT Value FROM Settings WHERE Setting = @SettingName";
|
||||
|
||||
dbResponse = db.ExecuteCMD(sql, dbDict);
|
||||
if (dbResponse.Rows.Count == 0)
|
||||
if (typeof(T) == typeof(DateTime) || typeof(T) == typeof(Nullable<DateTime>))
|
||||
{
|
||||
// no value with that name stored - respond with the default value
|
||||
SetSetting<T>(SettingName, DefaultValue);
|
||||
return DefaultValue;
|
||||
AppSettings.Add(SettingName, (T)dbResponse.Rows[0]["ValueDate"]);
|
||||
return (T)dbResponse.Rows[0]["ValueDate"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -532,8 +528,7 @@ namespace gaseous_server.Classes
|
|||
if (Database.schema_version >= 1016)
|
||||
{
|
||||
sql = "REPLACE INTO Settings (Setting, ValueType, Value, ValueDate) VALUES (@SettingName, @ValueType, @Value, @ValueDate)";
|
||||
Type type = typeof(T);
|
||||
if (type.ToString() == "System.DateTime")
|
||||
if (typeof(T) == typeof(DateTime) || typeof(T) == typeof(Nullable<DateTime>))
|
||||
{
|
||||
dbDict = new Dictionary<string, object>
|
||||
{
|
||||
|
|
@ -143,7 +143,7 @@ namespace gaseous_server.Classes
|
|||
|
||||
for (int i = OuterSchemaVer; i < 10000; i++)
|
||||
{
|
||||
string resourceName = "gaseous_server.Support.Database.MySQL.gaseous-" + i + ".sql";
|
||||
string resourceName = "gaseous_lib.Support.Database.MySQL.gaseous-" + i + ".sql";
|
||||
string dbScript = "";
|
||||
|
||||
string[] resources = Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
||||
|
|
@ -44,7 +44,7 @@ namespace gaseous_server.Classes
|
|||
{
|
||||
Logging.LogKey(Logging.LogType.Information, "process.database", "database.schema_version_requires_missing_table", null, new[] { TargetSchemaVersion.ToString() });
|
||||
|
||||
string resourceName = "gaseous_server.Support.Database.MySQL.gaseous-fix-1005.sql";
|
||||
string resourceName = "gaseous_lib.Support.Database.MySQL.gaseous-fix-1005.sql";
|
||||
string dbScript = "";
|
||||
|
||||
string[] resources = Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
||||
|
|
@ -186,7 +186,7 @@ namespace gaseous_server.Classes
|
|||
// load country list
|
||||
Logging.LogKey(Logging.LogType.Information, "process.database", "database.adding_country_lookup_table_contents");
|
||||
|
||||
string countryResourceName = "gaseous_server.Support.Country.txt";
|
||||
string countryResourceName = "gaseous_lib.Support.Country.txt";
|
||||
using (Stream stream = assembly.GetManifestResourceStream(countryResourceName))
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
|
|
@ -206,7 +206,7 @@ namespace gaseous_server.Classes
|
|||
// load language list
|
||||
Logging.LogKey(Logging.LogType.Information, "process.database", "database.adding_language_lookup_table_contents");
|
||||
|
||||
string languageResourceName = "gaseous_server.Support.Language.txt";
|
||||
string languageResourceName = "gaseous_lib.Support.Language.txt";
|
||||
using (Stream stream = assembly.GetManifestResourceStream(languageResourceName))
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
|
|
@ -3,6 +3,7 @@ using System.Data;
|
|||
using System.Threading.Tasks;
|
||||
using gaseous_server.Classes;
|
||||
using gaseous_server.Classes.Metadata;
|
||||
using gaseous_server.Models;
|
||||
using Microsoft.CodeAnalysis.FlowAnalysis.DataFlow;
|
||||
|
||||
namespace gaseous_server
|
||||
|
|
@ -83,7 +84,7 @@ namespace gaseous_server
|
|||
LibraryItem library = new LibraryItem((int)row["Id"], (string)row["Name"], (string)row["Path"], (long)row["DefaultPlatform"], Convert.ToBoolean((int)row["DefaultLibrary"]));
|
||||
if (GetStorageInfo == true)
|
||||
{
|
||||
library.PathInfo = Controllers.SystemController.GetDisk(library.Path);
|
||||
library.PathInfo = SystemInfo.GetDisk(library.Path);
|
||||
}
|
||||
libraryItems.Add(library);
|
||||
|
||||
|
|
@ -198,7 +199,7 @@ namespace gaseous_server
|
|||
|
||||
if (GetStorageInfo == true)
|
||||
{
|
||||
library.PathInfo = Controllers.SystemController.GetDisk(library.Path);
|
||||
library.PathInfo = SystemInfo.GetDisk(library.Path);
|
||||
}
|
||||
|
||||
return library;
|
||||
|
|
@ -273,7 +274,7 @@ namespace gaseous_server
|
|||
}
|
||||
public bool IsDefaultLibrary => _IsDefaultLibrary;
|
||||
|
||||
public Controllers.SystemController.SystemInfo.PathItem? PathInfo { get; set; }
|
||||
public SystemInfoModel.PathItem? PathInfo { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -470,9 +470,9 @@ namespace gaseous_server.Classes
|
|||
var resourceNames = assembly.GetManifestResourceNames();
|
||||
foreach (var resourceName in resourceNames)
|
||||
{
|
||||
if (resourceName.StartsWith("gaseous_server.Support.Localisation.") && resourceName.EndsWith(".json"))
|
||||
if (resourceName.StartsWith("gaseous_lib.Support.Localisation.") && resourceName.EndsWith(".json"))
|
||||
{
|
||||
string localeCode = resourceName.Substring("gaseous_server.Support.Localisation.".Length);
|
||||
string localeCode = resourceName.Substring("gaseous_lib.Support.Localisation.".Length);
|
||||
localeCode = localeCode.Substring(0, localeCode.Length - ".json".Length);
|
||||
try
|
||||
{
|
||||
|
|
@ -519,7 +519,7 @@ namespace gaseous_server.Classes
|
|||
|
||||
private static LocaleFileModel LoadLocaleFromResources(string locale)
|
||||
{
|
||||
string resourceName = "gaseous_server.Support.Localisation." + locale + ".json";
|
||||
string resourceName = "gaseous_lib.Support.Localisation." + locale + ".json";
|
||||
using (var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
|
||||
{
|
||||
if (stream == null)
|
||||
|
|
@ -307,7 +307,8 @@ namespace gaseous_server.Classes.Metadata
|
|||
}
|
||||
else
|
||||
{
|
||||
using Stream? stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("gaseous_server.wwwroot.images.Ratings.AgeGroupMap.json");
|
||||
// using Stream? stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("gaseous_server.wwwroot.images.Ratings.AgeGroupMap.json");
|
||||
using Stream? stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("gaseous_lib.Support.AgeGroupMap.json");
|
||||
if (stream != null)
|
||||
{
|
||||
using StreamReader reader = new StreamReader(stream);
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
using gaseous_server.Classes.Metadata;
|
||||
using gaseous_server.Controllers;
|
||||
using gaseous_server.Models;
|
||||
using System.Linq;
|
||||
using HasheousClient.Models;
|
||||
|
|
@ -175,6 +174,7 @@ namespace gaseous_server.Classes
|
|||
/// </param>
|
||||
/// <param name="AutomaticMetadataSourceId">
|
||||
/// The unique identifier for the data source as provided by the automatic metadata fetcher.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// If the metadata source is preferred, all other metadata sources for the same metadata map will be set to not preferred.
|
||||
/// </remarks>
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue