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; string saveDataPath = null;
byte[] applicationIcon = null; byte[] applicationIcon = null;
try
{
using (FileStream file = new FileStream(applicationPath, FileMode.Open, FileAccess.Read)) using (FileStream file = new FileStream(applicationPath, FileMode.Open, FileAccess.Read))
{ {
if ((Path.GetExtension(applicationPath).ToLower() == ".nsp") || if ((Path.GetExtension(applicationPath).ToLower() == ".nsp") ||
@ -94,6 +96,7 @@ namespace Ryujinx.Ui
try try
{ {
PartitionFileSystem pfs; PartitionFileSystem pfs;
bool isExeFs = false; bool isExeFs = false;
if (Path.GetExtension(applicationPath).ToLower() == ".xci") if (Path.GetExtension(applicationPath).ToLower() == ".xci")
@ -223,7 +226,7 @@ namespace Ryujinx.Ui
} }
catch (Exception exception) 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()); Logger.PrintDebug(LogClass.Application, exception.ToString());
numApplicationsFound--; numApplicationsFound--;
@ -282,7 +285,7 @@ namespace Ryujinx.Ui
} }
catch 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--; numApplicationsFound--;
@ -309,7 +312,7 @@ namespace Ryujinx.Ui
} }
catch 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--; numApplicationsFound--;
_loadingError = true; _loadingError = true;
@ -327,6 +330,16 @@ namespace Ryujinx.Ui
titleName = Path.GetFileNameWithoutExtension(applicationPath); titleName = Path.GetFileNameWithoutExtension(applicationPath);
} }
} }
}
catch (IOException exception)
{
Logger.PrintWarning(LogClass.Application, exception.Message);
numApplicationsFound--;
_loadingError = true;
continue;
}
ApplicationMetadata appMetadata = LoadAndSaveMetaData(titleId); ApplicationMetadata appMetadata = LoadAndSaveMetaData(titleId);
@ -384,7 +397,7 @@ namespace Ryujinx.Ui
{ {
Gtk.Application.Invoke(delegate 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.");
}); });
} }
} }