mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add and use ThrowOnError global (temp)
This commit is contained in:
@@ -59,9 +59,12 @@ namespace SabreTools.Library.DatFiles
|
||||
// Get the current line, split and parse
|
||||
svr.ReadNextLine();
|
||||
}
|
||||
catch (InvalidDataException)
|
||||
catch (InvalidDataException ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Malformed line found in '{filename}' at line {svr.LineNumber}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -167,6 +170,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -210,6 +216,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -267,6 +276,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -480,6 +480,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -518,6 +521,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -553,6 +559,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -580,6 +589,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -684,6 +696,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -707,6 +722,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -751,6 +751,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -814,6 +817,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -885,6 +891,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -931,6 +940,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1050,6 +1062,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1846,6 +1860,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error($"Error with file '{filename}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2259,6 +2275,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (IOException ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3490,6 +3509,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error($"Datfile {outfile} could not be written out: {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -3497,6 +3518,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -322,6 +322,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -355,6 +358,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -383,6 +389,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -406,6 +415,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -444,6 +456,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -467,6 +482,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -185,6 +188,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,6 +152,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -347,6 +350,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -314,6 +314,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -342,6 +345,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -365,6 +371,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -459,6 +468,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
// For XML errors, just skip the affected node
|
||||
xtr?.Read();
|
||||
@@ -1201,6 +1203,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1228,6 +1233,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1277,6 +1285,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1300,6 +1311,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1678,6 +1692,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1704,6 +1721,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
// For XML errors, just skip the affected node
|
||||
xtr?.Read();
|
||||
@@ -731,6 +733,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -811,6 +816,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -894,6 +902,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -917,6 +928,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1021,6 +1035,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1047,6 +1064,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -128,6 +131,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
// For XML errors, just skip the affected node
|
||||
xtr?.Read();
|
||||
@@ -719,6 +721,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -843,6 +848,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -911,6 +919,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -963,6 +974,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
// For XML errors, just skip the affected node
|
||||
xtr?.Read();
|
||||
@@ -581,6 +583,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -621,6 +626,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -654,6 +662,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -677,6 +688,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -752,6 +766,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -778,6 +795,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
|
||||
ir.Dispose();
|
||||
@@ -420,6 +422,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -457,6 +462,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -518,6 +526,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
|
||||
jtr.Close();
|
||||
@@ -405,6 +407,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -435,6 +440,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -470,6 +478,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -496,6 +507,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -531,6 +545,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -563,6 +580,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
// For XML errors, just skip the affected node
|
||||
xtr?.Read();
|
||||
@@ -136,6 +138,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
// For XML errors, just skip the affected node
|
||||
xtr?.Read();
|
||||
@@ -187,6 +191,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
// For XML errors, just skip the affected node
|
||||
xtr?.Read();
|
||||
@@ -269,6 +275,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -300,6 +309,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -333,6 +345,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -358,6 +373,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -388,6 +406,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -420,6 +441,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,9 +63,12 @@ namespace SabreTools.Library.DatFiles
|
||||
// Get the current line, split and parse
|
||||
svr.ReadNextLine();
|
||||
}
|
||||
catch (InvalidDataException)
|
||||
catch (InvalidDataException ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Malformed line found in '{filename}' at line {svr.LineNumber}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -156,6 +159,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -200,6 +206,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -293,6 +302,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,8 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
// For XML errors, just skip the affected node
|
||||
xtr?.Read();
|
||||
@@ -573,6 +575,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -600,6 +605,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -635,6 +643,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -658,6 +669,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -813,6 +827,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -839,6 +856,9 @@ namespace SabreTools.Library.DatFiles
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1114,8 +1114,11 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
return (norename ? nc.Compare(x.Machine.Name, y.Machine.Name) : x.Source.Index - y.Source.Index);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
// Absorb the error
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,11 @@ namespace SabreTools.Library.Data
|
||||
/// </summary>
|
||||
public static string TempDir { get; set; } = Path.GetTempPath();
|
||||
|
||||
/// <summary>
|
||||
/// Whether to throw an exception from the library if an error is found
|
||||
/// </summary>
|
||||
public static bool ThrowOnError { get; set; } = false;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +127,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -205,6 +208,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return realentry;
|
||||
}
|
||||
|
||||
@@ -244,6 +250,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return (ms, realentry);
|
||||
}
|
||||
|
||||
@@ -380,7 +389,10 @@ namespace SabreTools.Library.FileTypes
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
success = false;
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -75,17 +75,25 @@ namespace SabreTools.Library.FileTypes
|
||||
|
||||
encounteredErrors = false;
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
catch (EndOfStreamException ex)
|
||||
{
|
||||
// Catch this but don't count it as an error because SharpCompress is unsafe
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
|
||||
@@ -173,6 +181,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
ms = null;
|
||||
realEntry = null;
|
||||
}
|
||||
@@ -242,6 +253,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,17 +68,25 @@ namespace SabreTools.Library.FileTypes
|
||||
encounteredErrors = false;
|
||||
ra.Dispose();
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
catch (EndOfStreamException ex)
|
||||
{
|
||||
// Catch this but don't count it as an error because SharpCompress is unsafe
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
|
||||
@@ -159,6 +167,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
ms = null;
|
||||
realEntry = null;
|
||||
}
|
||||
@@ -219,6 +230,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -260,6 +274,8 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return empties;
|
||||
|
||||
@@ -117,17 +117,25 @@ namespace SabreTools.Library.FileTypes
|
||||
zf.ZipFileClose();
|
||||
encounteredErrors = false;
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
catch (EndOfStreamException ex)
|
||||
{
|
||||
// Catch this but don't count it as an error because SharpCompress is unsafe
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
|
||||
@@ -243,6 +251,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
ms = null;
|
||||
realEntry = null;
|
||||
}
|
||||
@@ -330,6 +341,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -383,6 +397,8 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return empties;
|
||||
@@ -599,7 +615,10 @@ namespace SabreTools.Library.FileTypes
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
success = false;
|
||||
}
|
||||
finally
|
||||
@@ -828,7 +847,10 @@ namespace SabreTools.Library.FileTypes
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
success = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,17 +73,26 @@ namespace SabreTools.Library.FileTypes
|
||||
encounteredErrors = false;
|
||||
ta.Dispose();
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
catch (EndOfStreamException ex)
|
||||
{
|
||||
// Catch this but don't count it as an error because SharpCompress is unsafe
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
|
||||
@@ -164,6 +173,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
ms = null;
|
||||
realEntry = null;
|
||||
}
|
||||
@@ -224,6 +236,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -265,6 +280,8 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return empties;
|
||||
@@ -418,7 +435,10 @@ namespace SabreTools.Library.FileTypes
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
success = false;
|
||||
}
|
||||
finally
|
||||
@@ -598,7 +618,10 @@ namespace SabreTools.Library.FileTypes
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
success = false;
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -69,17 +69,25 @@ namespace SabreTools.Library.FileTypes
|
||||
|
||||
encounteredErrors = false;
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
catch (EndOfStreamException ex)
|
||||
{
|
||||
// Catch this but don't count it as an error because SharpCompress is unsafe
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
|
||||
@@ -165,6 +173,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
ms = null;
|
||||
realEntry = null;
|
||||
}
|
||||
@@ -231,6 +242,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,17 +118,25 @@ namespace SabreTools.Library.FileTypes
|
||||
zf.ZipFileClose();
|
||||
encounteredErrors = false;
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
catch (EndOfStreamException ex)
|
||||
{
|
||||
// Catch this but don't count it as an error because SharpCompress is unsafe
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
encounteredErrors = true;
|
||||
}
|
||||
|
||||
@@ -244,6 +252,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
ms = null;
|
||||
realEntry = null;
|
||||
}
|
||||
@@ -335,6 +346,9 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -388,6 +402,8 @@ namespace SabreTools.Library.FileTypes
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return empties;
|
||||
@@ -603,7 +619,10 @@ namespace SabreTools.Library.FileTypes
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
success = false;
|
||||
}
|
||||
finally
|
||||
@@ -833,7 +852,10 @@ namespace SabreTools.Library.FileTypes
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
success = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,9 @@ namespace SabreTools.Library.Filtering
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Warning($"Exception found while parsing '{ini}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,9 @@ namespace SabreTools.Library.IO
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error($"An exception occurred getting the full path for '{input}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -104,13 +107,17 @@ namespace SabreTools.Library.IO
|
||||
{
|
||||
outputs.Add(new ParentablePath(Path.GetFullPath(dir), appendparent ? parentPath : string.Empty));
|
||||
}
|
||||
catch (PathTooLongException)
|
||||
catch (PathTooLongException ex)
|
||||
{
|
||||
Globals.Logger.Warning($"The path for '{dir}' was too long");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error($"An exception occurred processing '{dir}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -188,6 +195,9 @@ namespace SabreTools.Library.IO
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error($"An exception occurred getting the full path for '{input}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -200,13 +210,17 @@ namespace SabreTools.Library.IO
|
||||
{
|
||||
outputs.Add(new ParentablePath(Path.GetFullPath(file), appendparent ? parentPath : string.Empty));
|
||||
}
|
||||
catch (PathTooLongException)
|
||||
catch (PathTooLongException ex)
|
||||
{
|
||||
Globals.Logger.Warning($"The path for '{file}' was too long");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error($"An exception occurred processing '{file}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,13 +230,17 @@ namespace SabreTools.Library.IO
|
||||
{
|
||||
outputs.Add(new ParentablePath(Path.GetFullPath(input), appendparent ? parentPath : string.Empty));
|
||||
}
|
||||
catch (PathTooLongException)
|
||||
catch (PathTooLongException ex)
|
||||
{
|
||||
Globals.Logger.Warning($"The path for '{input}' was too long");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error($"An exception occurred processing '{input}': {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,8 +187,11 @@ namespace SabreTools.Library.IO
|
||||
else
|
||||
return DatFormat.ClrMamePro;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -298,9 +301,11 @@ namespace SabreTools.Library.IO
|
||||
outFileType = FileType.ZstdArchive;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Don't log file open errors
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return outFileType;
|
||||
|
||||
@@ -192,8 +192,11 @@ namespace SabreTools.Library.IO
|
||||
loadBuffer.Dispose();
|
||||
hashers.ForEach(h => h.Dispose());
|
||||
}
|
||||
catch (IOException)
|
||||
catch (IOException ex)
|
||||
{
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return new BaseFile();
|
||||
}
|
||||
finally
|
||||
@@ -226,13 +229,17 @@ namespace SabreTools.Library.IO
|
||||
|
||||
return input.Position;
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
catch (NotSupportedException ex)
|
||||
{
|
||||
Globals.Logger.Verbose("Stream does not support seeking to starting offset. Stream position not changed");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
catch (NotImplementedException ex)
|
||||
{
|
||||
Globals.Logger.Warning("Stream does not support seeking to starting offset. Stream position not changed");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
@@ -176,6 +176,9 @@ namespace SabreTools.Library.Logging
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Console.WriteLine("Could not write to log file!");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,6 +202,9 @@ namespace SabreTools.Library.Skippers
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error(ex.ToString());
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -138,6 +138,8 @@ CREATE TABLE IF NOT EXISTS data (
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -422,6 +422,9 @@ Reset the internal state: reset();";
|
||||
catch (Exception ex)
|
||||
{
|
||||
Globals.Logger.Error($"There was an exception processing {path}: {ex}");
|
||||
if (Globals.ThrowOnError)
|
||||
throw ex;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user