diff --git a/src/metadata/mod-metadata-reader.ts b/src/metadata/mod-metadata-reader.ts index b388dff..ff97f40 100644 --- a/src/metadata/mod-metadata-reader.ts +++ b/src/metadata/mod-metadata-reader.ts @@ -1,7 +1,22 @@ +import ModLoaderType from "./mod-loader-type"; import ModMetadata from "./mod-metadata"; +import ModMetadataReaderFactory from "./mod-metadata-reader-factory"; interface ModMetadataReader { readMetadata(modPath: string): Promise; } +namespace ModMetadataReader { + export async function readMetadata(modPath: string): Promise { + const factory = new ModMetadataReaderFactory(); + for (const loaderType of ModLoaderType.getValues()) { + const metadata = await factory.create(loaderType).readMetadata(modPath).catch(_ => null); + if (metadata) { + return metadata; + } + } + return null; + } +} + export default ModMetadataReader;