Fix resource import interrupted when item not valid.
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Logger = Cryville.Common.Logger;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
internal class LegacyResourceManager : IResourceManager<ChartDetail> {
|
||||
@@ -117,7 +118,10 @@ namespace Cryville.Crtr.Browsing {
|
||||
foreach (var converter in converters[file.Extension]) {
|
||||
var resources = converter.ConvertFrom(file);
|
||||
foreach (var res in resources) {
|
||||
if (res is ChartResource) {
|
||||
if (!res.Valid) {
|
||||
Logger.Log("main", 3, "Resource", "Attempt to import invalid resource {0}", res);
|
||||
}
|
||||
else if (res is ChartResource) {
|
||||
var tres = (ChartResource)res;
|
||||
var dir = new DirectoryInfo(_rootPath + "/charts/" + res.Name);
|
||||
if (!dir.Exists) dir.Create();
|
||||
@@ -134,6 +138,7 @@ namespace Cryville.Crtr.Browsing {
|
||||
if (!dir.Exists) dir.Create();
|
||||
var dest = new FileInfo(_rootPath + "/charts/" + res.Name + "/cover" + tres.Source.Extension);
|
||||
if (!dest.Exists) tres.Source.CopyTo(dest.FullName);
|
||||
|
||||
}
|
||||
else if (res is SongResource) {
|
||||
var tres = (SongResource)res;
|
||||
|
Reference in New Issue
Block a user