Ejemplo n.º 1
0
        private void QueuePackageGroup(IPackageGroup packageGroup)
        {
            if (packageGroup is null || !packageGroup.Mod.Enabled)
            {
                return;
            }

            foreach (var p in packageGroup.Packages)
            {
                if (p.Enabled)
                {
                    _packageImport.Queue(p);
                }
            }
        }
Ejemplo n.º 2
0
        private void Import(IMod mod = null)
        {
            void QueuePackageGroup(IPackageGroup packageGroup)
            {
                if (packageGroup is null || !packageGroup.Mod.Enabled)
                {
                    return;
                }

                foreach (var p in packageGroup.Packages)
                {
                    if (p.Enabled)
                    {
                        _packageImportPackageImport.Queue(p);
                    }
                }
            }

            Utils.SafeWrap(() =>
            {
                _packageImportPackageImport.Clear();

                if (mod is null)
                {
                    foreach (var pg in _packageManage.PackageGroups)
                    {
                        QueuePackageGroup(pg);
                    }
                }
                else
                {
                    QueuePackageGroup(_packageManage.PackageGroups.FirstOrDefault(pg => pg.Mod.Name == mod.Name));
                }

                _packageImportPackageImport.Import(true);

                Localizer.RefreshLanguages();

                Utils.LogDebug("Auto import end.");
            });
        }