LogDependencyError() static private method

static private LogDependencyError ( string error ) : void
error string
return void
Example #1
0
        internal static bool BuildAll(string[] modFolders, IBuildStatus status)
        {
            var modList = new List <LocalMod>();

            //read mod sources folder
            foreach (var modFolder in modFolders)
            {
                var mod = ReadProperties(modFolder, status);
                if (mod == null)
                {
                    return(false);
                }

                modList.Add(mod);
            }

            //figure out which of the installed mods are required for building
            var installedMods = ModOrganizer.FindMods().Where(mod => !modList.Exists(m => m.Name == mod.Name)).ToList();

            var requiredFromInstall = new HashSet <LocalMod>();

            void Require(LocalMod mod)
            {
                foreach (var dep in mod.properties.RefNames(true))
                {
                    var depMod = installedMods.SingleOrDefault(m => m.Name == dep);
                    if (depMod != null && requiredFromInstall.Add(depMod))
                    {
                        Require(depMod);
                    }
                }
            }

            foreach (var mod in modList)
            {
                Require(mod);
            }

            modList.AddRange(requiredFromInstall);

            //sort and version check
            List <BuildingMod> modsToBuild;

            try
            {
                ModOrganizer.EnsureDependenciesExist(modList, true);
                ModOrganizer.EnsureTargetVersionsMet(modList);
                var sortedModList = ModOrganizer.Sort(modList);
                modsToBuild = sortedModList.OfType <BuildingMod>().ToList();
            }
            catch (ModSortingException e)
            {
                ErrorLogger.LogDependencyError(e.Message);
                return(false);
            }

            //build
            int num = 0;

            foreach (var mod in modsToBuild)
            {
                status.SetProgress(num++, modsToBuild.Count);
                if (!Build(mod, status))
                {
                    return(false);
                }
            }

            return(true);
        }