Skip to content

Commit

Permalink
Update HighVersionForgeInstaller.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
laolarou726 committed Dec 2, 2024
1 parent bd26b5f commit cf8b0e4
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using ProjBobcat.Event;
using ProjBobcat.Interface;
using SharpCompress.Archives;
using SharpCompress.Readers;
using FileInfo = ProjBobcat.Class.Model.FileInfo;

namespace ProjBobcat.DefaultComponent.Installer.ForgeInstaller;
Expand Down Expand Up @@ -68,7 +69,8 @@ public async Task<ForgeInstallResult> InstallForgeTaskAsync()
}
};

using var archive = ArchiveFactory.Open(Path.GetFullPath(this.ForgeExecutablePath));
await using var archiveFs = File.OpenRead(Path.GetFullPath(this.ForgeExecutablePath));
using var archive = ArchiveFactory.Open(archiveFs);

#region 解析 Version.json

Expand Down Expand Up @@ -469,7 +471,9 @@ public async Task<ForgeInstallResult> InstallForgeTaskAsync()
var maven = processor.Processor.Jar.ResolveMavenString()!;
var libPath = Path.Combine(this.RootPath, GamePathHelper.GetLibraryPath(maven.Path));

using var libArchive = ArchiveFactory.Open(Path.GetFullPath(libPath));
await using var libFs = File.OpenRead(Path.GetFullPath(libPath));
using var libArchive = ArchiveFactory.Open(libFs);

var libEntry =
libArchive.Entries.FirstOrDefault(e =>
e.Key?.Equals("META-INF/MANIFEST.MF", StringComparison.OrdinalIgnoreCase) ?? false);
Expand Down Expand Up @@ -623,7 +627,6 @@ void WhenCompleted(object? sender, DownloadFileCompletedEventArgs e)

this._totalDownloaded++;


var progress = ProgressValue.Create(this._totalDownloaded, this._needToDownload);
var retryStr = file.RetryCount > 0 ? $"[重试 - {file.RetryCount}] " : string.Empty;

Expand Down

0 comments on commit cf8b0e4

Please sign in to comment.