Merge pull request #44 from thomeval/stable

Fix loading MDB files in XML format
This commit is contained in:
Freddie Wang 2022-05-13 18:46:31 +08:00 committed by GitHub
commit 0bf3cc30fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
GITADORA Plugin for Asphyxia-Core
=================================
![Version: v1.2.2](https://img.shields.io/badge/version-v1.2.2-blue)
![Version: v1.2.3](https://img.shields.io/badge/version-v1.2.3-blue)
This plugin is based on converted from public-exported Asphyxia's Routes.
@ -31,6 +31,10 @@ Known Issues
Release Notes
=============
v1.2.3
----------------
* Fixed bug preventing MDB files in XML format from loading (Thanks to DualEdge for reporting this ).
v1.2.2
----------------
* Major improvements to the MDB (song data) loader. MDB files can now be in .json, .xml or .b64 format. This applies to both the per-version defaults and custom MDBs. To use a custom MDB, enable it in the web UI, and place a 'custom.xml', 'custom.json' or 'custom.b64' file in the data/mdb subfolder.

View File

@ -17,7 +17,6 @@ type processRawDataHandler = (path: string) => Promise<CommonMusicData>
const logger = new Logger("mdb")
export async function readXML(path: string) {
logger.debugInfo(`Loading MDB data from ${path}.`)
const xml = await IO.ReadFile(path, 'utf-8');
const json = U.parseXML(xml, false)
return json
@ -40,7 +39,7 @@ export async function readMDBFile(path: string, processHandler?: processRawDataH
result = JSON.parse(str)
break;
case '.xml':
processHandler ?? defaultProcessRawXmlData
processHandler = processHandler ?? defaultProcessRawXmlData
result = await processHandler(path)
// Uncomment to save the loaded XML file as JSON.
// await IO.WriteFile(path.replace(".xml", ".json"), JSON.stringify(data))