Skip to content

Commit

Permalink
Added additional logging when model fails to read
Browse files Browse the repository at this point in the history
  • Loading branch information
Exactol committed Jun 30, 2019
1 parent 38dbbc8 commit 681a54f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
6 changes: 3 additions & 3 deletions CompilePalX/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public partial class App : Application
// catch all unhandled exceptions and log them
protected override void OnStartup(StartupEventArgs e)
{
AppDomain.CurrentDomain.UnhandledException += (s, err) => { ExceptionHandler.LogException((Exception)err.ExceptionObject); };
AppDomain.CurrentDomain.UnhandledException += (s, err) => { ExceptionHandler.LogException((Exception)err.ExceptionObject, false); };

DispatcherUnhandledException += (s, err) => { ExceptionHandler.LogException(err.Exception); };
DispatcherUnhandledException += (s, err) => { ExceptionHandler.LogException(err.Exception, false); };

TaskScheduler.UnobservedTaskException += (s, err) => { ExceptionHandler.LogException(err.Exception); };
TaskScheduler.UnobservedTaskException += (s, err) => { ExceptionHandler.LogException(err.Exception, false); };
}
}
}
1 change: 0 additions & 1 deletion CompilePalX/Compilers/BSPPack/AssetUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ public static List<string> findPhyGibs(string path)

if (File.Exists(path))
{
// YOU GUYS DIDNT CLOSE STREAM OMG!!!!!
using (FileStream phy = new FileStream(path, FileMode.Open))
{
using (BinaryReader reader = new BinaryReader(phy))
Expand Down
15 changes: 14 additions & 1 deletion CompilePalX/Compilers/BSPPack/PakFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Media;
using CompilePalX.Compilers.UtilityProcess;
using CompilePalX.Compiling;

namespace CompilePalX.Compilers.BSPPack
{
Expand Down Expand Up @@ -224,7 +226,18 @@ public void AddModel(string internalPath, List<int> skins = null)
foreach (string gib in AssetUtils.findPhyGibs(ext_path))
AddModel(gib);
}
var mdlMatsAndModels = AssetUtils.findMdlMaterialsAndModels(externalPath, skins);

Tuple<List<string>, List<string>> mdlMatsAndModels;
try
{
mdlMatsAndModels = AssetUtils.findMdlMaterialsAndModels(externalPath, skins);
}
catch (Exception e)
{
ExceptionHandler.LogException(e, false);
CompilePalLogger.LogLineColor($"Failed to read file {externalPath}", Brushes.Red);
return;
}

foreach (string mat in mdlMatsAndModels.Item1)
AddTexture(mat);
Expand Down

0 comments on commit 681a54f

Please sign in to comment.