Skip to content

Commit 402924c

Browse files
committed
add logging to sawyerstreamreader, which now gives a bit more info in the logs
1 parent 3f65272 commit 402924c

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

AvaGui/Models/ObjectEditorModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ void CreateIndex(string[] allFiles, IProgress<float>? progress)
221221

222222
private bool LoadSingleObjectFile(string file, IDictionary<string, IndexObjectHeader> ccHeaderIndex, IDictionary<string, UiLocoFile> ccObjectCache, out DatFileInfo? fileInfo)
223223
{
224-
(fileInfo, var locoObject) = SawyerStreamReader.LoadFullObjectFromFile(file);
224+
(fileInfo, var locoObject) = SawyerStreamReader.LoadFullObjectFromFile(file, logger: Logger);
225225

226226
if (locoObject == null)
227227
{

Core/DatFileParsing/SawyerStreamReader.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,26 @@ public static (DatFileInfo DatFileInfo, ILocoObject? LocoObject) LoadFullObjectF
161161

162162
static void ValidateLocoStruct(S5Header s5Header, ILocoStruct locoStruct, ILogger? logger)
163163
{
164+
var warnings = new List<string>();
165+
164166
try
165167
{
168+
if (s5Header.SourceGame == SourceGame.Vanilla && !OriginalObjectFiles.Names.ContainsKey(s5Header.Name.Trim()))
169+
{
170+
warnings.Add($"\"{s5Header.Name}\" is not a vanilla object but is marked as such.");
171+
}
172+
166173
if (!locoStruct.Validate())
167174
{
168-
logger?.Warning($"\"{s5Header.Name}\" failed validation");
175+
warnings.Add($"\"{s5Header.Name}\" failed validation");
176+
}
177+
178+
if (warnings.Count != 0)
179+
{
180+
foreach (var warning in warnings)
181+
{
182+
logger?.Warning(warning);
183+
}
169184
}
170185
else
171186
{

0 commit comments

Comments
 (0)