private void Import(IMod mod = null) { try { _packageImport.Clear(); if (mod is null) { foreach (var pg in _packageManage.PackageGroups) { QueuePackageGroup(pg); } } else { QueuePackageGroup(_packageManage.PackageGroups.FirstOrDefault(pg => pg.Mod.Name == mod.Name)); } _packageImport.Import(true); Localizer.RefreshLanguages(); Utils.LogDebug("Auto import end."); } catch { } }
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."); }); }