示例#1
0
        public bool IsInstallationValid(out ErrorSummary errors)
        {
            if (errorSummary != null)
            {
                errors = errorSummary;
                return(errors.IsEmpty());
            }

            errors       = new ErrorSummary();
            errorSummary = errors;

            PluginData data = PluginsManifest.Instance.GetPluginData(this);

            if (data.installed == false)
            {
                return(false);
            }

            foreach (var symbol in GetSymbols())
            {
                if (DefineSymbols.Instance.IsEnabled(symbol.symbolName) == false)
                {
                    errors.RegisterInvalidItem($"{symbol.symbolName}", PluginDependencyType.DefineSymbol);
                }
            }

            foreach (ModuleInstallInfo moduleInfo in GetModules())
            {
                if (ModuleInstaller.IsModuleInstallationValid(moduleInfo) == false)
                {
                    errors.RegisterInvalidItem($"{AssetDatabase.GetAssetPath(moduleInfo)}", PluginDependencyType.Module);
                }
            }

            foreach (PackageDependency packageDependency in GetPackages())
            {
                if (Util.HasPackageDependency(packageDependency.packageName, packageDependency.version) == false)
                {
                    errors.RegisterInvalidItem($"{packageDependency.FullName}", PluginDependencyType.Package);
                }
            }

            foreach (PluginInfo dependency in GetDependencies())
            {
                if (dependency == this)
                {
                    Debug.LogWarning($"Circular dependency: {description} depends on itself!");
                    continue;
                }
                if (dependency == null)
                {
                    Debug.LogWarning($"Empty dependency detected on {description}!");
                    continue;
                }
                if (dependency.IsInstallationValid(out var depErrors) == false)
                {
                    errors.RegisterInvalidItem($"{AssetDatabase.GetAssetPath(dependency)}", PluginDependencyType.Plugin);
                }
            }

            return(errors.IsEmpty());
        }