diff --git a/BurnOutSharp/FileType/BFPK.cs b/BurnOutSharp/FileType/BFPK.cs index c9568202..a487b818 100644 --- a/BurnOutSharp/FileType/BFPK.cs +++ b/BurnOutSharp/FileType/BFPK.cs @@ -63,7 +63,7 @@ namespace BurnOutSharp.FileType br.BaseStream.Seek(offset, SeekOrigin.Begin); uint compressedSize = br.ReadUInt32(); - + // Some files can lack the length prefix if (compressedSize > br.BaseStream.Length) { @@ -102,8 +102,11 @@ namespace BurnOutSharp.FileType } } } - catch { } - + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } + br.BaseStream.Seek(current, SeekOrigin.Begin); } } @@ -116,14 +119,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/FileType/BZip2.cs b/BurnOutSharp/FileType/BZip2.cs index 725a24c0..38371268 100644 --- a/BurnOutSharp/FileType/BZip2.cs +++ b/BurnOutSharp/FileType/BZip2.cs @@ -51,7 +51,10 @@ namespace BurnOutSharp.FileType bz2File.CopyTo(fs); } } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } // Collect and format all found protections @@ -62,14 +65,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/FileType/Executable.cs b/BurnOutSharp/FileType/Executable.cs index 87276f05..8737ec16 100644 --- a/BurnOutSharp/FileType/Executable.cs +++ b/BurnOutSharp/FileType/Executable.cs @@ -75,8 +75,10 @@ namespace BurnOutSharp.FileType fileContent = br.ReadBytes((int)stream.Length); } } - catch + catch (Exception ex) { + if (scanner.IncludeDebug) Console.WriteLine(ex); + Utilities.AppendToDictionary(protections, file, "[Out of memory attempting to open]"); return protections; } diff --git a/BurnOutSharp/FileType/GZIP.cs b/BurnOutSharp/FileType/GZIP.cs index 09668a77..bcad50b3 100644 --- a/BurnOutSharp/FileType/GZIP.cs +++ b/BurnOutSharp/FileType/GZIP.cs @@ -54,7 +54,10 @@ namespace BurnOutSharp.FileType string tempFile = Path.Combine(tempPath, entry.Key); entry.WriteToFile(tempFile); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } } @@ -66,14 +69,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/FileType/InstallShieldArchiveV3.cs b/BurnOutSharp/FileType/InstallShieldArchiveV3.cs index 1157fa56..da3aaf21 100644 --- a/BurnOutSharp/FileType/InstallShieldArchiveV3.cs +++ b/BurnOutSharp/FileType/InstallShieldArchiveV3.cs @@ -75,7 +75,10 @@ namespace BurnOutSharp.FileType fs.Write(fileContents, 0, fileContents.Length); } } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } // Collect and format all found protections @@ -86,14 +89,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } return null; diff --git a/BurnOutSharp/FileType/InstallShieldCAB.cs b/BurnOutSharp/FileType/InstallShieldCAB.cs index 6520d661..06a0853e 100644 --- a/BurnOutSharp/FileType/InstallShieldCAB.cs +++ b/BurnOutSharp/FileType/InstallShieldCAB.cs @@ -64,7 +64,10 @@ namespace BurnOutSharp.FileType string tempFile = Path.Combine(tempPath, cabfile.FileName(i)); cabfile.FileSave(i, tempFile); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } // Collect and format all found protections @@ -75,14 +78,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } return null; diff --git a/BurnOutSharp/FileType/MPQ.cs b/BurnOutSharp/FileType/MPQ.cs index e7d2c10e..1f370610 100644 --- a/BurnOutSharp/FileType/MPQ.cs +++ b/BurnOutSharp/FileType/MPQ.cs @@ -69,7 +69,10 @@ namespace BurnOutSharp.FileType Directory.CreateDirectory(Path.GetDirectoryName(tempFile)); mpqArchive.ExtractFile(sub, tempFile); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } } @@ -81,14 +84,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/FileType/MSI.cs b/BurnOutSharp/FileType/MSI.cs index 729efe62..e49475f2 100644 --- a/BurnOutSharp/FileType/MSI.cs +++ b/BurnOutSharp/FileType/MSI.cs @@ -53,14 +53,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/FileType/MicrosoftCAB.cs b/BurnOutSharp/FileType/MicrosoftCAB.cs index 4169e350..df860e45 100644 --- a/BurnOutSharp/FileType/MicrosoftCAB.cs +++ b/BurnOutSharp/FileType/MicrosoftCAB.cs @@ -51,7 +51,10 @@ namespace BurnOutSharp.FileType string tempFile = Path.Combine(tempPath, sub.Name.TrimEnd('.')); sub.CopyTo(tempFile); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } // Collect and format all found protections @@ -62,14 +65,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/FileType/PKZIP.cs b/BurnOutSharp/FileType/PKZIP.cs index 7908a7ea..283e9439 100644 --- a/BurnOutSharp/FileType/PKZIP.cs +++ b/BurnOutSharp/FileType/PKZIP.cs @@ -63,7 +63,10 @@ namespace BurnOutSharp.FileType string tempFile = Path.Combine(tempPath, entry.Key); entry.WriteToFile(tempFile); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } } @@ -75,14 +78,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/FileType/RAR.cs b/BurnOutSharp/FileType/RAR.cs index 8f173acf..777fa7cf 100644 --- a/BurnOutSharp/FileType/RAR.cs +++ b/BurnOutSharp/FileType/RAR.cs @@ -59,7 +59,10 @@ namespace BurnOutSharp.FileType string tempFile = Path.Combine(tempPath, entry.Key); entry.WriteToFile(tempFile); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } } @@ -71,14 +74,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/FileType/SevenZip.cs b/BurnOutSharp/FileType/SevenZip.cs index 49a997f3..69f677f0 100644 --- a/BurnOutSharp/FileType/SevenZip.cs +++ b/BurnOutSharp/FileType/SevenZip.cs @@ -54,7 +54,10 @@ namespace BurnOutSharp.FileType string tempFile = Path.Combine(tempPath, entry.Key); entry.WriteToFile(tempFile); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } // Collect and format all found protections @@ -65,7 +68,10 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); @@ -73,7 +79,10 @@ namespace BurnOutSharp.FileType return protections; } } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/FileType/TapeArchive.cs b/BurnOutSharp/FileType/TapeArchive.cs index a3a19d6d..09437392 100644 --- a/BurnOutSharp/FileType/TapeArchive.cs +++ b/BurnOutSharp/FileType/TapeArchive.cs @@ -57,7 +57,10 @@ namespace BurnOutSharp.FileType string tempFile = Path.Combine(tempPath, entry.Key); entry.WriteToFile(tempFile); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } } @@ -69,14 +72,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/FileType/Textfile.cs b/BurnOutSharp/FileType/Textfile.cs index d7baef4c..b0864d7e 100644 --- a/BurnOutSharp/FileType/Textfile.cs +++ b/BurnOutSharp/FileType/Textfile.cs @@ -97,9 +97,9 @@ namespace BurnOutSharp.FileType if (fileContent.Contains("http://cp.sonybmg.com/xcp/")) Utilities.AppendToDictionary(protections, file, "XCP"); } - catch + catch (Exception ex) { - // We don't care what the error was + if (scanner.IncludeDebug) Console.WriteLine(ex); } return protections; diff --git a/BurnOutSharp/FileType/Valve.cs b/BurnOutSharp/FileType/Valve.cs index 554ca85b..45fd269c 100644 --- a/BurnOutSharp/FileType/Valve.cs +++ b/BurnOutSharp/FileType/Valve.cs @@ -68,14 +68,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/FileType/XZ.cs b/BurnOutSharp/FileType/XZ.cs index b9bb3b15..5ad8cc84 100644 --- a/BurnOutSharp/FileType/XZ.cs +++ b/BurnOutSharp/FileType/XZ.cs @@ -50,7 +50,10 @@ namespace BurnOutSharp.FileType xzFile.CopyTo(fs); } } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } // Collect and format all found protections @@ -61,14 +64,20 @@ namespace BurnOutSharp.FileType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/PackerType/WinRARSFX.cs b/BurnOutSharp/PackerType/WinRARSFX.cs index ef98ba0d..dcbf45b2 100644 --- a/BurnOutSharp/PackerType/WinRARSFX.cs +++ b/BurnOutSharp/PackerType/WinRARSFX.cs @@ -81,7 +81,10 @@ namespace BurnOutSharp.PackerType string tempFile = Path.Combine(tempPath, entry.Key); entry.WriteToFile(tempFile); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } } @@ -93,14 +96,20 @@ namespace BurnOutSharp.PackerType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/PackerType/WinZipSFX.cs b/BurnOutSharp/PackerType/WinZipSFX.cs index f2135676..7dfe7419 100644 --- a/BurnOutSharp/PackerType/WinZipSFX.cs +++ b/BurnOutSharp/PackerType/WinZipSFX.cs @@ -158,7 +158,10 @@ namespace BurnOutSharp.PackerType string tempFile = Path.Combine(tempPath, entry.Key); entry.WriteToFile(tempFile); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } } } @@ -170,14 +173,20 @@ namespace BurnOutSharp.PackerType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/PackerType/WiseInstaller.cs b/BurnOutSharp/PackerType/WiseInstaller.cs index b57d293d..6d93a292 100644 --- a/BurnOutSharp/PackerType/WiseInstaller.cs +++ b/BurnOutSharp/PackerType/WiseInstaller.cs @@ -111,14 +111,20 @@ namespace BurnOutSharp.PackerType { Directory.Delete(tempPath, true); } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return protections; } - catch { } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } return null; } diff --git a/BurnOutSharp/Scanner.cs b/BurnOutSharp/Scanner.cs index 8579cb8d..64e8af1d 100644 --- a/BurnOutSharp/Scanner.cs +++ b/BurnOutSharp/Scanner.cs @@ -261,6 +261,8 @@ namespace BurnOutSharp } catch (Exception ex) { + if (IncludeDebug) Console.WriteLine(ex); + var protections = new ConcurrentDictionary>(); Utilities.AppendToDictionary(protections, file, "[Exception opening file, please try again]"); Utilities.ClearEmptyKeys(protections); @@ -296,9 +298,10 @@ namespace BurnOutSharp stream.Read(magic, 0, 16); stream.Seek(0, SeekOrigin.Begin); } - catch + catch (Exception ex) { - // We don't care what the issue was, we can't read or seek the file + if (IncludeDebug) Console.WriteLine(ex); + return null; } @@ -442,7 +445,8 @@ namespace BurnOutSharp } catch (Exception ex) { - //Utilities.AppendToDictionary(protections, fileName, ex.ToString()); + if (IncludeDebug) Console.WriteLine(ex); + Utilities.AppendToDictionary(protections, fileName, "[Exception opening file, please try again]"); }