Add error notice popup for resource import.

This commit is contained in:
2022-11-15 13:31:39 +08:00
parent 0f8bb5f1f6
commit 174f616e5c
2 changed files with 10 additions and 3 deletions

View File

@@ -116,7 +116,14 @@ namespace Cryville.Crtr.Browsing {
var file = new FileInfo(path);
if (!converters.ContainsKey(file.Extension)) return false;
foreach (var converter in converters[file.Extension]) {
var resources = converter.ConvertFrom(file);
IEnumerable<Resource> resources = null;
try {
resources = converter.ConvertFrom(file);
}
catch (Exception ex) {
CallHelper.ShowMessageBox(ex.Message);
return false;
}
foreach (var res in resources) {
if (!res.Valid) {
Logger.Log("main", 3, "Resource", "Attempt to import invalid resource {0}", res);

View File

@@ -59,11 +59,11 @@ namespace Cryville.Crtr.Browsing {
private void OnAddDialogClosed() {
if (_dialog.FileName == null) return;
if (ResourceManager.ImportItemFrom(_dialog.FileName)) {
Debug.Log("Import succeeded"); // TODO
CallHelper.ShowMessageBox("Import succeeded");
OnPathClicked(ResourceManager.CurrentDirectory.Length - 1);
}
else {
Debug.Log("Import failed"); // TODO
CallHelper.ShowMessageBox("Import failed");
}
}
}