Esempio n. 1
0
        public void HandleErrors(List <YamlIO.Error> world_gen_errors)
        {
            string value = FileSystem.Normalize(GetDirectory());

            ListPool <Mod, Manager> .PooledList pooledList = ListPool <Mod, Manager> .Allocate();

            foreach (YamlIO.Error world_gen_error in world_gen_errors)
            {
                YamlIO.Error current = world_gen_error;
                string       text    = (current.file.source == null) ? string.Empty : FileSystem.Normalize(current.file.source.GetRoot());
                YamlIO.LogError(current, text.Contains(value));
                if (current.severity != YamlIO.Error.Severity.Recoverable && text.Contains(value))
                {
                    foreach (Mod mod in mods)
                    {
                        if (mod.enabled && text.Contains(mod.label.install_path))
                        {
                            events.Add(new Event
                            {
                                event_type = EventType.BadWorldGen,
                                mod        = mod.label,
                                details    = Path.GetFileName(current.file.full_path)
                            });
                            break;
                        }
                    }
                }
            }
            bool flag = IsInDevMode();

            foreach (Mod item in pooledList)
            {
                item.Crash(!flag);
                if (!flag)
                {
                    events.Add(new Event
                    {
                        event_type = EventType.Deactivated,
                        mod        = item.label
                    });
                }
                dirty = true;
            }
            pooledList.Recycle();
            Update(this);
        }