NotVrm0Exception

This commit is contained in:
ousttrue
2021-03-15 20:42:13 +09:00
parent 558f651534
commit b474ca3eba
2 changed files with 15 additions and 2 deletions

View File

@@ -25,7 +25,14 @@ namespace VRM
var ext = Path.GetExtension(path).ToLower();
if (ext == ".vrm")
{
ImportVrm(UnityPath.FromUnityPath(path));
try
{
ImportVrm(UnityPath.FromUnityPath(path));
}
catch (VRMImporterContext.NotVrm0Exception)
{
// is not vrm0
}
}
}
}

View File

@@ -10,6 +10,12 @@ namespace VRM
{
public class VRMImporterContext : ImporterContext
{
public class NotVrm0Exception : Exception
{
public NotVrm0Exception()
{ }
}
public VRM.glTF_VRM_extensions VRM { get; private set; }
public VRMImporterContext(GltfParser parser,
@@ -25,7 +31,7 @@ namespace VRM
}
else
{
throw new KeyNotFoundException("not vrm0");
throw new NotVrm0Exception();
}
}