|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
| 3 | +using System.Runtime.InteropServices; |
3 | 4 | using System.Threading; |
4 | 5 | using AET.ModVerify.Reporting; |
5 | 6 | using AET.ModVerify.Settings; |
@@ -240,31 +241,30 @@ private void VerifyParticle(IAloParticleFile file, IReadOnlyCollection<string> c |
240 | 241 | VerifierErrorCodes.InvalidFilePath, |
241 | 242 | $"Invalid texture file name '{texture}' in particle '{file.FileName}'", |
242 | 243 | VerificationSeverity.Error, |
243 | | - [file.FileName.ToUpperInvariant()], |
| 244 | + [NormalizeFileName(file.FileName)], |
244 | 245 | texture)); |
245 | 246 | }); |
246 | 247 | } |
247 | 248 |
|
248 | | - var fileName = FileSystem.Path.GetFileNameWithoutExtension(file.FilePath.AsSpan()); |
| 249 | + var fileName = GameEngine.GameRepository.PGFileSystem.GetFileNameWithoutExtension(file.FilePath.AsSpan()); |
249 | 250 | var name = file.Content.Name.AsSpan(); |
250 | 251 |
|
251 | 252 | if (!fileName.Equals(name, StringComparison.OrdinalIgnoreCase)) |
252 | 253 | { |
253 | | - // TODO: Re-enable |
254 | | - // AddError(VerificationError.Create( |
255 | | - // this, |
256 | | - // VerifierErrorCodes.InvalidParticleName, |
257 | | - // $"The particle name '{file.Content.Name}' does not match file name '{file.FileName}'", |
258 | | - // VerificationSeverity.Error, |
259 | | - // [file.FileName.ToUpperInvariant()], |
260 | | - // file.Content.Name)); |
| 254 | + AddError(VerificationError.Create( |
| 255 | + this, |
| 256 | + VerifierErrorCodes.InvalidParticleName, |
| 257 | + $"The particle name '{file.Content.Name}' does not match file name '{file.FileName}'", |
| 258 | + VerificationSeverity.Error, |
| 259 | + [NormalizeFileName(file.FileName)], |
| 260 | + file.Content.Name)); |
261 | 261 | } |
262 | 262 |
|
263 | 263 | } |
264 | 264 |
|
265 | 265 | private void VerifyModel(IAloModelFile file, AnimationCollection animations, IReadOnlyCollection<string> contextInfo, CancellationToken token) |
266 | 266 | { |
267 | | - IReadOnlyList<string> modelContext = [.. contextInfo, file.FileName.ToUpperInvariant()]; |
| 267 | + IReadOnlyList<string> modelContext = [.. contextInfo, NormalizeFileName(file.FileName)]; |
268 | 268 |
|
269 | 269 | foreach (var texture in file.Content.Textures) |
270 | 270 | { |
@@ -334,7 +334,7 @@ private void VerifyTextureExists(IPetroglyphFileHolder model, string texture, IR |
334 | 334 | { |
335 | 335 | if (texture == "None") |
336 | 336 | return; |
337 | | - _textureVerifier.Verify(texture, [..contextInfo, model.FileName.ToUpperInvariant()], CancellationToken.None); |
| 337 | + _textureVerifier.Verify(texture, [..contextInfo, NormalizeFileName(model.FileName)], CancellationToken.None); |
338 | 338 | } |
339 | 339 |
|
340 | 340 | private void VerifyProxyExists(IPetroglyphFileHolder model, string proxy, IReadOnlyCollection<string> contextInfo, CancellationToken token) |
@@ -368,12 +368,17 @@ private void VerifyShaderExists(IPetroglyphFileHolder model, string shader, IRea |
368 | 368 | VerifierErrorCodes.FileNotFound, |
369 | 369 | message, |
370 | 370 | VerificationSeverity.Error, |
371 | | - [..contextInfo, model.FileName.ToUpperInvariant()], |
| 371 | + [..contextInfo, NormalizeFileName(model.FileName)], |
372 | 372 | shader); |
373 | 373 | AddError(error); |
374 | 374 | } |
375 | 375 | } |
376 | 376 |
|
| 377 | + private string NormalizeFileName(string fileName) |
| 378 | + { |
| 379 | + return GameEngine.GameRepository.PGFileSystem.GetFileName(fileName).ToUpperInvariant(); |
| 380 | + } |
| 381 | + |
377 | 382 | private void AddNotExistError(string fileName, IReadOnlyCollection<string> contextInfo) |
378 | 383 | { |
379 | 384 | AddError(VerificationError.Create( |
|
0 commit comments