Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Analyzer.Tests/Analyzer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

<ItemGroup>
<ProjectReference Include="..\Analyzer\Analyzer.csproj" />
<ProjectReference Include="..\UnityBinaryFormat\UnityBinaryFormat.csproj" />
<ProjectReference Include="..\TestCommon\TestCommon.csproj" />
<ProjectReference Include="..\UnityFileSystem\UnityFileSystem.csproj" />
</ItemGroup>
Expand Down
318 changes: 316 additions & 2 deletions Analyzer.Tests/FileDetectionTests.cs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Analyzer/Analyzer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\UnityBinaryFormat\UnityBinaryFormat.csproj" />
<ProjectReference Include="..\UnityFileSystem\UnityFileSystem.csproj" />
</ItemGroup>

Expand Down
15 changes: 15 additions & 0 deletions Analyzer/AnalyzerTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using UnityDataTools.Analyzer.SQLite.Parsers;
using UnityDataTools.Analyzer.SQLite.Parsers.Models;
using UnityDataTools.Analyzer.SQLite.Writers;
using UnityDataTools.BinaryFormat;
using UnityDataTools.FileSystem;

namespace UnityDataTools.Analyzer;

Expand Down Expand Up @@ -74,8 +76,21 @@ public int Analyze(
ReportProgress(Path.GetRelativePath(path, file), i, files.Length);
countSuccess++;
}
catch (SerializedFileOpenException e)
{
// Expected failure — the file content could not be parsed.
// Don't print a stack trace; it adds no value for this known failure mode.
EraseProgressLine();
var relativePath = Path.GetRelativePath(path, file);
Console.Error.WriteLine($"Failed to open: {relativePath}");
var hint = SerializedFileDetector.GetOpenFailureHint(e.FilePath);
if (hint != null)
Console.Error.WriteLine(hint);
countFailures++;
}
catch (Exception e)
{
// Unexpected failure (SQL error, I/O error, bug, etc.) — print full details.
EraseProgressLine();
var relativePath = Path.GetRelativePath(path, file);
Console.Error.WriteLine($"Failed to process: {relativePath}");
Expand Down
2 changes: 1 addition & 1 deletion Analyzer/SQLite/Parsers/SerializedFileParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.Data.Sqlite;
using UnityDataTools.Analyzer.SQLite.Handlers;
using UnityDataTools.Analyzer.SQLite.Writers;
using UnityDataTools.Analyzer.Util;
using UnityDataTools.BinaryFormat;
using UnityDataTools.FileSystem;

namespace UnityDataTools.Analyzer.SQLite.Parsers
Expand Down
2 changes: 1 addition & 1 deletion Analyzer/SerializedObjects/BuildReport.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using UnityDataTools.Analyzer.Util;
using UnityDataTools.BinaryFormat;
using UnityDataTools.FileSystem.TypeTreeReaders;

namespace UnityDataTools.Analyzer.SerializedObjects;
Expand Down
2 changes: 1 addition & 1 deletion Analyzer/SerializedObjects/PackedAssets.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using UnityDataTools.Analyzer.Util;
using UnityDataTools.BinaryFormat;
using UnityDataTools.FileSystem.TypeTreeReaders;

namespace UnityDataTools.Analyzer.SerializedObjects;
Expand Down
Loading
Loading