예제 #1
0
        private static void ValidateModList()
        {
            List <ModMetaData> running = ModsConfig.ActiveModsInLoadOrder.ToList();

            var list    = new List <ModItem>();
            var builder = new StringBuilder();

            foreach (ModMetaData metaData in running.Where(m => m.Active)
                     .Where(mod => !mod.Official)
                     .Where(mod => !File.Exists(Path.Combine(mod.RootDir.ToString(), "About/IgnoreMe.txt"))))
            {
                ModItem item;

                try
                {
                    item = ModItem.FromMetadata(metaData);
                }
                catch (Exception)
                {
                    builder.AppendLine($" - {metaData?.Name ?? metaData?.FolderName}");

                    continue;
                }

                list.Add(item);
            }

            if (builder.Length > 0)
            {
                builder.Insert(0, "The following mods could not be processed:\n");
                TkUtils.Logger.Warn(builder.ToString());
            }

            Mods = list.ToArray();
        }