VolantisDev / Launchpad

Step up your non-Steam game! Generate Steam-compatible .exe files to effortlessly launch any game through Steam with overlay support.
https://launchpad.games
MIT License
85 stars 3 forks source link

Calculate dependencies and stop if they are not met #319

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 3 years ago

Calculate dependencies and stop if they are not met

https://github.com/VolantisDev/Launchpad/blob/759a38cd2a7a2ab964de55a8329dca6014475eca/Lib/Shared/AppLib/Service/ModuleManager.ahk#L35


class ModuleManager extends ConfigurableContainerServiceBase {
    discoverEvent := Events.MODULES_DISCOVER
    discoverAlterEvent := Events.MODULES_DISCOVER_ALTER
    loadEvent := Events.MODULE_LOAD
    loadAlterEvent := Events.MODULE_LOAD_ALTER
    moduleDirs := []

    __New(app, configPath, moduleDirs := "", defaultModuleInfo := "", defaultModules := "", autoLoad := true) {
        configObj := ModuleConfig(app, configPath, true)

        if (moduleDirs) {
            if (Type(moduleDirs) == "String") {
                moduleDirs := [moduleDirs]
            }

            this.moduleDirs := moduleDirs
        }

        super.__New(app, configObj, configObj.primaryConfigKey, defaultModuleInfo, defaultModules, autoLoad)
    }

    CreateDiscoverer() {
        searchDirs := this.GetModuleDirs()
        filePattern := "*.module.ahk"

        return ClassFileComponentDiscoverer(this, searchDirs, filePattern)
    }

    CreateLoader(componentInfo) {
        return ClassComponentLoader(this, componentInfo)
    }

    LoadComponents() {
        if (!this.componentsLoaded) {
            ; TODO: Calculate dependencies and stop if they are not met
            super.LoadComponents()
            this.RegisterSubscribers()
        }
    }

    DispatchEvent(eventName, eventObj, extra := "", hwnd := "") {
        modules := this.GetAll()

9a77945ce0f89fe7ee49aaaac887a4a55fc28f6f