/// <summary>
        /// Loads and verify content packs.
        /// </summary>
        /// <returns></returns>
        public void LoadContentPacks(IEnumerable <IContentPack> contentPacks)
        {
            this.monitor.Log("Loading content packs ...");

            // Try to load content packs and their's patches
            foreach (var pack in contentPacks)
            {
                try
                {
                    var managedPack = new ManagedContentPack(pack, this.monitor);

                    managedPack.Load();

                    if (!this.allowLegacyPacks && managedPack.IsLegacy())
                    {
                        this.monitor.Log($"Content pack `{pack.Manifest.Name}` (format version {managedPack.FormatVersion}) was skipped: Loading of legacy content packs (format version 1.2 and older) is disabled for security reasons. If you want load this content pack, allow legacy content packs in config file.", LogLevel.Error);
                        continue;
                    }

                    this.packs.Add(managedPack);
                } catch (ContentPackException e)
                {
                    this.monitor.Log($"Unable to load content pack `{pack.Manifest.Name}`:", LogLevel.Error);
                    this.monitor.Log($"   {e.Message}", LogLevel.Error);
                }
            }

            this.monitor.Log($"Loaded {this.packs.Count} content packs:", LogLevel.Info);
            this.packs.ForEach(mp => this.monitor.Log($"   {mp.Pack.Manifest.Name} {mp.Pack.Manifest.Version} by {mp.Pack.Manifest.Author}", LogLevel.Info));
            this.CheckCurrentFormat(this.packs);
            this.CheckForUsingReplacers(this.packs);
        }
Пример #2
0
        /// <summary>
        /// Loads and verify content packs.
        /// </summary>
        /// <returns></returns>
        public void LoadContentPacks(IEnumerable <IContentPack> contentPacks)
        {
            this.monitor.Log("Loading content packs ...");

            // Try to load content packs and their's patches
            foreach (var pack in contentPacks)
            {
                try
                {
                    var managedPack = new ManagedContentPack(pack, this.monitor, this.paranoid);

                    managedPack.Load();
                    this.packs.Add(managedPack);
                } catch (ContentPackException e)
                {
                    this.monitor.Log($"Unable to load content pack `{pack.Manifest.Name}`:", LogLevel.Error);
                    this.monitor.Log($"   {e.Message}", LogLevel.Error);
                }
            }

            this.monitor.Log($"Loaded {this.packs.Count} content packs:", LogLevel.Info);
            this.packs.ForEach(mp => this.monitor.Log($"   {mp.Pack.Manifest.Name} {mp.Pack.Manifest.Version} by {mp.Pack.Manifest.Author}", LogLevel.Info));
            this.CheckCurrentFormat(this.packs);
            this.CheckForUsingReplacers(this.packs);
        }