Catch System.IO.IOException (#932)

This commit is contained in:
Xpl0itR 2020-02-15 20:20:19 +00:00 committed by GitHub
parent 45d86b8f6f
commit d89e90a16e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,6 +85,8 @@ namespace Ryujinx.Ui
string saveDataPath = null;
byte[] applicationIcon = null;
try
{
using (FileStream file = new FileStream(applicationPath, FileMode.Open, FileAccess.Read))
{
if ((Path.GetExtension(applicationPath).ToLower() == ".nsp") ||
@ -94,6 +96,7 @@ namespace Ryujinx.Ui
try
{
PartitionFileSystem pfs;
bool isExeFs = false;
if (Path.GetExtension(applicationPath).ToLower() == ".xci")
@ -223,7 +226,7 @@ namespace Ryujinx.Ui
}
catch (Exception exception)
{
Logger.PrintError(LogClass.Application, $"The file encountered was not of a valid type. Errored File: {applicationPath}");
Logger.PrintWarning(LogClass.Application, $"The file encountered was not of a valid type. Errored File: {applicationPath}");
Logger.PrintDebug(LogClass.Application, exception.ToString());
numApplicationsFound--;
@ -282,7 +285,7 @@ namespace Ryujinx.Ui
}
catch
{
Logger.PrintError(LogClass.Application, $"The file encountered was not of a valid type. Errored File: {applicationPath}");
Logger.PrintWarning(LogClass.Application, $"The file encountered was not of a valid type. Errored File: {applicationPath}");
numApplicationsFound--;
@ -309,7 +312,7 @@ namespace Ryujinx.Ui
}
catch
{
Logger.PrintError(LogClass.Application, $"The file encountered was not of a valid type. Errored File: {applicationPath}");
Logger.PrintWarning(LogClass.Application, $"The file encountered was not of a valid type. Errored File: {applicationPath}");
numApplicationsFound--;
_loadingError = true;
@ -327,6 +330,16 @@ namespace Ryujinx.Ui
titleName = Path.GetFileNameWithoutExtension(applicationPath);
}
}
}
catch (IOException exception)
{
Logger.PrintWarning(LogClass.Application, exception.Message);
numApplicationsFound--;
_loadingError = true;
continue;
}
ApplicationMetadata appMetadata = LoadAndSaveMetaData(titleId);
@ -384,7 +397,7 @@ namespace Ryujinx.Ui
{
Gtk.Application.Invoke(delegate
{
GtkDialog.CreateErrorDialog("One or more files encountered were not of a valid type, check logs for more info.");
GtkDialog.CreateErrorDialog("One or more files encountered could not be loaded, check logs for more info.");
});
}
}