private void LoadPackages() { void LoadPackedPackages() { foreach (var file in new DirectoryInfo(Localizer.DownloadPackageDirPath).GetFiles()) { Utils.SafeWrap(() => { var pack = _packedPackageLoad.Load(file.FullName, _fileLoad); if (pack == null) { return; } _packageManage.AddPackage(pack); }); } } void LoadSourcePackages() { foreach (var dir in new DirectoryInfo(Localizer.SourcePackageDirPath).GetDirectories()) { Utils.SafeWrap(() => { var pack = _sourcePackageLoad.Load(dir.FullName, _fileLoad); if (pack == null) { return; } _packageManage.AddPackage(pack); }); } } try { _packageManage.PackageGroups = new List <IPackageGroup>(); var type = Localizer.Config.AutoImportType; if (type != AutoImportType.DownloadedOnly) { LoadSourcePackages(); } if (type != AutoImportType.SourceOnly) { LoadPackedPackages(); } _packageManage.LoadState(); } catch (Exception e) { Utils.LogError(e); } }
private void LoadPackedPackages() { var list = Directory.GetFiles(Localizer.DownloadPackageDirPath).ToList(); list.AddRange(Directory.GetFiles(Path.Combine(Terraria.Main.SavePath, "Mods"), "*.locpack")); foreach (var file in list) { try { var pack = _packedPackageLoad.Load(file, _fileLoad); if (pack != null) { _packageManage.AddPackage(pack); } } catch { } } }