mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Remove a bunch of unnecessary try-catch blocks so the exception gets caught one higher up and gives better info.
This commit is contained in:
parent
592a5c8f56
commit
0c8a545dc2
1 changed files with 75 additions and 131 deletions
|
|
@ -157,8 +157,6 @@ namespace Penumbra.Game
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GameObjectInfo HandleEquipment( FileType fileType, ObjectType objectType, GroupCollection groups )
|
private static GameObjectInfo HandleEquipment( FileType fileType, ObjectType objectType, GroupCollection groups )
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var setId = ushort.Parse( groups[ "id" ].Value );
|
var setId = ushort.Parse( groups[ "id" ].Value );
|
||||||
if( fileType == FileType.Imc )
|
if( fileType == FileType.Imc )
|
||||||
|
|
@ -176,16 +174,8 @@ namespace Penumbra.Game
|
||||||
var variant = byte.Parse( groups[ "variant" ].Value );
|
var variant = byte.Parse( groups[ "variant" ].Value );
|
||||||
return GameObjectInfo.Equipment( fileType, setId, gr, slot, variant );
|
return GameObjectInfo.Equipment( fileType, setId, gr, slot, variant );
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
PluginLog.Error( $"Parsing game path failed:\n{e}" );
|
|
||||||
return new GameObjectInfo { FileType = fileType, ObjectType = objectType };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static GameObjectInfo HandleWeapon( FileType fileType, ObjectType objectType, GroupCollection groups )
|
private static GameObjectInfo HandleWeapon( FileType fileType, ObjectType objectType, GroupCollection groups )
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var weaponId = ushort.Parse( groups[ "weapon" ].Value );
|
var weaponId = ushort.Parse( groups[ "weapon" ].Value );
|
||||||
var setId = ushort.Parse( groups[ "id" ].Value );
|
var setId = ushort.Parse( groups[ "id" ].Value );
|
||||||
|
|
@ -197,16 +187,8 @@ namespace Penumbra.Game
|
||||||
var variant = byte.Parse( groups[ "variant" ].Value );
|
var variant = byte.Parse( groups[ "variant" ].Value );
|
||||||
return GameObjectInfo.Weapon( fileType, setId, weaponId, variant );
|
return GameObjectInfo.Weapon( fileType, setId, weaponId, variant );
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
PluginLog.Error( $"Parsing game path failed:\n{e}" );
|
|
||||||
return new GameObjectInfo { FileType = fileType, ObjectType = objectType };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static GameObjectInfo HandleMonster( FileType fileType, ObjectType objectType, GroupCollection groups )
|
private static GameObjectInfo HandleMonster( FileType fileType, ObjectType objectType, GroupCollection groups )
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var monsterId = ushort.Parse( groups[ "monster" ].Value );
|
var monsterId = ushort.Parse( groups[ "monster" ].Value );
|
||||||
var bodyId = ushort.Parse( groups[ "id" ].Value );
|
var bodyId = ushort.Parse( groups[ "id" ].Value );
|
||||||
|
|
@ -218,16 +200,8 @@ namespace Penumbra.Game
|
||||||
var variant = byte.Parse( groups[ "variant" ].Value );
|
var variant = byte.Parse( groups[ "variant" ].Value );
|
||||||
return GameObjectInfo.Monster( fileType, monsterId, bodyId, variant );
|
return GameObjectInfo.Monster( fileType, monsterId, bodyId, variant );
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
PluginLog.Error( $"Parsing game path failed:\n{e}" );
|
|
||||||
return new GameObjectInfo { FileType = fileType, ObjectType = objectType };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static GameObjectInfo HandleDemiHuman( FileType fileType, ObjectType objectType, GroupCollection groups )
|
private static GameObjectInfo HandleDemiHuman( FileType fileType, ObjectType objectType, GroupCollection groups )
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var demiHumanId = ushort.Parse( groups[ "id" ].Value );
|
var demiHumanId = ushort.Parse( groups[ "id" ].Value );
|
||||||
var equipId = ushort.Parse( groups[ "equip" ].Value );
|
var equipId = ushort.Parse( groups[ "equip" ].Value );
|
||||||
|
|
@ -245,16 +219,8 @@ namespace Penumbra.Game
|
||||||
var variant = byte.Parse( groups[ "variant" ].Value );
|
var variant = byte.Parse( groups[ "variant" ].Value );
|
||||||
return GameObjectInfo.DemiHuman( fileType, demiHumanId, equipId, slot, variant );
|
return GameObjectInfo.DemiHuman( fileType, demiHumanId, equipId, slot, variant );
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
PluginLog.Error( $"Parsing game path failed:\n{e}" );
|
|
||||||
return new GameObjectInfo { FileType = fileType, ObjectType = objectType };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static GameObjectInfo HandleCustomization( FileType fileType, ObjectType objectType, GroupCollection groups )
|
private static GameObjectInfo HandleCustomization( FileType fileType, ObjectType objectType, GroupCollection groups )
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
if( groups[ "skin" ].Success )
|
if( groups[ "skin" ].Success )
|
||||||
{
|
{
|
||||||
|
|
@ -280,16 +246,8 @@ namespace Penumbra.Game
|
||||||
|
|
||||||
return GameObjectInfo.Customization( fileType, type, id, gr, bodySlot );
|
return GameObjectInfo.Customization( fileType, type, id, gr, bodySlot );
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
PluginLog.Error( $"Parsing game path failed:\n{e}" );
|
|
||||||
return new GameObjectInfo { FileType = fileType, ObjectType = objectType };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static GameObjectInfo HandleIcon( FileType fileType, ObjectType objectType, GroupCollection groups )
|
private static GameObjectInfo HandleIcon( FileType fileType, ObjectType objectType, GroupCollection groups )
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var hq = groups[ "hq" ].Success;
|
var hq = groups[ "hq" ].Success;
|
||||||
var id = uint.Parse( groups[ "id" ].Value );
|
var id = uint.Parse( groups[ "id" ].Value );
|
||||||
|
|
@ -308,16 +266,8 @@ namespace Penumbra.Game
|
||||||
};
|
};
|
||||||
return GameObjectInfo.Icon( fileType, id, hq, language );
|
return GameObjectInfo.Icon( fileType, id, hq, language );
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
PluginLog.Error( $"Parsing game path failed:\n{e}" );
|
|
||||||
return new GameObjectInfo { FileType = fileType, ObjectType = objectType };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static GameObjectInfo HandleMap( FileType fileType, ObjectType objectType, GroupCollection groups )
|
private static GameObjectInfo HandleMap( FileType fileType, ObjectType objectType, GroupCollection groups )
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var map = Encoding.ASCII.GetBytes( groups[ "id" ].Value );
|
var map = Encoding.ASCII.GetBytes( groups[ "id" ].Value );
|
||||||
var variant = byte.Parse( groups[ "variant" ].Value );
|
var variant = byte.Parse( groups[ "variant" ].Value );
|
||||||
|
|
@ -329,12 +279,6 @@ namespace Penumbra.Game
|
||||||
|
|
||||||
return GameObjectInfo.Map( fileType, map[ 0 ], map[ 1 ], map[ 2 ], map[ 3 ], variant );
|
return GameObjectInfo.Map( fileType, map[ 0 ], map[ 1 ], map[ 2 ], map[ 3 ], variant );
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
PluginLog.Error( $"Parsing game path failed:\n{e}" );
|
|
||||||
return new GameObjectInfo { FileType = fileType, ObjectType = objectType };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GameObjectInfo GetFileInfo( GamePath path )
|
public static GameObjectInfo GetFileInfo( GamePath path )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue