mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
Migrator fixes
This commit is contained in:
parent
6f846751c7
commit
b847212375
2 changed files with 10 additions and 18 deletions
|
@ -108,23 +108,6 @@ class SongMigrator
|
||||||
trace('Migrating song metadata from FNF Legacy.');
|
trace('Migrating song metadata from FNF Legacy.');
|
||||||
|
|
||||||
var songData:FNFLegacy = cast jsonData;
|
var songData:FNFLegacy = cast jsonData;
|
||||||
// Some cleanup
|
|
||||||
if (Std.isOfType(jsonData.song.notes, Array))
|
|
||||||
{
|
|
||||||
jsonData.song.notes = haxe.ds.Either.Left(jsonData.song.notes);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
jsonData.song.notes = haxe.ds.Either.Right(jsonData.song.notes);
|
|
||||||
}
|
|
||||||
if (Std.isOfType(jsonData.song.speed, Float))
|
|
||||||
{
|
|
||||||
jsonData.song.speed = haxe.ds.Either.Left(jsonData.song.speed);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
jsonData.song.speed = haxe.ds.Either.Right(jsonData.song.speed);
|
|
||||||
}
|
|
||||||
|
|
||||||
var songMetadata:SongMetadata = new SongMetadata('Import', 'Kawai Sprite', 'default');
|
var songMetadata:SongMetadata = new SongMetadata('Import', 'Kawai Sprite', 'default');
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,18 @@ class SerializerUtil
|
||||||
* Convert a JSON byte array to a Haxe object.
|
* Convert a JSON byte array to a Haxe object.
|
||||||
*/
|
*/
|
||||||
public static function fromJSONBytes(input:Bytes):Dynamic
|
public static function fromJSONBytes(input:Bytes):Dynamic
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
return Json.parse(input.toString());
|
return Json.parse(input.toString());
|
||||||
}
|
}
|
||||||
|
catch (e:Dynamic)
|
||||||
|
{
|
||||||
|
trace('An error occurred while parsing JSON from byte data');
|
||||||
|
trace(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customize how certain types are serialized when converting to JSON.
|
* Customize how certain types are serialized when converting to JSON.
|
||||||
|
|
Loading…
Reference in a new issue