Skip to content

Commit 688fcc1

Browse files
committed
to new descriptors
1 parent a19bf6b commit 688fcc1

35 files changed

Lines changed: 853 additions & 417 deletions

src/ModVerify/Reporting/Baseline/BaselineCollection.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ public VerificationErrors Categorize(IEnumerable<VerificationError> errors)
105105
return new VerificationErrors(newErrors, readOnlyExisting, resolvedErrors);
106106
}
107107

108-
public IEnumerator<IdentifiedBaseline> GetEnumerator() => _baselines.GetEnumerator();
108+
public IEnumerator<IdentifiedBaseline> GetEnumerator()
109+
{
110+
return _baselines.GetEnumerator();
111+
}
109112

110-
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
113+
IEnumerator IEnumerable.GetEnumerator()
114+
{
115+
return GetEnumerator();
116+
}
111117
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System.Collections.Generic;
2+
using AET.ModVerify.Verifiers;
3+
4+
namespace AET.ModVerify.Reporting.Diagnostics;
5+
6+
/// <summary>Provides factories for findings produced while verifying audio sample files.</summary>
7+
public static class Audio
8+
{
9+
private static readonly ErrorDescriptor _fileNotFound = new(
10+
VerifierErrorCodes.FileNotFound, "AudioFileNotFound", VerificationSeverity.Error, "Audio");
11+
12+
private static readonly ErrorDescriptor _notPcm = new(
13+
VerifierErrorCodes.SampleNotPCM, "SampleNotPcm", VerificationSeverity.Error, "Audio");
14+
15+
private static readonly ErrorDescriptor _notMono = new(
16+
VerifierErrorCodes.SampleNotMono, "SampleNotMono", VerificationSeverity.Information, "Audio");
17+
18+
private static readonly ErrorDescriptor _invalidSampleRate = new(
19+
VerifierErrorCodes.InvalidSampleRate, "InvalidSampleRate", VerificationSeverity.Error, "Audio");
20+
21+
private static readonly ErrorDescriptor _invalidBitsPerSecond = new(
22+
VerifierErrorCodes.InvalidBitsPerSeconds, "InvalidBitsPerSecond", VerificationSeverity.Error, "Audio");
23+
24+
/// <summary>Creates an error for an audio sample file that could not be found.</summary>
25+
public static VerificationError FileNotFound(IGameVerifierInfo verifier, string sampleName, IEnumerable<string> context)
26+
=> _fileNotFound.Create(verifier, $"Audio file '{sampleName}' could not be found.", sampleName, context);
27+
28+
/// <summary>Creates an error for an audio file that is not PCM-encoded.</summary>
29+
public static VerificationError NotPcm(IGameVerifierInfo verifier, string sampleName, string actualFormat, IEnumerable<string> context)
30+
=> _notPcm.Create(verifier, $"Audio file '{sampleName}' has an invalid format '{actualFormat}'. Supported is PCM.", sampleName, context);
31+
32+
/// <summary>Creates an error for a non-ambient audio file that is not mono.</summary>
33+
public static VerificationError NotMono(IGameVerifierInfo verifier, string sampleName, IEnumerable<string> context)
34+
=> _notMono.Create(verifier, $"Audio file '{sampleName}' is not mono audio.", sampleName, context);
35+
36+
/// <summary>Creates an error for an audio file whose sample rate exceeds the supported maximum.</summary>
37+
public static VerificationError InvalidSampleRate(IGameVerifierInfo verifier, string sampleName, int sampleRate, IEnumerable<string> context)
38+
=> _invalidSampleRate.Create(verifier, $"Audio file '{sampleName}' has a too high sample rate of {sampleRate}. Maximum is 48.000Hz.", sampleName, context);
39+
40+
/// <summary>Creates an error for an audio file whose bit depth exceeds the supported maximum.</summary>
41+
public static VerificationError InvalidBitsPerSecond(IGameVerifierInfo verifier, string sampleName, int bitsPerSecond, IEnumerable<string> context)
42+
=> _invalidBitsPerSecond.Create(verifier, $"Audio file '{sampleName}' has an invalid bit size of {bitsPerSecond}. Supported are 16bit.", sampleName, context);
43+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
using System.Collections.Generic;
2+
using AET.ModVerify.Verifiers;
3+
4+
namespace AET.ModVerify.Reporting.Diagnostics;
5+
6+
/// <summary>Provides factories for findings produced while verifying the command bar.</summary>
7+
public static class CommandBar
8+
{
9+
private const string GameCommandBarAsset = "GameCommandBar";
10+
11+
private static readonly ErrorDescriptor _unsupportedComponent = new(
12+
VerifierErrorCodes.CommandBarUnsupportedComponent, "CommandBarUnsupportedComponent", VerificationSeverity.Information, "CommandBar");
13+
14+
private static readonly ErrorDescriptor _duplicateComponent = new(
15+
VerifierErrorCodes.Duplicate, "CommandBarDuplicateComponent", VerificationSeverity.Warning, "CommandBar");
16+
17+
private static readonly ErrorDescriptor _componentNameTooLong = new(
18+
VerifierErrorCodes.NameTooLong, "CommandBarComponentNameTooLong", VerificationSeverity.Critical, "CommandBar");
19+
20+
private static readonly ErrorDescriptor _shellNoModel = new(
21+
VerifierErrorCodes.CommandBarShellNoModel, "CommandBarShellNoModel", VerificationSeverity.Error, "CommandBar");
22+
23+
private static readonly ErrorDescriptor _componentNotConnected = new(
24+
VerifierErrorCodes.CommandBarComponentNotConnected, "CommandBarComponentNotConnected", VerificationSeverity.Warning, "CommandBar");
25+
26+
private static readonly ErrorDescriptor _noShellsGroup = new(
27+
VerifierErrorCodes.CommandBarNoShellsGroup, "CommandBarNoShellsGroup", VerificationSeverity.Error, "CommandBar");
28+
29+
private static readonly ErrorDescriptor _manyShellsGroups = new(
30+
VerifierErrorCodes.CommandBarManyShellsGroup, "CommandBarManyShellsGroups", VerificationSeverity.Warning, "CommandBar");
31+
32+
private static readonly ErrorDescriptor _nonShellInShellGroup = new(
33+
VerifierErrorCodes.CommandBarNoShellsComponentInShellGroup, "CommandBarNonShellInShellGroup", VerificationSeverity.Warning, "CommandBar");
34+
35+
private static readonly ErrorDescriptor _megaTextureDirectoryNotFound = new(
36+
VerifierErrorCodes.FileNotFound, "CommandBarMegaTextureDirectoryNotFound", VerificationSeverity.Critical, "CommandBar");
37+
38+
private static readonly ErrorDescriptor _megaTextureNotFound = new(
39+
VerifierErrorCodes.FileNotFound, "CommandBarMegaTextureNotFound", VerificationSeverity.Critical, "CommandBar");
40+
41+
/// <summary>Creates an error for a command bar component the game does not support.</summary>
42+
public static VerificationError UnsupportedComponent(IGameVerifierInfo verifier, string componentName, IEnumerable<string> context)
43+
=> _unsupportedComponent.Create(verifier, $"The CommandBar component '{componentName}' is not supported by the game.", componentName, context);
44+
45+
/// <summary>Creates an error for two command bar components that share the same identifier.</summary>
46+
public static VerificationError DuplicateComponent(IGameVerifierInfo verifier, string componentName, object componentId, IEnumerable<string> context)
47+
=> _duplicateComponent.Create(verifier, $"The CommandBar component '{componentName}' with ID '{componentId}' already exists.", componentName, context);
48+
49+
/// <summary>Creates an error for a command bar shell component name that exceeds the maximum length.</summary>
50+
public static VerificationError ComponentNameTooLong(IGameVerifierInfo verifier, string componentName, int maxLength, IEnumerable<string> context)
51+
=> _componentNameTooLong.Create(verifier, $"The CommandBarShellComponent name '{componentName}' is too long. Maximum length is {maxLength}.", componentName, context);
52+
53+
/// <summary>Creates an error for a command bar shell component that has no model specified.</summary>
54+
public static VerificationError ShellNoModel(IGameVerifierInfo verifier, string componentName, IEnumerable<string> context)
55+
=> _shellNoModel.Create(verifier, $"The CommandBarShellComponent '{componentName}' has no model specified.", componentName, context);
56+
57+
/// <summary>Creates an error for a command bar component that is not connected to a shell component.</summary>
58+
public static VerificationError ComponentNotConnected(IGameVerifierInfo verifier, string componentName, IEnumerable<string> context)
59+
=> _componentNotConnected.Create(verifier, $"The CommandBar component '{componentName}' is not connected to a shell component.", componentName, context);
60+
61+
/// <summary>Creates an error for the missing required shells command bar group.</summary>
62+
public static VerificationError NoShellsGroup(IGameVerifierInfo verifier, string groupName, IEnumerable<string> context)
63+
=> _noShellsGroup.Create(verifier, $"No CommandBarGroup '{groupName}' found.", GameCommandBarAsset, context);
64+
65+
/// <summary>Creates an error for more than one shells command bar group being defined.</summary>
66+
public static VerificationError ManyShellsGroups(IGameVerifierInfo verifier, string groupName, IEnumerable<string> context)
67+
=> _manyShellsGroups.Create(verifier, $"Found more than one Shells CommandBarGroup. Mind that group names are case-sensitive. Correct name is '{groupName}'.", GameCommandBarAsset, context);
68+
69+
/// <summary>Creates an error for a non-shell component that is a member of the shells command bar group.</summary>
70+
public static VerificationError NonShellInShellGroup(IGameVerifierInfo verifier, string componentName, string groupName, IEnumerable<string> context)
71+
=> _nonShellInShellGroup.Create(verifier, $"The CommandBar component '{componentName}' is not a shell component, but part of the '{groupName}' group.", componentName, context);
72+
73+
/// <summary>Creates an error for the command bar mega-texture directory that could not be found.</summary>
74+
public static VerificationError MegaTextureDirectoryNotFound(IGameVerifierInfo verifier, string baseName, IEnumerable<string> context)
75+
=> _megaTextureDirectoryNotFound.Create(verifier, $"Cannot find CommandBar MegaTextureDirectory '{baseName}.mtd'.", $"{baseName}.mtd", context);
76+
77+
/// <summary>Creates an error for the command bar mega-texture that could not be found.</summary>
78+
public static VerificationError MegaTextureNotFound(IGameVerifierInfo verifier, string baseName, IEnumerable<string> context)
79+
=> _megaTextureNotFound.Create(verifier, $"Cannot find CommandBar MegaTexture '{baseName}.tga'.", $"{baseName}.tga", context);
80+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Collections.Generic;
2+
using AET.ModVerify.Verifiers;
3+
4+
namespace AET.ModVerify.Reporting.Diagnostics;
5+
6+
/// <summary>Provides factories for findings that are not specific to a single verifier family.</summary>
7+
public static class Common
8+
{
9+
private static readonly ErrorDescriptor _duplicate = new(
10+
VerifierErrorCodes.Duplicate, "DuplicateEntry", VerificationSeverity.Error, "Common");
11+
12+
/// <summary>Creates an error for a duplicate entry, using a caller-supplied message.</summary>
13+
public static VerificationError Duplicate(IGameVerifierInfo verifier, string asset, string message, IEnumerable<string> context)
14+
=> _duplicate.Create(verifier, message, asset, context);
15+
}
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
using System.Collections.Generic;
2+
using AET.ModVerify.Verifiers;
3+
4+
namespace AET.ModVerify.Reporting.Diagnostics;
5+
6+
/// <summary>Provides the engine-initialization descriptor read by the engine reporter.</summary>
7+
public static class Engine
8+
{
9+
/// <summary>The game engine reported an error during initialization. The message is supplied by the engine.</summary>
10+
public static readonly ErrorDescriptor InitializationError = new(
11+
VerifierErrorCodes.InitializationError, "EngineInitializationError", VerificationSeverity.Critical, "Engine");
12+
}
13+
14+
/// <summary>Provides factories for hard-coded engine assets that are loaded at startup.</summary>
15+
public static class HardcodedAssets
16+
{
17+
private static readonly ErrorDescriptor _shaderNotFound = new(
18+
VerifierErrorCodes.FileNotFound, "HardcodedShaderNotFound", VerificationSeverity.Error, "HardcodedAssets");
19+
20+
private static readonly ErrorDescriptor _terrainShaderNotFound = new(
21+
VerifierErrorCodes.FileNotFound, "HardcodedTerrainShaderNotFound", VerificationSeverity.Error, "HardcodedAssets");
22+
23+
/// <summary>Creates an error for a shader the engine loads at startup that could not be found.</summary>
24+
/// <returns>A new error for the finding.</returns>
25+
public static VerificationError ShaderNotFound(IGameVerifierInfo verifier, string shaderName, IEnumerable<string> context)
26+
=> _shaderNotFound.Create(verifier, $"Unable to find shader '{shaderName}'.", shaderName, context);
27+
28+
/// <summary>Creates an error for a terrain shader the engine loads on terrain load that could not be found.</summary>
29+
/// <returns>A new error for the finding.</returns>
30+
public static VerificationError TerrainShaderNotFound(IGameVerifierInfo verifier, string shaderName, IEnumerable<string> context)
31+
=> _terrainShaderNotFound.Create(verifier, $"Unable to find terrain shader '{shaderName}'.", shaderName, context);
32+
}
33+
34+
// Descriptors for findings produced by the engine-side reporters. Their messages are supplied by the engine
35+
// (XML parser, asserts), so the reporters read only Id and Severity.
36+
37+
/// <summary>Provides descriptors for findings reported by the engine's XML parser.</summary>
38+
public static class Xml
39+
{
40+
/// <summary>The XML parser reported an error that does not map to a more specific kind.</summary>
41+
public static readonly ErrorDescriptor Generic = new(
42+
VerifierErrorCodes.GenericXmlError, "XmlGenericError", VerificationSeverity.Warning, "Xml");
43+
44+
/// <summary>An XML file has an empty root element.</summary>
45+
public static readonly ErrorDescriptor EmptyRoot = new(
46+
VerifierErrorCodes.EmptyXmlRoot, "XmlEmptyRoot", VerificationSeverity.Critical, "Xml");
47+
48+
/// <summary>An XML file referenced by the parser could not be found.</summary>
49+
public static readonly ErrorDescriptor MissingFile = new(
50+
VerifierErrorCodes.FileNotFound, "XmlMissingFile", VerificationSeverity.Error, "Xml");
51+
52+
/// <summary>An XML element has an invalid value.</summary>
53+
public static readonly ErrorDescriptor InvalidValue = new(
54+
VerifierErrorCodes.InvalidXmlValue, "XmlInvalidValue", VerificationSeverity.Information, "Xml");
55+
56+
/// <summary>An XML element has a malformed value.</summary>
57+
public static readonly ErrorDescriptor MalformedValue = new(
58+
VerifierErrorCodes.MalformedXmlValue, "XmlMalformedValue", VerificationSeverity.Warning, "Xml");
59+
60+
/// <summary>An XML element is missing a required attribute.</summary>
61+
public static readonly ErrorDescriptor MissingAttribute = new(
62+
VerifierErrorCodes.MissingXmlAttribute, "XmlMissingAttribute", VerificationSeverity.Error, "Xml");
63+
64+
/// <summary>An XML element references an entry that does not exist.</summary>
65+
public static readonly ErrorDescriptor MissingReference = new(
66+
VerifierErrorCodes.MissingXmlReference, "XmlMissingReference", VerificationSeverity.Error, "Xml");
67+
68+
/// <summary>An XML value exceeds the maximum allowed length.</summary>
69+
public static readonly ErrorDescriptor ValueTooLong = new(
70+
VerifierErrorCodes.XmlValueTooLong, "XmlValueTooLong", VerificationSeverity.Warning, "Xml");
71+
72+
/// <summary>An XML file contains data before its header.</summary>
73+
public static readonly ErrorDescriptor DataBeforeHeader = new(
74+
VerifierErrorCodes.XmlDataBeforeHeader, "XmlDataBeforeHeader", VerificationSeverity.Information, "Xml");
75+
76+
/// <summary>A required XML node is missing.</summary>
77+
public static readonly ErrorDescriptor MissingNode = new(
78+
VerifierErrorCodes.XmlMissingNode, "XmlMissingNode", VerificationSeverity.Critical, "Xml");
79+
80+
/// <summary>An XML file contains a node the parser does not support.</summary>
81+
public static readonly ErrorDescriptor UnknownNode = new(
82+
VerifierErrorCodes.XmlUnsupportedTag, "XmlUnknownNode", VerificationSeverity.Information, "Xml");
83+
84+
/// <summary>An XML tag unexpectedly contains child elements.</summary>
85+
public static readonly ErrorDescriptor TagHasElements = new(
86+
VerifierErrorCodes.XmlElementsInTag, "XmlTagHasElements", VerificationSeverity.Warning, "Xml");
87+
88+
/// <summary>An XML element has a name the parser did not expect.</summary>
89+
public static readonly ErrorDescriptor UnexpectedElementName = new(
90+
VerifierErrorCodes.XmlUnexceptedElementName, "XmlUnexpectedElementName", VerificationSeverity.Information, "Xml");
91+
92+
/// <summary>An XML node has an empty name.</summary>
93+
public static readonly ErrorDescriptor EmptyNodeName = new(
94+
VerifierErrorCodes.XmlEmptyNodeName, "XmlEmptyNodeName", VerificationSeverity.Warning, "Xml");
95+
}
96+
97+
/// <summary>Provides descriptors for assertions raised by the engine.</summary>
98+
public static class Asserts
99+
{
100+
/// <summary>The engine asserted that a value was null or empty.</summary>
101+
public static readonly ErrorDescriptor NullOrEmptyValue = new(
102+
VerifierErrorCodes.AssertValueNullOrEmpty, "AssertNullOrEmptyValue", VerificationSeverity.Warning, "Asserts");
103+
104+
/// <summary>The engine asserted that a value was out of range.</summary>
105+
public static readonly ErrorDescriptor ValueOutOfRange = new(
106+
VerifierErrorCodes.AssertValueOutOfRange, "AssertValueOutOfRange", VerificationSeverity.Warning, "Asserts");
107+
108+
/// <summary>The engine asserted that a value was invalid.</summary>
109+
public static readonly ErrorDescriptor InvalidValue = new(
110+
VerifierErrorCodes.AssertValueInvalid, "AssertInvalidValue", VerificationSeverity.Warning, "Asserts");
111+
112+
/// <summary>The engine asserted that a file was not found.</summary>
113+
public static readonly ErrorDescriptor FileNotFound = new(
114+
VerifierErrorCodes.FileNotFound, "AssertFileNotFound", VerificationSeverity.Warning, "Asserts");
115+
116+
/// <summary>The engine asserted that a duplicate entry exists.</summary>
117+
public static readonly ErrorDescriptor DuplicateEntry = new(
118+
VerifierErrorCodes.Duplicate, "AssertDuplicateEntry", VerificationSeverity.Warning, "Asserts");
119+
120+
/// <summary>The engine asserted that a binary file is corrupt.</summary>
121+
public static readonly ErrorDescriptor CorruptBinary = new(
122+
VerifierErrorCodes.BinaryFileCorrupt, "AssertCorruptBinary", VerificationSeverity.Warning, "Asserts");
123+
}

0 commit comments

Comments
 (0)