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);
        }
Esempio n. 2
0
    private static void YamlParseErrorCB(YamlIO.Error error, bool force_log_as_warning)
    {
        string message = $"{error.severity} parse error in {error.file.full_path}\n{error.message}";

        throw new Exception(message, error.inner_exception);
    }
Esempio n. 3
0
 /// <summary>
 /// A callback function for the YAML parser to process errors that it throws.
 /// </summary>
 /// <param name="error">The YAML parsing error</param>
 internal static void YamlParseErrorCB(YamlIO.Error error, bool _)
 {
     throw new InvalidDataException(string.Format("{0} parse error in {1}\n{2}", error.
                                                  severity, error.file.full_path, error.message), error.inner_exception);
 }