Better error handling for failed model downloads

This commit is contained in:
N00MKRAD
2021-06-20 18:35:14 +02:00
parent 54c69e4e19
commit 899cc9f064

View File

@@ -141,11 +141,18 @@ namespace Flowframes.IO
await DownloadTo(GetMdlFileUrl(aiDir, modelDir, "files.json"), mdlDir);
List<ModelFile> modelFiles = GetModelFilesFromJson(File.ReadAllText(Path.Combine(mdlDir, "files.json")));
string jsonPath = Path.Combine(mdlDir, "files.json");
List<ModelFile> modelFiles = GetModelFilesFromJson(File.ReadAllText(jsonPath));
if (IOUtils.GetFilesize(jsonPath) < 32)
{
Interpolate.Cancel($"Error: Failed to download index file. Please try again.");
return;
}
if (modelFiles.Count < 1)
{
Interpolate.Cancel($"Error: Can't download model files because no entries were loaded from files.json. Please try again.");
Interpolate.Cancel($"Error: Can't download model files because no entries were loaded from the index file. Please try again.");
return;
}