11using DBDefsLib ;
2+ using DBDefsLib . Constants ;
23using DBDefsLib . Structs ;
34using System ;
45using System . Collections . Generic ;
@@ -209,8 +210,6 @@ static void Main(string[] args)
209210
210211 foreach ( var mapping in mappings )
211212 {
212- // TODO: Enum/flag file validation
213-
214213 if ( ! definitionCache . TryGetValue ( mapping . tableName , out var dbDef ) )
215214 {
216215 errorEncountered . Add ( mapping . tableName ) ;
@@ -226,6 +225,36 @@ static void Main(string[] args)
226225 Console . ResetColor ( ) ;
227226 }
228227
228+ if ( mapping . meta == MetaType . COLOR )
229+ continue ;
230+
231+ // Flags without file definitions are allowed
232+ if ( string . IsNullOrEmpty ( mapping . metaValue ) )
233+ continue ;
234+
235+ var dir = mapping . meta == MetaType . ENUM ? "enums" : "flags" ;
236+ var ext = mapping . meta == MetaType . ENUM ? ".dbde" : ".dbdf" ;
237+ var path = Path . Combine ( metaDirectory , dir , $ "{ mapping . metaValue } { ext } ") ;
238+
239+ if ( File . Exists ( path ) )
240+ {
241+ using ( var fs = new FileStream ( path , FileMode . Open , FileAccess . Read ) )
242+ {
243+ try
244+ {
245+ var dbdeReader = new DBDEnumReader ( ) ;
246+ var enumDef = dbdeReader . Read ( fs , mapping . meta ) ;
247+ }
248+ catch ( Exception ex )
249+ {
250+ errorEncountered . Add ( mapping . metaValue ) ;
251+ Console . ForegroundColor = ConsoleColor . Red ;
252+ Console . WriteLine ( $ "Failed to read { mapping . metaValue } for mapping { mapping . tableName } ::{ mapping . columnName } : " + ex ) ;
253+ Console . ResetColor ( ) ;
254+ }
255+ }
256+ }
257+
229258 // TODO: Conditional table/column validation
230259 }
231260 }
0 commit comments